Apologies if this has been covered elsewhere. I am evaluating the Desktop edition .NET GIS control in Visual Basic but am not able to view the sample maps. All I get is a blank control with random 'unlicensed' labels.
If I run it with the sample code in C# it works fine, however VB.net does not work.
Thanks for your interests in Map Suite products and welcome you to ThinkGeo discussion forum.
I am sorry to say that in our Quick start, we only have the C# version up to now, while we have provided tons of VB.net samples in our HowDoI samples guiding you doing very simple maps.
In your description, I guess, you set the wrong styles or MapUint for your data, please double check, if you still cannot make it show, could you paste the C# version code which works and VB.net version code which does not work, we can try to help you figure out the problem.
Thanks for your reply. I am new to this application and do no know what the MapUint property is. I have tried the ‘HowDoI’ code for VB and get the same result.
Here is the entire code:
Imports System Imports System.Windows.Forms Imports ThinkGeo.MapSuite.Core Imports ThinkGeo.MapSuite.DesktopEdition
Namespace VBSampleApps Public Class DisplayShapeMap Inherits UserControl Public Sub New() InitializeComponent() End Sub
Private Sub DisplayMap_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load winformsMap1.MapUnit = GeographyUnit.DecimalDegree winformsMap1.BackgroundOverlay.BackgroundBrush = New GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean)
Dim worldMapKitDesktopOverlay As WorldMapKitWmsDesktopOverlay = New WorldMapKitWmsDesktopOverlay() winformsMap1.Overlays.Add(worldMapKitDesktopOverlay)
winformsMap1.CurrentExtent = New RectangleShape(-139.2, 92.4, 120.9, -93.2)
winformsMap1.Refresh() End Sub
#Region “Component Designer generated code”
Private components As System.ComponentModel.IContainer = Nothing Private winformsMap1 As WinformsMap
‘’’ ‘’’ Clean up any resources being used. ‘’’ ‘’’ true if managed resources should be disposed; otherwise, false. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing AndAlso (components IsNot Nothing) Then components.Dispose() End If MyBase.Dispose(disposing) End Sub
‘’’ ‘’’ Required method for Designer support - do not modify ‘’’ the contents of this method with the code editor. ‘’’ Private Sub InitializeComponent() Me.winformsMap1 = New ThinkGeo.MapSuite.DesktopEdition.WinformsMap Me.SuspendLayout() ’ 'winformsMap1 ’ Me.winformsMap1.BackColor = System.Drawing.Color.White Me.winformsMap1.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.[Default] Me.winformsMap1.CurrentScale = 590591790 Me.winformsMap1.DrawingQuality = ThinkGeo.MapSuite.Core.DrawingQuality.[Default] Me.winformsMap1.Location = New System.Drawing.Point(0, 0) Me.winformsMap1.MapFocusMode = ThinkGeo.MapSuite.DesktopEdition.MapFocusMode.[Default] Me.winformsMap1.MapResizeMode = ThinkGeo.MapSuite.Core.MapResizeMode.PreserveScale Me.winformsMap1.MapUnit = ThinkGeo.MapSuite.Core.GeographyUnit.DecimalDegree Me.winformsMap1.MaximumScale = 80000000000000 Me.winformsMap1.MinimumScale = 200 Me.winformsMap1.Name = “winformsMap1” Me.winformsMap1.Size = New System.Drawing.Size(740, 528) Me.winformsMap1.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality Me.winformsMap1.TabIndex = 0 Me.winformsMap1.Text = “winformsMap1” Me.winformsMap1.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias Me.winformsMap1.ThreadingMode = ThinkGeo.MapSuite.DesktopEdition.MapThreadingMode.[Default] Me.winformsMap1.ZoomLevelSnapping = ThinkGeo.MapSuite.DesktopEdition.ZoomLevelSnappingMode.[Default] ’ 'DisplayShapeMap ’ Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.Controls.Add(Me.winformsMap1) Me.Name = “DisplayShapeMap” Me.Size = New System.Drawing.Size(740, 528) Me.ResumeLayout(False)
I have 2 things probably you can verify: 1)Could you set a break point in DisplayMap_Load to verify it is executed. 2) If it is executed. Then could you replace the following code into DisplayMap_Load to see it works? Because I doubt the network to get the image from WorldMapKit server is something wired. winformsMap1.MapUnit = GeographyUnit.DecimalDegree winformsMap1.BackgroundOverlay.BackgroundBrush = New GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean)
'Dim worldMapKitDesktopOverlay As New WorldMapKitWmsDesktopOverlay() 'winformsMap1.Overlays.Add(worldMapKitDesktopOverlay)
Dim worldLayer As New ShapeFileFeatureLayer("..\..\SampleData\Data\Countries02.shp") worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.SimpleColors.Transparent, GeoColor.FromArgb(100, GeoColor.SimpleColors.Green)) worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20
Dim staticOverlay As New LayerOverlay() staticOverlay.Layers.Add("WorldLayer", worldLayer) winformsMap1.Overlays.Add("WorldOverlay", staticOverlay)
winformsMap1.CurrentExtent = New RectangleShape(-139.2, 92.4, 120.9, -93.2)
I believe my problems have to do with the solution setup. I would like a template solution for VB.net that I can use just to get started. The ‘how do I’ solution comes with much too much baggage. It should be simple enough to start with, and able to add features.
I agree with you that we need to include some quick start templates. These templates would be projects where someone starting a new map could get a bunch common GIS functionality etc. Let me see if we can get this project going. Maybe we can release this in the short term as a code community project.