www.skylinesoft.com Homepage
Forum Home Forum Home > SkylineGlobe Enterprise Products > TerraExplorer for Developers
  New Posts New Posts RSS Feed - CreateLabel method
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CreateLabel method

 Post Reply Post Reply
Author
Message
glenngraham View Drop Down
Skyline Customers
Skyline Customers
Avatar

Joined: January 17 2006
Location: United States
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote glenngraham Quote  Post ReplyReply Direct Link To This Post Topic: CreateLabel method
    Posted: 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.

Two After the description there is a note about...
 

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:
 ITerrainLabel *pITerrain4 ;
    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);
//upto here no problems no errors
   pITerrain4->Text = Id_ID;
or //   pITerrain4->put_Text(Id_ID);
or //   pITerrain4->PutText(Id_ID);

All separately will not work.

Please Help

Glenn Graham
Software Engineer
Manning NavComp, Inc.
Austin, Texas
www.navcomp.com
Back to Top
glenngraham View Drop Down
Skyline Customers
Skyline Customers
Avatar

Joined: January 17 2006
Location: United States
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote glenngraham Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
glenngraham View Drop Down
Skyline Customers
Skyline Customers
Avatar

Joined: January 17 2006
Location: United States
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote glenngraham Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down



This page was generated in 0.188 seconds.