MapWindow ActiveX versus DotSpatial to move random dots

Nov 19, 2010 at 8:48 PM

I tried the TestViewer viewer sample to move random dots and it worked great. I see that it was mentioned that a current version of DotSpatial is needed or the move operation won't work.

I'm using the MapWindow4 Active X component because it supports more data formats and I also may need to use it somehow in an unmanaged application by writing a wrapper method around it.

Anyone know if the MapWindow 4 ActiveX component can move dots like DotSpatial?

I read on the MapWindow forum that the screen may need to be redrawn with every update.

I'm still trying to get a grip on the functionality of MapWindow ActiveX versus DotSpatial so I can build an app that works like a GPS style map but uses a raster map with a vector overlay.

Any advice on how this can be done is much appreciated!

Thanks,
Alan

Developer
Nov 19, 2010 at 9:59 PM
With MapWindow ActiveX, I would recommend using a drawing layer rather than using a Shapefile. Shapefiles in the activeX are file based and not in ram. So I usually had grief trying to get the screen to update new shape coordinates. If you use a drawing layer, it becomes simpler for you to manage because you don't have to force updates to the disk to get it to recognize your changes. Remember that the DrawingLayer is like a single transparent stencil on top of the map and that as you draw on the layer, you are always drawing on top of whatever other geospatial layers exist. The ActiveX map at the time I used it did not have a working Paint event to trap, so you couldn't easily draw on top of it using GDI+ graphics, and even the drawing layer updates force a redraw of all the GIS layers. If your layers are small, this is not a problem.

You can handle the ExtentsChanged event if you use screen referenced drawings, or you can use georeferenced drawings by using the Georeferenced mode in the DrawingLayer constructor. I'd recommend using that if your points don't change much compared to people panning and zooming the map. You can specify whether the new DrawingLayer is screen referenced or georeferenced coordinates. My experience was that the more data layers you have in the activeX, the more painful the updates will become becuase it redraws everything.

The demo on moving points was also not a demonstration of the best solution for moving points with DotSpatial, but was rather a proof that a bug had been fixed for updating point features. The method shown will redraw all the layers and some might be large GIS layers. For performance with a lot of heavy grind in the background in DotSpatial, you handle the Map.Paint event, and take advantage of the Map.ProjToPixel() routines in order to transform your coordinates into pixels. Then you can use the GDI+ graphics drawing to draw your fast moving sprites. With this technique, you can invalidate even small rectangles on the Map, preventing redrawing of the whole back-buffer. Be sure to both invalidate the old location and the new one, or a rectangle large enough to enclose both.


Ted



On Fri, Nov 19, 2010 at 1:48 PM, aleberkn <notifications@codeplex.com> wrote:

From: aleberkn

I tried the TestViewer viewer sample to move random dots and it worked great. I see that it was mentioned that a current version of DotSpatial is needed or the move operation won't work.

I'm using the MapWindow4 Active X component because it supports more data formats and I also may need to use it somehow in an unmanaged application by writing a wrapper method around it.

Anyone know if the MapWindow 4 ActiveX component can move dots like DotSpatial?

I read on the MapWindow forum that the screen may need to be redrawn with every update.

I'm still trying to get a grip on the functionality of MapWindow ActiveX versus DotSpatial so I can build an app that works like a GPS style map but uses a raster map with a vector overlay.

Any advice on how this can be done is much appreciated!

Thanks,
Alan

Read the full discussion online.

To add a post to this discussion, reply to this email (DotSpatial@discussions.codeplex.com@discussions.codeplex.com)

To start a new discussion for this project, email DotSpatial@discussions.codeplex.com@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com