コード例 #1
0
ファイル: RedlineStyleDialog.cs プロジェクト: achilex/MgDev
        internal RedlineStyle GetUpdatedStyle()
        {
            var style = RedlineStyle.CreateDefault();

            style.LabelSizeUnits  = (SizeUnit)cmbLabelSizeUnits.SelectedItem;
            style.LineSizeUnits   = (SizeUnit)cmbLineThicknessUnit.SelectedItem;
            style.BorderSizeUnits = (SizeUnit)cmbPolyBorderThicknessUnit.SelectedItem;
            style.MarkerSizeUnits = (SizeUnit)cmbMarkerSizeUnit.SelectedItem;
            style.LinePattern     = (LinePattern)cmbLinePattern.SelectedItem;
            style.BorderPattern   = (LinePattern)cmbPolyBorderPattern.SelectedItem;
            style.FillPattern     = (FillPattern)cmbPolyFillPattern.SelectedItem;
            style.MarkerType      = (MarkerType)cmbPointMarkerType.SelectedItem;
            style.LabelBackStyle  = (LabelStyle)cmbLabelStyle.SelectedItem;

            style.LabelBackColor = clrLabelBackground.BackColor;
            style.LabelForeColor = clrLabelForeground.BackColor;
            style.FillBackColor  = clrPolyFillBackground.BackColor;
            style.FillForeColor  = clrPolyFillForeground.BackColor;
            style.LineColor      = clrLine.BackColor;
            style.MarkerColor    = clrMarker.BackColor;
            style.BorderColor    = clrPolyBorder.BackColor;

            style.FillTransparency = Math.Min(100.0, Convert.ToDouble(numFillTransparency.Value));

            style.LabelFontSize   = Convert.ToDouble(txtLabelSizeValue.Text);
            style.LineThickness   = Convert.ToDouble(txtLineThicknessValue.Text);
            style.MarkerSize      = Convert.ToDouble(txtMarkerSizeValue.Text);
            style.BorderThickness = Convert.ToDouble(txtPolyBorderThicknessValue.Text);

            style.LabelBold      = chkBold.Checked;
            style.LabelItalic    = chkItalic.Checked;
            style.LabelUnderline = chkUnderline.Checked;

            return(style);
        }
コード例 #2
0
 private void btnEditLayerStyle_Click(object sender, EventArgs e)
 {
     using (var diag = new RedlineStyleDialog(_style))
     {
         if (diag.ShowDialog() == DialogResult.OK)
         {
             _style = diag.GetUpdatedStyle();
         }
     }
 }
コード例 #3
0
ファイル: RedlineStyleDialog.cs プロジェクト: achilex/MgDev
        private void InitFromStyle(RedlineStyle style)
        {
            cmbLabelSizeUnits.DataSource          = Enum.GetValues(typeof(SizeUnit));
            cmbLineThicknessUnit.DataSource       = Enum.GetValues(typeof(SizeUnit));
            cmbPolyBorderThicknessUnit.DataSource = Enum.GetValues(typeof(SizeUnit));
            cmbMarkerSizeUnit.DataSource          = Enum.GetValues(typeof(SizeUnit));

            cmbLinePattern.DataSource       = Enum.GetValues(typeof(LinePattern));
            cmbPolyBorderPattern.DataSource = Enum.GetValues(typeof(LinePattern));
            cmbPolyFillPattern.DataSource   = Enum.GetValues(typeof(FillPattern));

            cmbPointMarkerType.DataSource = Enum.GetValues(typeof(MarkerType));
            cmbLabelStyle.DataSource      = Enum.GetValues(typeof(LabelStyle));

            numFillTransparency.Value = Convert.ToDecimal(style.FillTransparency);

            cmbLabelSizeUnits.SelectedItem          = style.LabelSizeUnits;
            cmbLineThicknessUnit.SelectedItem       = style.LineSizeUnits;
            cmbPolyBorderThicknessUnit.SelectedItem = style.BorderSizeUnits;
            cmbMarkerSizeUnit.SelectedItem          = style.MarkerSizeUnits;
            cmbLinePattern.SelectedItem             = style.LinePattern;
            cmbPolyBorderPattern.SelectedItem       = style.BorderPattern;
            cmbPolyFillPattern.SelectedItem         = style.FillPattern;
            cmbPointMarkerType.SelectedItem         = style.MarkerType;
            cmbLabelStyle.SelectedItem = style.LabelBackStyle;

            clrLabelBackground.BackColor = style.LabelBackColor;
            clrLabelForeground.BackColor = style.LabelForeColor;

            chkTransparent.Checked = style.FillBackTransparency;

            clrPolyFillBackground.BackColor = style.FillBackColor;
            clrPolyFillForeground.BackColor = style.FillForeColor;
            clrLine.BackColor       = style.LineColor;
            clrMarker.BackColor     = style.MarkerColor;
            clrPolyBorder.BackColor = style.BorderColor;

            txtLabelSizeValue.Text           = style.LabelFontSize.ToString(CultureInfo.InvariantCulture);
            txtLineThicknessValue.Text       = style.LineThickness.ToString(CultureInfo.InvariantCulture);
            txtMarkerSizeValue.Text          = style.MarkerSize.ToString(CultureInfo.InvariantCulture);
            txtPolyBorderThicknessValue.Text = style.BorderThickness.ToString(CultureInfo.InvariantCulture);

            chkBold.Checked      = style.LabelBold;
            chkItalic.Checked    = style.LabelItalic;
            chkUnderline.Checked = style.LabelUnderline;
        }
