Пример #1
0
        public SchemaDesignContext(FdoConnection conn)
        {
            _spatialContexts = new BindingList <SpatialContextInfo>();

            if (conn == null)
            {
                _schemas  = new FeatureSchemaCollection(null);
                _mappings = new PhysicalSchemaMappingCollection();
            }
            else
            {
                using (var svc = conn.CreateFeatureService())
                {
                    _schemas = svc.DescribeSchema();

                    _mappings = svc.DescribeSchemaMapping(true);
                    if (_mappings == null)
                    {
                        _mappings = new PhysicalSchemaMappingCollection();
                    }

                    var spatialContexts = svc.GetSpatialContexts();
                    foreach (var sc in spatialContexts)
                    {
                        _spatialContexts.Add(sc);
                    }
                }
            }

            this.Connection = conn;

            EvaluateCapabilities();
        }
        public SchemaDesignContext(FdoConnection conn)
        {
            _spatialContexts = new BindingList<SpatialContextInfo>();

            if (conn == null)
            {
                _schemas = new FeatureSchemaCollection(null);
                _mappings = new PhysicalSchemaMappingCollection();
            }
            else
            {
                using (var svc = conn.CreateFeatureService())
                {
                    _schemas = svc.DescribeSchema();
                    _mappings = svc.DescribeSchemaMapping(true);
                    if (_mappings == null)
                        _mappings = new PhysicalSchemaMappingCollection();

                    var spatialContexts = svc.GetSpatialContexts();
                    foreach (var sc in spatialContexts)
                    {
                        _spatialContexts.Add(sc);
                    }
                }
            }

            this.Connection = conn;

            EvaluateCapabilities();
        }
Пример #3
0
        /// <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));
                    }
                }
        }
Пример #4
0
        internal void SetConfiguration(FdoDataStoreConfiguration conf)
        {
            _schemas  = conf.Schemas;
            _mappings = conf.Mappings;

            if (_schemas == null)
            {
                _schemas = new FeatureSchemaCollection(null);
            }

            if (_mappings == null)
            {
                _mappings = new PhysicalSchemaMappingCollection();
            }

            _spatialContexts.Clear();
            if (conf.SpatialContexts != null && conf.SpatialContexts.Length > 0)
            {
                foreach (var sc in conf.SpatialContexts)
                {
                    _spatialContexts.Add(sc);
                }
            }
        }
Пример #5
0
        internal void SetConfiguration(FdoDataStoreConfiguration conf)
        {
            _schemas = conf.Schemas;
            _mappings = conf.Mappings;

            if (_schemas == null)
                _schemas = new FeatureSchemaCollection(null);

            if (_mappings == null)
                _mappings = new PhysicalSchemaMappingCollection();

            _spatialContexts.Clear();
            if (conf.SpatialContexts != null && conf.SpatialContexts.Length > 0)
            {
                foreach (var sc in conf.SpatialContexts)
                {
                    _spatialContexts.Add(sc);
                }
            }
        }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="schemas"></param>
 /// <param name="contexts"></param>
 /// <param name="mappings"></param>
 public FdoDataStoreConfiguration(FeatureSchemaCollection schemas, SpatialContextInfo[] contexts, PhysicalSchemaMappingCollection mappings)
 {
     this.Schemas = schemas;
     this.SpatialContexts = contexts;
     this.Mappings = 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);
                }
            }
        }
Пример #8
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="schemas"></param>
 /// <param name="contexts"></param>
 /// <param name="mappings"></param>
 public FdoDataStoreConfiguration(FeatureSchemaCollection schemas, SpatialContextInfo[] contexts, PhysicalSchemaMappingCollection mappings)
 {
     this.Schemas         = schemas;
     this.SpatialContexts = contexts;
     this.Mappings        = mappings;
 }