示例#1
0
 /// <summary>
 /// Adds the specified raster location to this document
 /// </summary>
 /// <param name="item"></param>
 /// <returns></returns>
 public GdalRasterLocationItem AddLocation(GdalRasterLocationItem item)
 {
     if (!_items.ContainsKey(item.Location))
     {
         _items.Add(item.Location, item);
     }
     return _items[item.Location];
 }
示例#2
0
 /// <summary>
 /// Adds the specified raster location to this document
 /// </summary>
 /// <param name="item"></param>
 /// <returns></returns>
 public GdalRasterLocationItem AddLocation(GdalRasterLocationItem item)
 {
     if (!_items.ContainsKey(item.Location))
     {
         _items.Add(item.Location, item);
     }
     return(_items[item.Location]);
 }
示例#3
0
        /// <summary>
        /// Write this document's schema mappings from the given XML document
        /// </summary>
        /// <param name="node">The node.</param>
        /// <param name="mgr">The namespace manager.</param>
        protected override void ReadSchemaMappings(System.Xml.XmlNode node, System.Xml.XmlNamespaceManager mgr)
        {
            //XmlNodeList mappings = node.SelectNodes("SchemaMapping");
            foreach (XmlNode map in node.ChildNodes)
            {
                if (map.Name != "SchemaMapping") //NOXLATE
                    continue;

                var prv = map.Attributes["provider"]; //NOXLATE
                if (prv == null)
                    throw new Exception(string.Format(Strings.ErrorBadDocumentExpectedAttribute, "provider"));

                var sn = map.Attributes["name"]; //NOXLATE
                if (sn == null)
                    throw new Exception(string.Format(Strings.ErrorBadDocumentExpectedAttribute, "name"));

                if (!prv.Value.StartsWith("OSGeo.Gdal")) //NOXLATE
                    continue;

                //XmlNodeList list = map.SelectNodes("complexType");
                foreach (XmlNode schemaMap in map.ChildNodes)
                {
                    if (schemaMap.Name != "complexType") //NOXLATE
                        continue;

                    var schemaName = schemaMap.Attributes["name"].Value; //NOXLATE
                    schemaName = schemaName.Substring(0, schemaName.Length - 4);
                    if (!SchemaExists(schemaName))
                        continue;

                    var rasterType = schemaMap.FirstChild;
                    var rasterDef = rasterType.FirstChild;

                    if (rasterType.Name != "complexType") //NOXLATE
                        throw new Exception(string.Format(Strings.ErrorBadDocumentExpectedElement, "complexType"));

                    if (rasterDef.Name != "RasterDefinition") //NOXLATE
                        throw new Exception(string.Format(Strings.ErrorBadDocumentExpectedElement, "RasterDefinition"));

                    foreach (XmlNode loc in rasterDef.ChildNodes)
                    {
                        var location = new GdalRasterLocationItem();
                        location.ReadXml(loc, mgr);

                        AddLocation(location);
                    }
                }
            }
        }
示例#4
0
 /// <summary>
 /// Removes the specified raster location from this document
 /// </summary>
 /// <param name="item"></param>
 /// <returns></returns>
 public bool RemoveLocation(GdalRasterLocationItem item)
 {
     return _items.Remove(item.Location);
 }
示例#5
0
 /// <summary>
 /// Removes the specified raster location from this document
 /// </summary>
 /// <param name="item"></param>
 /// <returns></returns>
 public bool RemoveLocation(GdalRasterLocationItem item) => _items.Remove(item.Location);
示例#6
0
        /// <summary>
        /// Write this document's schema mappings from the given XML document
        /// </summary>
        /// <param name="node">The node.</param>
        /// <param name="mgr">The namespace manager.</param>
        protected override void ReadSchemaMappings(System.Xml.XmlNode node, System.Xml.XmlNamespaceManager mgr)
        {
            //XmlNodeList mappings = node.SelectNodes("SchemaMapping");
            foreach (XmlNode map in node.ChildNodes)
            {
                if (map.Name != "SchemaMapping") //NOXLATE
                {
                    continue;
                }

                var prv = map.Attributes["provider"]; //NOXLATE
                if (prv == null)
                {
                    throw new Exception(string.Format(Strings.ErrorBadDocumentExpectedAttribute, "provider"));
                }

                var sn = map.Attributes["name"]; //NOXLATE
                if (sn == null)
                {
                    throw new Exception(string.Format(Strings.ErrorBadDocumentExpectedAttribute, "name"));
                }

                if (!prv.Value.StartsWith("OSGeo.Gdal")) //NOXLATE
                {
                    continue;
                }

                //XmlNodeList list = map.SelectNodes("complexType");
                foreach (XmlNode schemaMap in map.ChildNodes)
                {
                    if (schemaMap.Name != "complexType") //NOXLATE
                    {
                        continue;
                    }

                    var schemaName = schemaMap.Attributes["name"].Value; //NOXLATE
                    schemaName = schemaName.Substring(0, schemaName.Length - 4);
                    if (!SchemaExists(schemaName))
                    {
                        continue;
                    }

                    var rasterType = schemaMap.FirstChild;
                    var rasterDef  = rasterType.FirstChild;

                    if (rasterType.Name != "complexType") //NOXLATE
                    {
                        throw new Exception(string.Format(Strings.ErrorBadDocumentExpectedElement, "complexType"));
                    }

                    if (rasterDef.Name != "RasterDefinition") //NOXLATE
                    {
                        throw new Exception(string.Format(Strings.ErrorBadDocumentExpectedElement, "RasterDefinition"));
                    }

                    foreach (XmlNode loc in rasterDef.ChildNodes)
                    {
                        var location = new GdalRasterLocationItem();
                        location.ReadXml(loc, mgr);

                        AddLocation(location);
                    }
                }
            }
        }