laptop and a wrench

漏洞

Cannot import vertical multipatches into SDE.

上次发布: August 25, 2014 No Product Found
漏洞 ID 编号 NIM011541
已提交September 10, 2007
上次修改时间April 2, 2025
适用范围No Product Found
找到的版本9.2
修正版本9.3
状态Fixed

解决办法

Use the following code:Option Explicit' Use to ensure multipatch footprints are 'simple' relative to target spatial referencePublic Sub FileMultiPatchToSDE() On Error GoTo EH ' First layer in doc contains input multipatch feature class ' Second layer is target SDE multipatch feature class. You can make the FC with ArcCatalog ' (an empty FC with the proper spatial reference) then place it in the doc. Dim pDoc As IMxDocument Set pDoc = ThisDocument ' Get input Dim pFL As IFeatureLayer Set pFL = pDoc.ActiveView.FocusMap.Layer(0) Dim pInFC As IFeatureClass Set pInFC = pFL.FeatureClass Dim pInFCur As IFeatureCursor Set pInFCur = pInFC.Search(Nothing, True) Dim pInF As IFeature Set pInF = pInFCur.NextFeature ' Get output - assumed to reside in SDE feature dataset Set pFL = pDoc.ActiveView.FocusMap.Layer(1) Dim pOutFC As IFeatureClass Set pOutFC = pFL.FeatureClass Dim pWE As IWorkspaceEdit If (pOutFC.FeatureDataset Is Nothing) Then Dim pDS As IDataset Set pDS = pOutFC Set pWE = pDS.Workspace Else Set pWE = pOutFC.FeatureDataset.Workspace End If pWE.StartEditing False pWE.StartEditOperation Dim pOutGDS As IGeoDataset Set pOutGDS = pOutFC Dim pSR As ISpatialReference Set pSR = pOutGDS.SpatialReference Dim pOutCursor As IFeatureCursor Set pOutCursor = pOutFC.Insert(True) Dim pOutBuffer As IFeatureBuffer Set pOutBuffer = pOutFC.CreateFeatureBuffer Do While (Not pInF Is Nothing) ' Get the shape Dim pMP As IMultiPatch2 Set pMP = pInF.ShapeCopy ' Snap and simplify projected footprint relative to output spatial ref Dim pTransform As ITransform3D Set pTransform = pMP Dim pGeom As IGeometry Set pGeom = pTransform.ProjectToPlane(Nothing, Nothing, Nothing) Set pGeom.SpatialReference = pSR pGeom.SnapToSpatialReference Dim pTopo As ITopologicalOperator2 Set pTopo = pGeom pTopo.IsKnownSimple = False pTopo.Simplify ' Check if simplify was able to generate a clean footprint. If not (e.g., feature with ' no 2D area, like a vertical cylinder with no top and bottom) use the 2D bounding box ' as the footprint. For completeness, this test should also check for an axis aligned ' vertical feature (e.g., wall) that would yield a 0 area envelope. That would be another ' special case. Dim pGC As IGeometryCollection Set pGC = pTopo If (pGC.GeometryCount = 0) Then Set pGeom = pMP Set pMP.XYFootprint = EnvelopeAsPoly(pGeom.Envelope) Else Set pMP.XYFootprint = pTopo End If Set pOutBuffer.Shape = pMP pOutCursor.InsertFeature pOutBuffer Set pInF = pInFCur.NextFeature Loop Set pOutBuffer = Nothing Set pOutCursor = Nothing pWE.StopEditOperation pWE.StopEditing True Exit SubEH: Debug.Print Err.DescriptionEnd SubPublic Function EnvelopeAsPoly(pEnvelope As IEnvelope) As IPolygon Dim xmin As Double, ymin As Double, xmax As Double, ymax As Double pEnvelope.QueryCoords xmin, ymin, xmax, ymax Dim pt As IPoint Dim pRing As IPointCollection Set pRing = New Ring Set pt = New esriGeometry.Point pt.X = xmin pt.Y = ymin pRing.AddPoint pt pt.Y = ymax pRing.AddPoint pt pt.X = xmax pRing.AddPoint pt pt.Y = ymin pRing.AddPoint pt pt.X = xmin pRing.AddPoint pt Dim pPoly As IGeometryCollection Set pPoly = New esriGeometry.Polygon pPoly.AddGeometry pRing Set EnvelopeAsPoly = pPolyEnd Function

重现步骤

漏洞 ID: NIM011541

软件:

  • No Product Found

当漏洞状态发生变化时获得通知

下载 Esri 支持应用程序

发现关于本主题的更多内容

获取来自 ArcGIS 专家的帮助

联系技术支持部门

下载 Esri 支持应用程序

转至下载选项