![]() |
CreateLabel method |
Post Reply
|
| Author | |
glenngraham
Skyline Customers
Joined: January 17 2006 Location: United States Status: Offline Points: 5 |
Post Options
Thanks(0)
Quote Reply
Topic: CreateLabel methodPosted: January 23 2006 at 3:10pm |
|
Two things: I'm not assure why the documentation says use pITerrainLabel2
for the pointer. It doesn't seem to work pITerrainLabel does. Remarks: After this method call returns, the label is not yet visible on
the terrain. The client must first set either ITerrainLabel2::Text or
ITerrainLabel2::ImageFileName (or both) properties. But there are no examples and the following code creates a
fatal exception: All separately will not work. Please Help |
|
|
Glenn Graham
Software Engineer Manning NavComp, Inc. Austin, Texas www.navcomp.com |
|
![]() |
|
glenngraham
Skyline Customers
Joined: January 17 2006 Location: United States Status: Offline Points: 5 |
Post Options
Thanks(0)
Quote Reply
Posted: January 23 2006 at 6:21pm |
|
Here is my error.
I used ITerrainLabel *pITerrain4 ; I should have used ITerrainLabelPtr pITerrain4 ; Here is my cleaned up (a little) code... int CTE3DWindow::SetId(long Id, double longVal, double latVal, ITerrainLabel2 **pITerrainLabel2) { ITerrainLabelPtr pITerrain4 = NULL; // Prevent TerraExplorer from displaying the error messages. pITerraExplorer4->DisplayErrorMessages = FALSE; HRESULT hr = S_OK; _bstr_t GroupName = "My Group"; long GroupID = pIInformationTree->CreateGroup(GroupName, 0); wchar_t wsz[] = L"There's the Count."; _bstr_t Id_ID; Id_ID = SysAllocString(wsz); pITerrain4 = pIObjectManager->CreateLabel(longVal, latVal, 100, GroupID, Id_ID); _bstr_t myText = "This is some text!"; pITerrain4->Text = myText; if (SUCCEEDED(hr)) return 1; else return 0; } |
|
|
Glenn Graham
Software Engineer Manning NavComp, Inc. Austin, Texas www.navcomp.com |
|
![]() |
|
glenngraham
Skyline Customers
Joined: January 17 2006 Location: United States Status: Offline Points: 5 |
Post Options
Thanks(0)
Quote Reply
Posted: January 25 2006 at 5:49pm |
|
ITerrainLabel2Ptr tl = NULL;
tl = objManager->CreateLabel(...); // the (...) is because I was too lazy to make up the params right now, sorry! // now, we have a valid instance of ITerrainLabel2 _bstr_t myText = "This is some text!"; tl->Text = myText; // That's it! - - - - - ----- Intially I got an error. I had set the following: IObjectManagerPtr pIObjectManager; So when I called hr = pIObjectManager->CreateLabel(longVal, latVal, 100, GroupID, myText, &pITerrain4); I get the error. 'raw_CreateLabel' : cannot convert parameter 6 from 'struct ITerrainLabel2 ** ' to 'struct ITerrainLabel ** So I change to: IObjectManager2Ptr pIObjectManager; I was following the C++ example in Ch 25 "Examples in C++->Adding Objects to the Project" for the help. All is working now. |
|
|
Glenn Graham
Software Engineer Manning NavComp, Inc. Austin, Texas www.navcomp.com |
|
![]() |
|
Post Reply
|
|
|
|
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |