PointClass centroid = new PointClass() { X = 0, Y = 0}; PointClass permiterPoint = new PointClass() { X = 4, Y = 0 }; CircularArcClass circularArc = new CircularArcClass(); circularArc.PutCoords(centroid, permiterPoint, permiterPoint, esriArcOrientation.esriArcClockwise); IPolygon polygon = new PolygonClass(); segmentCollection = polygon as ISegmentCollection; segmentCollection.AddSegment(circularArc); ISpatialReferenceFactory srFactory = new SpatialReferenceEnvironmentClass(); IGeographicCoordinateSystem cs1 = srFactory.CreateGeographicCoordinateSystem((int)esriSRGeoCSType.esriSRGeoCS_Clarke1880); IGeographicCoordinateSystem cs2 = srFactory.CreateGeographicCoordinateSystem((int)esriSRGeoCSType.esriSRGeoCS_WGS1984); polygon.SpatialReference = cs1; polygon.Project(cs2); IGraphicTrackerSymbol graphicTrackerSymbol = graphicTracker.CreateSymbol(fillSymbol as ISymbol, null); int graphicID = graphicTracker.Add(polygon, graphicTrackerSymbol);
Solved! Go to Solution.
ISpatialReferenceFactory srFactory = new SpatialReferenceEnvironmentClass(); IGeographicCoordinateSystem cs = srFactory.CreateGeographicCoordinateSystem((int)esriSRGeoCSType.esriSRGeoCS_WGS1984); polygon.Project(cs); graphicTracker.CreateSymbol....
//Create Spatial Reference Factory ISpatialReferenceFactory srFactory = new SpatialReferenceEnvironmentClass(); ISpatialReference sr1; //GCS to project from IGeographicCoordinateSystem gcs = srFactory.CreateGeographicCoordinateSystem((int)esriSRGeoCSType.esriSRGeoCS_NAD1983); sr1 = gcs; sr1.SetFalseOriginAndUnits(-180, -90, 1000000); //Projected Coordinate System to project into IProjectedCoordinateSystem pcs = srFactory.CreateProjectedCoordinateSystem((int)esriSRProjCSType.esriSRProjCS_NAD1983N_AmericaLambert); pcs.SetFalseOriginAndUnits(0, 0, 1000); ISpatialReference sr2; sr2 = pcs; //Point to project IPoint point = new PointClass() as IPoint; point.PutCoords(-117.17, 34.06); //Geometry Interface to do actual project IGeometry geometry; geometry = point; geometry.SpatialReference = sr1; geometry.Project(sr2); point = geometry as IPoint; double x; double y; point.QueryCoords(out x, out y); Debug.Print("X: " + x.ToString()); Debug.Print("Y: " + y.ToString());
PointClass centroid = new PointClass() { X = 0, Y = 60}; PointClass permiterPoint = new PointClass() { X = 4, Y = 60 }; CircularArcClass circularArc = new CircularArcClass(); circularArc.PutCoords(centroid, permiterPoint, permiterPoint, esriArcOrientation.esriArcClockwise); IPolygon polygon = new PolygonClass(); segmentCollection = polygon as ISegmentCollection; segmentCollection.AddSegment(circularArc); ESRI.ArcGIS.Geometry.ISpatialReference2 pSpatRef; ESRI.ArcGIS.Geometry.ISpatialReferenceFactory2 pSpatRefFact = (ISpatialReferenceFactory2) new ESRI.ArcGIS.Geometry.SpatialReferenceEnvironment(); pSpatRef = (ISpatialReference2) pSpatRefFact.CreateSpatialReference((int) ESRI.ArcGIS.Geometry.esriSRGeoCSType.esriSRGeoCS_WGS1984); polygon.Project(pSpatRef); // .. Draw shape