ArcGIS Engine 画扇形要素

IFeatureClass featureClass  = GetLayerByName( " 摄像头 " ).FeatureClass;
                    IFeature featureForDraw;
                       
                    IFeatureCursor tmpcur  = Base.QueryElement(featureClass, "" );
                                   
                     while ( true )
                    {
                        featureForDraw  =  tmpcur.NextFeature();   // 得到对象

                         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;
                             // 这里用了属性查询,用到前面得到的对象的主字段值。
                             // IRubberBand pRubberBand=new  RubberCircleClass();
                            ESRI.ArcGIS.Geometry.IConstructCircularArc con = new  CircularArcClass();

                          
                             double  FW = 40.0 ;
                             double   zj = 0.01 ;  // 直径
                             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;
                               
                             
                             // 重点
                                 cir.PutCoordsByAngle(p,FW * Math.PI / 180 , 40 * Math.PI / 180 ,zj);

                                IPoint 起始点 = cir.FromPoint;
                                IPoint 结束点 = cir.ToPoint;

                                ILine line = new  LineClass();
                                ILine line1 = new  LineClass();
                                line.PutCoords(p,起始点);
                                line1.PutCoords(结束点,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);
                }

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值