public LabelParameters(ScaleInterval visibleRange, int fontSize, Brush foreground, FontFamily fontFamily, Func <SqlGeometry, SqlGeometry> positionFunc)
        {
            this.VisibleRange = visibleRange;

            this.FontSize = fontSize;

            this.Foreground = foreground ?? Brushes.Black;

            this.FontFamily = fontFamily;

            this.PositionFunc = positionFunc;
        }
Exemple #2
0
        public override bool Equals(object obj)
        {
            if (obj is double)
            {
                return(((double)obj) > Lower && ((double)obj) < Upper);
            }

            else if (obj is ScaleInterval)
            {
                ScaleInterval temp = obj as ScaleInterval;

                return(temp.Lower.Equals(this.Lower) && temp.Upper.Equals(this.Upper));
            }

            return(false);
        }
Exemple #3
0
        private void Initialize(string layerName, SqlFeatureDataSource dataSource, RenderingApproach rendering,
                                RasterizationApproach toRasterTechnique, ScaleInterval visibleRange, Func <SqlFeature, VisualParameters> symbologyRule)
        {
            this.LayerId = Guid.NewGuid();

            this.DataSource = dataSource;

            this.Rendering = rendering;

            this.ToRasterTechnique = toRasterTechnique;

            var geometries = dataSource.GetGeometries();

            this.Type = LayerType.Feature | LayerType.FeatureLayer;

            //if (geometries?.Count > 0)
            //{
            //    this.Type = type | GetGeometryType(geometries.FirstOrDefault(g => g != null));
            //}
            //else
            //{
            //    this.Type = type;
            //}

            this.Extent = DataSource?.GetGeometries()?.GetBoundingBox() ?? sb.BoundingBox.NaN;

            this.LayerName = layerName;

            this.VisualParameters = new VisualParameters(null, null, 0, 1, Visibility.Visible);

            this.SymbologyRule = symbologyRule;

            //this.PointSymbol = pointSymbol ?? new SimplePointSymbol() { SymbolWidth = 4, SymbolHeight = 4 };

            //this.Labels = labeling;

            ////Check for missing visibleRange
            //if (this.Labels != null)
            //{
            //    if (this.Labels.VisibleRange == null)
            //    {
            //        this.Labels.VisibleRange = visibleRange;
            //    }
            //}

            this.VisibleRange = (visibleRange == null) ? ScaleInterval.All : visibleRange;
        }
        public RasterLayer(IDataSource dataSource, string layerName, ScaleInterval visibleRange, bool isBaseMap, bool isPyramid, Visibility visibility, double opacity, RenderingApproach rendering = RenderingApproach.Default)
        {
            this.LayerId = Guid.NewGuid();

            this._type = isBaseMap ? LayerType.BaseMap : (isPyramid ? LayerType.ImagePyramid : LayerType.Raster);

            this.DataSource = dataSource;

            if (!BoundingBox.IsNaN(dataSource.Extent))
            {
                this._extent = dataSource.Extent;
            }

            //AddTiled method is not supported for raster layers and image pyramid
            //this.Rendering = rendering;

            this.LayerName = layerName;

            this.VisibleRange = visibleRange;

            //this.VisualParameters = new VisualParameters(null, isBaseMap ? null : Brushes.Black, isBaseMap ? 0 : 1, opacity);
            this.VisualParameters = new VisualParameters(null, null, 0, opacity, visibility);
        }
Exemple #5
0
        public SpecialPointLayer(string name, IEnumerable <Locateable> items, double opacity = 1, ScaleInterval visibleRange = null, LayerType type = LayerType.Complex)
        {
            this.LayerId = Guid.NewGuid();

            this.Type = type;

            this.LayerName = name;

            this.ZIndex = int.MaxValue;

            this.Items = new ObservableCollection <Locateable>();

            this.Items.CollectionChanged -= Items_CollectionChanged;
            this.Items.CollectionChanged += Items_CollectionChanged;

            if (visibleRange == null)
            {
                VisibleRange = ScaleInterval.All;
            }
            else
            {
                VisibleRange = visibleRange;
            }

            this.VisualParameters = new VisualParameters(null, null, 0, opacity, System.Windows.Visibility.Visible);

            if (items == null)
            {
                return;
            }

            foreach (var item in items)
            {
                this.Items.Add(item);
            }
        }
Exemple #6
0
        //public int ZIndex { get; set; }

        //private FrameworkElement visualElement;

        //public FrameworkElement Element
        //{
        //    get { return this.visualElement; }

        //    set
        //    {
        //        this.visualElement = value;

        //        BindWithFrameworkElement(value);

        //        OnPropertyChanged("Element");
        //    }
        //}

        //public bool IsLabeled(double mapScale)
        //{
        //    return this.Labels != null && this.Labels.IsLabeled(1.0 / mapScale);
        //}

        //private LabelParameters _labels;

        //public LabelParameters Labels
        //{
        //    get { return _labels; }
        //    set
        //    {
        //        _labels = value;
        //        OnPropertyChanged("Labels");
        //    }
        //}

        //public Func<SqlGeometry, SqlGeometry> PositionFunc { get; set; }

        //private VisualParameters _visualParameters;

        //public VisualParameters VisualParameters
        //{
        //    get { return _visualParameters; }
        //    set
        //    {
        //        _visualParameters = value;
        //        OnPropertyChanged("VisualParameters");
        //    }
        //}

        //private Geometry _pointSymbol;

        //public Geometry PointSymbol
        //{
        //    get { return _pointSymbol; }
        //    set
        //    {
        //        _pointSymbol = value;
        //        OnPropertyChanged("PointSymbol");
        //    }
        //}

        //private ImageSource _imageSymbol;

        //public ImageSource ImageSymbol
        //{
        //    get { return _imageSymbol; }
        //    set
        //    {
        //        _imageSymbol = value;
        //        OnPropertyChanged("Symbol");
        //    }
        //}

        public SpecialPointLayer(string name, Locateable item, double opacity = 1, ScaleInterval visibleRange = null, LayerType type = LayerType.Complex)
            : this(name, new List <Locateable>() { item }, opacity, visibleRange, type)
        {
        }
Exemple #7
0
 public FeatureLayer(string layerName, SqlFeatureDataSource dataSource, RenderingApproach rendering,
                     RasterizationApproach toRasterTechnique, Func <SqlFeature, VisualParameters> symbologyRule, ScaleInterval visibleRange)
 {
     Initialize(layerName, dataSource, rendering, toRasterTechnique, visibleRange, symbologyRule);
 }
Exemple #8
0
        public FeatureLayer(string name, List <SqlFeature> features, Func <SqlFeature, VisualParameters> symbologyRule,
                            RenderingApproach rendering, RasterizationApproach toRasterTechnique, ScaleInterval visibleRange)
        {
            if (features == null || features.Count == 0)
            {
                throw new NotImplementedException();
            }

            Initialize(name, new SqlFeatureDataSource(features), rendering, toRasterTechnique, visibleRange, symbologyRule);
        }
 public LabelParameters(ScaleInterval visibleRange, int fontSize, Color foreground, FontFamily fontFamily, Func <SqlGeometry, SqlGeometry> positionFunc)
     : this(visibleRange, fontSize, new SolidColorBrush(foreground), fontFamily, positionFunc)
 {
 }