コード例 #4
0
        public NewRedlineLayerDialog(RedlineStyle style, RedlineDataStoreFormat defaultDataStore, int defaultGeometryTypes, string defaultName)
            : this()
        {
            _style = style;
            cmbDataStoreFormat.DataSource = Enum.GetValues(typeof(RedlineDataStoreFormat));

            txtName.Text = defaultName;
            cmbDataStoreFormat.SelectedItem = defaultDataStore;
            if ((defaultGeometryTypes & MgFeatureGeometricType.Point) == MgFeatureGeometricType.Point)
            {
                chkPoints.Checked = true;
            }
            if ((defaultGeometryTypes & MgFeatureGeometricType.Curve) == MgFeatureGeometricType.Curve)
            {
                chkLines.Checked = true;
            }
            if ((defaultGeometryTypes & MgFeatureGeometricType.Surface) == MgFeatureGeometricType.Surface)
            {
                chkPolygons.Checked = true;
            }
        }
コード例 #5
0
ファイル: RedlineManager.cs プロジェクト: achilex/MgDev
        internal void UpdateLayerStyle(RedlineLayer layer, RedlineStyle updatedStyle)
        {
            //HACK: SQLite leaky abstraction (hard-coded schema name), SHP probably has some leaks of its own, so we can't assume MarkupSchema:Markup
            //as the class name interrogate our schema to figure it out
            MgResourceIdentifier fsId = new MgResourceIdentifier(layer.FeatureSource);

            MgFeatureSchemaCollection   schemas = _featSvc.DescribeSchema(fsId, string.Empty, null);
            MgFeatureSchema             schema  = schemas.GetItem(0);
            MgClassDefinitionCollection classes = schema.GetClasses();
            MgClassDefinition           cls     = classes.GetItem(0);
            string className = schema.Name + ":" + cls.Name;

            MgResourceIdentifier ldfId = new MgResourceIdentifier(layer.LayerDefinition);

            string layerDefContent = CreateRedlineLayerDefinitionContent(fsId, className, updatedStyle, layer.StyleType);

            byte[]       bytes      = Encoding.UTF8.GetBytes(layerDefContent);
            MgByteSource byteSource = new MgByteSource(bytes, bytes.Length);
            MgByteReader byteReader = byteSource.GetReader();

            _resSvc.SetResource(ldfId, byteReader, null);
        }
