/// <summary>
 /// Creates a new Custom Line symbolizer with the specified properties
 /// </summary>
 /// <param name="uniqueName">the unique name</param>
 /// <param name="name">the name of the custom symbolizer</param>
 /// <param name="category">the map category of the custom symbolizer</param>
 /// <param name="symbolizer">the associated line symbolizer</param>
 public CustomLineSymbolizer(string uniqueName, string name, string category, LineSymbolizer symbolizer)
 {
     base.UniqueName = uniqueName;
     base.Name = name;
     base.Category = category;
     base.Symbolizer = symbolizer;
 }
 /// <summary>
 /// Creates a new instance of a polygon symbolizer
 /// </summary>
 /// <param name="fillColor">The fill color to use for the polygons</param>
 /// <param name="outlineColor">The border color to use for the polygons</param>
 public PolygonSymbolizer(Color fillColor, Color outlineColor)
 {
     _patterns = new CopyList<IPattern>();
     _patterns.Add(new SimplePattern(fillColor));
     OutlineSymbolizer = new LineSymbolizer(outlineColor, 1);
     
 }
Exemplo n.º 3
0
 /// <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>
 /// Draws a preview of a line symbolizer inside of the specified rectangle
 /// </summary>      
 private void DrawLineSymbolizer(LineSymbolizer sym, Graphics g, Rectangle rect)
 {
     if (sym != null)
     {
         g.FillRectangle(Brushes.White, rect);
         System.Drawing.Drawing2D.GraphicsPath gp = new System.Drawing.Drawing2D.GraphicsPath();
         gp.AddLine(10, rect.Height / 2, rect.Width - 20, rect.Height / 2);
         foreach (IStroke stroke in sym.Strokes)
         {
             stroke.DrawPath(g, gp, 1);
         }
         gp.Dispose();
     }
 }
 /// <summary>
 /// Creates a new instance of PolygonSymbolizer
 /// </summary>
 /// <param name="selected">Boolean, true if this should use selection symbology</param>
 /// <param name="extents">When creating geographic points, this represents the extents to use.</param>
 public PolygonSymbolizer(bool selected, IEnvelope extents)
 {
     _patterns = new CopyList<IPattern>();
     if (selected)
     {
         _patterns.Add(new SimplePattern(Color.Cyan));
         OutlineSymbolizer = new LineSymbolizer(Color.DarkCyan, 1);
     }
     else
     {
         _patterns.Add(new SimplePattern());
     }
 }
 /// <summary>
 /// Creates a new PicturePattern with the specified image
 /// </summary>
 /// <param name="picture">The picture to draw</param>
 /// <param name="wrap">The way to wrap the picture</param>
 /// <param name="angle">The angle to rotate the image</param>
 /// <param name="outlineColor">The color to use for the border symbolizer</param>
 /// <param name="outlineWidth">The width of the line to use for the border symbolizer</param>
 public PolygonSymbolizer(Image picture, WrapMode wrap, double angle, Color outlineColor, double outlineWidth)
 {
     _patterns = new CopyList<IPattern>();
     _patterns.Add(new PicturePattern(picture, wrap, angle));
     OutlineSymbolizer = new LineSymbolizer(outlineColor, outlineWidth);
 }
 /// <summary>
 /// Creates a new instance of a Gradient Pattern using the specified colors and angle
 /// </summary>
 /// <param name="startColor">The start color</param>
 /// <param name="endColor">The end color</param>
 /// <param name="angle">The direction of the gradient, measured in degrees clockwise from the x-axis</param>
 /// <param name="style">The type of gradient to use</param>
 /// <param name="outlineColor">The color to use for the border symbolizer</param>
 /// <param name="outlineWidth">The width of the line to use for the border symbolizer</param>
 public PolygonSymbolizer(Color startColor, Color endColor, double angle, GradientTypes style, Color outlineColor, double outlineWidth)
 {
     _patterns = new CopyList<IPattern>();
     _patterns.Add(new GradientPattern(startColor, endColor, angle, style));
     OutlineSymbolizer = new LineSymbolizer(outlineColor, outlineWidth);
 }
        private static List<CustomSymbolizer> getBasicLineSymbols()
        {
            List<CustomSymbolizer> lst = new List<CustomSymbolizer>();

            LineSymbolizer sym1 = new LineSymbolizer();
            CustomLineSymbolizer cust1 = new CustomLineSymbolizer();
            cust1.Symbolizer = sym1;
            cust1.UniqueName = "line_0001";
            cust1.Category = "default";
            lst.Add(cust1);
            

            LineSymbolizer sym2 = new LineSymbolizer();
            sym2.Strokes.Clear();
            SimpleStroke stroke1 = new SimpleStroke(2.5, Color.Brown);
            sym2.Strokes.Add(stroke1);
            SimpleStroke stroke0 = new SimpleStroke(1.0, Color.Yellow);
            sym2.Strokes.Add(stroke0);
            CustomLineSymbolizer cust2 = new CustomLineSymbolizer();
            cust2.Symbolizer = sym2;
            cust2.UniqueName = "line_0002";
            cust2.Category = "default";
            lst.Add(cust2);

            LineSymbolizer sym3 = new LineSymbolizer();
            sym3.Strokes.Clear();
            CartographicStroke stroke3 = new CartographicStroke(Color.Brown);
            stroke3.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
            sym3.Strokes.Add(stroke3);
            CustomLineSymbolizer cust3 = new CustomLineSymbolizer();
            cust3.Symbolizer = sym3;
            cust3.UniqueName = "line_0003";
            cust3.Category = "travel";
            cust3.Name = "path";
            lst.Add(cust3);
            return lst;
        }
        private static List<CustomLineSymbolizer> GetLineSymbols()
        {
            List<CustomLineSymbolizer> lst = new List<CustomLineSymbolizer>();




            LineSymbolizer sym1 = new LineSymbolizer();
            sym1.Strokes.Clear();
            SimpleStroke stroke11 = new SimpleStroke(Color.DarkGray);
            sym1.Strokes.Add(stroke11);
            CustomLineSymbolizer cust1 = new CustomLineSymbolizer();
            cust1.Symbolizer = sym1;
            cust1.UniqueName = "line_0001";
            cust1.Name = "simple line";
            cust1.Category = "Transportation";
            lst.Add(cust1);
            

            LineSymbolizer sym2 = new LineSymbolizer();
            sym2.Strokes.Clear();
            SimpleStroke stroke1 = new SimpleStroke(2.5, Color.Brown);
            sym2.Strokes.Add(stroke1);
            SimpleStroke stroke0 = new SimpleStroke(1.0, Color.Yellow);
            sym2.Strokes.Add(stroke0);
            CustomLineSymbolizer cust2 = new CustomLineSymbolizer();
            cust2.Symbolizer = sym2;
            cust2.UniqueName = "line_0002";
            cust2.Name = "Road";
            cust2.Category = "Transportation";
            lst.Add(cust2);

            LineSymbolizer sym3 = new LineSymbolizer();
            sym3.Strokes.Clear();
            CartographicStroke stroke3 = new CartographicStroke(Color.Brown);
            stroke3.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
            sym3.Strokes.Add(stroke3);
            CustomLineSymbolizer cust3 = new CustomLineSymbolizer();
            cust3.Symbolizer = sym3;
            cust3.UniqueName = "line_0003";
            cust3.Category = "Transportation";
            cust3.Name = "Path";
            lst.Add(cust3);

            LineSymbolizer sym4 = new LineSymbolizer();
            sym4.Strokes.Clear();
            SimpleStroke stroke41 = new SimpleStroke(4.5,Color.Gray);
            SimpleStroke stroke42 = new SimpleStroke(2.5, Color.Yellow);
            SimpleStroke stroke43 = new SimpleStroke(0.5, Color.Gray);
            sym4.Strokes.Add(stroke41);
            sym4.Strokes.Add(stroke42);
            sym4.Strokes.Add(stroke43);
            CustomLineSymbolizer cust4 = new CustomLineSymbolizer();
            cust4.Symbolizer = sym4;
            cust4.UniqueName = "line_0004";
            cust4.Category = "Transportation";
            cust4.Name = "Highway";
            lst.Add(cust4);

            LineSymbolizer sym5 = new LineSymbolizer();
            sym5.Strokes.Clear();
            CartographicStroke stroke51 = new CartographicStroke(Color.Gray);
            CartographicStroke stroke52 = new CartographicStroke(Color.LightPink);
            stroke52.Width = 4.0;
            stroke52.Offset = 2.5f;
            stroke52.DashStyle = System.Drawing.Drawing2D.DashStyle.DashDotDot;
            sym5.Strokes.Add(stroke51);
            sym5.Strokes.Add(stroke52);         
            CustomLineSymbolizer cust5 = new CustomLineSymbolizer();
            cust5.Symbolizer = sym5;
            cust5.UniqueName = "line_0005";
            cust5.Category = "Boundaries";
            cust5.Name = "Boundary 1";
            lst.Add(cust5);


            LineSymbolizer sym6 = new LineSymbolizer();
            sym6.Strokes.Clear();
            SimpleStroke stroke53 = new SimpleStroke(Color.DarkBlue);
            SimpleStroke stroke54 = new SimpleStroke(Color.LightBlue);
            stroke53.Width = 3;
            sym6.Strokes.Add(stroke53);
            sym6.Strokes.Add(stroke54);
            CustomLineSymbolizer cust6 = new CustomLineSymbolizer();
            cust6.Symbolizer = sym6;
            cust6.UniqueName = "line_0006";
            cust6.Category = "Rivers";
            cust6.Name = "River";
            lst.Add(cust6);

            return lst;
        }
