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); }
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 IEnumerable <ILayer> UpdateAndGetLayers(double inverseMapScale, RenderingApproach rendering) { Debug.WriteLine($"LayerManager; {DateTime.Now.ToLongTimeString()}; UpdateAndGetLayers called"); ArrangeZIndex(); var newLayers = allLayers.Where(l => l.VisibleRange.IsInRange(inverseMapScale) && l.Rendering == rendering) .OrderByDescending(i => i.Type == LayerType.BaseMap) //.ThenByDescending(i => i.Type == LayerType.Raster) //.ThenByDescending(i => i.Type == LayerType.ImagePyramid) //.ThenByDescending(i => i.Type == LayerType.VectorLayer) //.ThenByDescending(i => i.Type == LayerType.FeatureLayer) //.ThenByDescending(i => i.Type == LayerType.Selection) .ThenBy(i => i.Type == LayerType.RightClickOption) .ThenBy(i => i.Type == LayerType.MoveableItem) .ThenBy(i => i.Type == LayerType.EditableItem) .ThenBy(i => i.Type == LayerType.Complex) .ThenBy(i => i.Type == LayerType.Drawing) .ThenBy(i => i.ZIndex); //if (rendering == RenderingApproach.Default) //{ // System.Diagnostics.Debug.WriteLine($"UpdateAndGetLayers layercounts:{ newLayers.Count()}"); //} var toBeRemovedLayers = this.CurrentLayers.Where(i => i.Rendering == rendering && newLayers.All(l => l.LayerId != i.LayerId)).ToList(); for (int i = 0; i < toBeRemovedLayers.Count; i++) { this.CurrentLayers.Remove(toBeRemovedLayers[i]); } var toBeAdded = newLayers.Where(i => i.Rendering == rendering && this.CurrentLayers.All(l => l.LayerId != i.LayerId)).ToList(); for (int i = 0; i < toBeAdded.Count; i++) { this.CurrentLayers.Add(toBeAdded[i]); } Debug.WriteLine($"LayerManager; {DateTime.Now.ToLongTimeString()}; UpdateAndGetLayers finished"); return(newLayers); }
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); }
public RasterLayer(RasterLayer parent, string name, BitmapImage image, double opacity, BoundingBox boundingBox, bool isBaseMap, bool isPyramid = false, RenderingApproach rendering = RenderingApproach.Default) { this.LayerId = Guid.NewGuid(); this._parent = parent; this._type = isBaseMap ? LayerType.BaseMap : (isPyramid ? LayerType.ImagePyramid : LayerType.Raster); this.Rendering = rendering; this.LayerName = name; this._extent = boundingBox; this.Image = image; //this.VisualParameters = new VisualParameters(new ImageBrush(image), isBaseMap ? null : Brushes.Black, isBaseMap ? 0 : 1, opacity); }
private void Initialize(string layerName, IFeatureDataSource dataSource, VisualParameters parameters, LayerType type, RenderingApproach rendering, RasterizationApproach toRasterTechnique, ScaleInterval visibleRange, SimplePointSymbol pointSymbol, LabelParameters labeling) { this.Id = Guid.NewGuid(); this.DataSource = dataSource; this.Rendering = rendering; this.ToRasterTechnique = toRasterTechnique; var geometries = dataSource.GetGeometries(); if (geometries.Count > 0) { this.Type = type | GetGeometryType(geometries.FirstOrDefault()); } else { this.Type = type; } this.Extent = geometries.GetBoundingBox(); this.LayerName = layerName; this.VisualParameters = parameters; this.PointSymbol = pointSymbol ?? new SimplePointSymbol() { SymbolWidth = 4, SymbolHeight = 4 }; //this.PositionFunc = positionFunc; 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 VectorLayer(string layerName, IFeatureDataSource dataSource, VisualParameters parameters, LayerType type, RenderingApproach rendering, RasterizationApproach toRasterTechnique, ScaleInterval visibleRange, SimplePointSymbol pointSymbol = null, LabelParameters labeling = null) { Initialize(layerName, dataSource, parameters, type, rendering, toRasterTechnique, visibleRange, pointSymbol, labeling); }
public VectorLayer(string layerName, List <SqlGeometry> features, VisualParameters parameters, LayerType type, RenderingApproach rendering, RasterizationApproach toRasterTechnique) { if (features == null || features.Count == 0) { throw new NotImplementedException(); } Initialize(layerName, new MemoryDataSource <object>(features), parameters, type, rendering, toRasterTechnique, ScaleInterval.All, null, null); }
public VectorLayer(string name, List <SqlGeometry> features, LayerType type, RenderingApproach rendering, RasterizationApproach toRasterTechnique) : this(name, features, new VisualParameters(BrushHelper.PickBrush(), BrushHelper.PickBrush(), 1, 1, Visibility.Visible), type, rendering, toRasterTechnique) { }
public FeatureLayer(string layerName, SqlFeatureDataSource dataSource, RenderingApproach rendering, RasterizationApproach toRasterTechnique, Func <SqlFeature, VisualParameters> symbologyRule, ScaleInterval visibleRange) { Initialize(layerName, dataSource, rendering, toRasterTechnique, visibleRange, symbologyRule); }
public RasterLayer(IDataSource dataSource, string layerName, ScaleInterval visibleRange, bool isBaseMap, bool isPyramid, Visibility visibility, double opacity, RenderingApproach rendering = RenderingApproach.Default) { this.Id = Guid.NewGuid(); this._type = isBaseMap ? LayerType.BaseMap : (isPyramid ? LayerType.ImagePyramid : LayerType.Raster); this.DataSource = dataSource; 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); }