Welcome to MapForums!

Register, sign in, or use Facebook Connect above to join in and participate in the forum.

When you are signed in, this message, the ads in this row, and the red-underlined link ads all go away.

Subscribe to receive our newsletter.
Subscribe Unsubscribe
Results 1 to 4 of 4

MapPoint: How to make MapPoint zoom to the extent of all shapes drawing on map?

This is a discussion on MapPoint: How to make MapPoint zoom to the extent of all shapes drawing on map? within the MapPoint Desktop Discussion forums, part of the Map Forums category; Hi all, any body know how to make MapPoint zoom to a given coordinate extent by code? For example, I ...

  1. #1
    bluefireball is offline Junior Member Yellow Belt
    Join Date
    Mar 2007
    Posts
    27

    MapPoint: How to make MapPoint zoom to the extent of all shapes drawing on map?

    Hi all, any body know how to make MapPoint zoom to a given coordinate extent by code? For example, I have drawed several polygons on different area, I need one button click to zoom the map to show all polygons in aproper scale. Thanks.

  2. #2
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433

    Re: MapPoint: How to make MapPoint zoom to the extent of all shapes drawing on map?

    Hi,

    Add all Location objects that you have used for the Poligons in an array and Call Union(<array>).Goto(); method with this array. This will go to and zoom to the best view of it.

  3. #3
    DrNobody is offline Junior Member White Belt
    Join Date
    Feb 2007
    Posts
    10

    Re: MapPoint: How to make MapPoint zoom to the extent of all shapes drawing on map?

    Hi, I do it like this (bit of the live code)
    Code:
    void CMapPage::ShowParkPoints()
    {
     try
     {
      if(m_bShowPark)
      {
       m_dsParkPoints = m_DataSets.ImportData(m_strParkPointsPath, NULL, 
                 geoCountryDefault, geoDelimiterDefault, NULL);
       m_dsParkPoints.SetSymbol(20);
       int nRecordCount = m_dsParkPoints.GetRecordCount ();
       if(nRecordCount == 0)
       {
        //AfxMessageBox (_T("There are no \"Park\" points"), MB_ICONINFORMATION);
        return;
       }
       COleSafeArray saFields;
       saFields.CreateOneDim (VT_DISPATCH, 4);
       long lIndex[1];
       CFields colFields = m_dsParkPoints.GetFields ();
       CField objField;
       for(int i = 0; i < 4; i ++)
       {
        lIndex[0] = i;
        objField = colFields.GetItem(COleVariant((long) (i + 2)));
        saFields.PutElement (lIndex, objField.m_lpDispatch);
       }
       m_dsParkPoints.SetFieldsVisibleInBalloon (saFields);
       m_DataSets.ZoomTo ();
      }
      else
       m_dsParkPoints.Delete();
     } //try
     catch (COleDispatchException * pExpn)
     {
    #ifdef _DEBUG
      pExpn->ReportError ();
    #endif
      pExpn->Delete ();
     }
    }
    Or how Wilfried said.

  4. #4
    bluefireball is offline Junior Member Yellow Belt
    Join Date
    Mar 2007
    Posts
    27

    Re: MapPoint: How to make MapPoint zoom to the extent of all shapes drawing on map?

    What I did is to use the shape extent ( calculated from shape vertices) to define two locations. I added it to a lcoation array and use union().Goto() method to zoom, just as Wilfried recommended. It works very well. Thanks Wilfried & DrNobody.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Drawing Shapes
    By Matrices in forum MapPoint Desktop Discussion
    Replies: 7
    Last Post: 11-07-2006, 11:04 AM
  2. Drawing / Zoom
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 04-04-2005, 07:59 AM
  3. How to make shapes unmoveable ?
    By Jaba in forum MapPoint Desktop Discussion
    Replies: 6
    Last Post: 01-12-2005, 05:03 AM
  4. Extent
    By nringdahl in forum Wish List
    Replies: 0
    Last Post: 06-07-2004, 06:28 AM
  5. Drawing shapes on the ocx
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 10-01-2002, 05:54 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96