コード例 #6
0
ファイル: RedlineManager.cs プロジェクト: achilex/MgDev
        public RedlineStyle GetLayerStyle(RedlineLayer layer)
        {
            var style = RedlineStyle.CreateDefault();

            var ldfId = new MgResourceIdentifier(layer.LayerDefinition);
            var br    = _resSvc.GetResourceContent(ldfId);
            var doc   = new XmlDocument();

            doc.LoadXml(br.ToString());

            if (layer.StyleType == RedlineStylizationType.Basic)
            {
                var vsr = doc.GetElementsByTagName("VectorScaleRange")[0];
                var pts = vsr["PointTypeStyle"];
                var ats = vsr["AreaTypeStyle"];
                var lts = vsr["LineTypeStyle"];

                if (pts != null)
                {
                    var label = (XmlElement)pts.GetElementsByTagName("Label")[0];
                    var psym  = pts.GetElementsByTagName("PointSymbolization2D");
                    if (psym.Count > 0)
                    {
                        var mark = psym[0]["Mark"];

                        style.MarkerSizeUnits = ParseEnumValue <SizeUnit>(GetNodeValue(mark, "Unit"));
                        style.MarkerSize      = Convert.ToDouble(GetNodeValue(mark, "SizeX"));
                        style.MarkerType      = ParseEnumValue <MarkerType>(GetNodeValue(mark, "Shape"));
                        style.MarkerColor     = Util.FromHtmlColor(GetNodeValue(mark, "ForegroundColor"), false);
                    }
                    style.LabelSizeUnits = ParseEnumValue <SizeUnit>(GetNodeValue(label, "Unit"));
                    style.LabelFontSize  = Convert.ToDouble(GetNodeValue(label, "SizeX"));
                    style.LabelForeColor = Util.FromHtmlColor(GetNodeValue(label, "ForegroundColor"), false);
                    style.LabelBackColor = Util.FromHtmlColor(GetNodeValue(label, "BackgroundColor"), false);
                    style.LabelBackStyle = ParseEnumValue <LabelStyle>(GetNodeValue(label, "BackgroundStyle"));
                    style.LabelBold      = Convert.ToBoolean(GetNodeValue(label, "Bold"));
                    style.LabelItalic    = Convert.ToBoolean(GetNodeValue(label, "Italic"));
                    style.LabelUnderline = Convert.ToBoolean(GetNodeValue(label, "Underlined"));
                }
                if (lts != null)
                {
                    var label = (XmlElement)lts.GetElementsByTagName("Label")[0];

                    style.LabelSizeUnits = ParseEnumValue <SizeUnit>(GetNodeValue(label, "Unit"));
                    style.LabelFontSize  = Convert.ToDouble(GetNodeValue(label, "SizeX"));
                    style.LabelForeColor = Util.FromHtmlColor(GetNodeValue(label, "ForegroundColor"), false);
                    style.LabelBackColor = Util.FromHtmlColor(GetNodeValue(label, "BackgroundColor"), false);
                    style.LabelBackStyle = ParseEnumValue <LabelStyle>(GetNodeValue(label, "BackgroundStyle"));

                    if (pts == null)
                    {
                        style.LabelBold      = Convert.ToBoolean(GetNodeValue(label, "Bold"));
                        style.LabelItalic    = Convert.ToBoolean(GetNodeValue(label, "Italic"));
                        style.LabelUnderline = Convert.ToBoolean(GetNodeValue(label, "Underlined"));
                    }

                    var lsym = lts.GetElementsByTagName("LineSymbolization2D");
                    if (lsym.Count > 0)
                    {
                        var line = (XmlElement)lsym[0];
                        style.LinePattern   = ParseEnumValue <LinePattern>(GetNodeValue(line, "LineStyle"));
                        style.LineThickness = Convert.ToDouble(GetNodeValue(line, "Thickness"));
                        style.LineColor     = Util.FromHtmlColor(GetNodeValue(line, "Color"), false);
                        style.LineSizeUnits = ParseEnumValue <SizeUnit>(GetNodeValue(line, "Unit"));
                    }
                }
                if (ats != null)
                {
                    var label = (XmlElement)ats.GetElementsByTagName("Label")[0];

                    style.LabelSizeUnits = ParseEnumValue <SizeUnit>(GetNodeValue(label, "Unit"));
                    style.LabelFontSize  = Convert.ToDouble(GetNodeValue(label, "SizeX"));
                    style.LabelForeColor = Util.FromHtmlColor(GetNodeValue(label, "ForegroundColor"), false);
                    style.LabelBackColor = Util.FromHtmlColor(GetNodeValue(label, "BackgroundColor"), false);
                    style.LabelBackStyle = ParseEnumValue <LabelStyle>(GetNodeValue(label, "BackgroundStyle"));

                    if (pts == null && lts == null)
                    {
                        style.LabelBold      = Convert.ToBoolean(GetNodeValue(label, "Bold"));
                        style.LabelItalic    = Convert.ToBoolean(GetNodeValue(label, "Italic"));
                        style.LabelUnderline = Convert.ToBoolean(GetNodeValue(label, "Underlined"));
                    }

                    var asym = ats.GetElementsByTagName("AreaSymbolization2D");
                    if (asym.Count > 0)
                    {
                        var fill   = asym[0]["Fill"];
                        var stroke = asym[0]["Stroke"];

                        style.FillPattern   = ParseEnumValue <FillPattern>(GetNodeValue(fill, "FillPattern"));
                        style.FillForeColor = Util.FromHtmlColor(GetNodeValue(fill, "ForegroundColor"), false);
                        style.FillBackColor = Util.FromHtmlColor(GetNodeValue(fill, "BackgroundColor"), false);

                        style.BorderPattern   = ParseEnumValue <LinePattern>(GetNodeValue(stroke, "LineStyle"));
                        style.BorderThickness = Convert.ToDouble(GetNodeValue(stroke, "Thickness"));
                        style.BorderColor     = Util.FromHtmlColor(GetNodeValue(stroke, "Color"));
                        style.BorderSizeUnits = ParseEnumValue <SizeUnit>(GetNodeValue(stroke, "Unit"));
                    }
                }
            }
            else
            {
                var extData = doc.GetElementsByTagName("ExtendedData1");
                if (extData.Count == 1)
                {
                    var ext = (XmlElement)extData[0];
                    style.MarkerColor          = Util.FromHtmlColor(GetNodeValue(ext, "MG_MARKER_COLOR"));
                    style.MarkerType           = ParseEnumValue <MarkerType>(GetNodeValue(ext, "MG_MARKER_TYPE"));
                    style.MarkerSizeUnits      = ParseEnumValue <SizeUnit>(GetNodeValue(ext, "MG_MARKER_UNITS"));
                    style.MarkerSize           = Convert.ToDouble(GetNodeValue(ext, "MG_MARKER_SIZE"));
                    style.LineColor            = Util.FromHtmlColor(GetNodeValue(ext, "MG_LINE_COLOR"));
                    style.LinePattern          = ParseEnumValue <LinePattern>(GetNodeValue(ext, "MG_LINE_PATTERN"));
                    style.LineSizeUnits        = ParseEnumValue <SizeUnit>(GetNodeValue(ext, "MG_LINE_UNITS"));
                    style.LineThickness        = Convert.ToDouble(GetNodeValue(ext, "MG_LINE_THICKNESS"));
                    style.FillPattern          = ParseEnumValue <FillPattern>(GetNodeValue(ext, "MG_FILL_PATTERN"));
                    style.FillTransparency     = 100 - ((Convert.ToInt32(GetNodeValue(ext, "MG_FILL_FORE_TRANSPARENCY"), 16) / 255.0) * 100.0);
                    style.FillForeColor        = Util.FromHtmlColor(GetNodeValue(ext, "MG_FILL_FORE_COLOR"));
                    style.FillBackColor        = Util.FromHtmlColor(GetNodeValue(ext, "MG_FILL_BACK_COLOR"));
                    style.FillBackTransparency = (GetNodeValue(ext, "MG_FILL_BACK_TRANSPARENCY") == "FF");
                    style.BorderPattern        = ParseEnumValue <LinePattern>(GetNodeValue(ext, "MG_BORDER_PATTERN"));
                    style.BorderSizeUnits      = ParseEnumValue <SizeUnit>(GetNodeValue(ext, "MG_BORDER_UNITS"));
                    style.BorderColor          = Util.FromHtmlColor(GetNodeValue(ext, "MG_BORDER_COLOR"));
                    style.BorderThickness      = Convert.ToDouble(GetNodeValue(ext, "MG_BORDER_THICKNESS"));
                    style.LabelSizeUnits       = ParseEnumValue <SizeUnit>(GetNodeValue(ext, "MG_LABEL_FONT_UNITS"));
                    style.LabelFontSize        = Convert.ToDouble(GetNodeValue(ext, "MG_LABEL_FONT_SIZE"));
                    style.LabelBold            = Convert.ToBoolean(GetNodeValue(ext, "MG_BOLD"));
                    style.LabelItalic          = Convert.ToBoolean(GetNodeValue(ext, "MG_ITALIC"));
                    style.LabelUnderline       = Convert.ToBoolean(GetNodeValue(ext, "MG_UNDERLINE"));
                    style.LabelForeColor       = Util.FromHtmlColor(GetNodeValue(ext, "MG_LABEL_FORECOLOR"));
                    style.LabelBackColor       = Util.FromHtmlColor(GetNodeValue(ext, "MG_LABEL_BACKCOLOR"));
                    style.LabelBackStyle       = ParseEnumValue <LabelStyle>(GetNodeValue(ext, "MG_LABEL_STYLE"));
                }
            }

            return(style);
        }
