ThinkGeo.com    |     Documentation    |     Premium Support

The picture doesn't show completely

Hello, I'm first time to contact version 3.0.453 RC2.  I used version 2.x  before.

 


Could someone tell me why it can't show completely?  Is my code wrong?


And when I zoom out too much, the image of car is disappearance


 .....delete some code....


     LayerOverlay.Layers.Add(all_town)

        LayerOverlay.Layers.Add(all_river)

        Dim carLayer As New InMemoryFeatureLayer()

        carLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle.PointType = PointType.Bitmap

        carLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle.Image = New GeoImage("D:\GIS\D1.gif")

        carLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20

        Dim dynamicOverlay As New LayerOverlay()

        dynamicOverlay.Layers.Add("PointLayer", carLayer)

        WinformsMap1.Overlays.Add("PointOverlay", dynamicOverlay)

        WinformsMap1.Overlays.Add(LayerOverlay)

        WinformsMap1.CurrentExtent = New RectangleShape(121, 25, 122, 22)

        WinformsMap1.Refresh()


....when click button----


  Private Sub focus_b_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles focus_b.Click


        Dim longitude As Double = Convert.ToDouble(TextBox1.Text, CultureInfo.InvariantCulture)

        Dim latitude As Double = Convert.ToDouble(TextBox2.Text, CultureInfo.InvariantCulture)


        Dim rectangle = New RectangleShape(longitude - 0.001, latitude + 0.001, longitude + 0.001, latitude - 0.001)


        WinformsMap1.CurrentExtent = rectangle


        Dim feature As New Feature(longitude, latitude, "Point1")

        Dim pointLayer As InMemoryFeatureLayer = DirectCast(WinformsMap1.FindFeatureLayer("PointLayer"), InMemoryFeatureLayer)

        If Not pointLayer.InternalFeatures.Contains("Point1") Then

            pointLayer.InternalFeatures.Add("Point1", feature)

        End If


        WinformsMap1.Refresh() 

    End Sub




    Private Sub btnZoomIn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnZoomIn.Click

        WinformsMap1.ZoomIn(60)

        WinformsMap1.Refresh()

    End Sub


    Private Sub btnZoomOut_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnZoomOut.Click

        WinformsMap1.ZoomOut(30)

        WinformsMap1.Refresh()

    End Sub




 



 


Carol,
 
Thanks for your post and questions.
 
The reason for this problem is when you refresh you mapControl in your focus_b_click event, you have to passed in the target changed overlay:

winformsMap1.Refresh(winformsMap1.Overlays("InmemoryOverlay"))

 
Of course, when you add your overlay, it is better you can add the key:

WinformsMap1.Overlays.Add(“InmemoryOverlay “,LayerOverlay)

 
We have a how do I sample, I think exactly do what you are trying to achieve:
Getting startted\ Highlight A Feature on the Map
 
Any more qeusitons just feel free to let me know.
 
Thanks.
 
Yale
 

Thanks for your reply, Yale


My code refers to the sample of Plot A Latitude And Longitude Point On The Map.


Why the picture can't show completely?


It can show the car when I zoom out, but it still can't show completely.


I attach my code as below.


 



1383-plotASymbol.txt (3.2 KB)

Carol,


You are welcome.
 
Just want to make sure your setting the correct extent for this:

WinformsMap1.CurrentExtent = New RectangleShape(121, 25, 122, 22)

 
If so, I think the magic is for the Snapped extent, even your set the current extent , while we will snapped to a certain zoomlevel which will probablly change the extent somehow. Could you have a quick try to set the snapped mode to none:

winformsMap1.ZoomLevelSnapping = ZoomLevelSnappingMode.None;

 
Any more qeustions just feel free to let me know.
 
Thanks.
 
Yale

Thanks for your reply, Yale


It is the same result.


when I load the map...it looks completely.



 


But when I input lon/lat...



when I zoom out...




Carol, 
  
 Sorry for my understanding. I think your results are correct. 
  
 First load: the extent is set the full extent of the layer, that looks good. 
  
 Then you click to add the lon/lat for the car, then you set the extent to a new extent which is a slightly bigger than the car, that looks right too. 
  
 Then Zoomout, that will be zoomout from previous extent by 30 percentage, is it not right? 
  
 Another quick thing, could you try to load your data into MapSuite Exploer attached to see your data unit is decimal degrees and your setting of MapUnit for MapControl is correct? 
  
 Thanks. 
  
 Yale 


Thanks for your reply, Yale


But I means that why I zoom in lon/lat, the background color is white? 


 all_county.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.SimpleColors.PaleGreen, GeoColor.GeographicColors.Ice)


Is it normal?


I attach a picture that I use v2.x to execut as below:




Carol, 
  
 Thanks for your answer and information. 
  
 Just want to make sure you set the background for the MapControl in 2.x while not in 3.x? 
  
 And The shapes besides the rivers should be roads instead of area? If so, I think the style you set above will not be applied correctly. 
  
 Any more quesitons just feel free to let me know. 
  
 Thanks. 
  
 Yale 


Yale, 

in v3.x:

 all_county.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.SimpleColors.PaleGreen, GeoColor.GeographicColors.Ice)


and it shows as belows:


I feel confused in why I zoom in or I extend a small range, the background color change to white?




 Carol, 
  
 I am also very curious wired problem, could you make a small application withi this specified extent set for us to recreate the problem(it is better to attach the data)?That would be very helpful for us to fix it as soon as possible. 
  
 Thanks. 
  
 Yale