private PolyBezierLayer(VisualParameters parameters)
        {
            this.LayerId = Guid.NewGuid();

            this.VisibleRange = ScaleInterval.All;

            //this.VisualParameters = new VisualParameters(Colors.Black, Colors.Gray, 2, .9);
            this.VisualParameters = parameters ?? VisualParameters.CreateNew(1);
        }
        public BaseLayer()
        {
            this.LayerId = Guid.NewGuid();

            this.VisibleRange = ScaleInterval.All;

            this.VisualParameters = VisualParameters.CreateNew(1);

            this.ParentLayerId = Guid.Empty;
        }
Exemple #3
0
        internal DrawingItemLayer(
            string title,
            Geometry geometry,
            VisualParameters visualParameters = null,
            int id = int.MinValue,
            FeatureDataSource source = null)
        {
            this.Extent = geometry.GetBoundingBox();

            this.VisualParameters = visualParameters ?? VisualParameters.GetDefaultForDrawingItems();

            //this.VisualParameters.OnVisibilityChanged += (sender, e) => { this.RequestChangeVisibility?.Invoke(this); };

            HighlightGeometryKey = Guid.NewGuid();

            //this.OriginalSymbology = VisualParameters.Clone();

            var featureType =
                (geometry.Type == GeometryType.Point || geometry.Type == GeometryType.MultiPoint) ? LayerType.Point :
                ((geometry.Type == GeometryType.LineString || geometry.Type == GeometryType.MultiLineString) ? LayerType.Polyline :
                 (geometry.Type == GeometryType.Polygon || geometry.Type == GeometryType.MultiPolygon) ? LayerType.Polygon : LayerType.None);

            this.Type = LayerType.Drawing | featureType;

            this.Rendering = RenderingApproach.Default;

            this.ToRasterTechnique = RasterizationApproach.GdiPlus;

            this.Id = id;

            this.OriginalSource = source;

            this.ZIndex = int.MaxValue;

            //this.DataSource = new MemoryDataSource(new List<SqlGeometry>() { geometry.AsSqlGeometry() });

            //this.Title = title;

            this.LayerName = title;

            this.Geometry = geometry;

            this.Commands = new List <ILegendCommand>();

            this.OnIsSelectedInTocChanged += (sender, e) =>
            {
                this.RequestHighlightGeometry?.Invoke(this);
            };

            this.OnVisibilityChanged += (sender, e) =>
            {
                this.RequestChangeVisibility?.Invoke(this);
            };
        }
        //FeatureType _featureType;
        //private string layerName_2;
        //private CartographyParameters parameters;
        //private LayerType layerType;

        //private FeatureType featureType;

        public MapLegendItem(string layerName, IRI.Jab.Common.VisualParameters parameters, LayerType type)
        {
            InitializeComponent();

            //this._featureType = featureType;
            //this.isFeatureType = false;

            this.type = type;

            Initialize(layerName, parameters);
        }
Exemple #5
0
 public static VisualParameters GetDefaultForMeasurements()
 {
     return(new VisualParameters(
                BrushHelper.CreateBrush(ColorHelper.ToWpfColor("#FBB03B"), 0.3),
                BrushHelper.CreateBrush("#FBB03B"),
                3,
                1,
                System.Windows.Visibility.Visible)
     {
         DashStyle = VisualParameters.GetDefaultDashStyleForMeasurements()
     });
 }
        /// <summary>
        /// In case of PolyBezierMode, control points must be included
        /// </summary>
        /// <param name="pointCollection"></param>
        /// <param name="extent"></param>
        /// <param name="polyBezierMode"></param>
        public SpecialLineLayer(System.Windows.Media.Geometry symbol, VisualParameters parameters, List <Point> pointCollection, bool canEdit = true, bool polyBezierMode = true)
        {
            if (!polyBezierMode)
            {
                throw new NotImplementedException();
            }

            this.VisualParameters = parameters ?? VisualParameters.CreateNew(1);

            this.ZIndex = int.MaxValue;

            Update(symbol, pointCollection, canEdit, polyBezierMode);
        }
