Пример #1
0
        public IssueGeodatabaseCreator([NotNull] IFeatureWorkspace featureWorkspace,
                                       [NotNull] IIssueTableFieldManagement fields,
                                       [CanBeNull] ISpatialReference spatialReference,
                                       double gridSize1 = 0d,
                                       double gridSize2 = 0d,
                                       double gridSize3 = 0d)
        {
            Assert.ArgumentNotNull(featureWorkspace, nameof(featureWorkspace));
            Assert.ArgumentNotNull(fields, nameof(fields));

            _featureWorkspace = featureWorkspace;
            _fields           = fields;

            _rowWriter = CreateRowWriter(IssueDatasetUtils.RowClassName, featureWorkspace,
                                         fields, LocalizableStrings.IssuesStandaloneTableName);

            if (spatialReference != null)
            {
                var spatialReferenceCopy =
                    (ISpatialReference)((IClone)spatialReference).Clone();
                if (!spatialReferenceCopy.HasZPrecision())
                {
                    SpatialReferenceUtils.SetZDomain(spatialReferenceCopy,
                                                     -10000, 100000,
                                                     0.0001, 0.001);
                }

                _featureWriters.Add(
                    CreateFeatureWriter(
                        IssueDatasetUtils.PolygonClassName, featureWorkspace, fields,
                        esriGeometryType.esriGeometryPolygon,
                        spatialReferenceCopy, gridSize1, gridSize2, gridSize3,
                        LocalizableStrings.RawIssuesLayerName_Polygon));

                _featureWriters.Add(
                    CreateFeatureWriter(
                        IssueDatasetUtils.PolylineClassName, featureWorkspace, fields,
                        esriGeometryType.esriGeometryPolyline,
                        spatialReferenceCopy, gridSize1, gridSize2, gridSize3,
                        LocalizableStrings.RawIssuesLayerName_Polyline));

                _featureWriters.Add(
                    CreateFeatureWriter(
                        IssueDatasetUtils.MultipointClassName, featureWorkspace, fields,
                        esriGeometryType.esriGeometryMultipoint,
                        spatialReferenceCopy, gridSize1, gridSize2, gridSize3,
                        LocalizableStrings.RawIssuesLayerName_Multipoint));

                _featureWriters.Add(
                    CreateFeatureWriter(
                        IssueDatasetUtils.MultiPatchClassName, featureWorkspace, fields,
                        esriGeometryType.esriGeometryMultiPatch,
                        spatialReferenceCopy, gridSize1, gridSize2, gridSize3,
                        LocalizableStrings.RawIssuesLayerName_MultiPatch));
            }
        }
Пример #2
0
        public void SetupFixture()
        {
            _lic.Checkout();

            _spatialReference =
                SpatialReferenceUtils.CreateSpatialReference(
                    (int)esriSRProjCS2Type.esriSRProjCS_CH1903Plus_LV95,
                    (int)esriSRVerticalCSType.esriSRVertCS_Landeshohennetz1995);
            SpatialReferenceUtils.SetXYDomain(_spatialReference,
                                              -100, -100, 1000, 1000,
                                              0.0001, 0.001);
            SpatialReferenceUtils.SetZDomain(_spatialReference,
                                             -100, 5000,
                                             0.0001, 0.001);
        }