コード例 #7
0
ファイル: RedlineManager.cs プロジェクト: achilex/MgDev
        private string CreateRedlineLayerDefinitionContent(MgResourceIdentifier fsId, string className, RedlineStyle style, RedlineStylizationType type)
        {
            double transpc           = (100 - style.FillTransparency) / 100;
            string hexFgTransparency = string.Format("{0:X2}", Convert.ToInt32(255 * transpc)); //Convert % to alpha value
            string hexBgTransparency = style.FillBackTransparency ? "FF" : "00";                //All or nothing

            if (type == RedlineStylizationType.Basic)
            {
                string template = Strings.markuplayerdefinition;
                return(Util.Substitute(template,
                                       new string [] {
                    fsId.ToString(),                                                //<ResourceId> - Feature Source
                    className,                                                      //<FeatureName> - Class Name
                    style.LabelSizeUnits.ToString(),                                //<Unit> - Mark Label
                    style.LabelFontSize.ToString(CultureInfo.InvariantCulture),     //<SizeX> - Mark Label Size
                    style.LabelFontSize.ToString(CultureInfo.InvariantCulture),     //<SizeY> - Mark Label Size
                    "FF" + Util.ToHtmlColor(style.LabelForeColor),                  //<ForegroundColor> - Mark Label
                    "FF" + Util.ToHtmlColor(style.LabelBackColor),                  //<BackgroundColor> - Mark Label
                    style.LabelBackStyle.ToString(),                                //<BackgroundStyle> - Mark Label
                    style.LabelBold.ToString().ToLower(),                           //<Bold> - Mark Label
                    style.LabelItalic.ToString().ToLower(),                         //<Bold> - Mark Label
                    style.LabelUnderline.ToString().ToLower(),                      //<Underlined> - Mark Label
                    style.MarkerSizeUnits.ToString(),                               //<Unit> - Mark
                    style.MarkerSize.ToString(CultureInfo.InvariantCulture),        //<SizeX> - Mark
                    style.MarkerSize.ToString(CultureInfo.InvariantCulture),        //<SizeY> - Mark
                    style.MarkerType.ToString(),                                    //<Shape> - Mark
                    "FF" + Util.ToHtmlColor(style.MarkerColor),                     //<ForegroundColor> - Mark
                    "FF" + Util.ToHtmlColor(style.MarkerColor),                     //<Color> - Mark
                    style.LabelSizeUnits.ToString(),                                //<Unit> - Line Label
                    style.LabelFontSize.ToString(CultureInfo.InvariantCulture),     //<SizeX> - Line Label Size
                    style.LabelFontSize.ToString(CultureInfo.InvariantCulture),     //<SizeY> - Line Label Size
                    "FF" + Util.ToHtmlColor(style.LabelForeColor),                  //<ForegroundColor> - Line Label
                    "FF" + Util.ToHtmlColor(style.LabelBackColor),                  //<BackgroundColor> - Line Label
                    style.LabelBackStyle.ToString(),                                //<BackgroundStyle> - Line Label
                    style.LabelBold.ToString().ToLower(),                           //<Bold> - Line Label
                    style.LabelItalic.ToString().ToLower(),                         //<Bold> - Line Label
                    style.LabelUnderline.ToString().ToLower(),                      //<Underlined> - Line Label
                    style.LinePattern.ToString(),                                   //<LineStyle> - Line
                    style.LineThickness.ToString(CultureInfo.InvariantCulture),     //<Thickness> - Line
                    "FF" + Util.ToHtmlColor(style.LineColor),                       //<Color> - Line
                    style.LineSizeUnits.ToString(),                                 //<Unit> - Line
                    style.LabelSizeUnits.ToString(),                                //<Unit> - Polygon Label
                    style.LabelFontSize.ToString(CultureInfo.InvariantCulture),     //<SizeX> - Polygon Label Size
                    style.LabelFontSize.ToString(CultureInfo.InvariantCulture),     //<SizeY> - Polygon Label Size
                    "FF" + Util.ToHtmlColor(style.LabelForeColor),                  //<ForegroundColor> - Polygon Label
                    "FF" + Util.ToHtmlColor(style.LabelBackColor),                  //<BackgroundColor> - Polygon Label
                    style.LabelBackStyle.ToString(),                                //<BackgroundStyle> - Polygon Label
                    style.LabelBold.ToString().ToLower(),                           //<Bold> - Polygon Label
                    style.LabelItalic.ToString().ToLower(),                         //<Bold> - Polygon Label
                    style.LabelUnderline.ToString().ToLower(),                      //<Underlined> - Polygon Label
                    style.FillPattern.ToString(),                                   //<FillPattern> - Fill
                    hexFgTransparency + Util.ToHtmlColor(style.FillForeColor),      //<ForegroundColor> - Fill
                    hexBgTransparency + Util.ToHtmlColor(style.FillBackColor),      //<BackgroundColor> - Fill
                    style.BorderPattern.ToString(),                                 //<LineStyle> - Fill
                    style.BorderThickness.ToString(CultureInfo.InvariantCulture),   //<Thickness> - Fill
                    "FF" + Util.ToHtmlColor(style.BorderColor),                     //<Color> - Fill
                    style.BorderSizeUnits.ToString()                                //<Unit> - Fill
                }));
            }
            else
            {
                StringBuilder template       = new StringBuilder(Strings.markuplayerdefinition_advanced);
                double        fontHeight     = SizeInMM(style.LabelFontSize, style.LabelSizeUnits);
                string        labelForeColor = "FF" + Util.ToHtmlColor(style.LabelForeColor);
                string        labelBackColor = "FF" + Util.ToHtmlColor(style.LabelBackColor);

                //Substitute inner templates first, so their placeholders tokens are also brought in
                template.Replace("#{FILL_PATTERN_TEMPLATE}", GetFillPatternTemplate(style.FillPattern));
                template.Replace("#{BORDER_PATTERN_TEMPLATE}", GetBorderPatternGeometry(style.BorderPattern));

                //For non-opaque labels we need to empty the frame fill color
                if (style.LabelBackStyle == LabelStyle.Opaque)
                {
                    template.Replace("#{FRAME_FILL_COLOR}", "0xffffffff");
                }
                else
                {
                    template.Replace("#{FRAME_FILL_COLOR}", string.Empty);
                    if (style.LabelBackStyle == LabelStyle.Transparent)
                    {
                        labelBackColor = string.Empty;
                    }
                }

                //I don't think this is correct wrt to the UI, but this is to replicate the behaviour that we currently have under basic stylization
                //If fill is solid and background color is fully transparent, comment that portion out of the composite type style as it will interfere
                //with the area foreground symbol
                if (style.FillPattern == FillPattern.Solid && hexBgTransparency == "FF")
                {
                    template.Replace("#{START_BACKGROUND_FILL}", "<!--");
                    template.Replace("#{END_BACKGROUND_FILL}", "-->");
                }
                else
                {
                    template.Replace("#{START_BACKGROUND_FILL}", "");
                    template.Replace("#{END_BACKGROUND_FILL}", "");
                }

                //Then do a find/replace of all known tokens
                template.Replace("#{RESOURCE_ID}", fsId.ToString());
                template.Replace("#{FEATURE_CLASS}", className);
                template.Replace("#{FONT_HEIGHT}", fontHeight.ToString(CultureInfo.InvariantCulture));
                template.Replace("#{LABEL_FORE_COLOR}", labelForeColor);
                template.Replace("#{LABEL_BACK_COLOR}", labelBackColor);
                template.Replace("#{BOLD}", style.LabelBold.ToString().ToLower());
                template.Replace("#{ITALIC}", style.LabelItalic.ToString().ToLower());
                template.Replace("#{UNDERLINE}", style.LabelUnderline.ToString().ToLower());
                template.Replace("#{MARKER_GEOMETRY}", GetMarkerGeometry(style.MarkerType));
                template.Replace("#{MARKER_SIZE_X}", GetMarkerSize(style.MarkerSize, style.MarkerSizeUnits));
                template.Replace("#{MARKER_SIZE_Y}", GetMarkerSize(style.MarkerSize, style.MarkerSizeUnits));
                template.Replace("#{MARKER_COLOR}", "FF" + Util.ToHtmlColor(style.MarkerColor));
                template.Replace("#{LINE_PATTERN_GEOMETRY}", GetLinePatternGeometry(style.LinePattern));
                template.Replace("#{LINE_THICKNESS}", GetLineThickness(style.LineThickness, style.LineSizeUnits));
                template.Replace("#{LINE_COLOR}", "FF" + Util.ToHtmlColor(style.LineColor));
                template.Replace("#{FILL_BACK_COLOR}", hexBgTransparency + Util.ToHtmlColor(style.FillBackColor));
                template.Replace("#{FILL_FORE_COLOR}", hexFgTransparency + Util.ToHtmlColor(style.FillForeColor));
                template.Replace("#{BORDER_THICKNESS}", SizeInMM(style.BorderThickness, style.BorderSizeUnits).ToString(CultureInfo.InvariantCulture));
                template.Replace("#{BORDER_COLOR}", "FF" + Util.ToHtmlColor(style.BorderColor));

                //Fill in the UI values under ExtendedData, so we can read from this element if we need to go back to Edit Style UI
                template.Replace("#{MG_RESOURCE_ID}", fsId.ToString());
                template.Replace("#{MG_FEATURE_CLASS}", className);
                template.Replace("#{MG_FILL_PATTERN}", style.FillPattern.ToString());
                template.Replace("#{MG_BORDER_PATTERN}", style.BorderPattern.ToString());
                template.Replace("#{MG_LINE_PATTERN}", style.LinePattern.ToString());
                template.Replace("#{MG_LABEL_FONT_SIZE}", style.LabelFontSize.ToString(CultureInfo.InvariantCulture));
                template.Replace("#{MG_LABEL_FONT_UNITS}", style.LabelSizeUnits.ToString());
                template.Replace("#{MG_LABEL_FORECOLOR}", Util.ToHtmlColor(style.LabelForeColor));
                template.Replace("#{MG_LABEL_BACKCOLOR}", Util.ToHtmlColor(style.LabelBackColor));
                template.Replace("#{MG_BOLD}", style.LabelBold.ToString().ToLower());
                template.Replace("#{MG_ITALIC}", style.LabelItalic.ToString().ToLower());
                template.Replace("#{MG_UNDERLINE}", style.LabelUnderline.ToString().ToLower());
                template.Replace("#{MG_MARKER_TYPE}", style.MarkerType.ToString());
                template.Replace("#{MG_MARKER_SIZE}", style.MarkerSize.ToString(CultureInfo.InvariantCulture));
                template.Replace("#{MG_MARKER_UNITS}", style.MarkerSizeUnits.ToString());
                template.Replace("#{MG_MARKER_COLOR}", Util.ToHtmlColor(style.MarkerColor));
                template.Replace("#{MG_LINE_THICKNESS}", style.LineThickness.ToString(CultureInfo.InvariantCulture));
                template.Replace("#{MG_LINE_UNITS}", style.LineSizeUnits.ToString());
                template.Replace("#{MG_LINE_COLOR}", Util.ToHtmlColor(style.LineColor));
                template.Replace("#{MG_FILL_BACK_COLOR}", Util.ToHtmlColor(style.FillBackColor));
                template.Replace("#{MG_FILL_FORE_COLOR}", Util.ToHtmlColor(style.FillForeColor));
                template.Replace("#{MG_FILL_FORE_TRANSPARENCY}", hexFgTransparency);
                template.Replace("#{MG_FILL_BACK_TRANSPARENCY}", hexBgTransparency);
                template.Replace("#{MG_BORDER_THICKNESS}", style.BorderThickness.ToString(CultureInfo.InvariantCulture));
                template.Replace("#{MG_BORDER_UNITS}", style.BorderSizeUnits.ToString());
                template.Replace("#{MG_BORDER_COLOR}", Util.ToHtmlColor(style.BorderColor));
                template.Replace("#{MG_LABEL_STYLE}", style.LabelBackStyle.ToString());

                return(template.ToString());
            }
        }
コード例 #8
0
ファイル: RedlineStyleDialog.cs プロジェクト: achilex/MgDev
 public RedlineStyleDialog(RedlineStyle style)
     : this()
 {
     InitFromStyle(style);
 }