Printable versions
This Page
All Pages
PDF (2.0MB)

Index

Component
GpsViewNET

Class
Map

Properties
Position
OffsetX
OffsetY
Zoom
Rotation
Background
UpdateInterval

Layers
MapLib

Events
OnObjectDown
OnObjectUp
OnMouseDown
OnMouseUp
OnMouseMove
OnDraw
OnDrawComplete

Methods
Open
Merge
Close
Update
UpdateAsync
CancelUpdate

NewMapShape
NewMapShapeFile
NewIcon
NewLine
NewRectangle
NewEllipse
NewLabel
Delete

GetByID
GetByIndex
GetByPosition
SetIndex
GetIndex

ActiveLayer
ActiveMapData

Position2Point
Point2Position

ZoomByBoundingBox

Map.Position2Point GpsTools v2.00 and later

Converts a geographic position to a pixel position on map.

The Point you get is relative the bitmaps origin and not relative the Control's origin in which the bitmap is displayed. This can be a little bit confusing at first sight.

Note that the origin and size of this bitmap will change when the bitmap is zoomed or rotated.

Here is how to calculate the relative offset the Control has into the bitmap (the larger raster map, that the Control "looks into").

C# for .NET, other platforms and languages need minor changes

// Get Maps position (which is centered)
GpsToolsNET.Position mapPos = map1.Position;

// Maps center in pixels seen from the origin of the bitmap
// (not from the Control)
// This value changes when Map.Zoom or Map.Rotation changes
GetViewNET.Point mapPoint = map1.Position2Point(mapPos);

// This is the offset that differs the Control's orgio
// and the raster maps (bitmaps) origin
int offset_x = mapPoint.X - map1.Width / 2;
int offset_y = mapPoint.Y - map1.Height / 2;

// If you have set Map.OffsetX and Map.OffsetY
// you need to add those values to offset_x and offset_y


Syntax
Set objPoint = objMap.Position2Point(objPosition)

Part Type Description
objMap GpsViewNET.Map An object that evaluates to an GpsViewNET.Map object.
objPoint GpsViewNET.Point
Point.
objPosition GpsToolsNET.Position
Position.



Compact Framework
© 2016 Franson Technology AB, All rights reserved, Contact | | Affiliate | Login