Borland C++ Builder : Using Mappoint over olecontainer or TApp TMapp
Hi Team, greetz from North Italy
Here a working bcb sample (of course many was from your page):
But I still have some Problems switching into usermode (Actually I click manually.
I would appreciate it If someone could help me with UsermodeCode:int i=0; PushpinPtr pin[5000]; LocationPtr loc[5000]; MapPtr AMap; if (inita==0){ OleContainer1->CreateObject(WideString("MapPoint.Map.EU"),false); inita=1; return; //bad that I need the above to set manually Usermode, but i was not able to figure it out } AMap=OleContainer1->OleObjectInterface; loc[i]=AMap->GetLocation((double)46.48168,(double)11.11670,300); pin[i]=AMap->AddPushpin(loc[i], WideString("TestPin")+IntToStr(i)); pin[i]->set_Symbol(2); pin[i]->set_Highlight( true ); pin[i]->set_Note(WideString("Test Note 1") ); pin[i]->set_BalloonState( 1 ); //AMap->GoToLatLong((double)46.48168,(double)11.11670,300); AMap->_set_Location(loc[i]); AMap->ZoomOut(); AMap->ZoomIn(); //Now Problem Howto switch into Usermode=true //of course i should set usermode before drawing.. _Application *Mapp; //not sure but this way should be ok !? Mapp=AMap->get_Application(); //or get_parent() // Mapp->UserControl //not working PUT IMPORTANT //Mapp->Activate(); ShowMessage(AnsiString(Mapp->get_Name())); //workz fine therefore i guess Mapp has the correct Pointer Mapp->UserControl=0; //not working and no error ! Mapp->PaneState=7; //not working i guess Mapp->set_Units(0); // works fine ... geoMiles = 0, geoKm = 1 AMap->set_Saved(1); //?? should it save the edit mode aka user settings ? AMap->Save(); //Find sample 1 WideString wsStreet="Saring"; WideString wsFStreet="sda"; WideString wsFCity="bolzano"; WideString wsFOtherCity=""; WideString wsFRegion="bz"; WideString wsFPostalCode="39100"; FindResultsPtr resultsPtr = AMap->FindAddressResults(wsFStreet.c_bstr(),wsFCity.c_bstr(),wsFOtherCity.c_bstr(),wsFRegion.c_bstr(),wsFPostalCode.c_bstr()); FindResults* myResults = (FindResults*)resultsPtr; //not working on bcb5 but ok under 6 (i guess from old utilcls) ShowMessage(AnsiString(myResults->Count)); //returns 100 ok !! VARIANT idx; VariantInit(&idx); V_VT(&idx) = VT_I4; for (int i = 1; i<myResults->Count+1; i++) { V_I4(&idx)=i; // FindResults is collection. This particular example returns multiple locations. // Pick the first one. NB: GetItem is 1-referenced. // the value we wish to pass LocationPtr locHotSpringsPtr = myResults->get_Item( &idx ); //warning about idx in bcb5 Location* locHotSprings = (Location*)locHotSpringsPtr; pin[i]=AMap->AddPushpin(locHotSprings, WideString("TestPin")+IntToStr(i)); pin[i]->set_Symbol(2); pin[i]->set_Highlight( true ); pin[i]->set_Note(WideString("Test Note ")+IntToStr(i) ); pin[i]->set_BalloonState( 1 ); AMap->_set_Location(locHotSprings); Sleep(500); } //end for points
and maybe set custom shapes and how to implement a - zoom if
the location was marked from the bottom to the top and + like
actually implemented.
And maybe i need a way to lock the drag and drop on certain
custom shapes.
Or a sample howto connect the TMap and TApp to the container,
would be nice.
Thx in Advance
elec29a / elec@dcmd.net
Note: I tested many Mapping Software but MapPoint was amazing,
if you look at the feature set & pricelevel.