internal SpatialContextInfo(ISpatialContextReader reader)
 {
     this.CoordinateSystem = reader.GetCoordinateSystem();
     this.CoordinateSystemWkt = reader.GetCoordinateSystemWkt();
     this.Description = reader.GetDescription();
     this.ExtentType = reader.GetExtentType();
     this.Name = reader.GetName();
     this.XYTolerance = reader.GetXYTolerance();
     this.ZTolerance = reader.GetZTolerance();
     this.IsActive = reader.IsActive();
     try
     {
         byte[] bGeom = reader.GetExtent();
         if (bGeom != null)
         {
             using (FgfGeometryFactory factory = new FgfGeometryFactory())
             using (IGeometry geom = factory.CreateGeometryFromFgf(bGeom))
             {
                 this.ExtentGeometryText = geom.Text;
             }
         }
     }
     catch
     {
         this.ExtentGeometryText = null;
     }
 }
示例#2
0
 internal SpatialContextInfo(ISpatialContextReader reader)
 {
     this.CoordinateSystem    = reader.GetCoordinateSystem();
     this.CoordinateSystemWkt = reader.GetCoordinateSystemWkt();
     this.Description         = reader.GetDescription();
     this.ExtentType          = reader.GetExtentType();
     this.Name        = reader.GetName();
     this.XYTolerance = reader.GetXYTolerance();
     this.ZTolerance  = reader.GetZTolerance();
     this.IsActive    = reader.IsActive();
     try
     {
         byte[] bGeom = reader.GetExtent();
         if (bGeom != null)
         {
             using (FgfGeometryFactory factory = new FgfGeometryFactory())
                 using (IGeometry geom = factory.CreateGeometryFromFgf(bGeom))
                 {
                     this.ExtentGeometryText = geom.Text;
                 }
         }
     }
     catch
     {
         this.ExtentGeometryText = null;
     }
 }
        public static OSGeo.FDO.Geometry.IGeometry GetGeometry(IFeatureReader reader, string name)
        {
            byte[] geometryBytes = reader.GetGeometry(name);

            FgfGeometryFactory geometryFactory = new FgfGeometryFactory();
            IGeometry          geometry        = geometryFactory.CreateGeometryFromFgf(geometryBytes);

            return(geometry);
        }
        /// <summary>
        /// Loads a FDO XML configuration document
        /// </summary>
        /// <param name="xmlFile"></param>
        /// <returns></returns>
        public static FdoDataStoreConfiguration FromFile(string xmlFile)
        {
            using (var fact = new FgfGeometryFactory())
                using (var ios = new IoFileStream(xmlFile, "r"))
                {
                    using (var reader = new XmlReader(ios))
                    {
                        List <SpatialContextInfo> contexts = new List <SpatialContextInfo>();
                        using (var scReader = new XmlSpatialContextReader(reader))
                        {
                            while (scReader.ReadNext())
                            {
                                var sc = new SpatialContextInfo();
                                sc.CoordinateSystem    = scReader.GetCoordinateSystem();
                                sc.CoordinateSystemWkt = scReader.GetCoordinateSystemWkt();
                                sc.Description         = scReader.GetDescription();
                                sc.ExtentType          = scReader.GetExtentType();
                                if (sc.ExtentType == OSGeo.FDO.Commands.SpatialContext.SpatialContextExtentType.SpatialContextExtentType_Static)
                                {
                                    using (var geom = fact.CreateGeometryFromFgf(scReader.GetExtent()))
                                    {
                                        sc.ExtentGeometryText = geom.Text;
                                    }
                                }
                                sc.IsActive    = scReader.IsActive();
                                sc.Name        = scReader.GetName();
                                sc.XYTolerance = scReader.GetXYTolerance();
                                sc.ZTolerance  = scReader.GetZTolerance();

                                contexts.Add(sc);
                            }
                        }

                        ios.Reset();

                        var schemas = new FeatureSchemaCollection(null);
                        schemas.ReadXml(ios);

                        ios.Reset();

                        var mappings = new PhysicalSchemaMappingCollection();
                        mappings.ReadXml(ios);

                        ios.Close();

                        return(new FdoDataStoreConfiguration(schemas, contexts.ToArray(), mappings));
                    }
                }
        }
        /// <summary>
        /// Loads a FDO XML configuration document
        /// </summary>
        /// <param name="xmlFile"></param>
        /// <returns></returns>
        public static FdoDataStoreConfiguration FromFile(string xmlFile)
        {
            using (var fact = new FgfGeometryFactory())
            using (var ios = new IoFileStream(xmlFile, "r"))
            {
                using (var reader = new XmlReader(ios))
                {
                    List<SpatialContextInfo> contexts = new List<SpatialContextInfo>();
                    using (var scReader = new XmlSpatialContextReader(reader))
                    {
                        while (scReader.ReadNext())
                        {
                            var sc = new SpatialContextInfo();
                            sc.CoordinateSystem = scReader.GetCoordinateSystem();
                            sc.CoordinateSystemWkt = scReader.GetCoordinateSystemWkt();
                            sc.Description = scReader.GetDescription();
                            sc.ExtentType = scReader.GetExtentType();
                            if (sc.ExtentType == OSGeo.FDO.Commands.SpatialContext.SpatialContextExtentType.SpatialContextExtentType_Static)
                            {
                                using (var geom = fact.CreateGeometryFromFgf(scReader.GetExtent()))
                                {
                                    sc.ExtentGeometryText = geom.Text;
                                }
                            }
                            sc.IsActive = scReader.IsActive();
                            sc.Name = scReader.GetName();
                            sc.XYTolerance = scReader.GetXYTolerance();
                            sc.ZTolerance = scReader.GetZTolerance();

                            contexts.Add(sc);
                        }
                    }

                    ios.Reset();

                    var schemas = new FeatureSchemaCollection(null);
                    schemas.ReadXml(ios);

                    ios.Reset();

                    var mappings = new PhysicalSchemaMappingCollection();
                    mappings.ReadXml(ios);

                    ios.Close();

                    return new FdoDataStoreConfiguration(schemas, contexts.ToArray(), mappings);
                }
            }
        }
示例#6
0
 /// <summary>
 /// Gets the geometry object.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <returns></returns>
 public IGeometry GetGeometryObject(string name)
 {
     byte[] fgf = GetGeometry(name);
     return(_internalFactory.CreateGeometryFromFgf(fgf));
 }