Ejemplo n.º 1
0
        /// <summary>
        /// Set the current element's content from the current XML node
        /// </summary>
        /// <param name="node"></param>
        /// <param name="mgr"></param>
        public void ReadXml(XmlNode node, XmlNamespaceManager mgr)
        {
            if (node.Name != "RasterDefinition") //NOXLATE
            {
                throw new Exception(string.Format(Strings.ErrorBadDocumentExpectedElement, "RasterDefinition"));
            }

            var fc = node.ParentNode.Attributes["name"].Value;                                           //NOXLATE

            this.FeatureClass       = Utility.DecodeFDOName(fc.Substring(0, fc.Length - "Type".Length)); //NOXLATE
            this.RasterPropertyName = node.Attributes["name"].Value;                                     //NOXLATE

            var format       = node["Format"];                                                           //NOXLATE
            var transparent  = node["Transparent"];                                                      //NOXLATE
            var useTileCache = node["UseTileCache"];                                                     //NOXLATE
            var bgcolor      = node["BackgroundColor"];                                                  //NOXLATE
            var time         = node["Time"];                                                             //NOXLATE
            var elevation    = node["Elevation"];                                                        //NOXLATE
            var sc           = node["SpatialContext"];                                                   //NOXLATE

            if (format != null)
            {
                this.ImageFormat = format.InnerText;
            }

            if (transparent != null)
            {
                this.IsTransparent = (transparent.InnerText.ToLower() == "true"); //NOXLATE
            }
            if (useTileCache != null)
            {
                this.UseTileCache = (useTileCache.InnerText.ToLower() == "true"); //NOXLATE
            }
            if (bgcolor != null)
            {
                if (!string.IsNullOrEmpty(bgcolor.InnerText))
                {
                    this.BackgroundColor = bgcolor.InnerText.StartsWith("0x") ? Utility.ParseHTMLColor(bgcolor.InnerText.Substring(2)) : Utility.ParseHTMLColor(bgcolor.InnerText);
                }
                else
                {
                    this.BackgroundColor = default(Color);
                }
            }

            if (time != null)
            {
                this.Time = time.InnerText;
            }

            if (elevation != null)
            {
                this.ElevationDimension = elevation.InnerText;
            }

            if (sc != null)
            {
                this.SpatialContextName = sc.InnerText;
            }

            foreach (XmlNode ln in node.ChildNodes)
            {
                if (ln.Name == "Layer") //NOXLATE
                {
                    var layer = new WmsLayerDefinition();
                    layer.ReadXml(ln, mgr);

                    this.AddLayer(layer);
                }
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Removes the given WMS layer configuration element
 /// </summary>
 /// <param name="layer">The layer.</param>
 public void RemoveLayer(WmsLayerDefinition layer)
 {
     _layers.Remove(layer);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Adds a WMS layer configuration element.
 /// </summary>
 /// <param name="layer">The layer.</param>
 public void AddLayer(WmsLayerDefinition layer)
 {
     _layers.Add(layer);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Removes the given WMS layer configuration element
 /// </summary>
 /// <param name="layer">The layer.</param>
 public void RemoveLayer(WmsLayerDefinition layer)
 {
     _layers.Remove(layer);
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Set the current element's content from the current XML node
        /// </summary>
        /// <param name="node"></param>
        /// <param name="mgr"></param>
        public void ReadXml(System.Xml.XmlNode node, System.Xml.XmlNamespaceManager mgr)
        {
            if (node.Name != "RasterDefinition") //NOXLATE
                throw new Exception(string.Format(Strings.ErrorBadDocumentExpectedElement, "RasterDefinition"));

            var fc = node.ParentNode.Attributes["name"].Value; //NOXLATE
            this.FeatureClass = Utility.DecodeFDOName(fc.Substring(0, fc.Length - "Type".Length)); //NOXLATE
            this.RasterPropertyName = node.Attributes["name"].Value; //NOXLATE

            var format = node["Format"]; //NOXLATE
            var transparent = node["Transparent"]; //NOXLATE
            var useTileCache = node["UseTileCache"]; //NOXLATE
            var bgcolor = node["BackgroundColor"]; //NOXLATE
            var time = node["Time"]; //NOXLATE
            var elevation = node["Elevation"]; //NOXLATE
            var sc = node["SpatialContext"]; //NOXLATE

            if (format != null)
                this.ImageFormat = format.InnerText;

            if (transparent != null)
                this.IsTransparent = (transparent.InnerText.ToLower() == "true"); //NOXLATE

            if (useTileCache != null)
                this.UseTileCache = (useTileCache.InnerText.ToLower() == "true"); //NOXLATE

            if (bgcolor != null)
            {
                if (!string.IsNullOrEmpty(bgcolor.InnerText))
                {
                    if (bgcolor.InnerText.StartsWith("0x")) //NOXLATE
                        this.BackgroundColor = ColorTranslator.FromHtml("#" + bgcolor.InnerText.Substring(2)); //NOXLATE
                    else
                        this.BackgroundColor = ColorTranslator.FromHtml("#" + bgcolor.InnerText); //NOXLATE
                }
                else
                {
                    this.BackgroundColor = default(Color);
                }
            }

            if (time != null)
                this.Time = time.InnerText;

            if (elevation != null)
                this.ElevationDimension = elevation.InnerText;

            if (sc != null)
                this.SpatialContextName = sc.InnerText;

            foreach (XmlNode ln in node.ChildNodes)
            {
                if (ln.Name == "Layer") //NOXLATE
                {
                    var layer = new WmsLayerDefinition();
                    layer.ReadXml(ln, mgr);

                    this.AddLayer(layer);
                }
            }
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Adds a WMS layer configuration element.
 /// </summary>
 /// <param name="layer">The layer.</param>
 public void AddLayer(WmsLayerDefinition layer)
 {
     _layers.Add(layer);
 }