Hi,
I’ve just ‘upgraded’ from V4.8 to V4.9.6.1.
Am I right in understanding that there is no Legend object in MapWinGIS versions over 4.8 anymore?
I assume I’m not the only person that needs a legend on maps. Has anyone suggestions (apart from ‘write your own legend’) how to get a legend on a map again? Anybody out there willing to share their hard-earned legend code?
Hello @pan054
There have been a couple recent questions regarding a Legend. Any build-in Legend predates my time on this project. Paul (@pmeems) answered a similar question here, perhaps he knows the history behind it’s removal?
Regards,
Jerry.
Hi Jerry,
Thanks for your reply. Yes, I hope Paul could give ussome pointer re the legend. I understand the intricacies of open source and volunteer-based SW development and I’m very grateful for the use of MWG, but is definitely less attractive without any legend.
I’ve used MWG 4.8 for many years but like to upgrade to better use projections and grids. I tried to just stlip in the old MapWinInterfaces.dll that contains a legend object, but it does fall over during runtime.
Cheers
Francis
We never had a legend control in MapWinGIS. We did have a legend in MapWinInterfaces.dll
but in the earlier versions of v4.9 lot of changes have been made to the displaying of the data. Gradients were added, also charts and another way of adding labels.
Because of these changes the MapWinInterfaces.dll
needed to be completely rebuild. We decided to not do that but instead add the legend control directly to MapWinGIS. But first we worked on MapWindow-v5 (MW5) which would use the new MapWinGIS-v4.9+.
Due to lack of time and interests of the former developers this was never implemented.
In MW5 we do have an extensive legend (written in C#) which you can use to create your own.
The best solution would be to get a C++ developer enthusiastic enough to rebuild the legend in MapWinGIS. Then everybody could use it.
Another solution for you migration could be to not write your own application with MapWinGIS as your mapping control, but use MW5 and write a plugin. Then you would have access to all the benefits of MW5 without the need to write them yourself.
Hi Paul (hoe gaat het),
I’ve started a trial of MWG 5 but got already pretty much lost at trying to set references and get the map control into the toolbox after installing MapWinGIS-only-v5.1.1.1-Win32-VS2017.exe. Could you please point me at some MWG5 installation documentation for VS (I’m using 2019).
Cheers
Francis
Great, I got MWG5 on the go in VS2019 and it is a great development, but the absence of a legend control is still the main stumbling block, and I guess it will be for many ‘historic’ users needing or wanting to upgrade. Rewriting C++ code of the mapwininterfaces.dll seems to be a retrograde step and is way outside my level of expertise.
I can’t use Paul’s suggestion to use MW app as the spatial component is part of a much bigger application. Also can’t really use the older versions of MWG4.xx because I have to be able to load .asc files into grid layers, so I’m not too sure where to go next.
I got a very basic Syncfusion TreeViewAdv-based legend rigged up. Not very flash and no symbology, but at least I can see which layers there are on the map and switch the layer visibility on or off. All written in VB.Net.
I’m glad you got something working. It know it is not trivial, and can take some time. I created one for a customer using a Checkbox Treeview control (in VB .NET), part of which is shown below:
- I kept the checkboxes at the top-level only (for layer visibility), and used a Windows API call to hide the checkboxes on the sub-items.
- The control accepts images, and for polygons, I created small rectangular bitmaps with the appropriate border and fill colors.
- And I added context menus to change rendering on-the-fly, such as label sizes, or the color scheme.
Of course, most of it is proprietary, so I can’t share the source, but I thought I would share the concepts, and that it can be done using stock .NET components.
Regards,
Jerry.
Hi Jerry,
Your legend is definitely more visually appealing! I found that getting rid of 2nd order node checkboxes was very fiddly using the MS Treeview so I used the Syncfusion TreeViewAdv. Thank you vm for sharing your layout!
I’m really struggling with the Categories concept and implementation and stayed with V4.8 to prevent having to rewrite a fair bit of code just to accommodate them (and the loss of the legend of course). I just submitted a (maybe too long Single-shape categories) message asking for some help, as the Shapefile.set_ShapeCategory() function does not exist according to my AxMap 5.2.4 object. If you would have a moment…
Cheers
Francis
Hello Francis.
In response to your comment about ShapeCategory, note that from c++ and c#, many properties require the get_ and set_ prefix, but from VB, you can just specify ShapeCategory(shapeIndex)
.
Regards,
Jerry.