Exemple #1
0
        public Layer(XElement node, string ns)
        {
            var att = node.Attribute(XName.Get("queryable"));

            Queryable = att != null && att.Value == "1";

            att      = node.Attribute(XName.Get("cascaded"));
            Cascaded = att != null?int.Parse(att.Value, NumberFormatInfo.InvariantInfo) : 0;

            att    = node.Attribute(XName.Get("opaque"));
            Opaque = att != null && att.Value == "1";

            att       = node.Attribute(XName.Get("noSubsets"));
            NoSubsets = att != null && att.Value == "1";

            att        = node.Attribute(XName.Get("fixedWidth"));
            FixedWidth = att != null?int.Parse(att.Value, NumberFormatInfo.InvariantInfo) : 0;

            att         = node.Attribute(XName.Get("fixedHeight"));
            FixedHeight = att != null?int.Parse(att.Value, NumberFormatInfo.InvariantInfo) : 0;

            var element = node.Element(XName.Get("Name", ns));

            Name = element != null ? element.Value : string.Empty;

            element = node.Element(XName.Get("Title", ns));
            Title   = element != null ? element.Value : string.Empty;

            element  = node.Element(XName.Get("Abstract", ns));
            Abstract = element != null ? element.Value : string.Empty;

            element = node.Element(XName.Get("KeywordList", ns));
            if (element != null)
            {
                _keywordListField = new KeywordList(element, ns);
            }

            foreach (var el in node.Elements(XName.Get("CRS", ns)))
            {
                _crsField.Add(el.Value);
            }

            foreach (var el in node.Elements(XName.Get("SRS", ns)))
            {
                _srsField.Add(el.Value);
            }

            element = node.Element(XName.Get("EX_GeographicBoundingBox", ns));
            if (element != null)
            {
                ExGeographicBoundingBox = new ExGeographicBoundingBox(element, ns);
            }

            BoundingBox = new List <BoundingBox>();
            foreach (var el in node.Elements(XName.Get("BoundingBox", ns)))
            {
                BoundingBox.Add(new BoundingBox(el, ns));
            }

            Dimension = new List <Dimension>();
            foreach (var el in node.Elements(XName.Get("Dimension", ns)))
            {
                Dimension.Add(new Dimension(el, ns));
            }

            element = node.Element(XName.Get("Attribution", ns));
            if (element != null)
            {
                Attribution = new Attribution(element, ns);
            }

            AuthorityURL = new List <AuthorityURL>();
            foreach (var el in node.Elements(XName.Get("AuthorityURL", ns)))
            {
                AuthorityURL.Add(new AuthorityURL(el, ns));
            }

            Identifier = new List <Identifier>();
            foreach (var el in node.Elements(XName.Get("Identifier", ns)))
            {
                Identifier.Add(new Identifier(el, ns));
            }

            MetadataURL = new List <MetadataURL>();
            foreach (var el in node.Elements(XName.Get("MetadataURL", ns)))
            {
                MetadataURL.Add(new MetadataURL(el, ns));
            }

            DataURL = new List <DataURL>();
            foreach (var el in node.Elements(XName.Get("DataURL", ns)))
            {
                DataURL.Add(new DataURL(el, ns));
            }

            FeatureListURL = new List <FeatureListURL>();
            foreach (var el in node.Elements(XName.Get("FeatureListURL", ns)))
            {
                FeatureListURL.Add(new FeatureListURL(el, ns));
            }

            Style = new List <Style>();
            foreach (var el in node.Elements(XName.Get("Style", ns)))
            {
                Style.Add(new Style(el, ns));
            }

            element = node.Element(XName.Get("MinScaleDenominator", ns));
            if (element != null)
            {
                MinScaleDenominator = double.Parse(element.Value, NumberFormatInfo.InvariantInfo);
            }

            element = node.Element(XName.Get("MaxScaleDenominator", ns));
            if (element != null)
            {
                MaxScaleDenominator = double.Parse(element.Value, NumberFormatInfo.InvariantInfo);
            }

            foreach (var layerNode in node.Elements(XName.Get("Layer", ns)))
            {
                ChildLayers.Add(new Layer(layerNode, ns));
            }
        }
