コード例 #1
0
        public void SerializeLabelStyleName()
        {
            LabelStyle labelStyle = new LabelStyle();
            labelStyle.Name = "Test Style";

            String xml = OgcSymbologySerialize.LabelStyle(labelStyle);

            StringAssert.Contains(@"<Name>Test Style</Name>", xml);
            StringAssert.Contains(@"<FeatureTypeStyle", xml);
        }
コード例 #2
0
        public void SerializeLabelStyleDescription()
        {
            LabelStyle labelStyle = new LabelStyle();
            labelStyle.Description = new Description("description","abstract");

            String xml = OgcSymbologySerialize.LabelStyle(labelStyle);

            StringAssert.Contains(@"<Title>description</Title>", xml);
            StringAssert.Contains(@"<Abstract>abstract</Abstract>", xml);
        }
コード例 #3
0
        public static String LabelStyle(LabelStyle style)
        {
            FeatureTypeStyleType rawStyle = new FeatureTypeStyleType();

            if (!String.IsNullOrEmpty(style.Name))
            {
                rawStyle.Name = style.Name;
            }

            if (style.Description != null)
            {
                rawStyle.Description = new DescriptionType();
                rawStyle.Description.Title = style.Description.Title;
                rawStyle.Description.Abstract= style.Description.Abstract;
            }

            return FeatureTypeStyleSerializer.Serialize(rawStyle);
        }
コード例 #4
0
        public static LabelStyle LabelStyle(String xml)
        {
            FeatureTypeStyleType rawStyle = FeatureTypeStyleSerializer.Deserialize(xml);
            LabelStyle labelStyle = new LabelStyle();

            if (!String.IsNullOrEmpty(rawStyle.Name))
            {
                labelStyle.Name = rawStyle.Name;
            }

            if (rawStyle.Description != null)
            {
                labelStyle.Description = new Description(rawStyle.Description.Title,
                                                         rawStyle.Description.Abstract);
            }

            return labelStyle;
        }