ThinkGeo.com    |     Documentation    |     Premium Support

PointMapShape

What's happend with the class PointMapShape in this version? 

I have the follow code to paint points around the map, that work fine in the last version. But now, without the class pointmapshape i don't know how to do it.




Dim longValue As Double = DecimalDegrees.DMSToDecimalDegrees(grados_lon, minutos_lon, segundos_lon) 

Dim latValue As Double = DecimalDegrees.DMSToDecimalDegrees(grados_lat, minutos_lat, segundos_lat)


PointShp = New PointShape(longValue, latValue) 

pointMapSh = New PointMapShape(PointShp) 

pointMapSh.ZoomLevel01.GeoStyle = GeoPointStyles.GetSimpleCircleStyle(GeoColor.SimpleColors.Red, 7, GeoColor.SimpleColors.Black, 1) 

pointMapSh.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.ZoomLevel18 

pointMapSh.Dragable = False 

Map1.MapShapes.Add(pointMapSh) 

Map1.Refresh()




Any ideas? Thanks!!!! 

Carlos



Hey Carlos. 
  
 It looks like for now, you need to add the style to the layer… then when you add a geometry to the layer, it will apply the style automatically for you. So something like this: 
  
 InMemoryFeatureLayer pointLayer = new InMemoryFeatureLayer(); 
 pointLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.CreateSimpleCircleStyle(…); 
 pointLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; 
  
 Feature pointShapeFeature = new Feature(x, y); 
 pointLayer.Features.Add(pointShapeFeature); 
  
 I’m hoping that we will be able to add points with individual style in a release down the line. I have not seen this feature in the current version, but you should be able to add points with the code I added here for now. 
  
 Hope this helps. 


Carlos,


Here is the new code using 3.0.  
 

        Dim longValue As Double = DecimalDegreesHelper.GetDecimalDegreeFromDegreesMinutesSeconds(grados_lon, minutos_lon, segundos_lon)
        Dim latValue As Double = DecimalDegreesHelper.GetDecimalDegreeFromDegreesMinutesSeconds(grados_lat, minutos_lat, segundos_lat)

        Dim feature As New Feature(longValue, latValue)

        Dim inMemoryFeatureLayer As New InMemoryFeatureLayer()
        inMemoryFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.CreateSimpleCircleStyle(GeoColor.SimpleColors.Red, 7, GeoColor.SimpleColors.Black, 1)
        inMemoryFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20
        inMemoryFeatureLayer.InternalFeatures.Add("key", feature)

        WinformsMap1.StaticOverlay.Layers.Add(inMemoryFeatureLayer)
        WinformsMap1.CurrentExtent = New RectangleShape(-180, 80, 180, -90)
        WinformsMap1.Refresh()


 
There are definitely some changes from 2.0, if you are interested in it, here are some points you can check.
 
1, Feature is an object including all the data, shape data and tabular data, of one record. It can represent any shape (a polygon, a line or a point……).
2, InMemoryFeatureLayer is similar as the layer in 2.0, the big difference is that the data is from memory instead of shape file.
3, About overLayers, please have a look at one post here. This post is in web forum and in Map Suite 3.0, Overlay shares the same idea between Desktop and Web Edition.
 
Any queries please let us know.

The new code work's fine!!! Thank you very much Ben.



You are welcome Carlos

I have another similar problem. This time printing a line. And I Know that 

we have a similar post on the next page but i can't solve this one:


This is my code:




Dim coleccion As New MultipointShape


coleccion.Points.Add(PointShp1)

coleccion.Points.Add(PointShp2)

...


Dim feature As New Feature(coleccion)


Dim inMemoryFeatureLayer As New InMemoryFeatureLayer()

inMemoryFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.SimpleColors.PastelYellow, 14, True)

inMemoryFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20

inMemoryFeatureLayer.InternalFeatures.Add("linea", feature)


WinformsMap1.DynamicOverlay.Layers.Add(inMemoryFeatureLayer)

WinformsMap1.Refresh()




I don't know where are the mistakes.Thanks!!!

Carlos.



Carlos,  
  
 The feature you created is a MultiPointShape but the style you set is for a line. You need to set the DefaultPointStyle for the layer. 
  
 Also, it’s better you have the following lines included, to set the map unit and map extent. 
  
 winformsMap1.MapUnit = GeographyUnit.DecimalDegree; 
 winformsMap1.CurrentExtent = new RectangleShape(-180, 90, 180, -90); 
  
 Ben.