AnsweredAssumed Answered

Draw an exact circle?

Question asked by alphamale on Aug 14, 2015
Latest reply on Aug 14, 2015 by Dan_Patterson

Hi,

 

I tried drawing a circle but this seems to be not quite a circle:

 

 

 

Dim pCircleArc As IConstructCircularArc

pCircleArc = New CircularArc

pCircleArc.ConstructCircle(pOrigin,radius,True)

Dim pPolygon As IPolygonpPolygon = New Polygon

pPolygon.SpatialReference = pSpRef

Dim pSegmentCollection As ISegmentCollection

pSegmentCollection = pPolygon

pSegmentCollection.AddSegment(pCircleArc)

Dim pElement As IElementpElement = New PolygonElement

pElement.Geometry = pPolygon

Dim pFSElem As IFillShapeElement

pFSElem = pElementpFSElem.Symbol = pSFSym

Dim pGraphicsContainer As IGraphicsContainer

pGraphicsContainer = bmap

 

pGraphicsContainer.AddElement(pElement, -1)

 

I thought to try another approach:

 

Dim pMap As IMap

pMap = pDoc.FocusMap

 

Dim pSpRef As ISpatialReference

pSpRef = pMap.SpatialReference

 

Dim pPt As IPoint = New Point

pPt.X = 0

pPt.Y = 0

pPt.SpatialReference = pSpRef

 

Dim f As IFeature = New Feature

f.Shape.SpatialReference = pSpRef

f.Shape = pPt

 

 

Dim topop As ESRI.ArcGIS.Geometry.ITopologicalOperator

topop = f.shape

 

Dim elt As ESRI.ArcGIS.Carto.PolygonElement

 

elt = New PolygonElement

elt.Geometry = topop.butter(24)

 

Dim gc As IGraphicsContainer = pMap

gc.AddElement(elt,0)

 

The error I get is "All geometries involved in this operation must have the same spatial reference."

 

 

 

 

 

 

Outcomes