SinoTech
02-04-2008, 09:57 AM
Hi all,
I'm not very familiar with MapPoint yet, but already got some basics. However, currently I have a problem when displaying a bunch of push-pins. Somewhere here in the fourm I found code importing data from a file, which works fine.
That's the code:
m_dsStopPoints = m_DataSets.ImportData(m_strStopPointsPath, NULL, geoCountryDefault, geoDelimiterDefault, NULL);
m_dsStopPoints.SetSymbol(18);
int iLength = m_dsStopPoints.GetRecordCount();
if(!m_dsStopPoints.GetRecordCount ())
return;
m_DataSets.ZoomTo ();
That code needs around 0.5 seconds for importing and displaying around 135 pushpins. Unfortunatelly the pushpins I need to display are not contained in a file, but in memory instead. So the code above does not work. The code I use for my purpose is as follows:
_myPushPinSet= m_DataSets.AddPushpinSet(L"Pushpins");
for(itGPSPoints = _vecStopPoints.begin() ; itGPSPoints != _vecStopPoints.end(); itGPSPoints++)
{
locLocation = m_objMap.GetLocation( (*itGPSPoints)->GetLatitude(), (*itGPSPoints)->GetLongitude(), 2.0);
pinPushpin = m_objMap.AddPushpin(locLocation, L"Stoppoint");
pinPushpin.SetSymbol(18);
pinPushpin.MoveTo(_setStopPoints);
}
_myPushPinSet.SetFieldNamesVisibleInBalloon(TRUE);
_myPushPinSet.ZoomTo();
So I create a "CDataSet" and fill it with points ("itGPSPoints" is an iterator of a vector containg GPS-Points). However, this code needs arround 3 - 4 seconds, which is 8 times of what the first code does.
My theorie is as follows:
The first code imports all the data first, and then draws them all to the map.
The second code adds the data point by point, and draws them each time a new point is added.
That's just a theory, but would explain why my code is so slow.
Maybe someone can point me out on how to update my code in a way to make it more efficient.
Cheers,
Sino
I'm not very familiar with MapPoint yet, but already got some basics. However, currently I have a problem when displaying a bunch of push-pins. Somewhere here in the fourm I found code importing data from a file, which works fine.
That's the code:
m_dsStopPoints = m_DataSets.ImportData(m_strStopPointsPath, NULL, geoCountryDefault, geoDelimiterDefault, NULL);
m_dsStopPoints.SetSymbol(18);
int iLength = m_dsStopPoints.GetRecordCount();
if(!m_dsStopPoints.GetRecordCount ())
return;
m_DataSets.ZoomTo ();
That code needs around 0.5 seconds for importing and displaying around 135 pushpins. Unfortunatelly the pushpins I need to display are not contained in a file, but in memory instead. So the code above does not work. The code I use for my purpose is as follows:
_myPushPinSet= m_DataSets.AddPushpinSet(L"Pushpins");
for(itGPSPoints = _vecStopPoints.begin() ; itGPSPoints != _vecStopPoints.end(); itGPSPoints++)
{
locLocation = m_objMap.GetLocation( (*itGPSPoints)->GetLatitude(), (*itGPSPoints)->GetLongitude(), 2.0);
pinPushpin = m_objMap.AddPushpin(locLocation, L"Stoppoint");
pinPushpin.SetSymbol(18);
pinPushpin.MoveTo(_setStopPoints);
}
_myPushPinSet.SetFieldNamesVisibleInBalloon(TRUE);
_myPushPinSet.ZoomTo();
So I create a "CDataSet" and fill it with points ("itGPSPoints" is an iterator of a vector containg GPS-Points). However, this code needs arround 3 - 4 seconds, which is 8 times of what the first code does.
My theorie is as follows:
The first code imports all the data first, and then draws them all to the map.
The second code adds the data point by point, and draws them each time a new point is added.
That's just a theory, but would explain why my code is so slow.
Maybe someone can point me out on how to update my code in a way to make it more efficient.
Cheers,
Sino