Draw an exact circle?

2293
1
08-14-2015 09:29 AM
JoeMcCollum
New Contributor

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."

0 Kudos
1 Reply
DanPatterson_Retired
MVP Emeritus

Image? 

It is either because you drew a circle using unprojected data and it looks like an ellipse or its edges aren't perfectly round which is because most circle implementations are n-gons (generally a 360 sided polygon)

0 Kudos