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 spatialRef; ESRI.ArcGIS.Geometry.ISpatialReferenceFactory2 factory = (ISpatialReferenceFactory2)new ESRI.ArcGIS.Geometry.SpatialReferenceEnvironment(); spatialRef = (ISpatialReference2)factory.CreateSpatialReference((int)ESRI.ArcGIS.Geometry.esriSRGeoCSType.esriSRGeoCS_WGS1984); polygon.Project(spatialRef); // ... Add shape to trackerSolved! Go to Solution.
//Create source spatial reference.
Type factoryType = Type.GetTypeFromProgID("esriGeometry.SpatialReferenceEnvironment");
System.Object obj = Activator.CreateInstance(factoryType);
ISpatialReferenceFactory3 spatialReferenceFactory = obj as ISpatialReferenceFactory3;
ISpatialReference spatialReference = spatialReferenceFactory.CreateGeographicCoordinateSystem((int) esriSRGeoCSType.esriSRGeoCS_WGS1984);
spatialReference.SetFalseOriginAndUnits(-80.0000000232831, 39.9999999767169, 42949672.9);
//Create an envelope and define its spatial reference.
IEnvelope envelope = new EnvelopeClass();
envelope.PutCoords(-68.6076204314651, 49.6186709634653, -68.5531907607304, 49.6530789785679);
envelope.SpatialReference = spatialReference;
//Destination spatial reference.
ISpatialReference projectedCoordinateSystem = spatialReferenceFactory.CreateProjectedCoordinateSystem((int) esriSRProjCSType.esriSRProjCS_NAD1927UTM_19N);
//Define the XYDomain equivalent to SetFalseOriginAndUnits.
projectedCoordinateSystem.SetDomain(500000, 600000, 5300000, 5600000);
String report = "Print envelope coordinates before projection:\n" +
envelope.XMin + " , " + envelope.YMin + " , " + envelope.XMax + " , " + envelope.YMax + "\n\n\n";
//Project envelope.
IGeometry geometry = envelope as IGeometry2;
geometry.Project(projectedCoordinateSystem as ISpatialReference);
report = report + "Print envelope coordinates after projection:\n" +
envelope.XMin + " , " + envelope.YMin + " , " + envelope.XMax + " , " + envelope.YMax;
System.Windows.Forms.MessageBox.Show(report);