ThinkGeo.com    |     Documentation    |     Premium Support

Basic map

I am starting to convert from V2 to 3 of desktop )-:


 


Are there any examples for V3.0 to do all of the following menu items ? In particular Map.CurrentExtent = Map.FullExtent


 


Regards


 


Ewan    


 


The following code is from V2


 


Select Case e.Button.ToolTipText

            Case "Track Zoom In"

                mapToolBar.Buttons(0).Pushed = True

                Map.Mode = ModeType.TrackZoomIn

                Exit Select

            Case "Zoom In"

                Map.ZoomIn(40)

                Exit Select

            Case "Zoom Out"

                Map.ZoomOut(40)

                Exit Select

            Case "Full Extent"

                Map.CurrentExtent = Map.FullExtent

                Exit Select

            Case "Toggle Extent"

                Map.ToggleMapExtents()

                Exit Select

            Case "Previous Extent"

                Map.GetPreviousExtent()

                Exit Select

            Case "Pan"

                mapToolBar.Buttons(8).Pushed = True

                Map.Mode = ModeType.Pan

                Exit Select

            Case "Pan Left"

                Map.Pan(PanDirection.Left, 20)

                Exit Select

            Case "Pan Right"

                Map.Pan(PanDirection.Right, 20)

                Exit Select

            Case "Pan Up"

                Map.Pan(PanDirection.Up, 20)

                Exit Select

            Case "Pan Down"

                Map.Pan(PanDirection.Down, 20)

                Exit Select

            Case "Print Preview"

                Dim PrintPreview As New PrintPreviewDialog()

                Map.PrintDocument.DefaultPageSettings.Landscape = True

                PrintPreview.Document = Map.PrintDocument

                PrintPreview.ShowDialog()

                Exit Select

            Case "Open Map"


end select



Ewan, Welcome you to ThinkGeo MapSuite Desktop Edition Forum!


MapSuite 3.0 is much more powerful than MapSuite2.0 with its widely supports all kinds of layers, while NOT all kinds of layer has bounding box for it.
 
So In MapSuite3.0, We do not support FullExtent anymore, if you want, you can write the logic your self as following way:
 

winformsMap1.CurrentExtent = GetFullExtent()

Private Function GetFullExtent() As RectangleShape
            Dim boundingBox As RectangleShape = Nothing

            For Each Overlay In winformsMap1.Overlays
                If TypeOf (Overlay) Is LayerOverlay Then
                    Dim layerOverlay As LayerOverlay = DirectCast(Overlay, LayerOverlay)
                    For Each layer As Layer In layerOverlay.Layers
                        If layer.HasBoundingBox Then
                            If Not layer.IsOpen Then
                                layer.Open()
                            End If
                            If boundingBox Is Nothing Then
                                boundingBox = layer.GetBoundingBox()
                            Else
                                boundingBox.ExpandToInclude(layer.GetBoundingBox())
                            End If
                        End If
                    Next

                End If
            Next
            Return boundingBox
        End Function

 

Let me know if any more questions.
 
Thanks.
 
Yale


Thanks - this was helpful but I still only seem to be able to render the image to show at about 50% its size in the control. 
  
 ie the world map only show 1/2 size despite the bounding box upper left and lower right properties being at the world extents ?? 
  
  
 Ewan

Ewan,


Thanks for your post and question!
 
The reason for this is the “Snapping” behavior changed the extent somehow, our default will shown contains 20 preset scales for better caching effects. If you set an extent just between the middle of 2 preset “Scales” (bounding box upper left and lower right of the world extent), it will snap to some preset one (1/2 size).
 
If you want, you can set different snapping mode and have a try:

winformsMap1.ZoomLevelSnapping = ZoomLevelSnappingMode.None;

Let me know if any more questions.


 
Thanks
 
Yale