Пример #1
0
        /// <summary>
        /// Adds a point.
        /// </summary>
        /// <param name="layerKey"></param>
        /// <param name="longitude"></param>
        /// <param name="latitude"></param>
        /// <param name="caption"></param>
        /// <param name="font"></param>
        /// <param name="markShape"></param>
        /// <param name="size"></param>
        /// <param name="stroke"></param>
        /// <param name="fill"></param>
        public void DrawPoint(string layerKey,
                              double longitude, double latitude,
                              string caption, System.Drawing.Font font, System.Drawing.Color textColor,
                              MarkerShape markShape, double size, System.Drawing.Color stroke, System.Drawing.Color fill)
        {
#if !DYN
            var mark = new C1.WPF.Maps.C1VectorPlacemark();
            mark.Lod = new C1.WPF.Maps.LOD(1, 300, 0, 10); // tbd: allow to control this
#else
            dynamic mark = DynLoader.CreateC1MapsInstance("C1VectorPlacemark");
            mark.Lod = DynLoader.CreateC1MapsInstance("C1.WPF.Maps.LOD", 1, 300, 0, 10);
#endif
            mark.GeoPoint = new Point(longitude, latitude);

            if (!string.IsNullOrEmpty(caption))
            {
                mark.Label = caption;
                Util.ApplyFontToControl(font, mark);
                if (!Util.IsColorEmpty(textColor))
                {
                    mark.Foreground = Util.BrushFromGdiColor(textColor);
                }
                // mark.LabelPosition = WPF.Maps.LabelPosition.Right | WPF.Maps.LabelPosition.Bottom;
                // mark.Background = new SolidColorBrush(Colors.Red);
                // TBD: label:
                // - setting mark.LabelPosition makes the label tiny. clarify.
            }

            mark.Geometry = Util.MarkerShapeToGeometry(markShape, size);
            mark.Stroke   = Util.BrushFromGdiColor(stroke);
            mark.Fill     = Util.BrushFromGdiColor(fill);

            PointsMapsLayer ml = _layers.Find((l) => l.MapLayer.Key == layerKey) as PointsMapsLayer;
            System.Diagnostics.Debug.Assert(ml != null);
            ml.AddMark(mark);
        }
Пример #2
0
 public void AddMark(C1.WPF.Maps.C1VectorPlacemark mark)