private static List <WKSPointVA> GetFromEnumVertex([NotNull] IMultiPatch multiPatch) { var pts = (IPointCollection)multiPatch; int pointCount = pts.PointCount; var result = new List <WKSPointVA>(pointCount); IEnumVertex enumVertex = pts.EnumVertices; enumVertex.Reset(); IPoint p = new PointClass(); int part; int vertex; for (enumVertex.QueryNext(p, out part, out vertex); vertex >= 0; enumVertex.QueryNext(p, out part, out vertex)) { var pnt = new WKSPointVA(); double x; double y; p.QueryCoords(out x, out y); pnt.m_x = x; pnt.m_y = y; pnt.m_z = p.Z; pnt.m_m = p.M; pnt.m_id = p.ID; result.Add(pnt); } return(result); }
private static void AddToMultipatch(IMultiPatch result, IRing ringTemplate, Linestring exteriorRing, IList <Linestring> interiorRings, bool invert, int?pointId) { if (invert) { exteriorRing.ReverseOrientation(); foreach (Linestring interiorRing in interiorRings) { interiorRing.ReverseOrientation(); } } AddRing(result, exteriorRing, ringTemplate, esriMultiPatchRingType.esriMultiPatchOuterRing, pointId); foreach (Linestring interiorRing in interiorRings) { AddRing(result, interiorRing, ringTemplate, esriMultiPatchRingType.esriMultiPatchInnerRing, pointId); } }
public static void SchrijfTrianglesMP(IFeature pFeat) { IMultiPatch pMultiPatch = (IMultiPatch)pFeat.ShapeCopy; IGeometryCollection GeoColl = (IGeometryCollection)pMultiPatch; //Schrijf TrianglesVlag = true Boolean TrianglesVlag = true; WriteBoolean(TrianglesVlag); //Schrijf aantal parts int aantalparts = GeoColl.GeometryCount; Naar3dsMax.binWriter.Write(aantalparts); //int //Loop door de onderdelen for (int i = 0; i < aantalparts; i++) { IPointCollection pPartPoints = (IPointCollection)GeoColl.get_Geometry(i); //Schrijf aantal punten int aantalpunten = pPartPoints.PointCount; Naar3dsMax.binWriter.Write(aantalpunten); //int //Loop door de vertices van de onderdelen for (int n = 0; n < aantalpunten; n++) { SchrijfTransformatie(pPartPoints.get_Point(n)); } } }
//---------------------------------------------------------------------------------- public static void SchrijfRingenMP(IFeature pFeat) { IMultiPatch pMultiPatch = (IMultiPatch)pFeat.ShapeCopy; IGeometryCollection GeoColl = (IGeometryCollection)pMultiPatch; //Schrijf TrianglesVlag = false Boolean TrianglesVlag = false; WriteBoolean(TrianglesVlag); //Schrijf aantalringen int aantalringen = GeoColl.GeometryCount; Naar3dsMax.binWriter.Write(aantalringen); //Loop door de ringencollectie for (int i = 0; i < aantalringen; i++) { IRing pRing = (IRing)GeoColl.get_Geometry(i); Boolean isbeginning = true; esriMultiPatchRingType ringtype = pMultiPatch.GetRingType(pRing, ref isbeginning); //Schrijf Buitenringvlag Boolean Buitenringvlag = (ringtype == esriMultiPatchRingType.esriMultiPatchOuterRing); WriteBoolean(Buitenringvlag); SchrijfRing(pRing); } }
public void Cut3D([NotNull] IMultiPatch cutSurfaces, [CanBeNull] ITrackCancel trackCancel = null) { foreach (IFeature feature in GetFeaturesToCut(cutSurfaces)) { if (trackCancel != null && !trackCancel.Continue()) { return; } try { CutFeature3D(feature, cutSurfaces); } catch (Exception e) { if (!ContinueOnFailure) { throw; } FailedCutOperations.Add( new KeyValuePair <int, string>(feature.OID, e.Message)); } } }
public static void RemovePoints([NotNull] IMultiPatch multipatch, [NotNull] IEnumerable <IPoint> pointsToRemove) { double searchRadius = GeometryUtils.GetSearchRadius(multipatch); var geometryCollection = (IGeometryCollection)multipatch; foreach (IPoint point in pointsToRemove) { // NOTE: Never use hit test with multipatches! It's wrong. foreach ( int partIndex in GeometryUtils.FindPartIndices(geometryCollection, point, searchRadius)) { var ring = ((IGeometryCollection)multipatch).Geometry[partIndex] as IRing; Assert.NotNull(ring, "Multipatch has non-ring geometry"); IGeometry highLevelRing = GeometryUtils.GetHighLevelGeometry(ring, dontClonePath: true); RemovePoint(highLevelRing, point, searchRadius); } } ((IGeometryCollection)multipatch).GeometriesChanged(); }
private static IEnumerable <IPolygon> GetRingsAsPolygons( [NotNull] IMultiPatch multiPatch) { var parts = (IGeometryCollection)multiPatch; var result = new List <IPolygon>(parts.GeometryCount); foreach (IGeometry part in GeometryUtils.GetParts(parts)) { var ring = part as IRing; if (ring == null) { continue; } var isBeginningRing = false; multiPatch.GetRingType(ring, ref isBeginningRing); if (isBeginningRing) { IPolygon ringPolygon = MultiPatchUtils.GetFace(multiPatch, ring); if (!ringPolygon.IsEmpty) { result.Add(ringPolygon); } } } return(result); }
private int CheckRings([NotNull] IMultiPatch multiPatch, [NotNull] IFeature feature) { int errorCount; IEnumerable <KeyValuePair <int, List <IPolygon> > > ringPolygonGroups = GetRingPolygonGroups(multiPatch, feature, out errorCount); foreach (KeyValuePair <int, List <IPolygon> > pair in ringPolygonGroups) { List <IPolygon> ringPolygons = pair.Value; IList <IPolygon> intersections = GetInteriorIntersections(ringPolygons); switch (intersections.Count) { case 0: continue; case 1: errorCount += ReportErrors(feature, intersections[0], pair.Key); break; default: var union = (IPolygon)GeometryUtils.Union(intersections); errorCount += ReportErrors(feature, union, pair.Key); break; } } return(errorCount); }
public static List <esriSegmentInfo> CalculateMultipatchShortSegments( [NotNull] IMultiPatch multipatch, double segmentLength3DToEnforce, [CanBeNull] IGeometry inPerimeter = null) { var sourceCollection = (IGeometryCollection)multipatch; var resultList = new List <esriSegmentInfo>(); for (var i = 0; i < sourceCollection.GeometryCount; i++) { IGeometry originalGeometryPart = sourceCollection.get_Geometry(i); var highLevelPolycurve = (IPolycurve)GeometryUtils.GetHighLevelGeometry(originalGeometryPart); const bool use3DLength = true; IList <esriSegmentInfo> shortSegments = GeometryUtils.GetShortSegments((ISegmentCollection)highLevelPolycurve, segmentLength3DToEnforce, use3DLength, inPerimeter); resultList.AddRange(shortSegments); } return(resultList); }
private static int GetInteriorRingCount([NotNull] IMultiPatch multiPatch) { Assert.ArgumentNotNull(multiPatch, nameof(multiPatch)); var count = 0; foreach (IGeometry part in GeometryUtils.GetParts((IGeometryCollection)multiPatch) ) { var ring = part as IRing; if (ring == null) { continue; } var isBeginningRing = false; esriMultiPatchRingType type = multiPatch.GetRingType(ring, ref isBeginningRing); if ((type & esriMultiPatchRingType.esriMultiPatchInnerRing) != 0) { count++; } } return(count); }
public static IIndexedMultiPatch CreateIndexedMultiPatch( [NotNull] IMultiPatch multiPatch) { var indexedMultiPatch = new IndexedMultiPatch(multiPatch); return(indexedMultiPatch); }
public void CanTestMultiPatches() { var fc = new FeatureClassMock(1, "mock", esriGeometryType.esriGeometryMultiPatch); var construction = new MultiPatchConstruction(); construction.StartOuterRing(5, 4, 0, 1).Add(5, 8, 0, 1).Add(8, 8, 0, 1).Add(8, 4, 0, 1) .StartInnerRing(6, 5, 0, 2).Add(6, 7, 0, 2).Add(7, 7, 0, 2); IMultiPatch multiPatch = construction.MultiPatch; multiPatch.SpatialReference = ((IGeoDataset)fc).SpatialReference; multiPatch.SnapToSpatialReference(); IFeature row1 = fc.CreateFeature(); row1.Shape = multiPatch; row1.Store(); const bool includeInnerRings = true; const bool doNotIncludeInnerRings = false; var test = new QaMpConstantPointIdsPerRing(fc, doNotIncludeInnerRings); var runner = new QaTestRunner(test); runner.Execute(row1); Assert.AreEqual(0, runner.Errors.Count); test = new QaMpConstantPointIdsPerRing(fc, includeInnerRings); runner = new QaTestRunner(test); runner.Execute(row1); Assert.AreEqual(1, runner.Errors.Count); }
private static IEnumerable <List <IRing> > GetPolygons([NotNull] IMultiPatch multipatch, [NotNull] GeometryPart part) { var result = new Dictionary <IRing, List <IRing> >(); foreach (IRing ring in part.LowLevelGeometries.Cast <IRing>()) { bool beginning = false; esriMultiPatchRingType type = multipatch.GetRingType(ring, ref beginning); if (type != esriMultiPatchRingType.esriMultiPatchInnerRing) { result.Add(ring, new List <IRing>()); } else { IRing outerRing = multipatch.FindBeginningRing(ring); Assert.True(result.ContainsKey(outerRing), "No outer ring found for inner ring."); result[outerRing].Add(ring); } } foreach (KeyValuePair <IRing, List <IRing> > keyValuePair in result) { List <IRing> polygonRings = keyValuePair.Value; polygonRings.Insert(0, keyValuePair.Key); yield return(polygonRings); } }
public static void AddRingGroup(IMultiPatch result, RingGroup ringGroup, bool simplify, bool setPointIds) { IRing ringTemplate = GeometryFactory.CreateEmptyRing(result); int?pointId = setPointIds ? ringGroup.Id : null; if (simplify) { IPolygon poly = CreatePolygon(result, ringTemplate, ringGroup); GeometryUtils.Simplify(poly); if (!poly.IsEmpty) { AddToMultipatch(result, poly, false, pointId); return; } } Linestring exteriorRing = ringGroup.ExteriorRing; IList <Linestring> interiorRings = ringGroup.InteriorRings.ToList(); AddToMultipatch(result, ringTemplate, exteriorRing, interiorRings, false, pointId); }
protected static IMultiPatch CopyWithConvertedInnerRings( [NotNull] IMultiPatch multiPatch, [NotNull] IEnumerable <int> outerRingIndexes) { IMultiPatch result = GeometryFactory.Clone(multiPatch); var allFollowingRings = new List <IRing>(); foreach (int outerRingIndex in outerRingIndexes) { var ring = (IRing)((IGeometryCollection)result).Geometry[outerRingIndex]; int followingRingCount = result.FollowingRingCount[ring]; var followingRings = new IRing[followingRingCount]; GeometryUtils.GeometryBridge.QueryFollowingRings(result, ring, ref followingRings); allFollowingRings.AddRange(followingRings); } foreach (IRing followingRing in allFollowingRings) { result.PutRingType(followingRing, esriMultiPatchRingType.esriMultiPatchOuterRing); } return(result); }
public void CanTestEmptyGeometrySdeMultipatch() { IWorkspace workspace = TestUtils.OpenUserWorkspaceOracle(); //IWorkspace workspace = ProSuite.Commons.AO.Test.TestUtils.OpenSDEWorkspaceOracle(); IMultiPatch normalGeometry = GeometryFactory.CreateMultiPatch( GeometryFactory.CreateRing(new[] { new WKSPointZ { X = 2600000, Y = 1200000, Z = 400 }, new WKSPointZ { X = 2600000, Y = 1200100, Z = 400 }, new WKSPointZ { X = 2600100, Y = 1200000, Z = 400 }, new WKSPointZ { X = 2600000, Y = 1200000, Z = 400 }, })); GeometryUtils.MakeZAware(normalGeometry); IFeature feature = CreateEmptyGeometryFeature((IFeatureWorkspace)workspace, esriGeometryType.esriGeometryMultiPatch, normalGeometry); AssertOneErrorEmptyGeometry((IFeatureClass)feature.Class); }
public void CanCutMultipatchWithInnerRingThroughInnerRing() { ISpatialReference lv95 = SpatialReferenceUtils.CreateSpatialReference( WellKnownHorizontalCS.LV95); IPolygon originalPoly = GeometryFactory.CreatePolygon( GeometryFactory.CreateEnvelope(2600000, 1200000, 500, 50, 50, lv95)); IPolygon innerRingPoly = GeometryFactory.CreatePolygon( GeometryFactory.CreateEnvelope(2600000, 1200000, 500, 10, 10, lv95)); var innerRing = (IRing)((IGeometryCollection)innerRingPoly).Geometry[0]; innerRing.ReverseOrientation(); IMultiPatch multiPatch = GeometryFactory.CreateMultiPatch(originalPoly); GeometryFactory.AddRingToMultiPatch(innerRing, multiPatch, esriMultiPatchRingType .esriMultiPatchInnerRing); // cut line cuts through the inner ring IPolyline cutLine = GeometryFactory.CreateLine( GeometryFactory.CreatePoint(2600000 - 100, 1200000), GeometryFactory.CreatePoint(2600000 + 100, 1200000)); cutLine.SpatialReference = lv95; IFeature mockFeature = TestUtils.CreateMockFeature(multiPatch); var cutter = new FeatureCutter(new[] { mockFeature }); cutter.ZSourceProvider = new DatasetSpecificSettingProvider <ChangeAlongZSource>( string.Empty, ChangeAlongZSource.SourcePlane); cutter.Cut(cutLine); IList <IGeometry> results = cutter.ResultGeometriesByFeature[mockFeature]; Assert.AreEqual(2, results.Count); double areaSum = 0; var partCount = 0; foreach (IGeometry result in cutter.ResultGeometriesByFeature[mockFeature]) { Assert.IsFalse(GeometryUtils.HasUndefinedZValues(result)); areaSum += GeometryUtils.GetParts((IGeometryCollection)result) .Sum(part => ((IArea)part).Area); partCount += GeometryUtils.GetParts((IGeometryCollection)result).Count(); } Assert.AreEqual(2, partCount); Assert.AreEqual(((IArea)originalPoly).Area + ((IArea)innerRing).Area, areaSum, 0.0001); }
public void CanReshapeMultipatch() { ISpatialReference lv95 = SpatialReferenceUtils.CreateSpatialReference( WellKnownHorizontalCS.LV95); IPolygon polygon = GeometryFactory.CreatePolygon( GeometryFactory.CreateEnvelope(2600000, 1200000, 500, 50, 20, lv95)); IMultiPatch multiPatch = GeometryFactory.CreateMultiPatch( polygon); IPolyline cutLine = GeometryFactory.CreateLine( GeometryFactory.CreatePoint(2600000 - 100, 1200000), GeometryFactory.CreatePoint(2600000 + 100, 1200000)); cutLine.SpatialReference = lv95; var reshapePath = (IPath)((IGeometryCollection)cutLine).Geometry[0]; var reshapeInfo = new ReshapeInfo(multiPatch, reshapePath, null); IList <ReshapeInfo> singleReshapes; ReshapeUtils.ReshapeAllGeometryParts(reshapeInfo, reshapePath, out singleReshapes); var reshapedRing = (IRing)((IGeometryCollection)multiPatch).Geometry[0]; Assert.True(MathUtils.AreEqual(((IArea)reshapedRing).Area, ((IArea)polygon).Area / 2, 0.1)); }
//---------------------------------------------------------------------------------- public static IGeometry MaakRingenMP() { IGeometryCollection multiPatchGeometryCollection = new MultiPatchClass(); IMultiPatch multiPatch = multiPatchGeometryCollection as IMultiPatch; IPointCollection RingPointCollection; //Lees aantal ringen int aantalringen = ImportInArcscene.binReader.ReadInt32(); for (int i = 0; i < aantalringen; i++) { //Lees buitenringvlag Boolean buitenringvlag = leesboolean(); //Ringtype definieren esriMultiPatchRingType ringtype; if (buitenringvlag) { ringtype = esriMultiPatchRingType.esriMultiPatchOuterRing; } else { ringtype = esriMultiPatchRingType.esriMultiPatchInnerRing; } //Ring RingPointCollection = MaakRingPointCollection(); multiPatchGeometryCollection.AddGeometry(RingPointCollection as IGeometry, ref _missing, ref _missing); multiPatch.PutRingType(RingPointCollection as IRing, ringtype); } return(multiPatchGeometryCollection as IGeometry); }
internal static IEnumerable <PatchProxy> GetPatchProxies( [NotNull] IMultiPatch multiPatch) { int minPartIndex = 0; var parts = multiPatch as IGeometryCollection; if (parts == null) { // no geometry collection yield return(new PatchProxy(0, 0, (IPointCollection4)multiPatch)); } else { int partCount = parts.GeometryCount; for (int partIndex = 0; partIndex < partCount; partIndex++) { var patch = (IPointCollection4)parts.Geometry[partIndex]; try { var patchProxy = new PatchProxy(partIndex, minPartIndex, patch); minPartIndex += patchProxy.PlanesCount; yield return(patchProxy); } finally { Marshal.ReleaseComObject(patch); } } } }
private static double GetMultiPatchPerimeterLength([NotNull] IMultiPatch multiPatch) { IPolygon polygon = GeometryFactory.CreatePolygon(multiPatch); return(polygon.IsEmpty ? 0 : polygon.Length); }
public void SetupFixture() { _lic.Checkout(); _largeData = GetMultiPatch(50000); _testWs = TestWorkspaceUtils.CreateTestFgdbWorkspace("TestMultipatchUtils"); }
private int InitPlaneOffsets(bool reportErrors, [CanBeNull] IFeature involvedFeature) { const int noError = 0; if (_minOffset <= 0 && _maxOffset >= 0) { return(noError); } Plane3D plane = Plane; var unitNormal = UnitNormal; // double nf = plane.Nf; _minOffset = 0; _maxOffset = 0; var segmentsCount = 0; foreach (SegmentProxy segment in SegmentsPlane.Segments) { segmentsCount++; IPnt point = segment.GetStart(true); // double f = normal.X * point.X + normal.Y * point.Y + normal.Z * point[2] + nf; double distanceSigned = plane.GetDistanceSigned(point.X, point.Y, point[2]); double offset = Math.Abs(distanceSigned); if (distanceSigned > 0 == unitNormal[2] > 0 ) // oriented same as normal { _maxOffset = Math.Max(offset, _maxOffset); } else { _minOffset = Math.Min(-offset, _minOffset); } } var coplanarityTolerance = GeomUtils.AdjustCoplanarityTolerance( plane, _parent.CoplanarityTolerance, _parent._zSrTolerance, _parent._xySrTolerance); double maxOffset = Math.Max(Math.Abs(_maxOffset), Math.Abs(_minOffset)); _coplanar = maxOffset < coplanarityTolerance; if (_coplanar || !reportErrors || involvedFeature == null) { return(noError); } IMultiPatch errorGeometry = SegmentUtils.CreateMultiPatch(SegmentsPlane.Segments); return(_parent.ReportNonCoplanarFace(segmentsCount, maxOffset, errorGeometry, involvedFeature)); }
private int ReportCollinearSegments([NotNull] IMultiPatch errorGeometry, [NotNull] IFeature feature) { const string description = "The segments of this face are collinear and do not define a valid plane"; return(ReportError(description, errorGeometry, Codes[Code.FaceDoesNotDefineValidPlane], null, feature)); }
public static IGeometry GetExample5() { const int XRange = 16; const int YRange = 16; const int InteriorRingCount = 25; const double HoleRange = 0.5; //RingGroup: Square Lying In XY Plane With Single Exterior Ring And Multiple Interior Rings IGeometryCollection multiPatchGeometryCollection = new MultiPatchClass(); IMultiPatch multiPatch = multiPatchGeometryCollection as IMultiPatch; //Exterior Ring IPointCollection exteriorRingPointCollection = new RingClass(); exteriorRingPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(0.5 * (XRange + 2), -0.5 * (YRange + 2), 0), ref _missing, ref _missing); exteriorRingPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-0.5 * (XRange + 2), -0.5 * (YRange + 2), 0), ref _missing, ref _missing); exteriorRingPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-0.5 * (XRange + 2), 0.5 * (YRange + 2), 0), ref _missing, ref _missing); exteriorRingPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(0.5 * (XRange + 2), 0.5 * (YRange + 2), 0), ref _missing, ref _missing); IRing exteriorRing = exteriorRingPointCollection as IRing; exteriorRing.Close(); multiPatchGeometryCollection.AddGeometry(exteriorRing as IGeometry, ref _missing, ref _missing); multiPatch.PutRingType(exteriorRing, esriMultiPatchRingType.esriMultiPatchOuterRing); //Interior Rings Random random = new Random(); for (int i = 0; i < InteriorRingCount; i++) { double interiorRingOriginX = XRange * (random.NextDouble() - 0.5); double interiorRingOriginY = YRange * (random.NextDouble() - 0.5); IPointCollection interiorRingPointCollection = new RingClass(); interiorRingPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(interiorRingOriginX - 0.5 * HoleRange, interiorRingOriginY - 0.5 * HoleRange, 0), ref _missing, ref _missing); interiorRingPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(interiorRingOriginX + 0.5 * HoleRange, interiorRingOriginY - 0.5 * HoleRange, 0), ref _missing, ref _missing); interiorRingPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(interiorRingOriginX + 0.5 * HoleRange, interiorRingOriginY + 0.5 * HoleRange, 0), ref _missing, ref _missing); interiorRingPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(interiorRingOriginX - 0.5 * HoleRange, interiorRingOriginY + 0.5 * HoleRange, 0), ref _missing, ref _missing); IRing interiorRing = interiorRingPointCollection as IRing; interiorRing.Close(); multiPatchGeometryCollection.AddGeometry(interiorRing as IGeometry, ref _missing, ref _missing); multiPatch.PutRingType(interiorRing, esriMultiPatchRingType.esriMultiPatchInnerRing); } return(multiPatchGeometryCollection as IGeometry); }
public int ReportErrors([NotNull] IFeature feature) { if (!Plane.IsDefined) { IMultiPatch errorGeometry = SegmentUtils.CreateMultiPatch(SegmentsPlane.Segments); return(_parent.ReportCollinearSegments(errorGeometry, feature)); } return(InitPlaneOffsets(true, feature)); }
public IPoint GetMultiPatchCenter(IMultiPatch pMultiPatch) { IPoint pt = new PointClass(); pt.PutCoords((pMultiPatch.Envelope.XMax + pMultiPatch.Envelope.XMin) / 2, (pMultiPatch.Envelope.YMax + pMultiPatch.Envelope.YMin) / 2); IZAware za = pt as IZAware; za.ZAware = true; pt.Z = (pMultiPatch.Envelope.ZMax + pMultiPatch.Envelope.ZMin) / 2; return(pt); }
private int ReportDisjointFootprintPolygon([NotNull] IFeature feature, [NotNull] IPolygon footprintPolygon, [NotNull] IMultiPatch multiPatch) { IGeometry errorGeometry = GetErrorGeometry(multiPatch, footprintPolygon); IssueCode issueCode = Codes[Code.FootprintHasMultipleParts]; return(ReportError("Footprint of MultiPatch feature contains more than one part", errorGeometry, issueCode, _shapeFieldName, feature)); }
/// <summary> /// 显示参考面 张琪 20110629 /// </summary> /// <param name="pPoly">参考多边形</param> private void ShowRefPlane(IPolygon pPoly) { SysCommon.CProgress vProgress = new SysCommon.CProgress("进度条"); try { IGeometry pBoundary = new PolylineClass(); pBoundary = null; IGeometry pPolygon = new PolygonClass(); pPolygon = null; object StepSize = Type.Missing; m_SurFace.InterpolateShape(pPoly as IGeometry, out pPolygon, ref StepSize); Cls3DMarkDraw.DeleteAllElementsWithName(m_pCurrentSceneControl.Scene, sRefPlaneName); //清除已有的参考面 if (!chkShowLWRP.Checked) //当为false时不显示参考面 { m_pCurrentSceneControl.SceneGraph.RefreshViewers(); return; } vProgress.EnableCancel = false;//设置进度条 vProgress.ShowDescription = true; vProgress.FakeProgress = true; vProgress.TopMost = true; vProgress.ShowProgress(); vProgress.SetProgress("正在绘制参考面"); ITopologicalOperator pTopo = pPolygon as ITopologicalOperator; pBoundary = pTopo.Boundary as IPolyline; //设置Z值方向显示 IZAware pZAware = pBoundary as IZAware; pZAware.ZAware = true; m_SurFace.InterpolateShape(pBoundary as IGeometry, out pBoundary, ref StepSize); m_SurFace.InterpolateShape(pPoly as IGeometry, out pPolygon, ref StepSize); IExtrude pExtrude = new GeometryEnvironmentClass(); //获取参考面的多面体 IMultiPatch pMultiPatchRefPlaneWall = pExtrude.ExtrudeAbsolute(Convert.ToDouble(txtPlaneHeight.Text), pBoundary as IGeometry) as IMultiPatch; pMultiPatchRefPlaneWall.SpatialReference = m_pCurrentSceneControl.Scene.SpatialReference; IZ pZ; pZAware = pPolygon as IZAware; pZAware.ZAware = true; pZ = pPolygon as IZ; pZ.SetConstantZ(Convert.ToDouble(txtPlaneHeight.Text)); //用于绘制三维效果 IGroupElement pGroup = null; Cls3DMarkDraw.AddSimpleGraphic(pMultiPatchRefPlaneWall as IGeometry, Cls3DMarkDraw.getRGB(71, 61, 255), 1, sRefPlaneName, m_pCurrentSceneControl.Scene, pGroup); Cls3DMarkDraw.AddSimpleGraphic(pPolygon as IGeometry, Cls3DMarkDraw.getRGB(71, 61, 255), 1, sRefPlaneName, m_pCurrentSceneControl.Scene, pGroup); m_pCurrentSceneControl.SceneGraph.RefreshViewers(); vProgress.Close(); } catch { vProgress.Close(); } }
private int ReportError([NotNull] IPolygon footPrint, [NotNull] IMultiPatch multiPatch, [NotNull] IRow row) { IGeometryCollection innerRings = new PolygonClass(); var rings = (IGeometryCollection)footPrint; int ringCount = rings.GeometryCount; for (int index = 0; index < ringCount; index++) { var ring = (IRing)rings.Geometry[index]; if (ring.IsExterior) { continue; } object missing = Type.Missing; innerRings.AddGeometry(GeometryFactory.Clone(ring), ref missing, ref missing); } ((IZAware)innerRings).ZAware = true; ((IZ)innerRings).SetConstantZ(multiPatch.Envelope.ZMin); int errorCount = 0; foreach (IRing ring in GeometryUtils.GetRings((IPolygon)innerRings)) { double area = Math.Abs(((IArea)ring).Area); if (_minimumArea > 0 && area >= _minimumArea) { continue; } string description = string.Format("Footprint has inner ring (area: {0})", FormatArea(area, _spatialReference)); errorCount += ReportError(description, GeometryFactory.CreatePolygon(ring), Codes[Code.FootprintHasInnerRing], _shapeFieldName, new object[] { area }, row); } return(errorCount); }