Beispiel #1
0
        private void menu_Click(object sender, EventArgs e)
        {
            FormContour Frm = new FormContour();

            Frm.layers = App.Map.GetRasterLayers();

            if (Frm.layers.GetLength(0) <= 0)
            {
                MessageBox.Show("No raster layer found!");
                return;
            }

            if (Frm.ShowDialog() == DialogResult.OK)
            {
                IMapFeatureLayer fl = App.Map.Layers.Add(Frm.Contours);
                fl.LegendText = Frm.LayerName + " - Contours";

                int numlevs = Frm.lev.GetLength(0);

                switch (Frm.contourtype)
                {
                case (Contour.ContourType.Line):
                {
                    LineScheme ls = new LineScheme();
                    ls.Categories.Clear();

                    for (int i = 0; i < Frm.color.GetLength(0); i++)
                    {
                        LineCategory lc = new LineCategory(Frm.color[i], 2.0);

                        lc.FilterExpression = "[Value] = " + Frm.lev[i].ToString();
                        lc.LegendText       = Frm.lev[i].ToString();

                        ls.AddCategory(lc);
                    }

                    fl.Symbology = ls;
                }
                break;

                case (Contour.ContourType.Polygon):
                {
                    PolygonScheme ps = new PolygonScheme();
                    ps.Categories.Clear();

                    for (int i = 0; i < Frm.color.GetLength(0); i++)
                    {
                        PolygonCategory pc = new PolygonCategory(Frm.color[i], Color.Transparent, 0);
                        pc.FilterExpression = "[Lev] = " + i.ToString();
                        pc.LegendText       = Frm.lev[i].ToString() + " - " + Frm.lev[i + 1].ToString();

                        ps.AddCategory(pc);
                    }

                    fl.Symbology = ps;
                }
                break;
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Creates a new raster with the specified cell size.  If the cell size
        /// is zero, this will default to the shorter of the width or height
        /// divided by 256.  If the cell size produces a raster that is greater
        /// than 8, 000 pixels in either dimension, it will be re-sized to
        /// create an 8, 000 length or width raster.
        /// </summary>
        /// <param name="fs">The featureset to convert to a raster.</param>
        /// <param name="extent">Force the raster to this specified extent.</param>
        /// <param name="cellSize">The double extent of the cell.</param>
        /// <param name="fieldName">The integer field index of the file.</param>
        /// <param name="outputFileName">The fileName of the raster to create.</param>
        /// <param name="driverCode">The optional GDAL driver code to use if using GDAL
        /// for a format that is not discernable from the file extension.  An empty string
        ///  is usually perfectly acceptable here.</param>
        /// <param name="options">For GDAL rasters, they can be created with optional parameters
        ///  passed in as a string array.  In most cases an empty string is perfectly acceptable.</param>
        /// <param name="progressHandler">An interface for handling the progress messages.</param>
        /// <returns>Generates a raster from the vectors.</returns>
        public static IRaster ToRaster(IFeatureSet fs, Extent extent, double cellSize, string fieldName,
                                       string outputFileName,
                                       string driverCode, string[] options, IProgressHandler progressHandler)
        {
            Extent env = extent;

            if (cellSize == 0)
            {
                if (env.Width < env.Height)
                {
                    cellSize = env.Width / 256;
                }
                else
                {
                    cellSize = env.Height / 256;
                }
            }
            int w = (int)Math.Ceiling(env.Width / cellSize);

            if (w > 8000)
            {
                w        = 8000;
                cellSize = env.Width / 8000;
            }
            int h = (int)Math.Ceiling(env.Height / cellSize);

            if (h > 8000)
            {
                h = 8000;
            }
            Bitmap   bmp = new Bitmap(w, h);
            Graphics g   = Graphics.FromImage(bmp);

            g.Clear(Color.Transparent);
            g.SmoothingMode     = SmoothingMode.None;
            g.TextRenderingHint = TextRenderingHint.SingleBitPerPixel;
            g.InterpolationMode = InterpolationMode.NearestNeighbor;
            Hashtable colorTable;
            MapArgs   args = new MapArgs(new Rectangle(0, 0, w, h), env, g);

            switch (fs.FeatureType)
            {
            case FeatureType.Polygon:
            {
                MapPolygonLayer mpl = new MapPolygonLayer(fs);
                PolygonScheme   ps  = new PolygonScheme();
                colorTable    = ps.GenerateUniqueColors(fs, fieldName);
                mpl.Symbology = ps;
                mpl.DrawRegions(args, new List <Extent> {
                        env
                    });
            }
            break;

            case FeatureType.Line:
            {
                MapLineLayer mpl = new MapLineLayer(fs);
                LineScheme   ps  = new LineScheme();
                colorTable    = ps.GenerateUniqueColors(fs, fieldName);
                mpl.Symbology = ps;
                mpl.DrawRegions(args, new List <Extent> {
                        env
                    });
            }
            break;

            default:
            {
                MapPointLayer mpl = new MapPointLayer(fs);
                PointScheme   ps  = new PointScheme();
                colorTable    = ps.GenerateUniqueColors(fs, fieldName);
                mpl.Symbology = ps;
                mpl.DrawRegions(args, new List <Extent> {
                        env
                    });
            }
            break;
            }
            Type tp = fieldName == "FID" ? typeof(int) : fs.DataTable.Columns[fieldName].DataType;

            // We will try to convert to double if it is a string
            if (tp == typeof(string))
            {
                tp = typeof(double);
            }
            InRamImageData image = new InRamImageData(bmp, env);
            ProgressMeter  pm    = new ProgressMeter(progressHandler, "Converting To Raster Cells", h);

            IRaster output;

            output        = Raster.Create(outputFileName, driverCode, w, h, 1, tp, options);
            output.Bounds = new RasterBounds(h, w, env);

            double noDataValue = output.NoDataValue;

            if (fieldName != "FID")
            {
                // We can't use this method to calculate Max on a non-existent FID field.
                double dtMax = Convert.ToDouble(fs.DataTable.Compute("Max(" + fieldName + ")", ""));
                double dtMin = Convert.ToDouble(fs.DataTable.Compute("Min(" + fieldName + ")", ""));

                if (dtMin <= noDataValue && dtMax >= noDataValue)
                {
                    if (dtMax != GetFieldValue(tp, "MaxValue"))
                    {
                        output.NoDataValue = noDataValue;
                    }
                    else if (dtMin != GetFieldValue(tp, "MinValue"))
                    {
                        output.NoDataValue = noDataValue;
                    }
                }
            }

            List <RcIndex> locations   = new List <RcIndex>();
            List <string>  failureList = new List <string>();

            for (int row = 0; row < h; row++)
            {
                for (int col = 0; col < w; col++)
                {
                    Color c = image.GetColor(row, col);
                    if (c.A == 0)
                    {
                        output.Value[row, col] = output.NoDataValue;
                    }
                    else
                    {
                        if (colorTable.ContainsKey(c) == false)
                        {
                            if (c.A < 125)
                            {
                                output.Value[row, col] = output.NoDataValue;
                                continue;
                            }

                            // Use a color matching distance to pick the closest member
                            object val = GetCellValue(w, h, row, col, image, c, colorTable, locations);

                            output.Value[row, col] = GetDouble(val, failureList);
                        }
                        else
                        {
                            output.Value[row, col] = GetDouble(colorTable[c], failureList);
                        }
                    }
                }
                pm.CurrentValue = row;
            }
            const int maxIterations = 5;
            int       iteration     = 0;

            while (locations.Count > 0)
            {
                List <RcIndex> newLocations = new List <RcIndex>();
                foreach (RcIndex location in locations)
                {
                    object val = GetCellValue(w, h, location.Row, location.Column, image,
                                              image.GetColor(location.Row, location.Column), colorTable, newLocations);
                    output.Value[location.Row, location.Column] = GetDouble(val, failureList);
                }
                locations = newLocations;
                iteration++;
                if (iteration > maxIterations)
                {
                    break;
                }
            }

            pm.Reset();
            return(output);
        }
Beispiel #3
0
        /// <summary>
        /// Translates the given style as line style and adds it to the given line scheme.
        /// </summary>
        /// <param name="scheme">The scheme the style gets added to.</param>
        /// <param name="style">The style that gets translated.</param>
        private static void TranslateLineStyle(LineScheme scheme, string style)
        {
            if (string.IsNullOrWhiteSpace(style))
            {
                return;
            }

            var mystyle = style;
            int index   = mystyle.IndexOf("(", StringComparison.Ordinal);

            if (index < 1)
            {
                return;
            }

            var toolname = mystyle.Substring(0, index);

            mystyle = mystyle.Substring(index + 1);

            Color     col       = Color.Black;
            double    width     = 1;
            DashStyle dashStyle = DashStyle.Solid;

            float[] pattern   = null;
            bool    invisible = true;

            switch (toolname)
            {
            case "PEN":
                col       = GetColor(ref mystyle, Parameters.Color);
                width     = GetWidth(ref mystyle);
                pattern   = GetPattern(ref mystyle);
                dashStyle = GetDashStyle(ref mystyle, out invisible);
                break;
            }

            if (pattern != null)
            {
                dashStyle = DashStyle.Custom;
            }
            if (invisible)
            {
                col = Color.Transparent;
            }

            var stroke = new CartographicStroke(col)
            {
                Width     = width,
                DashStyle = dashStyle
            };

            if (pattern != null)
            {
                stroke.DashPattern = pattern;
            }

            var symb = new LineSymbolizer
            {
                ScaleMode = ScaleMode.Simple,
                Smoothing = false,
                Strokes   =
                {
                    [0] = stroke
                }
            };

            var cat = new LineCategory
            {
                FilterExpression = $"[style] = '{style}'",
                LegendText       = style,
                Symbolizer       = symb
            };

            scheme.AddCategory(cat);
        }
Beispiel #4
0
        /// <summary>
        /// Translates the style strings from the list to DotSpatial style categories and adds them to the given layer.
        /// </summary>
        /// <param name="layer">The layer the styles get added to.</param>
        /// <param name="styles">The style strings that should get translated.</param>
        public static void TranslateStyles(IMapFeatureLayer layer, IList <string> styles)
        {
            var featureType = layer.DataSet.FeatureType;

            switch (featureType)
            {
            case FeatureType.MultiPoint:
            case FeatureType.Point:
            {
                // create the scheme
                var scheme = new PointScheme();
                scheme.Categories.Clear();
                scheme.EditorSettings.ClassificationType = ClassificationType.UniqueValues;
                scheme.EditorSettings.FieldName          = "style";
                scheme.LegendText = "Point";

                // add the default category
                var cat = new PointCategory(Color.Black, Symbology.PointShape.Rectangle, 5)
                {
                    LegendText = "default",
                    Symbolizer =
                    {
                        ScaleMode = ScaleMode.Simple,
                        Smoothing = false
                    }
                };
                scheme.AddCategory(cat);

                var labelLayer = new MapLabelLayer();
                labelLayer.Symbology.Categories.Clear();

                bool needsLabels = styles.Any(_ => !string.IsNullOrWhiteSpace(_) && _.StartsWith("LABEL"));

                foreach (var style in styles)
                {
                    TranslatePointStyle(scheme, labelLayer.Symbology, style);
                }

                // assign the scheme
                layer.Symbology = scheme;

                // assign the label layer if needed
                if (needsLabels)
                {
                    layer.LabelLayer = labelLayer;
                    layer.ShowLabels = true;
                    layer.LabelLayer.CreateLabels();
                }

                layer.DataSet.UpdateExtent();
                layer.DataSet.InitializeVertices();
                layer.AssignFastDrawnStates();

                break;
            }

            case FeatureType.Line:
            {
                // create the scheme
                var scheme = new LineScheme();
                scheme.Categories.Clear();
                scheme.EditorSettings.ClassificationType = ClassificationType.UniqueValues;
                scheme.EditorSettings.FieldName          = "style";
                scheme.LegendText = "Line";

                // add the default category
                var cat = new LineCategory(Color.Black, 1)
                {
                    LegendText = "default",
                    Symbolizer =
                    {
                        ScaleMode = ScaleMode.Simple,
                        Smoothing = false
                    }
                };
                scheme.AddCategory(cat);

                // add the categories from the file
                foreach (var style in styles)
                {
                    TranslateLineStyle(scheme, style);
                }

                // assign the scheme
                layer.Symbology = scheme;

                layer.DataSet.UpdateExtent();
                layer.DataSet.InitializeVertices();
                layer.AssignFastDrawnStates();

                break;
            }

            case FeatureType.Polygon:
            {
                // create the scheme
                var scheme = new PolygonScheme();
                scheme.Categories.Clear();
                scheme.EditorSettings.ClassificationType = ClassificationType.UniqueValues;
                scheme.EditorSettings.FieldName          = "style";
                scheme.LegendText = "Polygon";

                // add the default category
                var cat = new PolygonCategory(Color.GhostWhite, Color.Black, 1)
                {
                    LegendText = "default",
                    Symbolizer =
                    {
                        ScaleMode = ScaleMode.Simple,
                        Smoothing = false
                    }
                };
                scheme.AddCategory(cat);

                // add the categories from the file
                foreach (var style in styles)
                {
                    TranslatePolygonStyle(scheme, style);
                }

                // assign the scheme
                layer.Symbology = scheme;

                layer.DataSet.UpdateExtent();
                layer.DataSet.InitializeVertices();
                layer.AssignFastDrawnStates();

                break;
            }

            default: throw new ArgumentOutOfRangeException(nameof(featureType), featureType, null);
            }
        }
Beispiel #5
0
        public void setSymbolizer()
        {
            double baseWidth        = 20.0;
            double baseOutlineWidth = 10.0;
            double adjWidth         = baseWidth;
            double adjOutlineWidth  = baseOutlineWidth;

            LineScheme rdScheme = new LineScheme();

            LineSymbolizer catSelSym = new LineSymbolizer();

            catSelSym.ScaleMode = ScaleMode.Geographic;
            catSelSym.SetWidth(adjWidth);
            catSelSym.SetOutline(Color.Blue, adjOutlineWidth);
            catSelSym.SetFillColor(Color.White);

            LineSymbolizer symDef = new LineSymbolizer();

            symDef.ScaleMode = ScaleMode.Geographic;
            symDef.SetWidth(adjWidth);
            symDef.SetOutline(Color.Black, adjOutlineWidth);
            symDef.SetFillColor(Color.Gray);

            LineCategory catDef = new LineCategory();

            catDef.LegendText = "No RSL Info";

            catDef.SelectionSymbolizer = catSelSym;
            catDef.Symbolizer          = symDef;
            rdScheme.AddCategory(catDef);

            int[] r = new int[30];
            int[] g = new int[30];
            int[] b = new int[30];

            if (Project.settings.GetValue("road_colors").Contains("t"))
            {
                if (moduleRoads.roadColors == "RSL")
                {
                    for (int rsl = 0; rsl <= 20; rsl++)
                    {
                        // create a category
                        LineCategory colorCat = new LineCategory();
                        colorCat.FilterExpression = "[TAMSROADRSL] = '" + rsl.ToString() + "'";

                        LineSymbolizer colorSym = new LineSymbolizer();
                        colorSym.ScaleMode = ScaleMode.Geographic;
                        colorSym.SetWidth(adjWidth);
                        colorSym.SetOutline(Color.DarkGray, adjOutlineWidth);

                        Color fillColor = Color.Gray;
                        if (rsl == 20 || rsl == 19)
                        {
                            fillColor = Color.Blue;
                        }
                        if (rsl <= 18 && rsl >= 16)
                        {
                            fillColor = Color.DeepSkyBlue;
                        }
                        if (rsl <= 15 && rsl >= 13)
                        {
                            fillColor = Color.Green;
                        }
                        if (rsl <= 12 && rsl >= 10)
                        {
                            fillColor = Color.LimeGreen;
                        }
                        if (rsl <= 9 && rsl >= 7)
                        {
                            fillColor = Color.Yellow;
                        }
                        if (rsl <= 6 && rsl >= 4)
                        {
                            fillColor = Color.Orange;
                        }
                        if (rsl <= 3 && rsl >= 1)
                        {
                            fillColor = Color.Red;
                        }
                        if (rsl == 0)
                        {
                            fillColor = Color.DarkRed;
                        }

                        if (selectedColors[fillColor])
                        {
                            colorSym.SetFillColor(fillColor);
                        }
                        else
                        {
                            continue;
                        }

                        colorCat.Symbolizer = colorSym;

                        // assign (default) selection symbolizer
                        colorCat.SelectionSymbolizer = catSelSym;

                        // done
                        rdScheme.AddCategory(colorCat);
                    }
                }

                if (moduleRoads.roadColors == "Treatment")
                {
                    DataTable nameToTreatment = Database.GetDataByQuery(Project.conn, "SELECT name, category FROM treatments;");
                    string[]  treatments      = new string[30];
                    int       j = 0;
                    foreach (DataRow row in nameToTreatment.Rows)
                    {
                        treatments[j] = row["name"].ToString();
                        if (row["category"].ToString() == "routine")
                        {
                            r[j] = 0;
                        }
                        g[j] = 0; b[j] = 255;
                        if (row["category"].ToString() == "patch")
                        {
                            r[j] = 50;
                        }
                        g[j] = 205; b[j] = 50;
                        if (row["category"].ToString() == "preventative")
                        {
                            r[j] = 255;
                        }
                        g[j] = 255; b[j] = 0;
                        if (row["category"].ToString() == "rehabilitation")
                        {
                            r[j] = 255;
                        }
                        g[j] = 0; b[j] = 0;
                        if (row["category"].ToString() == "reconstruction")
                        {
                            r[j] = 139;
                        }
                        g[j] = 0; b[j] = 0;
                        j++;
                    }
                    treatments[24] = "Routine"; r[24] = 0; g[24] = 0; b[24] = 255;
                    treatments[25] = "Patching"; r[25] = 50; g[25] = 205; b[25] = 50;
                    treatments[26] = "Preventative"; r[26] = 255; g[26] = 255; b[26] = 0;
                    treatments[27] = "Preventative with Patching"; r[27] = 255; g[27] = 165; b[27] = 0;
                    treatments[28] = "Rehabilitation"; r[28] = 255; g[28] = 0; b[28] = 0;
                    treatments[29] = "Reconstruction"; r[29] = 139; g[29] = 0; b[29] = 0;

                    for (int i = 0; i < treatments.Length; i++)
                    {
                        // TODO: Get this to work
                        Color fillColor = Color.Gray;
                        if (r[i] == 0 && g[i] == 0 && b[i] == 255)
                        {
                            fillColor = Color.Blue;
                        }
                        if (r[i] == 50 && g[i] == 205 && b[i] == 50)
                        {
                            fillColor = Color.LimeGreen;
                        }
                        if (r[i] == 255 && g[i] == 255 && b[i] == 0)
                        {
                            fillColor = Color.Yellow;
                        }
                        if (r[i] == 255 && g[i] == 165 && b[i] == 0)
                        {
                            fillColor = Color.Orange;
                        }
                        if (r[i] == 255 && g[i] == 0 && b[i] == 0)
                        {
                            fillColor = Color.Red;
                        }
                        if (r[i] == 139 && g[i] == 0 && b[i] == 0)
                        {
                            fillColor = Color.DarkRed;
                        }
                        if (!selectedColors[fillColor])
                        {
                            continue;
                        }

                        LineCategory colorCat = new LineCategory();
                        colorCat.FilterExpression = "[TAMSTREATMENT] = '" + treatments[i] + "'";

                        LineSymbolizer colorSym = new LineSymbolizer();
                        colorSym.ScaleMode = ScaleMode.Geographic;
                        colorSym.SetWidth(adjWidth);
                        colorSym.SetOutline(Color.DarkGray, adjOutlineWidth);
                        colorSym.SetFillColor(Color.FromArgb(r[i], g[i], b[i]));

                        colorCat.Symbolizer = colorSym;

                        // assign (default) selection symbolizer
                        colorCat.SelectionSymbolizer = catSelSym;

                        // done
                        rdScheme.AddCategory(colorCat);
                    }
                }
            }
            ((MapLineLayer)moduleRoads.Layer).ShowLabels = false;

            FeatureLayer roadFeatures = moduleRoads.Layer as FeatureLayer;

            if (!string.IsNullOrEmpty(Project.settings.GetValue("road_labels")))
            {
                string streetnames = "[" + Project.settings.GetValue(ModuleName + "_f_streetname") + "]";
                roadFeatures.AddLabels(streetnames, new Font("Tahoma", (float)8.0), moduleRoads.labelColor);
                roadFeatures.ShowLabels = Project.settings.GetValue("road_labels").Contains("true");
            }

            ((MapLineLayer)moduleRoads.Layer).Symbology = rdScheme;
            ((MapLineLayer)moduleRoads.Layer).ApplyScheme(rdScheme);
        }
Beispiel #6
0
        private void MenuClick(object sender, EventArgs e)
        {
            using (FormContour frm = new FormContour())
            {
                frm.Layers = App.Map.GetRasterLayers();
                if (frm.Layers.GetLength(0) <= 0)
                {
                    MessageBox.Show(Resources.NoRasterLayerFound);
                    return;
                }

                if (frm.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                IMapFeatureLayer fl = App.Map.Layers.Add(frm.Contours);
                fl.LegendText = frm.LayerName + " - Contours";

                int numlevs = frm.Lev.GetLength(0);

                switch (frm.Contourtype)
                {
                case Contour.ContourType.Line:
                {
                    LineScheme ls = new LineScheme();
                    ls.Categories.Clear();

                    for (int i = 0; i < frm.Color.GetLength(0); i++)
                    {
                        LineCategory lc = new LineCategory(frm.Color[i], 2.0)
                        {
                            FilterExpression = "[Value] = " + frm.Lev[i],
                            LegendText       = frm.Lev[i].ToString(CultureInfo.InvariantCulture)
                        };

                        ls.AddCategory(lc);
                    }

                    fl.Symbology = ls;
                }

                break;

                case Contour.ContourType.Polygon:
                {
                    PolygonScheme ps = new PolygonScheme();
                    ps.Categories.Clear();

                    for (int i = 0; i < frm.Color.GetLength(0); i++)
                    {
                        PolygonCategory pc = new PolygonCategory(frm.Color[i], Color.Transparent, 0)
                        {
                            FilterExpression = "[Lev] = " + i,
                            LegendText       = frm.Lev[i] + " - " + frm.Lev[i + 1]
                        };
                        ps.AddCategory(pc);
                    }

                    fl.Symbology = ps;
                }

                break;
                }
            }
        }
Beispiel #7
0
        private void SymbolizerLines(IMapFeatureLayer aLayer)
        {
            //Method 1. simple symbolizer
            aLayer.Symbolizer = new LineSymbolizer(Color.Brown, 1);

            //Method 2. Combined symbolizer
            LineSymbolizer road = new LineSymbolizer(Color.Yellow, 5);

            road.SetOutline(Color.Black, 1);
            aLayer.Symbolizer = road;

            /* Method 3. Symbology by unique values:
             * HueSatLight = true, then the ramp is created by adjusting the
             * hue, saturation and lightness between the start and end colors.
             * HueSatLight = false, then the red, blue and green values are ramped instead.
             *
             * In both cases, alpha (transparency) is ramped the same way.
             */
            LineScheme lScheme = new LineScheme();

            lScheme.EditorSettings.ClassificationType = ClassificationType.UniqueValues;
            lScheme.EditorSettings.FieldName          = "CARTO";
            lScheme.CreateCategories(aLayer.DataSet.DataTable);
            aLayer.Symbology = lScheme;

            //Method 4. Collapsible field name in legend via 'AppearsInLegend'
            LineScheme lScheme1 = new LineScheme();

            lScheme1.Categories.Clear(); //redundant???
            LineCategory lowCat = new LineCategory(Color.Blue, 2);

            lowCat.FilterExpression = "[CARTO] = 3";
            lowCat.LegendText       = "Low";
            LineCategory highCat = new LineCategory(
                Color.Red,
                Color.Black,
                6,
                DashStyle.Solid,
                LineCap.Triangle);;

            highCat.FilterExpression = "[CARTO] = 2";
            highCat.LegendText       = "High";
            lScheme1.AppearsInLegend = true;
            lScheme1.LegendText      = "CARTO";
            lScheme1.Categories.Add(lowCat);
            aLayer.Symbology = lScheme1;
            lScheme1.Categories.Add(highCat);

            /*Method 5. Lines with multiple strokes
             * Each individual LineSymbolizer is made up of at least one,
             * but potentially several strokes overlapping each other
             */
            LineSymbolizer multiStrokeSym = new LineSymbolizer();

            multiStrokeSym.Strokes.Clear(); //redundant???
            CartographicStroke ties = new CartographicStroke(Color.Brown);

            ties.DashPattern = new float[] { 1 / 6f, 2 / 6f };
            ties.Width       = 6;
            ties.EndCap      = LineCap.Flat;
            ties.StartCap    = LineCap.Flat;
            CartographicStroke rails = new CartographicStroke(Color.DarkGray);

            rails.CompoundArray = new float[] { .15f, .3f, .6f, .75f };
            rails.Width         = 6;
            rails.EndCap        = LineCap.Flat;
            rails.StartCap      = LineCap.Flat;
            multiStrokeSym.Strokes.Add(ties);
            multiStrokeSym.Strokes.Add(rails);
            aLayer.Symbolizer = multiStrokeSym;
        }