Community of VE/MapPoint Users and Developers
This is a discussion on Center pushin only if out of viewable area?? within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; That's my problem... I've a gps device sending coordinates to a my applications.. my app so.. get coordinates and move ...
| |||||||
| Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| Center pushin only if out of viewable area?? I've a gps device sending coordinates to a my applications.. my app so.. get coordinates and move a pushpin on the MapPoint control. Till here everything is ok. Now tha problem is that... I move the pushpin and center the map to the pushpin location.. but the control is redraw each time.. is there a way to lock this redraw??? or better.. recenter the map only if pushpin location is out of vievable area? |
| |||
|
Hi, LocationToX and LocationToY return -1 if Location object is outside visible area, so you can use these 2 to recenter when needed.
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
|
Can you post me an example.. i use this code: //mTarget = my moving pushpin mTarger.Location = this.mMap.GetLocation(lat, lon, 0); //mLoc is a MapPoint.Location mLoc = this.mMap.GetLocation(lat, lon, 0); //the place where i center the map mLoc.GoTo(); Can you show me how to adapt my code to work with LocationTox and Y regards Gianmaria |
| |||
|
Hi, It seems that6 the help is lying a little Code: private void centeronlyifnotinviewToolStripMenuItem_Click(object sender, EventArgs e)
{
double Lat = 51;
double Lon = 4.1;
double Alt = 20;
Location Loc = MP.ActiveMap.GetLocation(Lat, Lon, Alt);
MP.ActiveMap.GoToLatLong(Lat, Lon, Alt);
Thread.Sleep(1000);
// we place a pushpin in view
Lat = 51.02;
Loc = MP.ActiveMap.GetLocation(Lat, Lon, Alt);
Pushpin PP = MP.ActiveMap.AddPushpin(Loc, "");
PP.Symbol = 1;
// if location is out of view then we center again
if (MP.ActiveMap.LocationToX(Loc) < 0 ||
MP.ActiveMap.LocationToX(Loc) > MP.ActiveMap.Width ||
MP.ActiveMap.LocationToY(Loc) < 0 ||
MP.ActiveMap.LocationToY(Loc) > MP.ActiveMap.Height)
PP.GoTo();
Thread.Sleep(1000); // does not center
// we move the pushpin out of view
Lat = 50;
Loc = MP.ActiveMap.GetLocation(Lat, Lon, Alt);
PP = MP.ActiveMap.AddPushpin(Loc, "");
PP.Symbol = 1;
// if location is out of view then we center again
if (MP.ActiveMap.LocationToX(Loc) < 0 ||
MP.ActiveMap.LocationToX(Loc) > MP.ActiveMap.Width ||
MP.ActiveMap.LocationToY(Loc) < 0 ||
MP.ActiveMap.LocationToY(Loc) > MP.ActiveMap.Height)
PP.GoTo(); // jipieeee it centers :)
}
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
![]() |
| Tags |
| area, center, pushin, viewable |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Center Point | colin_turner99 | MapPoint 2006/2009 Discussion | 1 | 07-14-2006 02:38 PM |
| Find center of a polygon | Anonymous | MapPoint 2006/2009 Discussion | 11 | 05-25-2005 09:54 AM |
| Center Map to a pushpin? | Anonymous | MapPoint 2006/2009 Discussion | 7 | 02-14-2005 05:31 PM |
| Pushin Tool Version 2.4 Now Available | Eric Frost | Products: Pushpin Tool, Single State Mapper | 1 | 09-03-2003 02:32 PM |
| Determining Center of a Zipcode | shaistasohail | MapPoint 2006/2009 Discussion | 0 | 10-21-2002 11:13 PM |