ArcGIS 9.0 sector drawing

Source: Internet
Author: User
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 );
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.