/// <summary> /// Given a size, this will return the native symbolizer that has been adjusted to the specified size. /// </summary> /// <param name="size">The size of the symbol</param> /// <param name="color">The color of the symbol</param> /// <returns>The adjusted symbolizer.</returns> public IFeatureSymbolizer GetSymbolizer(double size, Color color) { IFeatureSymbolizer copy = Symbolizer.Copy(); // preserve aspect ratio, larger dimension specified IPointSymbolizer ps = copy as IPointSymbolizer; if (ps != null) { Size2D s = ps.GetSize(); double ratio = size / Math.Max(s.Width, s.Height); s.Width *= ratio; s.Height *= ratio; ps.SetSize(s); ps.SetFillColor(color); } ILineSymbolizer ls = copy as ILineSymbolizer; if (ls != null) { ls.SetWidth(size); ls.SetFillColor(color); } return(copy); }
/// <summary> /// Initializes this point size range control /// </summary> /// <param name="args"></param> public void Initialize(SizeRangeEventArgs args) { if (_sizeRange == null) { return; } _sizeRange.Start = args.StartSize; _sizeRange.End = args.EndSize; _sizeRange.Symbolizer = args.Template; _sizeRange.UseSizeRange = args.UseSizeRange; IPointSymbolizer ps = args.Template as IPointSymbolizer; if (ps != null) { psvStart.Visible = true; psvEnd.Visible = true; lsvStart.Visible = false; lsvEnd.Visible = false; } ILineSymbolizer ls = args.Template as ILineSymbolizer; if (ls != null) { lsvStart.Visible = true; lsvEnd.Visible = true; psvStart.Visible = false; psvEnd.Visible = false; } }
/// <summary> /// Draws the path that results from the given indices. /// </summary> /// <typeparam name="T">Type of the elements in the list.</typeparam> /// <param name="g">Graphics object used for drawing.</param> /// <param name="ls">LineSymbolizer used for drawing.</param> /// <param name="e">MapArgs needed for computation.</param> /// <param name="action">Action that is used to add the elements to the graphics path that gets drawn.</param> /// <param name="list">List that contains the elements that get drawn.</param> private void DrawPath <T>(Graphics g, ILineSymbolizer ls, MapArgs e, Action <GraphicsPath, Rectangle, IEnumerable <T> > action, IEnumerable <T> list) { g.SmoothingMode = ls.GetSmoothingMode(); Rectangle clipRect = ComputeClippingRectangle(e, ls); // Determine the subset of the specified features that are visible and match the category using (GraphicsPath graphPath = new GraphicsPath()) { action(graphPath, clipRect, list); double scale = ls.GetScale(e); // CGX if (MapFrame != null && (MapFrame as IMapFrame).ReferenceScale > 1.0 && (MapFrame as IMapFrame).CurrentScale > 0.0) { double dReferenceScale = (MapFrame as IMapFrame).ReferenceScale; double dCurrentScale = (MapFrame as IMapFrame).CurrentScale; scale = dReferenceScale / dCurrentScale; } // Fin CGX foreach (IStroke stroke in ls.Strokes) { stroke.DrawPath(g, graphPath, scale); } } }
/// <summary> /// Initializes a new instance of the <see cref="LineSymbolDialog"/> class. /// </summary> /// <param name="symbolizer">The line symbolizer.</param> public LineSymbolDialog(ILineSymbolizer symbolizer) { InitializeComponent(); _original = symbolizer; _symbolizer = symbolizer.Copy(); Configure(); }
/// <summary> /// Creates a new Detailed Line Symbol Dialog /// </summary> /// <param name="symbolizer"></param> public LineSymbolDialog(ILineSymbolizer symbolizer) { InitializeComponent(); _original = symbolizer; _symbolizer = symbolizer.Copy(); Configure(); }
/// <summary> /// Initializes a new instance of the <see cref="LineSymbolDialog"/> class. /// </summary> public LineSymbolDialog() { InitializeComponent(); _original = new LineSymbolizer(); _symbolizer = new LineSymbolizer(); _symbolizer2 = new LineSymbolizer(); Configure(); }
private static Rectangle ComputeClippingRectangle(MapArgs args, ILineSymbolizer ls) { // Compute a clipping rectangle that accounts for symbology int maxLineWidth = 2 * (int)Math.Ceiling(ls.GetWidth()); Rectangle clipRect = new Rectangle(args.ImageRectangle.Location.X, args.ImageRectangle.Location.Y, args.ImageRectangle.Width, args.ImageRectangle.Height); clipRect.Inflate(maxLineWidth, maxLineWidth); return(clipRect); }
/// <summary> /// Creates a new instance of DetailedLineSymbolDialog /// </summary> public LineSymbolDialog() { InitializeComponent(); _original = new LineSymbolizer(); _symbolizer = new LineSymbolizer(); _symbolizer2 = new LineSymbolizer(); Configure(); }
private void DrawFeatures(MapArgs e, IEnumerable <int> indices, bool selected) { if (selected && !DrawnStatesNeeded) { return; } Graphics g = e.Device ?? Graphics.FromImage(BackBuffer); var indiceList = indices as IList <int> ?? indices.ToList(); Action <GraphicsPath, Rectangle, IEnumerable <int> > drawFeature = (graphPath, clipRect, features) => { foreach (int shp in features) { ShapeRange shape = DataSet.ShapeIndices[shp]; BuildLineString(graphPath, DataSet.Vertex, shape, e, clipRect); } }; if (DrawnStatesNeeded) { FastDrawnState[] states = DrawnStates; if (indiceList.Max() >= states.Length) { AssignFastDrawnStates(); states = DrawnStates; } if (selected && !states.Any(_ => _.Selected)) { return; } foreach (ILineCategory category in Symbology.Categories) { // Define the symbology based on the category and selection state ILineSymbolizer ls = selected ? category.SelectionSymbolizer : category.Symbolizer; var features = GetFeatures(indiceList, states, category, selected); if (features.Count > 0) { DrawPath(g, ls, e, drawFeature, features); } } } else { // Selection state is disabled and there is only one category ILineSymbolizer ls = Symbology.Categories[0].Symbolizer; DrawPath(g, ls, e, drawFeature, indiceList); } if (e.Device == null) { g.Dispose(); } }
private static Rectangle ComputeClippingRectangle(MapArgs args, ILineSymbolizer ls) { // Compute a clipping rectangle that accounts for symbology int maxLineWidth = 2 * (int)Math.Ceiling(ls.GetWidth()); Rectangle clipRect = args.ProjToPixel(args.GeographicExtents); //use GeographicExtent for clipping because ImageRect clips to much clipRect.Inflate(maxLineWidth, maxLineWidth); return(clipRect); }
/// <summary> /// Copies the properties defining the outline from the specified source onto this pattern. /// </summary> /// <param name="source">The source pattern to copy outline properties from.</param> public void CopyOutline(IPattern source) { if (_innerPattern != null) { _innerPattern.CopyOutline(source); return; } _outline = source.Outline.Copy(); _useOutline = source.UseOutline; }
private void PredefinedSymbolControlSymbolSelected(object sender, EventArgs e) { CustomLineSymbolizer customSymbol = predefinedLineSymbolControl1.SelectedSymbolizer; if (customSymbol != null) { _symbolizer = customSymbol.Symbolizer; UpdatePreview(); } }
/// <summary> /// Checks if the control contains the specified symbolizer /// </summary> /// <param name="symbolizer">the line symbolizer to be checked</param> /// <returns>true if found, false otherwise</returns> public bool ContainsSymbolizer(ILineSymbolizer symbolizer) { foreach (ILineSymbolizer sym in _symbolizerList) { if (symbolizer == sym) { return(true); } } return(false); }
// This draws the individual line features private void DrawFeatures(MapArgs e, IEnumerable <IFeature> features) { Graphics g = e.Device ?? Graphics.FromImage(BackBuffer); for (int selectState = 0; selectState < 2; selectState++) { foreach (ILineCategory category in Symbology.Categories) { // Define the symbology based on the category and selection state ILineSymbolizer ls = category.Symbolizer; if (selectState == SELECTED) { ls = category.SelectionSymbolizer; } g.SmoothingMode = ls.Smoothing ? SmoothingMode.AntiAlias : SmoothingMode.None; Rectangle clipRect = ComputeClippingRectangle(e, ls); // Determine the subset of the specified features that are visible and match the category ILineCategory lineCategory = category; int i = selectState; Func <IDrawnState, bool> isMember = state => state.SchemeCategory == lineCategory && state.IsVisible && state.IsSelected == (i == 1); var drawnFeatures = from feature in features where isMember(DrawingFilter[feature]) select feature; GraphicsPath graphPath = new GraphicsPath(); foreach (IFeature f in drawnFeatures) { BuildLineString(graphPath, DataSet.Vertex, f.ShapeIndex, e, clipRect); } double scale = 1; if (ls.ScaleMode == ScaleMode.Geographic) { scale = e.ImageRectangle.Width / e.GeographicExtents.Width; } foreach (IStroke stroke in ls.Strokes) { stroke.DrawPath(g, graphPath, scale); } graphPath.Dispose(); } } if (e.Device == null) { g.Dispose(); } }
/// <summary> /// Launches a form for editing the line symbolizer /// </summary> /// <param name="context"></param> /// <param name="provider"></param> /// <param name="value"></param> /// <returns></returns> public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { _original = context.Instance as ILineSymbolizer; IWindowsFormsEditorService dialogProvider = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); _editCopy = _original.Copy(); DetailedLineSymbolDialog dialog = new DetailedLineSymbolDialog(_editCopy); dialog.ChangesApplied += DialogChangesApplied; if (_original != null) return dialogProvider.ShowDialog(dialog) != DialogResult.OK ? _original.Strokes : _editCopy.Strokes; return null; }
/// <summary> /// Launches a form for editing the line symbolizer /// </summary> /// <param name="context"></param> /// <param name="provider"></param> /// <param name="value"></param> /// <returns></returns> public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider, object value) { _original = value as ILineSymbolizer; if (_original == null) return value; _copy = _original.Copy(); IWindowsFormsEditorService dialogProvider = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); DetailedLineSymbolDialog dialog = new DetailedLineSymbolDialog(_copy); dialog.ChangesApplied += new EventHandler(dialog_ChangesApplied); if(dialogProvider.ShowDialog(dialog) != DialogResult.OK)return _original; _original.CopyProperties(_copy); return value; }
/// <summary> /// Initializes the control by updating the symbolizer /// </summary> /// <param name="original"></param> public void Initialize(ILineSymbolizer original) { _original = original; _symbolizer = original.Copy(); ccStrokes.Strokes = _symbolizer.Strokes; chkSmoothing.Checked = _symbolizer.Smoothing; ccStrokes.RefreshList(); if (_symbolizer.Strokes.Count > 0) { ccStrokes.SelectedStroke = _symbolizer.Strokes[0]; } UpdatePreview(); UpdateStrokeControls(); }
/// <summary> /// Initializes a new instance of the <see cref="LineCategory"/> class based on a symbolizer. /// This uses the same symbolizer, but with a fill and border color of light cyan for the selection symbolizer. /// </summary> /// <param name="lineSymbolizer">The symbolizer to use in order to create a category.</param> public LineCategory(ILineSymbolizer lineSymbolizer) { Symbolizer = lineSymbolizer; ILineSymbolizer select = lineSymbolizer.Copy(); SelectionSymbolizer = select; if (select.Strokes != null && select.Strokes.Count > 0) { if (select.Strokes[select.Strokes.Count - 1] is ISimpleStroke ss) { ss.Color = Color.Cyan; } } }
public void ConvertLayerProperties_MapLineDataWithThemeAndMetaDataNameNotInFeatures_OnlyAddsDefaultCategory() { // Setup const string metadataAttribute = "Meta"; var random = new Random(21); var theme = new MapTheme <LineCategoryTheme>("Other Meta", new[] { new LineCategoryTheme(ValueCriterionTestFactory.CreateValueCriterion(), new LineStyle { Color = Color.FromKnownColor(random.NextEnum <KnownColor>()), Width = random.Next(1, 48), DashStyle = random.NextEnum <LineDashStyle>() }) }); var lineStyle = new LineStyle { Color = Color.FromKnownColor(random.NextEnum <KnownColor>()), Width = random.Next(1, 48), DashStyle = random.NextEnum <LineDashStyle>() }; var mapLineData = new MapLineData("test", lineStyle, theme) { Features = new[] { CreateMapFeatureWithMetaData(metadataAttribute) } }; var mapLineLayer = new MapLineLayer(); var converter = new MapLineDataConverter(); // Call converter.ConvertLayerProperties(mapLineData, mapLineLayer); // Assert ILineSymbolizer expectedSymbolizer = CreateExpectedSymbolizer(lineStyle); ILineScheme appliedScheme = mapLineLayer.Symbology; Assert.AreEqual(1, appliedScheme.Categories.Count); ILineCategory baseCategory = appliedScheme.Categories[0]; AssertAreEqual(expectedSymbolizer, baseCategory.Symbolizer); Assert.IsNull(baseCategory.FilterExpression); }
/// <summary> /// Creates the category using a random fill color /// </summary> /// <param name="fillColor">The base color to use for creating the category</param> /// <param name="size">Creates the size</param> /// <returns>A new polygon category</returns> public override ICategory CreateNewCategory(Color fillColor, double size) { ILineSymbolizer ls = EditorSettings.TemplateSymbolizer.Copy() as ILineSymbolizer; if (ls != null) { ls.SetFillColor(fillColor); ls.SetWidth(size); } else { ls = new LineSymbolizer(fillColor, size); } return(new LineCategory(ls)); }
/// <summary> /// Launches a form for editing the line symbolizer /// </summary> /// <param name="context"></param> /// <param name="provider"></param> /// <param name="value"></param> /// <returns></returns> public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { _original = context.Instance as ILineSymbolizer; IWindowsFormsEditorService dialogProvider = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); _editCopy = _original.Copy(); DetailedLineSymbolDialog dialog = new DetailedLineSymbolDialog(_editCopy); dialog.ChangesApplied += DialogChangesApplied; if (_original != null) { return(dialogProvider.ShowDialog(dialog) != DialogResult.OK ? _original.Strokes : _editCopy.Strokes); } return(null); }
/// <summary> /// Launches a form for editing the line symbolizer /// </summary> /// <param name="context"></param> /// <param name="provider"></param> /// <param name="value"></param> /// <returns></returns> public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider, object value) { original = context.Instance as ILineSymbolizer; IWindowsFormsEditorService dialogProvider = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); editCopy = original.Copy(); DetailedLineSymbolDialog dialog = new DetailedLineSymbolDialog(editCopy); dialog.ChangesApplied += new EventHandler(dialog_ChangesApplied); if (dialogProvider.ShowDialog(dialog) != System.Windows.Forms.DialogResult.OK) { return original.Strokes; } else { return editCopy.Strokes; } }
// This draws the individual line features private void DrawFeatures(MapArgs e, IEnumerable <IFeature> features, bool selected) { if (selected && !DrawingFilter.DrawnStates.Any(_ => _.Value.IsSelected)) { return; } Graphics g = e.Device ?? Graphics.FromImage(BackBuffer); var featureList = features as IList <IFeature> ?? features.ToList(); Action <GraphicsPath, Rectangle, IEnumerable <IFeature> > drawFeature = (graphPath, clipRect, featList) => { foreach (IFeature f in featList) { BuildLineString(graphPath, f.Geometry as ILineString, e, clipRect); } }; foreach (ILineCategory category in Symbology.Categories) { // Define the symbology based on the category and selection state ILineSymbolizer ls = selected ? category.SelectionSymbolizer : category.Symbolizer; // Determine the subset of the specified features that are visible and match the category ILineCategory lineCategory = category; Func <IDrawnState, bool> isMember; if (selected) { // get only selected features isMember = state => state.SchemeCategory == lineCategory && state.IsVisible && state.IsSelected; } else { // get all features isMember = state => state.SchemeCategory == lineCategory && state.IsVisible; } var drawnFeatures = from feature in featureList where isMember(DrawingFilter[feature]) select feature; DrawPath(g, ls, e, drawFeature, drawnFeatures); } if (e.Device == null) { g.Dispose(); } }
/// <summary> /// Draws the path that results from the given indices. /// </summary> /// <typeparam name="T">Type of the elements in the list.</typeparam> /// <param name="g">Graphics object used for drawing.</param> /// <param name="ls">LineSymbolizer used for drawing.</param> /// <param name="e">MapArgs needed for computation.</param> /// <param name="action">Action that is used to add the elements to the graphics path that gets drawn.</param> /// <param name="list">List that contains the elements that get drawn.</param> private void DrawPath <T>(Graphics g, ILineSymbolizer ls, MapArgs e, Action <GraphicsPath, Rectangle, IEnumerable <T> > action, IEnumerable <T> list) { g.SmoothingMode = ls.GetSmoothingMode(); Rectangle clipRect = ComputeClippingRectangle(e, ls); // Determine the subset of the specified features that are visible and match the category using GraphicsPath graphPath = new(); action(graphPath, clipRect, list); double scale = ls.GetScale(e); foreach (IStroke stroke in ls.Strokes) { stroke.DrawPath(g, graphPath, scale); } }
private static void AssertAreEqual(ILineSymbolizer firstSymbolizer, ILineSymbolizer secondSymbolizer) { IList <IStroke> firstStrokes = firstSymbolizer.Strokes; IList <IStroke> secondStrokes = secondSymbolizer.Strokes; Assert.AreEqual(firstStrokes.Count, secondStrokes.Count, "Unequal amount of strokes defined."); for (var i = 0; i < firstStrokes.Count; i++) { var firstStroke = (CartographicStroke)firstStrokes[i]; var secondStroke = (CartographicStroke)secondStrokes[i]; Assert.AreEqual(firstStroke.Color, secondStroke.Color); Assert.AreEqual(firstStroke.EndCap, secondStroke.EndCap); Assert.AreEqual(firstStroke.DashStyle, secondStroke.DashStyle); Assert.AreEqual(firstStroke.Width, secondStroke.Width); } }
/// <summary> /// If possible, use the template to control the colors. Otherwise, just use the default /// settings for creating "unbounded" colors. /// </summary> /// <param name="count">The integer count.</param> /// <returns>The List of colors</returns> protected override List <Color> GetDefaultColors(int count) { if (EditorSettings != null) { ILineSymbolizer ls = EditorSettings.TemplateSymbolizer as ILineSymbolizer; if (ls != null) { List <Color> result = new List <Color>(); Color c = ls.GetFillColor(); for (int i = 0; i < count; i++) { result.Add(c); } return(result); } } return(base.GetDefaultColors(count)); }
/// <summary> /// Launches a form for editing the line symbolizer /// </summary> /// <param name="context"></param> /// <param name="provider"></param> /// <param name="value"></param> /// <returns></returns> public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { _original = value as ILineSymbolizer; if (_original == null) { return(value); } _copy = _original.Copy(); IWindowsFormsEditorService dialogProvider = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); DetailedLineSymbolDialog dialog = new DetailedLineSymbolDialog(_copy); dialog.ChangesApplied += DialogChangesApplied; if (dialogProvider.ShowDialog(dialog) != DialogResult.OK) { return(_original); } _original.CopyProperties(_copy); return(value); }
private void btnEdit_Click(object sender, EventArgs e) { if (_sizeRange == null) { return; } IPointSymbolizer ps = _sizeRange.Symbolizer as IPointSymbolizer; if (ps != null) { _pointDialog.Symbolizer = _sizeRange.Symbolizer as IPointSymbolizer; _pointDialog.ShowDialog(this); } ILineSymbolizer ls = _sizeRange.Symbolizer as ILineSymbolizer; if (ls != null) { _lineDialog.Symbolizer = _sizeRange.Symbolizer as ILineSymbolizer; _lineDialog.ShowDialog(this); } }
private void BtnImportSymbolClick(object sender, EventArgs e) { ILineSymbolizer ps = SerializeHelper.OpenFeatureSymbolizer() as ILineSymbolizer; if (ps != null) { _symbolizer = ps; ccStrokes.Strokes = _symbolizer.Strokes; ccStrokes.RefreshList(); if (_symbolizer.Strokes.Count > 0) { ccStrokes.SelectedStroke = _symbolizer.Strokes[0]; } UpdatePreview(); UpdateStrokeControls(); } else { MessageBox.Show("Failed to open file"); } }
/// <summary> /// /// </summary> /// <param name="e"></param> protected override void OnMouseDoubleClick(MouseEventArgs e) { _wasDoubleClick = true; Point loc = new Point(e.X + ControlRectangle.X, e.Location.Y + ControlRectangle.Top); foreach (LegendBox lb in _legendBoxes) { if (!lb.Bounds.Contains(loc) || lb.CheckBox.Contains(loc)) { continue; } ILineCategory lc = lb.Item as ILineCategory; if (lc != null) { DetailedLineSymbolDialog lsDialog = new DetailedLineSymbolDialog(lc.Symbolizer); lsDialog.ShowDialog(); ILineSymbolizer sel = lc.Symbolizer.Copy(); sel.SetFillColor(Color.Cyan); lc.SelectionSymbolizer = sel; } IPointCategory pc = lb.Item as IPointCategory; if (pc != null) { DetailedPointSymbolDialog dlg = new DetailedPointSymbolDialog(pc.Symbolizer); dlg.ShowDialog(); IPointSymbolizer ps = pc.Symbolizer.Copy(); ps.SetFillColor(Color.Cyan); pc.SelectionSymbolizer = ps; } IPolygonCategory polyCat = lb.Item as IPolygonCategory; if (polyCat != null) { DetailedPolygonSymbolDialog dlg = new DetailedPolygonSymbolDialog(polyCat.Symbolizer); dlg.ShowDialog(); IPolygonSymbolizer ps = polyCat.Symbolizer.Copy(); ps.SetFillColor(Color.Cyan); ps.OutlineSymbolizer.SetFillColor(Color.DarkCyan); polyCat.SelectionSymbolizer = ps; } IFeatureLayer fl = lb.Item as IFeatureLayer; if (fl != null) { LayerDialog layDialog = new LayerDialog(fl, new FeatureCategoryControl()); layDialog.ShowDialog(); } IRasterLayer rl = lb.Item as IRasterLayer; if (rl != null) { LayerDialog dlg = new LayerDialog(rl, new RasterCategoryControl()); dlg.ShowDialog(); } IColorCategory cb = lb.Item as IColorCategory; if (cb != null) { _tabColorDialog = new TabColorDialog(); _tabColorDialog.ChangesApplied += TabColorDialogChangesApplied; _tabColorDialog.StartColor = cb.LowColor; _tabColorDialog.EndColor = cb.HighColor; _editCategory = cb; _tabColorDialog.ShowDialog(this); } } base.OnMouseDoubleClick(e); }
/// <summary> /// Creates a new Detailed Line Symbol Dialog that displays a copy of the original, /// and when apply changes is pressed, will copy properties to the original. /// </summary> /// <param name="original">The current symbolizer being viewed on the map</param> public DetailedLineSymbolControl(ILineSymbolizer original) { _original = original; _symbolizer = original.Copy(); Configure(); }
/// <summary> /// Constructor /// </summary> public PolygonSymbolizerOld() { _borderSymbolizer = new LineSymbolizer(); Configure(); }
/// <summary> /// Gets or sets the polygon symbolizer /// </summary> /// <param name="selected">Boolean, true if this should use a standard selection symbology of light cyan coloring</param> public PolygonSymbolizerOld(bool selected) { _borderSymbolizer = new LineSymbolizer(selected); Configure(); }
/// <summary> /// Initializes a new instance of the <see cref="PolygonSymbolizerOld"/> class. /// </summary> /// <param name="env">The Envelope representing the base geometric size of the layer. This helps to estimate a useful geographic line width</param> /// <param name="selected">Boolean, true if this should use a standard selection symbology of light cyan coloring</param> public PolygonSymbolizerOld(Envelope env, bool selected) { _borderSymbolizer = new LineSymbolizer(env, selected); Configure(); }
/// <summary> /// Handles the inter-connectivity of the various controls and updates /// them all to match the latest value. /// </summary> public void UpdateControls() { if (_ignore) { return; } _ignore = true; if (_sizeRange == null) { _ignore = false; return; } chkSizeRange.Checked = _sizeRange.UseSizeRange; trkStart.Value = (int)_sizeRange.Start; trkEnd.Value = (int)_sizeRange.End; IPointSymbolizer ps = _sizeRange.Symbolizer as IPointSymbolizer; if (ps != null) { Color color = ps.GetFillColor(); if (_scheme != null && _scheme.EditorSettings.UseColorRange) { color = _scheme.EditorSettings.StartColor; } if (chkSizeRange.Checked) { psvStart.Symbolizer = _sizeRange.GetSymbolizer(_sizeRange.Start, color) as IPointSymbolizer; } else { IPointSymbolizer sm = ps.Copy(); sm.SetFillColor(color); psvStart.Symbolizer = sm; } if (_scheme != null && _scheme.EditorSettings.UseColorRange) { color = _scheme.EditorSettings.EndColor; } if (chkSizeRange.Checked) { psvEnd.Symbolizer = _sizeRange.GetSymbolizer(_sizeRange.End, color) as IPointSymbolizer; } else { IPointSymbolizer sm = ps.Copy(); sm.SetFillColor(color); psvEnd.Symbolizer = sm; } } ILineSymbolizer ls = _sizeRange.Symbolizer as ILineSymbolizer; if (ls != null) { Color color = ls.GetFillColor(); if (_scheme != null && _scheme.EditorSettings.UseColorRange) { color = _scheme.EditorSettings.StartColor; } if (chkSizeRange.Checked) { lsvStart.Symbolizer = _sizeRange.GetSymbolizer(_sizeRange.Start, color) as ILineSymbolizer; } else { ILineSymbolizer sm = ls.Copy(); sm.SetFillColor(color); lsvStart.Symbolizer = sm; } if (_scheme != null && _scheme.EditorSettings.UseColorRange) { color = _scheme.EditorSettings.EndColor; } if (chkSizeRange.Checked) { lsvEnd.Symbolizer = _sizeRange.GetSymbolizer(_sizeRange.End, color) as ILineSymbolizer; } else { ILineSymbolizer sm = ls.Copy(); sm.SetFillColor(color); lsvEnd.Symbolizer = sm; } } nudStart.Value = (decimal)_sizeRange.Start; nudEnd.Value = (decimal)_sizeRange.End; _ignore = false; OnSizeRangeChanged(); }
/// <summary> /// Checks if the control contains the specified symbolizer /// </summary> /// <param name="symbolizer">the line symbolizer to be checked</param> /// <returns>true if found, false otherwise</returns> public bool ContainsSymbolizer(ILineSymbolizer symbolizer) { foreach (ILineSymbolizer sym in _symbolizerList) { if (symbolizer == sym) { return true; } } return false; }
/// <summary> /// Creates a new polygon symbolizer based on the specified parameters. /// </summary> /// <param name="env">The IEnvelope representing the base geometric size of the layer. This helps to estimate a useful geographic line width</param> /// <param name="selected">Boolean, true if this should use a standard selection symbology of light cyan coloring</param> public PolygonSymbolizerOld(IEnvelope env, bool selected) { _borderSymbolizer = new LineSymbolizer(env, selected); Configure(); }
public GeometrySymbolizer() { _pointSymbolizer = new RasterPointSymbolizer(); _lineSymbolizer = new BasicLineSymbolizer(); _polygonSymbolizer = new BasicPolygonSymbolizer(); }
private void predefinedSymbolControl_SymbolSelected(object sender, EventArgs e) { CustomLineSymbolizer customSymbol = predefinedLineSymbolControl1.SelectedSymbolizer; if (customSymbol != null) { _symbolizer = customSymbol.Symbolizer; UpdatePreview(); } }
/// <summary> /// Creates a new instance of Pattern /// </summary> public Pattern() { _outline = new LineSymbolizer(); _outline.ItemChanged += OutlineItemChanged; _useOutline = true; }
private static Rectangle ComputeClippingRectangle(MapArgs args, ILineSymbolizer ls) { // Compute a clipping rectangle that accounts for symbology int maxLineWidth = 2 * (int)Math.Ceiling(ls.GetWidth()); Rectangle clipRect = new Rectangle(args.ImageRectangle.Location.X, args.ImageRectangle.Location.Y, args.ImageRectangle.Width, args.ImageRectangle.Height); clipRect.Inflate(maxLineWidth, maxLineWidth); return clipRect; }
/// <summary> /// Initializes a new instance of the <see cref="PolygonSymbolizerOld"/> class. /// </summary> public PolygonSymbolizerOld() { _borderSymbolizer = new LineSymbolizer(); Configure(); }
/// <summary> /// This constructor shows a different symbolizer in the view from what is currently loaded on the map. /// If apply changes is clicked, the properties of the current symbolizer will be copied to the original. /// </summary> /// <param name="original">The symbolizer on the map</param> /// <param name="displayed">The symbolizer that defines the form setup</param> public DetailedLineSymbolControl(ILineSymbolizer original, ILineSymbolizer displayed) { _symbolizer = displayed; _original = original; Configure(); }
/// <summary> /// Initializes a new instance of the <see cref="PolygonSymbolizerOld"/> class. /// </summary> /// <param name="selected">Boolean, true if this should use a standard selection symbology of light cyan coloring</param> public PolygonSymbolizerOld(bool selected) { _borderSymbolizer = new LineSymbolizer(selected); Configure(); }
/// <summary> /// Creates a new line symbol dialog where only the original is specified and the /// duplicate is created. /// </summary> /// <param name="original"></param> public DetailedLineSymbolDialog(ILineSymbolizer original) { InitializeComponent(); detailedLineSymbolControl.Initialize(original); Configure(); }
/// <summary> /// Creates a new instance of DetailedLineSymbolDialog /// </summary> public DetailedLineSymbolControl() { _original = new LineSymbolizer(); _symbolizer = new LineSymbolizer(); Configure(); }
/// <summary> /// Creates a new instance of LineSymbolizerEventArgs /// </summary> public LineSymbolizerEventArgs(ILineSymbolizer symbolizer) : base(symbolizer) { }
/// <summary> /// Creates a new category based on a symbolizer, and uses the same symbolizer, but with a fill and border color of light cyan /// for the selection symbolizer /// </summary> /// <param name="lineSymbolizer">The symbolizer to use in order to create a category</param> public LineCategory(ILineSymbolizer lineSymbolizer) { Symbolizer = lineSymbolizer; ILineSymbolizer select = lineSymbolizer.Copy(); SelectionSymbolizer = select; if (select.Strokes != null && select.Strokes.Count > 0) { ISimpleStroke ss = select.Strokes[select.Strokes.Count - 1] as ISimpleStroke; if (ss != null) ss.Color = Color.Cyan; } }