Adding Marker/Pushpin to selected Polygon

May 6, 2013 at 8:00 AM
Can anyone help me
i want to do something like this ---> http://www.mapwindow.org/documentation/mapwingis4.8/_point_icons_8cs-example.html#a17

but without points
i want to put marker inside a selected Polygon

thanks in advance
Developer
May 7, 2013 at 12:01 PM
Edited May 7, 2013 at 12:03 PM
I guess the best way to do it is to generated in-memory point shapefile with centers (centroids) of polygons and then to set icons like in the example. Here is some quick code how to do it (check naming for API members in documentation):
Shapefile sfNew = new Shapefile();
sfNew.Create("", ShpType.POINT);   // no filename = in-memory
 for(int i = 0; i < i sf.numShapes; i++) {
     Point pnt = sf.get_Shape(i).Centroid();
     Shape shp = new Shape();
     shp.Create(ShpType.POINT);
     shp.AddPoint(pnt);
     sfNew.EditAddShape(pnt);
}
// apply icons for sfNew