Exemplo n.º 1
0
        public void CanCreateIndexGeometry()
        {
            // TODO: Test umwandeln in CanGetMultiPatchProxy
            _largeData.SpatialReference = SpatialReferenceUtils.CreateSpatialReference
                                          (
                (int)esriSRProjCS2Type.esriSRProjCS_CH1903Plus_LV95);
            var geom = new IndexedPolycurve((IPointCollection4)_largeData);

            foreach (SegmentProxy segment in geom.GetSegments())
            {
                Assert.IsTrue(segment.IsLinear);
            }
        }
        private static NearFeatureCoincidence CreateCoincidenceChecker(
            [NotNull] IFeature feature)
        {
            var indexedSegmentsFeature = feature as IIndexedSegmentsFeature;

            if (indexedSegmentsFeature != null)
            {
                return(new IndexedSegmentsNearFeatureCoincidence(
                           feature, indexedSegmentsFeature.IndexedSegments));
            }

            IGeometry        shape     = feature.Shape;
            esriGeometryType shapeType = shape.GeometryType;

            if (shapeType == esriGeometryType.esriGeometryPolygon ||
                shapeType == esriGeometryType.esriGeometryPolyline)
            {
                var indexedPolycurve = new IndexedPolycurve((IPointCollection4)shape);
                return(new IndexedSegmentsNearFeatureCoincidence(feature, indexedPolycurve));
            }

            if (shapeType == esriGeometryType.esriGeometryMultiPatch)
            {
                IIndexedMultiPatch indexedMultiPatch =
                    QaGeometryUtils.CreateIndexedMultiPatch((IMultiPatch)shape);
                return(new IndexedSegmentsNearFeatureCoincidence(feature,
                                                                 indexedMultiPatch));
            }

            if (shapeType == esriGeometryType.esriGeometryPoint)
            {
                return(new PointNearFeatureCoincidence(feature, (IPoint)shape));
            }

            if (shapeType == esriGeometryType.esriGeometryMultipoint)
            {
                return(new MultipointNearFeatureCoincidence(feature, (IMultipoint)shape));
            }

            throw new InvalidOperationException("Unhandled geometry type: " +
                                                feature.Shape.GeometryType);
        }
Exemplo n.º 3
0
        public void CanCreateIndexGeometryWithTriangles()
        {
            // TODO: Test umwandeln in CanGetMultiPatchProxyWithTriangles
            var construction = new MultiPatchConstruction();

            construction.StartRing(5, 4, 0).Add(-5, 4, 0).Add(-5, -4, 0).Add(5, -4, 0)
            .StartFan(5, 4, 1).Add(-5, 4, 1).Add(-5, -4, 1).Add(5, -4, 1)
            .StartTris(5, 4, 2).Add(-5, 4, 2).Add(-5, -4, 2)
            .StartStrip(5, 4, 3).Add(-5, 4, 3).Add(-5, -4, 3).Add(5, -4, 3);

            IMultiPatch mp = construction.MultiPatch;

            ((IGeometry)mp).SpatialReference = SpatialReferenceUtils.CreateSpatialReference(
                (int)esriSRProjCS2Type.esriSRProjCS_CH1903Plus_LV95);

            var geom = new IndexedPolycurve((IPointCollection4)mp);

            foreach (SegmentProxy segment in geom.GetSegments())
            {
                Assert.IsTrue(segment.IsLinear);
            }
        }