Пример #1
0
        private void onSpatialReferenceChanged()
        {
            _geoFactory = _geoFactory.Clone();
            _geoFactory.SpatialReference = SpatialReference;

            foreach (ILayer layer in _layers)
            {
                if (!layer.SpatialReference.EqualParams(SpatialReference))
                {
                    if (layer.CoordinateTransformation != null)
                    {
                        // TODO: do we ever need to support multiple transforms?
                        throw new InvalidOperationException("The layer already has a coordinate transform.");
                    }

                    layer.CoordinateTransformation
                        = CoordinateTransformFactory.CreateFromCoordinateSystems(layer.SpatialReference,
                                                                                 SpatialReference);
                }
            }

            _extents = null;

            raisePropertyChanged(SpatialReferenceProperty.Name);
        }
Пример #2
0
        protected SpatialDbProviderBase(IDbUtility dbUtility,
                                        IGeometryFactory geometryFactory,
                                        String connectionString,
                                        String tableSchema,
                                        String tableName,
                                        String oidColumn,
                                        String geometryColumn,
                                        ICoordinateTransformationFactory coordinateTransformationFactory)
        {
            DbUtility                = dbUtility;
            GeometryFactory          = geometryFactory.Clone();
            OriginalSpatialReference = GeometryFactory.SpatialReference;
            OriginalSrid             = GeometryFactory.Srid;

            if (geometryFactory.SpatialReference != null)
            {
                _geometryFactorySridInt = SridMap.DefaultInstance.Process(geometryFactory.SpatialReference, (int?)null);
            }

            if (!String.IsNullOrEmpty(connectionString))
            {
                ConnectionString = connectionString;
            }

            if (!String.IsNullOrEmpty(tableSchema))
            {
                TableSchema = tableSchema;
            }

            if (!String.IsNullOrEmpty(oidColumn))
            {
                OidColumn = oidColumn;
            }

            if (!String.IsNullOrEmpty(geometryColumn))
            {
                GeometryColumn = geometryColumn;
            }

            if (!String.IsNullOrEmpty(tableName))
            {
                Table = tableName;
            }

            CoordinateTransformationFactory = coordinateTransformationFactory;

            ICoordinateSystem cs;
            string            srid;

            ReadSpatialReference(out cs, out srid);

            OriginalSpatialReference         = cs;
            OriginalSrid                     = srid;
            GeometryFactory.SpatialReference = SpatialReference;
            GeometryFactory.Srid             = Srid;
        }