This project is read-only.

MapLabelLayer in DotSpatial v1.4

Jan 27, 2013 at 9:23 PM

I have problem migrating to DotSpatial v1.4 - I have a project working fine in DotSpatial v1.3, but after migrating, it crashes.

It looks that there is a problem with the MapLabelLayer - I know that because after removing it, it looks like it works.

I create my layer like this:

        protected MapLabelLayer getLabelLayer(MapPointLayer originalLayer, string labelColumnName)
        {
            MapLabelLayer _labelLayer = new MapLabelLayer(originalLayer.DataSet) { Projection = originalLayer.Projection };
            _labelLayer.Symbology.Categories.Clear();
            _labelLayer.Symbology.Categories.Add(
                new LabelCategory()
                {
                    Expression = string.Format("[{0}]", labelColumnName),
                    Symbolizer = new LabelSymbolizer()
                    {
                        FontFamily = "Tahoma",
                        FontColor = Color.Black,
                        FontSize = 10,
                        BackColor = Color.White,
                        BackColorEnabled = true,
                        BackColorOpacity = 0.5f,
                        Orientation = ContentAlignment.MiddleRight,
                        PartsLabelingMethod = PartLabelingMethod.LabelAllParts,
                        OffsetX = 5
                    },
                    Name = originalLayer.Name + " Labels"
                }
            );

            _labelLayer.CreateLabels();
            return _labelLayer;
        }

My program crashes if I try to do something like:

        uxMap.ViewExtents.SetCenter(m.OwnVehicle.Lontitude, m.OwnVehicle.Lattitude, uxMap.ViewExtents.Width, uxMap.ViewExtents.Height);

After crashing for the first time, then it starts crashing whenever it comes to this line:

                uxMap.MapFrame.ResetBuffer();

Anyone has similar problems?

 

Thanks,
George J.