MapWinGIS:AxMap NewDrawing

This is a back-up of the WIKI.
Not all links might work
We're working on a new wiki.

Main Page | Recent changes | View source | Page history | Log in / create account |

Printable version | Disclaimers | Privacy policy

NewDrawing

Creates a new drawing layer on the map returning its handle.
See also tkDrawReferenceList


VB.NET Usage

Function NewDrawing(Projection As MapWinGIS.tkDrawReferenceList) As Integer

            Parameters

Projection

Sets the coordinate system to use for the new drawing layer to be created. (ScreenReferenced uses pixels in screen coordinates. SpatiallyReferenced uses projected map units.)
ReturnValue The handle for the new drawing layer in the map.

Sample Code

    Private Sub NewDrawing(ByVal DrawSpatiallyReferenced As Boolean)
        Dim hndl As Integer
        Dim xProjCenter As Double, yProjCenter As Double
        Dim xScreenCenter As Double, yScreenCenter As Double
        Dim extents As MapWinGIS.Extents
        'Get map extents
        extents = Map1.Extents
        'find the center of the view
        xProjCenter = extents.xMin + ((extents.xMax - extents.xMin) / 2)
        yProjCenter = extents.yMin + ((extents.yMax - extents.yMin) / 2)
        'create a new drawing surface
        If (DrawSpatiallyReferenced) Then
            'Use spatially referenced coordinates for new drawing layer and save handle
            hndl = Map1.NewDrawing(MapWinGIS.tkDrawReferenceList.dlSpatiallyReferencedList)
            'Draw circle on last created drawing surface
            Map1.DrawCircle(xProjCenter, yProjCenter, 100, System.Convert.ToUInt32(RGB(255, 0, 0)), True)
        Else
            'Get center of the screen in pixel units from projected map coordinates
            Map1.ProjToPixel(xProjCenter, yProjCenter, xScreenCenter, yScreenCenter)
            'Use screen referenced coordinates for new drawing layer and save handle
            hndl = Map1.NewDrawing(MapWinGIS.tkDrawReferenceList.dlScreenReferencedList)
            'Draw circle on last created drawing surface
            Map1.DrawCircle(xScreenCenter, yScreenCenter, 100, System.Convert.ToUInt32(RGB(255, 0, 0)), True)
        End If
    End Sub
  

VB 6 Usage

Function NewDrawing(Projection As tkDrawReferenceList) As Long
            Parameters

Projection

Sets the coordinate system to use for the new drawing layer to be created. (ScreenReferenced uses pixels in screen coordinates. SpatiallyReferenced uses projected map units.)
ReturnValue Handle for the new drawing layer in the map.

Sample Code

    Private Sub NewDrawing(ByVal DrawSpatiallyReferenced As Boolean)
        Dim hndl As Long
        Dim col As OLE_COLOR
        Dim xProjCenter As Double, yProjCenter As Double
        Dim xScreenCenter As Double, yScreenCenter As Double
        Dim extents As MapWinGIS.extents
        'Get map extents
        Set extents = Map1.extents
        'Get red color for drawing
        col = RGB(255, 0, 0)
        'find the center of the view
        xProjCenter = extents.xMin + ((extents.xMax - extents.xMin) / 2)
        yProjCenter = extents.yMin + ((extents.yMax - extents.yMin) / 2)
        radius = 100
        'create a new drawing surface
        If (DrawSpatiallyReferenced) Then
            'Use spatially referenced coordinates for new drawing layer and save handle
            hndl = Map1.NewDrawing(MapWinGIS.tkDrawReferenceList.dlSpatiallyReferencedList)
            'Draw circle on last created drawing surface with a radius of 100
            Map1.DrawCircle xProjCenter, yProjCenter, 100, col, True
        Else
            'Get center of the screen in pixel units from projected map coordinates
            Map1.ProjToPixel xProjCenter, yProjCenter, xScreenCenter, yScreenCenter
            'Use screen referenced coordinates for new drawing layer and save handle
            hndl = Map1.NewDrawing(MapWinGIS.tkDrawReferenceList.dlScreenReferencedList)
            'Draw circle on last created drawing surface
            Map1.DrawCircle xScreenCenter, yScreenCenter, 100, RGB(255, 0, 0), True
        End If
    End Sub

Retrieved from "http://mapwindow.org/wiki/index.php/MapWinGIS:AxMap_NewDrawing"

This page has been accessed 4,785 times. This page was last modified on 9 November 2005, at 18:30.