Exemplo n.º 10
0
 /// <summary>
 /// Creates a new instanec of a default point scheme category where the geographic symbol size has been
 /// scaled to the specified extent.
 /// </summary>
 /// <param name="extent">The geographic extent that is 100 times wider than the geographic size of the points.</param>
 public LineCategory(IEnvelope extent)
 {
     Symbolizer = new LineSymbolizer(extent, false);
     SelectionSymbolizer = new LineSymbolizer(extent, true);
 }
Exemplo n.º 11
0
 /// <summary>
 /// Creates a new line category with the specified color and width
 /// </summary>
 /// <param name="color">The color of the unselected line</param>
 /// <param name="width">The width of both the selected and unselected lines.</param>
 public LineCategory(Color color, double width)
 {
     Symbolizer = new LineSymbolizer(color, width);
     SelectionSymbolizer = new LineSymbolizer(Color.Cyan, width);
 }
Exemplo n.º 12
0
 /// <summary>
 /// Creates a new set of cartographic lines that together form a line with a border.  Since a compound
 /// pen is used, it is possible to use this to create a transparent line with just two border parts.
 /// The selection symbolizer will be dark cyan bordering light cyan, but use the same dash and cap
 /// patterns.
 /// </summary>
 /// <param name="fillColor">The fill color for the line</param>
 /// <param name="borderColor">The border color of the line</param>
 /// <param name="width">The width of the entire line</param>
 /// <param name="dash">The dash pattern to use</param>
 /// <param name="caps">The style of the start and end caps</param>
 public LineCategory(Color fillColor, Color borderColor, double width, DashStyle dash, LineCap caps)
 {
     Symbolizer = new LineSymbolizer(fillColor, borderColor, width, dash, caps);
     SelectionSymbolizer = new LineSymbolizer(Color.Cyan, Color.DarkCyan, width, dash, caps);
 }