Пример #3
0
        public static IFeatureClass CreateSimpleFeatureClass(
            [NotNull] IFeatureWorkspace workspace,
            [NotNull] string name,
            [CanBeNull] IFieldsEdit fieldsWithoutShapeField,
            esriGeometryType geometryType,
            esriSRProjCS2Type projType,
            double xyTolerance = 0,
            bool hasZ          = false)
        {
            if (fieldsWithoutShapeField == null)
            {
                fieldsWithoutShapeField = new FieldsClass();
                fieldsWithoutShapeField.AddField(FieldUtils.CreateOIDField());
            }

            ISpatialReference spatialReference = SpatialReferenceUtils
                                                 .CreateSpatialReference
                                                     ((int)projType, true);

            if (xyTolerance > 0)
            {
                ((ISpatialReferenceTolerance)spatialReference).XYTolerance =
                    xyTolerance;
            }

            if (hasZ)
            {
                SpatialReferenceUtils.SetZDomain(spatialReference, -10000, 10000,
                                                 0.0001, 0.001);
            }

            fieldsWithoutShapeField.AddField(
                FieldUtils.CreateShapeField("Shape", geometryType, spatialReference, 1000, hasZ));

            IFeatureClass featureClass =
                DatasetUtils.CreateSimpleFeatureClass(
                    workspace, name, fieldsWithoutShapeField);

            // make sure the table is known by the workspace
            ((IWorkspaceEdit)workspace).StartEditing(false);
            ((IWorkspaceEdit)workspace).StopEditing(true);

            return(featureClass);
        }
        private void CreateSpatialReferences()
        {
            _wgs84 = SpatialReferenceUtils.CreateSpatialReference(
                (int)esriSRGeoCSType.esriSRGeoCS_WGS1984);
            SpatialReferenceUtils.SetXYDomain(_wgs84,
                                              -180, -90, 180, 90,
                                              0.00001, 0.0001);
            SpatialReferenceUtils.SetZDomain(_wgs84,
                                             -100, 5000,
                                             0.0001, 0.1);

            _lv03lhn95_xytol_01_ztol_01 =
                SpatialReferenceUtils.CreateSpatialReference(
                    (int)esriSRProjCS2Type.esriSRProjCS_CH1903_LV03,
                    (int)esriSRVerticalCSType.esriSRVertCS_Landeshohennetz1995);
            SpatialReferenceUtils.SetXYDomain(_lv03lhn95_xytol_01_ztol_01,
                                              -100, -100, 1000, 1000,
                                              0.0001, 0.1);
            SpatialReferenceUtils.SetZDomain(_lv03lhn95_xytol_01_ztol_01,
                                             -100, 5000,
                                             0.0001, 0.1);

            _lv95_xytol_01_ztol_01 =
                SpatialReferenceUtils.CreateSpatialReference(
                    (int)esriSRProjCS2Type.esriSRProjCS_CH1903Plus_LV95);
            SpatialReferenceUtils.SetXYDomain(_lv95_xytol_01_ztol_01,
                                              -100, -100, 1000, 1000,
                                              0.0001, 0.1);
            SpatialReferenceUtils.SetZDomain(_lv95_xytol_01_ztol_01,
                                             -100, 5000,
                                             0.0001, 0.1);

            _lv95lhn95_xytol_01_ztol_02 =
                SpatialReferenceUtils.CreateSpatialReference(
                    (int)esriSRProjCS2Type.esriSRProjCS_CH1903Plus_LV95,
                    (int)esriSRVerticalCSType.esriSRVertCS_Landeshohennetz1995);
            SpatialReferenceUtils.SetXYDomain(_lv95lhn95_xytol_01_ztol_02,
                                              -100, -100, 1000, 1000,
                                              0.0001, 0.1);
            SpatialReferenceUtils.SetZDomain(_lv95lhn95_xytol_01_ztol_02,
                                             -100, 5000,
                                             0.0001, 0.2);

            _lv95lhn95_xytol_01_ztol_01 =
                SpatialReferenceUtils.CreateSpatialReference(
                    (int)esriSRProjCS2Type.esriSRProjCS_CH1903Plus_LV95,
                    (int)esriSRVerticalCSType.esriSRVertCS_Landeshohennetz1995);

            SpatialReferenceUtils.SetXYDomain(_lv95lhn95_xytol_01_ztol_01,
                                              -100, -100, 1000, 1000,
                                              0.0001, 0.1);
            SpatialReferenceUtils.SetZDomain(_lv95lhn95_xytol_01_ztol_01,
                                             -100, 5000,
                                             0.0001, 0.1);

            _lv95ln02_xytol_01_ztol_01 =
                SpatialReferenceUtils.CreateSpatialReference(
                    (int)esriSRProjCS2Type.esriSRProjCS_CH1903Plus_LV95,
                    (int)esriSRVerticalCSType.esriSRVertCS_Landesnivellement1902);

            SpatialReferenceUtils.SetXYDomain(_lv95ln02_xytol_01_ztol_01,
                                              -100, -100, 1000, 1000,
                                              0.0001, 0.1);
            SpatialReferenceUtils.SetZDomain(_lv95ln02_xytol_01_ztol_01,
                                             -100, 5000,
                                             0.0001, 0.1);

            _lv95_xytol_02_ztol_01 =
                SpatialReferenceUtils.CreateSpatialReference(
                    (int)esriSRProjCS2Type.esriSRProjCS_CH1903Plus_LV95);
            SpatialReferenceUtils.SetXYDomain(_lv95_xytol_02_ztol_01,
                                              -100, -100, 1000, 1000,
                                              0.0001, 0.2);
            SpatialReferenceUtils.SetZDomain(_lv95_xytol_02_ztol_01,
                                             -100, 5000,
                                             0.0001, 0.1);

            _lv95_xyres_001_zres_001 =
                SpatialReferenceUtils.CreateSpatialReference(
                    (int)esriSRProjCS2Type.esriSRProjCS_CH1903Plus_LV95);
            SpatialReferenceUtils.SetXYDomain(_lv95_xyres_001_zres_001,
                                              -100, -100, 1000, 1000,
                                              0.001, 0.1);
            SpatialReferenceUtils.SetZDomain(_lv95_xyres_001_zres_001,
                                             -100, 5000,
                                             0.001, 0.1);

            _lv95_xyres_001_zres_001_largerdomains =
                SpatialReferenceUtils.CreateSpatialReference(
                    (int)esriSRProjCS2Type.esriSRProjCS_CH1903Plus_LV95);
            SpatialReferenceUtils.SetXYDomain(_lv95_xyres_001_zres_001_largerdomains,
                                              -10000, -10000, 100000, 100000,
                                              0.001, 0.1);
            // note: a different ZMin value makes the ZPrecision different
            // (the same thing is not true for xy precision: domain differences alone
            // don't make the precision different, as long as the grids are compatible)
            SpatialReferenceUtils.SetZDomain(_lv95_xyres_001_zres_001_largerdomains,
                                             -100, 10000,
                                             0.001, 0.1);

            _lv95_xyres_001_zres_001_offsetdomains =
                SpatialReferenceUtils.CreateSpatialReference(
                    (int)esriSRProjCS2Type.esriSRProjCS_CH1903Plus_LV95);
            SpatialReferenceUtils.SetXYDomain(_lv95_xyres_001_zres_001_offsetdomains,
                                              -100.0001, -100, 1000, 1000,
                                              0.001, 0.1);
            SpatialReferenceUtils.SetZDomain(_lv95_xyres_001_zres_001_offsetdomains,
                                             -100.0001, 5000,
                                             0.001, 0.1);

            _lv95_xyres_001_zres_002 =
                SpatialReferenceUtils.CreateSpatialReference(
                    (int)esriSRProjCS2Type.esriSRProjCS_CH1903Plus_LV95,
                    (int)esriSRVerticalCSType.esriSRVertCS_Landesnivellement1902);
            SpatialReferenceUtils.SetXYDomain(_lv95_xyres_001_zres_002,
                                              -100, -100, 1000, 1000,
                                              0.001, 0.1);
            SpatialReferenceUtils.SetZDomain(_lv95_xyres_001_zres_002,
                                             -100, 5000,
                                             0.001, 0.2);

            _lv95_xyres_002_zres_001 =
                SpatialReferenceUtils.CreateSpatialReference(
                    (int)esriSRProjCS2Type.esriSRProjCS_CH1903Plus_LV95);
            SpatialReferenceUtils.SetXYDomain(_lv95_xyres_002_zres_001,
                                              -100, -100, 1000, 1000,
                                              0.002, 0.1);
            SpatialReferenceUtils.SetZDomain(_lv95_xyres_002_zres_001,
                                             -100, 5000,
                                             0.001, 0.1);
        }