ArcGIS 9.0 绘制扇形
2008-03-05 14:35
190 查看
我不多写了。。网上现有的代码算法有问题。把代码放上来,需要的同志可以参考。
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);
}
程序猿们,我也跟风开了网店,主要经营土特产,云南核桃,四川正宗土鸡蛋鸡蛋。有需要的就支持一下小店哈 七彩山川美食(http://qcsc.taobao.com)
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);
}
程序猿们,我也跟风开了网店,主要经营土特产,云南核桃,四川正宗土鸡蛋鸡蛋。有需要的就支持一下小店哈 七彩山川美食(http://qcsc.taobao.com)
相关文章推荐
- IOS绘制圆,直线,弧线,矩形,扇形,三角形,贝塞尔等图形
- ArcGIS Android Runtime100.1.0 - 草图绘制
- html5--5-9 绘制扇形
- iOS开发UI篇—Quartz2D简单图形绘制(二)直线,三角形,矩形,扇形,弧,圆
- ArcGis For Silverlight API,地图显示Gis,绘制点,线,绘制图等(三)--绘制点、线、圆,显示提示信息
- arcgis server flex 实现在地图上绘制折线图
- 《DirectX 9.0 3D游戏开发编程基础》 第二章 绘制流水线 读书笔记
- ArcGIS for Android 临时图层绘制文字 汉字不显示问题
- ESRI ArcGIS 9.0系列软件报价
- ArcGIS for Android 体验(二) 绘制标绘
- ArcGIS for Android Runtime100 基本操作(五)——绘制图层和符号渲染
- 初识ArcGIS9.0
- arcgis for js画扇形并给它填充不同的颜色
- ArcGIS 9.0 在Windows XP SP2 上安装的问题(数据保护造成的)
- 在使用ArcGIS 9.0或9.1的ArcToolbox时出错提示"该内存不能为读"
- ArcGis For Silverlight API,地图显示Gis,绘制点,线,绘制图等(二)--Silverlight 配置动态的 webService、动态加载ArcGis地图服务
- 安装完ArcGIS-ArcInfo9.0以后,Coverage工具从工具箱中丢失
- Arcgis---绘制多边形
- CSS之如何绘制任意角度的扇形
- 扇形绘制(超低效率)