Synchronize maps ?

Dec 22, 2013 at 1:37 PM
Hi,

I'm trying to have two synchronized maps in my Vb.net application. Unfortunately, after spending hours googling, I can't find a way to do it.

a) If I try to use Axmap.snapshot, to copy main map to a picturebox, I can't find a way to convert Mapwingis Image to System.Drawing.Image

b) If I try to copy one Axmap to another Axmap... I can't find a way to do it.

Thanks for any help,

Olivier
Dec 22, 2013 at 1:41 PM
Marked as answer by olivier57 on 12/23/2013 at 3:33 AM
Jan 21, 2014 at 10:37 AM
Edited Jan 21, 2014 at 1:17 PM
Hi,

I noticed that Mapstate is deprecated in 4.8. That seems bad to me because you can't anymore synchronize maps using memory with a simple line like
AxMap1.Mapstate=AxMap2.Mapstate.

I found that this was only partially working point labels visible in the first map where not visible in the other (at any scale).

Never mind, it seems now that the only way to do that is to use SerializeMapState/DeSerializeMapState. Those methode requires a path wich implies writing to disk. This is not as nice as exchanging data thru memory.

Am I right ?

Using SerializeMapState/DeSerializeMapState, I encountered the same problem as with MapState only, labels of one layer visible in the original map weren't visible in the destination one.

Using SaveMapState/LoadMapState, point layer is not visible either even documented in the xml file.

Any idea to solve the point layer not visible ?

Olivier

here is the generated map state. Line (arc.shp) are ok, but not points (ch.shp).
<Layer LayerType="Shapefile" LayerName="" LayerVisible="1" LayerKey="" Filename="ARC.shp">
      <ShapefileClass>
        <DefaultDrawingOptions FillColor="16777215" LineColor="7632246" />
        <ShapefileCategoriesClass />
        <LabelsClass Alignment="7" OffsetY="2" Generated="1" Positioning="5" TextRenderingHint="5" Expression="[COMPOSITIO]" />
        <ChartsClass />
      </ShapefileClass>
    </Layer>
    <Layer LayerType="Shapefile" LayerName="" LayerVisible="1" LayerKey="" Filename="CH.shp">
      <ShapefileClass>
        <DefaultDrawingOptions LineColor="9868950" />
        <ShapefileCategoriesClass />
        <LabelsClass Alignment="5" Generated="1" Positioning="1" TextRenderingHint="5" Expression="[CODE]" />
        <ChartsClass />
      </ShapefileClass>
    </Layer>
--- Edit

I tried to do LoadMapState after SaveMapState with the "good" map. Points Labels do not appear anymore. So in my idea, there is a problem with Mapstate wich compromise doesn't transfer labels chatacteristics