Exemple #2
0
        public Layer(XElement node, string ns)
        {
            var att = node.Attribute(XName.Get("queryable"));
            Queryable = att != null && att.Value == "1";

            att = node.Attribute(XName.Get("cascaded"));
            Cascaded = att != null ? int.Parse(att.Value, NumberFormatInfo.InvariantInfo) : 0;

            att = node.Attribute(XName.Get("opaque"));
            Opaque = att != null && att.Value == "1";

            att = node.Attribute(XName.Get("noSubsets"));
            NoSubsets = att != null && att.Value == "1";

            att = node.Attribute(XName.Get("fixedWidth"));
            FixedWidth = att != null ? int.Parse(att.Value, NumberFormatInfo.InvariantInfo) : 0;

            att = node.Attribute(XName.Get("fixedHeight"));
            FixedHeight = att != null ? int.Parse(att.Value, NumberFormatInfo.InvariantInfo) : 0;

            var element = node.Element(XName.Get("Name", ns));
            Name = element != null ? element.Value : string.Empty;

            element = node.Element(XName.Get("Title", ns));
            Title = element != null ? element.Value : string.Empty;

            element = node.Element(XName.Get("Abstract", ns));
            Abstract = element != null ? element.Value : string.Empty;

            element = node.Element(XName.Get("KeywordList", ns));
            if (element != null) _keywordListField = new KeywordList(element, ns);

            foreach (var el in node.Elements(XName.Get("CRS", ns)))
                _crsField.Add(el.Value);

            if (_crsField.Count == 0)
            { }

            element = node.Element(XName.Get("EX_GeographicBoundingBox", ns));
            if (element != null) ExGeographicBoundingBox = new ExGeographicBoundingBox(element, ns);

            BoundingBox = new List<BoundingBox>();
            foreach (var el in node.Elements(XName.Get("BoundingBox", ns)))
                BoundingBox.Add(new BoundingBox(el, ns));

            Dimension = new List<Dimension>();
            foreach (var el in node.Elements(XName.Get("Dimension", ns)))
                Dimension.Add(new Dimension(el, ns));

            element = node.Element(XName.Get("Attribution", ns));
            if (element != null) Attribution = new Attribution(element, ns);

            AuthorityURL = new List<AuthorityURL>();
            foreach (var el in node.Elements(XName.Get("AuthorityURL", ns)))
                AuthorityURL.Add(new AuthorityURL(el, ns));

            Identifier = new List<Identifier>();
            foreach (var el in node.Elements(XName.Get("Identifier", ns)))
                Identifier.Add(new Identifier(el, ns));

            MetadataURL = new List<MetadataURL>();
            foreach (var el in node.Elements(XName.Get("MetadataURL", ns)))
                MetadataURL.Add(new MetadataURL(el, ns));

            DataURL = new List<DataURL>();
            foreach (var el in node.Elements(XName.Get("DataURL", ns)))
                DataURL.Add(new DataURL(el, ns));

            FeatureListURL = new List<FeatureListURL>();
            foreach (var el in node.Elements(XName.Get("FeatureListURL", ns)))
                FeatureListURL.Add(new FeatureListURL(el, ns));

            Style = new List<Style>();
            foreach (var el in node.Elements(XName.Get("Style", ns)))
                Style.Add(new Style(el, ns));

            element = node.Element(XName.Get("MinScaleDenominator", ns));
            if (element != null)
                MinScaleDenominator = double.Parse(element.Value, NumberFormatInfo.InvariantInfo);

            element = node.Element(XName.Get("MaxScaleDenominator", ns));
            if (element != null)
                MaxScaleDenominator = double.Parse(element.Value, NumberFormatInfo.InvariantInfo);

            foreach (var layerNode in node.Elements(XName.Get("Layer", ns)))
                ChildLayers.Add(new Layer(layerNode, ns));
        }