Exemple #7
0
        public static VisualParameters GetDefaultForHighlight(ISqlGeometryAware sqlGeometryAware)
        {
            VisualParameters result;

            if (sqlGeometryAware?.TheSqlGeometry?.IsPointOrMultiPoint() == true)
            {
                result = new VisualParameters(DefaultHighlightStroke, DefaultHighlightFill, 2, .8)
                {
                    PointSymbol = new Model.Symbology.SimplePointSymbol(10)
                };
            }
            else
            {
                result = GetDefaultForHighlight();
            }

            return(result);
        }
        //public MapLegendItem(string layerName, CartographyParameters parameters, FeatureType featureType)
        //{
        //    InitializeComponent();

        //    this.type = LayerType.Feature;

        //    this.featureType = featureType;

        //    this.isFeatureType = true;

        //    Initialize(layerName, parameters);
        //}

        private void Initialize(string layerName, IRI.Jab.Common.VisualParameters parameters)
        {
            this.layerName.Text = layerName;

            this.layerName.ToolTip = layerName;

            this.layerOpacity.Value = parameters.Opacity;

            this.layerVisibility.IsChecked = parameters.Visibility == System.Windows.Visibility.Visible;

            if (this.type != LayerType.Feature)
            {
                this.layerSymbol.Child = new Rectangle()
                {
                    HorizontalAlignment = System.Windows.HorizontalAlignment.Center,
                    VerticalAlignment   = System.Windows.VerticalAlignment.Center,
                    Stroke          = parameters.Stroke,
                    StrokeThickness = 1.0,
                    Fill            = new SolidColorBrush(Colors.LightBlue),
                    Width           = 5,
                    Height          = 5
                };

                return;
            }

            Shape featuer;

            //this.type = featureType;

            if (this.type == LayerType.Polyline)
            {
                featuer = new Line()
                {
                    StrokeThickness = 3,
                    X1 = 0,
                    Y1 = 10,
                    X2 = 10,
                    Y2 = 10,
                    //Stretch = Stretch.Fill,
                    Stroke = parameters.Stroke,
                    //Fill = parameters.FillBrush,
                    HorizontalAlignment = System.Windows.HorizontalAlignment.Center,
                    VerticalAlignment   = System.Windows.VerticalAlignment.Center
                };
            }
            else if (this.type == LayerType.Point)
            {
                featuer = new Rectangle()
                {
                    HorizontalAlignment = System.Windows.HorizontalAlignment.Center,
                    VerticalAlignment   = System.Windows.VerticalAlignment.Center,
                    Stroke          = parameters.Stroke,
                    StrokeThickness = 1.0,
                    Fill            = parameters.Fill,
                    Width           = 5,
                    Height          = 5
                };
            }
            else if (this.type == LayerType.Polygon)
            {
                featuer = new Path()
                {
                    Data = Geometry.Parse("F1 M 0.499,10.500L 9.769,10.500L 6.342,6.005L 9.825,1.230L 4.264,0.499L 0.837,4.938L 0.499,10.500 Z"),
                    HorizontalAlignment = System.Windows.HorizontalAlignment.Center,
                    VerticalAlignment   = System.Windows.VerticalAlignment.Center,
                    Stroke          = parameters.Stroke,
                    StrokeThickness = parameters.StrokeThickness,
                    Fill            = parameters.Fill,
                    Width           = 15,
                    //Height = 15
                };
            }
            else
            {
                throw new NotImplementedException();
            }

            this.layerSymbol.Child = featuer;
        }
        public static PolyBezierLayer Create(string name, List <Point> mercatorPolyBezierPoints, Transform toScreen, System.Windows.Media.Geometry decoration, VisualParameters parameters)
        {
            if (mercatorPolyBezierPoints?.Count() < 2)
            {
                throw new NotImplementedException();
            }

            if ((mercatorPolyBezierPoints.Count - 1) % 3 != 0)
            {
                throw new NotImplementedException();
            }

            PolyBezierLayer result = new PolyBezierLayer(parameters);

            result.LayerName = name;

            result._toScreen = toScreen;

            result.mercatorPolyline = new List <Point>();

            //this.mercatorPolyline = mercatorPolyline;

            result._decorateLayer = new SpecialLineLayer(decoration, parameters, null);

            result.mercatorPolyline.Add(mercatorPolyBezierPoints.First());

            var numberOfSegments = (mercatorPolyBezierPoints.Count - 1) / 3;

            for (int i = 0; i < numberOfSegments; i++)
            {
                result.mercatorPolyline.Add(mercatorPolyBezierPoints[i * 3 + 3]);
            }

            result.Initialize();

            for (int i = 0; i < numberOfSegments; i++)
            {
                result._controlLocateables[2 * i].X = mercatorPolyBezierPoints[i * 3 + 1].X;
                result._controlLocateables[2 * i].Y = mercatorPolyBezierPoints[i * 3 + 1].Y;

                result._controlLocateables[2 * i + 1].X = mercatorPolyBezierPoints[i * 3 + 2].X;
                result._controlLocateables[2 * i + 1].Y = mercatorPolyBezierPoints[i * 3 + 2].Y;
            }

            return(result);
        }
        public PolyBezierLayer(List <Point> mercatorPolyline, Transform toScreen, System.Windows.Media.Geometry decoration, VisualParameters parameters) : this(parameters)
        {
            this._toScreen = toScreen;

            if (mercatorPolyline?.Count() < 2)
            {
                throw new NotImplementedException();
            }

            this.mercatorPolyline = mercatorPolyline;

            this._decorateLayer = new SpecialLineLayer(decoration, parameters, null);

            Initialize();
        }
Exemple #11
0
        public static VisualParameters GetDefaultForDrawing(DrawMode mode)
        {
            var result = new VisualParameters(mode == DrawMode.Polygon ? DefaultDrawingFill : null, DefaultDrawingStroke, 2, .7);

            return(result);
        }