Private Sub MakeIsoationPoly(env As IEnvelope, fc As IFeatureClass)
Dim app As IApplication
Set app = New AppRef
Dim edExt As IEditor
Set edExt = app.FindExtensionByName("ESRI OBJECT EDITOR")
edExt.StartOperation
Dim newFe As IFeature
Set newFe = fc.CreateFeature
Dim segCol As ISegmentCollection
Set segCol = New Polygon
Dim ln1 As ILine, ln2 As ILine, ln3 As ILine, ln4 As ILine
Set ln1 = New Line
Set ln2 = New Line
Set ln3 = New Line
Set ln4 = New Line
ln1.FromPoint = env.LowerLeft
ln1.ToPoint = env.LowerRight
ln2.FromPoint = env.LowerRight
ln2.ToPoint = env.UpperRight
ln3.FromPoint = env.UpperRight
ln3.ToPoint = env.UpperLeft
ln4.FromPoint = env.UpperLeft
ln4.ToPoint = env.LowerLeft
segCol.AddSegment ln1
segCol.AddSegment ln2
segCol.AddSegment ln3
segCol.AddSegment ln4
Set newFe.Shape = segCol
newFe.Store
edExt.StopOperation ("Make polygon")
End Sub
No comments:
Post a Comment