MapWinGIS:AxMap ProjToPixel
From MapWindow GIS
ProjToPixel
Converts projected map coordinates into screen pixel units.
VB.NET Usage
Sub ProjToPixel(projX As Double, projY As Double, ByRef pixelX As Double, ByRef pixelY As Double)
Parameters
|
projX | The projected x map coordinate to be converted into the x pixel coordinate. |
| projY | The projected y map coordinate to be converted into the y pixel coordinate. |
| pixelX | The pixel x coordinate is returned through this reference parameter. |
| pixelY | The pixel y coordinate is returned through this reference parameter. |
Sample Code
Private Sub DrawCenterCircle()
Dim draw_hndl As Integer
Dim xProjCenter As Double, yProjCenter As Double
Dim xScreenCenter As Double, yScreenCenter As Double
Dim extents As MapWinGIS.Extents
'Get the extents of Map1
extents = Map1.Extents
'Calculate the center x coordinate of the map
xProjCenter = extents.xMin + ((extents.xMax - extents.xMin) / 2)
'Calculate the center y coordinate of the map
yProjCenter = extents.yMin + ((extents.yMax - extents.yMin) / 2)
'Convert from the projected map coordinates of the center of the map to pixel coordinates
Map1.ProjToPixel(xProjCenter, yProjCenter, xScreenCenter, yScreenCenter)
'Create a new drawing layer
draw_hndl = Map1.NewDrawing(MapWinGIS.tkDrawReferenceList.dlScreenReferencedList)
'Draw a circle centered around the center of the map's view
Map1.DrawCircle(xScreenCenter, yScreenCenter, 50, System.Convert.ToUInt32(RGB(255, 0, 0)), False)
End Sub
VB 6 Usage
Sub ProjToPixel(projX As Double, projY As Double, ByRef pixelX As Double, ByRef pixelY As Double)
Parameters
|
projX | The projected x map coordinate to be converted into the x pixel coordinate. |
| projY | The projected y map coordinate to be converted into the y pixel coordinate. |
| pixelX | The pixel x coordinate is returned through this reference parameter. |
| pixelY | The pixel y coordinate is returned through this reference parameter. |
Sample Code
Private Sub DrawCenterCircle()
Dim draw_hndl As Long
Dim xProjCenter As Double, yProjCenter As Double
Dim xScreenCenter As Double, yScreenCenter As Double
Dim extents As MapWinGIS.extents
'Get the extents of Map1
Set extents = Map1.extents
'Calculate the center x coordinate of the map
xProjCenter = extents.xMin + ((extents.xMax - extents.xMin) / 2)
'Calculate the center y coordinate of the map
yProjCenter = extents.yMin + ((extents.yMax - extents.yMin) / 2)
'Convert from the projected map coordinates of the center of the map to pixel coordinates
Map1.ProjToPixel xProjCenter, yProjCenter, xScreenCenter, yScreenCenter
'Create a new drawing layer
draw_hndl = Map1.NewDrawing(MapWinGIS.tkDrawReferenceList.dlScreenReferencedList)
'Draw a circle centered around the center of the map's view
Map1.DrawCircle xScreenCenter, yScreenCenter, 50, RGB(255, 0, 0), False
End Sub
