Exemplo n.º 13
0
 /// <summary>
 /// Creates a new instance of PointSchemeCategory
 /// </summary>
 public LineCategory()
 {
     Symbolizer = new LineSymbolizer();
     SelectionSymbolizer = new LineSymbolizer(true);
 }
        /// <summary>
        /// Sets up the Table to work with the specified layer
        /// </summary>
        /// <param name="layer"></param>
        public void Initialize(IFeatureLayer layer)
        {
            _original = layer.Symbology;
            ILegendItem parent = _original.GetParentItem();
            //_original.SetParentItem(null);
            _newScheme = _original.Copy();
            _source = layer.DataSet;
            // _original.SetParentItem(parent); // Disconnect this from actually affecting the layers.
            if(!layer.DataSet.AttributesPopulated)
            {
                if(layer.DataSet.NumRows() < 100000)
                {
                    _source.FillAttributes(); // for small datasets, it is better to just load and cache it.
                }
            }
           
            if(_source.AttributesPopulated)
            {
                _expressionDialog.Table = _source.DataTable;
            }
            else
            {
                _expressionDialog.AttributeSource = _source;
            }
            
            _schemeType = GetSchemeType(layer);

            if (_schemeType != SymbolizerTypes.Polygon)
            {
                chkUseGradients.Visible = false;
                angGradientAngle.Visible = false;
            }
            else
            {
                chkUseGradients.Visible = true;
                angGradientAngle.Visible = true;
            }
            if (_schemeType == SymbolizerTypes.Point)
            {
                IPointScheme ps = _newScheme as IPointScheme;

                if (ps != null)
                {
                    IPointSymbolizer sym;
                    if (ps.Categories.Count == 0 || ps.Categories[0].Symbolizer == null)
                    {
                        sym = new PointSymbolizer();
                    }
                    else
                    {
                        sym = ps.Categories[0].Symbolizer;
                    }
                    _ignoreRefresh = true;
                    featureSizeRangeControl1.SizeRange = new FeatureSizeRange(sym,_newScheme.EditorSettings.StartSize , _newScheme.EditorSettings.EndSize);
                    featureSizeRangeControl1.Initialize(new SizeRangeEventArgs(_newScheme.EditorSettings.StartSize, _newScheme.EditorSettings.EndSize, sym, _newScheme.EditorSettings.UseSizeRange));
                    featureSizeRangeControl1.Scheme = ps;
                    featureSizeRangeControl1.Visible = true;
                    _ignoreRefresh = false;
                }
            }
            else if (_schemeType == SymbolizerTypes.Line)
            {
                ILineScheme ls = _newScheme as ILineScheme;
                if(ls != null)
                {
                    ILineSymbolizer sym;
                    if(ls.Categories.Count == 0 || ls.Categories[0].Symbolizer == null)
                    {
                        sym = new LineSymbolizer();
                    }
                    else
                    {
                        sym = ls.Categories[0].Symbolizer;
                    }
                    _ignoreRefresh = true;
                    featureSizeRangeControl1.SizeRange = new FeatureSizeRange(sym, _newScheme.EditorSettings.StartSize, _newScheme.EditorSettings.EndSize);
                    featureSizeRangeControl1.Initialize(new SizeRangeEventArgs(_newScheme.EditorSettings.StartSize, _newScheme.EditorSettings.EndSize, sym, _newScheme.EditorSettings.UseSizeRange));
                    featureSizeRangeControl1.Scheme = ls;
                    featureSizeRangeControl1.Visible = true;
                    _ignoreRefresh = false;
                }
            }
            else
            {
                featureSizeRangeControl1.Visible = false;
            }
            

            UpdateFields();
            if (_newScheme.EditorSettings.ClassificationType != ClassificationTypes.Quantities) return;
            nudCategoryCount.Enabled = true;
            tabScheme.Visible = true;
            dgvCategories.Height = 217;
            UpdateStatistics(false, null);
        }
 /// <summary>
 /// Creates a new CustomSymbolizer for symbolizing lines
 /// </summary>
 public CustomLineSymbolizer()
 {
     Symbolizer = new LineSymbolizer();
 }