How to handle DynamicViscosity

Nov 22, 2010 at 5:04 PM


There is already one discussion about DynamicViscosity but no solution for it. I have organized layers into groups and when try to set DynamicViscosity via gui program
stopped in method of Layer class (DynamicVisibilityWidth = MapFrame.Extents.Width;).

How to solve this problem?

Thanks for help, Vojko

Nov 22, 2010 at 5:21 PM

It's a little hard to tell from this what the problem might be, or whether this is a bug or if there is something you are doing that might cause an unexpected behavior.  Dynamic visibility was working for layers the last time I tested them, but I am bad about remembering to test layers when they are inside groups so I might have missed something, or maybe a recent change has introduced a new bug.  Can you please post this as an issue in the issue tracker along with as much information that you can, like the stack trace, and the steps to reproduce the bug.  That way I, or one of the other developers working on DotSpatial can probably fix the issue very quickly when we have time.  We have a lot on our plate and the issue list is long, so don't be discouraged if your issue doesn't get solved instantly, and don't be afraid to step into the source and see if you can fix it yourself.  We encourage community participation, especially for quick-fix bugs.  Thanks a bunch for getting involved.


Nov 22, 2010 at 6:46 PM

Hi Ted

I see that there is already a bug reported on Sep 14 under Work Item Details Item # 52.

Thanks for hearing me, Vojko

Nov 22, 2010 at 6:56 PM

Ok that's great.  Yes we had a sudden infusion of bug reports from Hydrodesktop in September, but we have been in the middle of a lot of major refactoring changes, so I haven't had time to work my way down that entire list yet.  One step at a time =).



Nov 23, 2010 at 2:32 PM

Hi Ted!

I am sending you my code which I use for programmatically adding groups and layers.

1. When save this content to the map file with Save MAP and reopen it with Open MAP it shows all the content OK.
2. When define the dynamic visibility (Layer.cs:  MapFrame.Extents.Width) program stopped
3. When select Selection from menu and Select by Attributes option which opens Select By Attributes window. There is Layer list box empty and also Field Names are empty.
4. When open the Attribute table Editor window sometimes there are data records with strange content, but if  open layer with command FillAttributes data are OK.
5. I just downloaded MW6 application ( Jun 15) and set new group in the legend with your application, then added data and move this feature layer to new group.
Follow with Save map and reopen with Open Map. And now tried to set dynamic visibility for the layer and program stopped as in my own case with programmatically
added groups and layers.

I will be very happy if you have time to give me some directions how to programmatically load groups and layers in correct way.

Best regards, Vojko


I changed the method    "public virtual List<IMapLayer> AddLayers()" in Map.cs  with my code to add new group with name "GROUP 1" and new layer to this group:

        public virtual List<IMapLayer> AddLayers()

            List<IDataSet> sets = DataManager.DefaultDataManager.OpenFiles();
            if (sets == null || sets.Count == 0) return null;
            List<IMapLayer> results = new List<IMapLayer>();
            foreach (IDataSet set in sets)
                if (set == null) return null;
                IFeatureSet fs = set as IFeatureSet;
                if (fs != null)
  // is this "GROUP 1" group already in legend or not?

                        foreach (ILayer layer in Layers)
                            IGroup grp = layer as IGroup;
                            if (grp != null)

                                if (grp.LegendText == "GROUP 1")
                      mgrp.LegendText = "GROUP 1";                

   // overlap or not other layers
   ins = 1;

                Layers.Insert(ins, mgrp);
   // or only add on the top of other layers


 // adding my new line layer to this group




        return results;