No Legend Control for MapWinGIS

Jan 1, 2015 at 2:25 PM
Could you please tell me if the download files MapWinGIS are provided wih legend control. I found that the MapWinInterfaible v 4.8 is not compatable with the MapWinGIS v can I download the atest version of MapWnInterface.

I need a legend control for my application. Without the legend control, I can't upgrade my application that is orginally developed with the old version 4.8.

Thank you for your help.
Jan 1, 2015 at 6:39 PM
The demo app which is included in new MapWinGIS installer has an updated version of Legend control. Binary version - MWLite.Symbology.dll - is in \MapWindowLite folder of installation. Source code is here: Assemblies/Demo/MWLite.Symbology/MWLite.Symbology.csproj The dll has legend control itself and dialogs to set properties for shapefile layers. You can check how it works by running the demo app itself. Don't hesitate to ask questions if you experience problems with migrating to new version.

Marked as answer by pmeems on 1/2/2015 at 10:34 AM
May 13, 2015 at 3:01 PM
Can u please give me a sample using the legend offered in MWLile.Symbology.dll?
I try to use it, but there are problems in setting layer visible or not.
My Question is how to link the legend control with the map (axMap)? I use MapWinGIS

Thank you.
May 13, 2015 at 5:15 PM
Please show what you have already tried and give some specifics about the problem. MWLite is a sample project in itself, so it should give enough clues on how to use legend. But let's hear the details of you problem.

May 13, 2015 at 5:30 PM
Edited May 13, 2015 at 5:31 PM
Thanks for replay.

My problem is as following:
when i connect the legend control to the map, to manage map layers, the layers are shown correctly; but when i click on the check-box next to the layer name to hide it, the layer remains visible even if the check-box is unchecked.

I use the following code to setup the legend control:
       Legend.Map = Map.GetOcx() as Map;
which is used in the demo through the InitLegend() method.

Is this enough? Or something is missing?

In the demo code, the event LayerCheckboxClicked is not implemented directly, or it is implemented in some way. How can I benefit from the same way used in the demo application?

Thank you very much.
May 13, 2015 at 5:50 PM
It's strange. The visibility of layer is changed directly by legend control in HandleLeftMouseDown function. It calls Map.set_LayerVisible which will automatically trigger map redraw. I don't see what can go wrong here. Perhaps make sure that you add layer with Legend.Layers.Add and not Map.AddLayer. Try to handle LayerCheckboxClicked event and call Map.get_LayerVisible/set_LayerVisible/Map.Redraw and see if it works for you. Make sure that map isn't locked (Map.IsLocked). Don't know what else to suggest.
May 13, 2015 at 7:05 PM
My fault is that I add layers directly using Map.AddLayer.
The use of Legend.Layers.Add solve the problem.
Thank you very much.
One last thing to suggest: a simple tutorial to use the legend control is very helpful, e.g a getting started page on using the legend. this is because usually a map is used together with the legend, and the offered legend (with functionnalities of symbology and labeling) are essential in any mapping application that use the MapWinGIS ocx control.

Two questions about the OCX control and the DotSpatial library:
1-What is the future of the ocx control? It will remain supported as an activeX control or the .Net library DotSpatial must take its place?
2-Why the performance of DotSpatial is worse than that of the OCX? There are many bugs exist in DotSpatial too. When expected that DotSpatial can take effectively the place of the activeX control (features, stability, performance)?

Thank you Mr. Sergei
May 13, 2015 at 9:28 PM
There aren't much questions about Legend control, so I guess this thread will be enough for now.

As for the general questions. MapWinGIS and DotSpatial are completely separate projects with different developers involved. So I can't say anything on behalf of DotSpatial team. As for MapWinGIS, now an active work is going on to create a new version of MapWindow C# app based on the latest version of MapWinGIS. This will also introduce new functionality to MapWinGIS control.

The performance difference is easy to explain - MapWinGIS is written in native C++ and DotSpatial uses .NET. One of the few disadvantages of .NET is slower performance for low level processing of large chunks of data. It can be alleviated to some extent by asynchronous programming and multithreading, but still it's hard to compete with native C++. On the other hand C++ is much more difficult and it usually takes at least three times longer to write the same functionality compared with .NET.

Hope this has cleared things a bit.