 |
Trilight Zone Privacy & Anonymity is our speciality !
|
|
|
| Author |
Message |
tricore Guest
|
Posted: Wed Jan 03, 2007 4:40 am Post subject: Zoom, View and To Data functions in MapPoint |
|
|
ZOOM
- You have these methods ActiveMap.ZoomIn() and ActiveMap.ZoomOut() and as an alternative you can set ActiveMap.Altitude = altitude to a very specific zoom level.
- The following code demonstrates how one can zoom into preset X and Y coordinates (there are two samples for this):
(1)
Dim oMap As MapPoint.Map
Dim Latitude As Double
Dim Longitude As Double
Latitude = 30.32667
Longitude = -97.71323
Dim oLoc As MapPoint.Location
Set oLoc = oMap.GetLocation(Latitude, Longitude, 0)
oLoc.GoTo
(2)
Sub ShowDistanceNYToLA()
Dim objApp As New MapPoint.Application
Dim objMap As MapPoint.Map
Dim objLocNY As MapPoint.Location
Dim objLocLA As MapPoint.Location
Dim objCenter As MapPoint.Location
Dim objTextbox As MapPoint.Shape
'Set up application and create Location objects
Let objApp.Visible = True
Let objApp.UserControl = True
Set objMap = objApp.ActiveMap
Set objLocNY = objMap.FindResults("New York, NY").Item(1)
Set objLocLA = objMap.FindResults("Los Angeles, CA").Item(1)
'Find the point on the screen midway between the two
X1% = objMap.LocationToX(objLocNY)
Y1% = objMap.LocationToY(objLocNY)
X2% = objMap.LocationToX(objLocLA)
Y2% = objMap.LocationToY(objLocLA)
x% = (X1% + X2%) / 2
y% = (Y1% + Y2%) / 2
Set objCenter = objMap.XYToLocation(x%, y%)
'Show the distance
objMap.Shapes.AddLine objLocNY, objLocLA
Set objTextbox = objMap.Shapes.AddTextbox(objCenter, 200, 50)
Distance# = objMap.Distance(objLocNY, objLocLA)
Let objTextbox.Text = "Distance, New York to Los Angeles: " & Distance#
End Sub
Note: This sample code is specific for use in MapPoint North America; it is for illustration purposes only.
For more information, please refer the following article:
http://msdn.microsoft.com/library/en-us/MapPoint2006/BIZAPILocation.asp
VIEWS
' Create and specify MapView object, set center point and scale.
Dim myMapView As MapView = New MapView()
myMapView.CenterPoint = New LatLongCoord()
myMapView.CenterPoint.Latitude = myLatitude
myMapView.CenterPoint.Longitude = myLongitude
myMapView.Scale = 50000
' Create an array of MapView objects, insert previously created single MapView object.
Dim myMapViews(0) As MapView
myMapViews(0) = myMapView
TO DATA
In the MapPoint SDK, under programming information, you can go through the “About mapping data with the MapPoint object model section” for more information on mapping data. For the information on MapPoint object model, the methods, properties, events etc supported, please refer the following article:
http://msdn.microsoft.com/library/en-us/MapPoint2006/BIZOMAboutOM.asp
The above mentioned article should give you a clear picture on the objects that you can use via code.
For more information:
http://msdn.microsoft.com/mappoint/ |
|
| Back to top |
|
 |
|
Powered by phpBB © 2001, 2005 phpBB Group
|