View Single Post

  #1 (permalink)  
Old 02-04-2008
SinoTech SinoTech is offline
Junior Member
White Belt
 
Join Date: Oct 2007
Posts: 3
Need help increasing speed adding a set of pushpins

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:
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:
Code:
        _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
Reply With Quote