I am not writing much .. There is a problem with the existing code algorithms on the Internet. Put the code up for reference by the comrades who need it.
IFeatureClass featureClass = GetLayerByName ("camera"). FeatureClass;
IFeature featureForDraw;
IFeatureCursor tmpcur = Base. QueryElement (featureClass ,"");
While (true)
{
FeatureForDraw = tmpcur. NextFeature (); // get the object
If (featureForDraw! = Null)
{
ISimpleFillSymbol pointSymbol = new SimpleFillSymbolClass ();
PointSymbol. Style = ESRI. ArcGIS. Display. esriSimpleFillStyle. esriSFSNull;
PointSymbol. Color = Base. GetRGBColor (255, 0, 0 );
ILineSymbol linesymbol = new SimpleLineSymbolClass ();
Linesymbol. Width = 1.1;
Linesymbol. Color = Base. GetRGBColor (255, 0, 0 );
PointSymbol. Outline = linesymbol;
IPoint p = featureForDraw. ShapeCopy as IPoint;
// Attribute query is used here, and the primary field value of the previously obtained object is used.
// IRubberBand pRubberBand = new RubberCircleClass ();
ESRI. ArcGIS. Geometry. IConstructCircularArc con = new CircularArcClass ();
Double FW = 40.0;
Double zj = 0.01; // diameter
Double jd = 1.414;
String _ fw = featureForDraw. get_Value (featureForDraw. Fields. FindField ("SP_ANGLE"). ToString (). Trim ();
If (_ fw! = String. Empty)
{
FW = double. Parse (_ fw );
}
String _ zj = featureForDraw. get_Value (featureForDraw. Fields. FindField ("BOUND"). ToString (). Trim ();
If (_ zj! = String. Empty)
{
Zj = double. Parse (_ zj );
}
Try
{
// Con. ConstructCircle (p, System. Convert. ToDouble (bound_str)/2000, false );
ESRI. ArcGIS. Geometry. ICircularArc cir = new CircularArcClass ();
Cir = con as ICircularArc;
// Key
Cir. PutCoordsByAngle (p, FW * Math. PI/180,40 * Math. PI/180, zj );
IPoint start point = cir. FromPoint;
IPoint end point = cir. ToPoint;
ILine line = new LineClass ();
ILine line1 = new LineClass ();
Line. PutCoords (p, starting point );
Line1.PutCoords (end point, p );
ISegmentCollection polygon = new PolygonClass ();
Object Missing = Type. Missing;
Polygon. AddSegment (line as ISegment, ref Missing, ref Missing );
Polygon. AddSegment (cir as ISegment, ref Missing, ref Missing );
Polygon. AddSegment (line1 as ISegment, ref Missing, ref Missing );
IGeometry geometry = polygon as IGeometry;
Object tmpSymbol = (object) pointSymbol;
AxMapControl1.DrawShape (geometry, ref tmpSymbol );
}
Catch
{
}
}
Else
{
Break;
}
}
}
Catch (Exception ex)
{
System. Console. WriteLine (ex. Message );
}