MapWindow 4 - ActiveX Control Programming : MapWindow Discussion Forum
Attachments: untitled.JPG (47.1 KB)
Hi all! I can draw or paint shapes of a shapefile in a MapWnGis AxMap with a for loop. But if I want to draw shapes one by one, only it draw the last shape, the others change to a small point. This is a example code:
Draw a shape
Posted by:
Winston ()
Date: June 22, 2011 02:41AM
Hi all!
I can draw or paint shapes of a shapefile in a MapWnGis AxMap with a for loop.
But if I want to draw shapes one by one, only it draw the last shape, the others change to a small point.
This is a example code:
Note: the param of the proc is the ID of the Shape in the shapefile.
After a lot of tests, I think that the problem is in the layer. But I can't correct the problem.
The result is: (The red TriangleLeft is the last shape). The points are the other shapes that change their 'shape' to a point.
Thanks a lot!!
Edited 2 time(s). Last edit at 06/22/2011 02:44AM by Winston.
I can draw or paint shapes of a shapefile in a MapWnGis AxMap with a for loop.
But if I want to draw shapes one by one, only it draw the last shape, the others change to a small point.
This is a example code:
private void ShowAll() { if (System.IO.File.Exists(@"D:\Geoposicionamiento\shapes\barcos.shp") == true) { //barcos.Open(@"D:\Geoposicionamiento\shapes\barcos.shp", null); if (barcos.NumShapes == 0) { MessageBox.Show("No hay barcos introducidos"); } else { //iIdShpBarcos = axMap1.AddLayer(barcos, true); for (int i = 0; i < barcos.NumShapes; i++) { ShowOne(i); } } } else { MessageBox.Show("No existe el fichero en mostrar barcos!"); } Well, this procedure works fine. But if I try to work with the ShowOne() func while I insert a shape this doesn't works. The code for the ShowOne() func is: private void ShowOne(int i) { axMap1.set_LayerVisible(iIdShpBarcos, true); axMap1.set_ShapePointType(iIdShpBarcos, i, MapWinGIS.tkPointType.ptTriangleLeft); axMap1.set_ShapePointSize(iIdShpBarcos, i, 5); axMap1.set_ShapePointColor(iIdShpBarcos, i, (UInt32)(System.Drawing.ColorTranslator.ToOle (System.Drawing.Color.Red))); }
Note: the param of the proc is the ID of the Shape in the shapefile.
After a lot of tests, I think that the problem is in the layer. But I can't correct the problem.
The result is: (The red TriangleLeft is the last shape). The points are the other shapes that change their 'shape' to a point.
Thanks a lot!!
Edited 2 time(s). Last edit at 06/22/2011 02:44AM by Winston.
Attachments: untitled.JPG (47.1 KB)
Re: Draw a shape
Posted by:
Sergei ()
Date: June 22, 2011 05:24AM
Quick answer: per-shape options aren't supported any more, you should use ShapefileCategories instead. Some hints on how to use them are, for example, here:
[mapwingis.codeplex.com]
[mapwingis.codeplex.com]
Sorry, only registered users may post in this forum.


