039Geometry 总结.docx

上传人:b****7 文档编号:10407463 上传时间:2023-02-11 格式:DOCX 页数:18 大小:269.70KB
下载 相关 举报
039Geometry 总结.docx_第1页
第1页 / 共18页
039Geometry 总结.docx_第2页
第2页 / 共18页
039Geometry 总结.docx_第3页
第3页 / 共18页
039Geometry 总结.docx_第4页
第4页 / 共18页
039Geometry 总结.docx_第5页
第5页 / 共18页
点击查看更多>>
下载资源
资源描述

039Geometry 总结.docx

《039Geometry 总结.docx》由会员分享,可在线阅读,更多相关《039Geometry 总结.docx(18页珍藏版)》请在冰豆网上搜索。

039Geometry 总结.docx

039Geometry总结

【039】Geometry总结

---------------------------------------------------------------------------------------------------------

●·●目录:

A1………… Geometry总结

A2………… 绘制几何图形——圆

A3………… 绘制几何图形——椭圆

A4………… 绘制几何图形——圆弧

A5………… 绘制几何图形——椭圆弧

A6………… VS2008打开VS2010项目

A7………… VisualStudio2008“分析EntityName时出错。

行2,位置81。

”报错解决!

A8………… 类、接口等的引用传递的理解

A9………… DrawShape与AddElement显示图形的区别

---------------------------------------------------------------------------------------------------------

          ╔════════╗

╠════╣    第A1个   ╠══════════════════════════════════════════════════╣

           ╚════════╝

●·● Geometry总结:

1.Polyline:

是Path的集合,可以实现IGeometryCollection接口,用于添加几何图形!

2.Path:

由Segment组成,可以实现ISegmentCollection接口,用于添加Segment!

3.Polygon:

是Ring的集合,可以实现IGeometryCollection接口,用于添加几何图形!

4.Ring:

由Segment组成,可以实现ISegmentCollection接口,用于添加Segment!

5.Segment:

包括Line、CircularArc、EllipticArc、BezierCurve四个!

---------------------------------------------------------------------------------------------------------

          ╔════════╗

╠════╣    第A2个   ╠══════════════════════════════════════════════════╣

           ╚════════╝

●·● 绘制几何图形——圆:

1.构造圆心点,IPoint。

2.构造圆弧,IConstructCircularArc,通过此接口,利用圆心和半径来确定圆弧。

3.构造线段,ISegment,将圆弧转为线段接口,用于添加到下面的线段集合中。

4.构造线段集合,ISegmentCollection,将上面的线段添加进来。

5.构造环,IRing,将线段集合转为环接口,用于实现图形的Close。

6.构造几何图形集合:

IGeometryCollection,将上面的环添加到几何图形集合中,然后就可以用了。

有填充颜色的:

IPointpPoint=newPointClass();

pPoint.X=110;

pPoint.Y=40;

//构建圆对象

IConstructCircularArcpConstructCircularArc=newCircularArcClass();

pConstructCircularArc.ConstructCircle(pPoint,20,false);

ICircularArcpArc=pConstructCircularArcasICircularArc;  //不必要

ISegmentpSegment1=pArcasISegment;

//通过ISegmentCollection构建Ring对象

ISegmentCollectionpSegCollection=newRingClass();

objecto=Type.Missing;

//添加Segement对象即圆

pSegCollection.AddSegment(pSegment1,refo,refo);

//QI到IRing接口封闭Ring对象,使其有效

IRingpRing=pSegCollectionasIRing;

pRing.Close();

//通过Ring对象使用IGeometryCollection构建Polygon对象

IGeometryCollectionpGeometryColl=newPolygonClass();

pGeometryColl.AddGeometry(pRing,refo,refo);

//构建一个CircleElement对象

IElementpElement=newCircleElementClass();

pElement.Geometry=pGeometryCollasIGeometry;

IGraphicsContainerpGC=this.axMapControl1.ActiveView.GraphicsContainer;

pGC.AddElement(pElement,0);

this.axMapControl1.Refresh();

没有填充颜色的,只需加入下面一句,使其为透明颜色即可!

pColor.Transparency=0;

---------------------------------------------------------------------------------------------------------

          ╔════════╗

╠════╣    第A3个   ╠══════════════════════════════════════════════════╣

           ╚════════╝

●·● 绘制几何图形——椭圆:

1.构造两个点,IPoint。

2.构造包络线也就是矩形,IEnvelope,通过上面的两个点。

3.构造圆弧,IConstructEllipticArc,通过此接口,利用矩形来确定椭圆弧。

4.构造线段,ISegment,将椭圆弧转为线段接口,用于添加到下面的线段集合中。

5.构造线段集合,ISegmentCollection,将上面的线段添加进来。

6.构造环,IRing,将线段集合转为环接口,用于实现图形的Close。

7.构造几何图形集合:

IGeometryCollection,将上面的环添加到几何图形集合中,然后就可以用了。

有填充颜色的:

IPointpPoint1=newPointClass();

pPoint1.PutCoords(80,20);

IPointpPoint2=newPointClass();

pPoint2.PutCoords(130,50);

IEnvelopepEnvelope=newEnvelopeClass();

pEnvelope.LowerLeft=pPoint1;

pEnvelope.UpperRight=pPoint2;

IConstructEllipticArcpConstructEllipticArc=newEllipticArcClass();

pConstructEllipticArc.ConstructEnvelope(pEnvelope);

IEllipticArcpEllipticArc=pConstructEllipticArcasIEllipticArc;  //不必要

ISegmentpSegment=pEllipticArcasISegment;

ISegmentCollectionpSegmentCollection=newRingClass();

objecto=Type.Missing;

pSegmentCollection.AddSegment(pSegment,refo,refo);

IRingpRing=pSegmentCollectionasIRing;

pRing.Close();

IGeometryCollectionpGeometryColl=newPolygonClass();

pGeometryColl.AddGeometry(pRing,refo,refo);

ISimpleLineSymbolpSimpleLineSym=newSimpleLineSymbol();

pSimpleLineSym.Color=GetColor(0,0,0);

pSimpleLineSym.Width=2;

ISimpleFillSymbolpSimpleFillSym=newSimpleFillSymbol();

IRgbColorpColor=newRgbColor();

pColor.Red=255;

pColor.Green=255;

pSimpleFillSym.Color=pColor;

pSimpleFillSym.Outline=pSimpleLineSym;

IElementpElement=newEllipseElementClass();

pElement.Geometry=pGeometryCollasIGeometry;

IFillShapeElementpFillShapeElement=pElementasIFillShapeElement;

pFillShapeElement.Symbol=pSimpleFillSym;

IGraphicsContainerpGC=axMapControl1.ActiveView.GraphicsContainer;

pGC.AddElement(pElement,0);

axMapControl1.Refresh();

---------------------------------------------------------------------------------------------------------

          ╔════════╗

╠════╣    第A4个   ╠══════════════════════════════════════════════════╣

           ╚════════╝

●·● 绘制几何图形——圆弧:

1.构造圆心点,IPoint。

2.构造圆弧,IConstructCircularArc,通过此接口,利用圆心、半径、起始角度,中心角来确定圆弧。

3.构造线段,ISegment,将圆弧转为线段接口,用于添加到下面的线段集合中。

4.构造线段集合,ISegmentCollection,将上面的线段添加进来。

5.构造环或者路径,IRingorIPath,将线段集合转为环接口或是路径接口。

6.构造几何图形集合:

IGeometryCollection,将上面的环添加到几何图形集合中,然后就可以用了。

IPointpPoint=newPointClass();

pPoint.X=80;

pPoint.Y=40;

IConstructCircularArcpConstructCircularArc=newCircularArcClass();

pConstructCircularArc.ConstructBearingRadiusAngle(pPoint,0,false,20,Math.PI*4/3);

ICircularArcpArc=pConstructCircularArcasICircularArc;  //不必要

ISegmentpSegment1=pArcasISegment;

ISegmentCollectionpSegCollection=newRingClass();

objecto=Type.Missing;

pSegCollection.AddSegment(pSegment1,refo,refo);

IRingpRing=pSegCollectionasIRing;

//IPathpRing=pSegCollectionasIPath;  //也可以的

IGeometryCollectionpGeometryColl=newPolygonClass();

pGeometryColl.AddGeometry(pRing,refo,refo);

ISimpleLineSymbolpSimpleLineSym=newSimpleLineSymbol();

pSimpleLineSym.Color=GetColor(0,0,0);

pSimpleLineSym.Width=2;

ISimpleFillSymbolpSimpleFillSym=newSimpleFillSymbol();

IRgbColorpColor=newRgbColor();

pColor.RGB=255;

//pColor.Transparency=0;  //透明填充

pSimpleFillSym.Color=pColor;

pSimpleFillSym.Outline=pSimpleLineSym;

IElementpElement=newCircleElementClass();

IFillShapeElementpFillShapeEle=pElementasIFillShapeElement;

pFillShapeEle.Symbol=pSimpleFillSym;

pElement.Geometry=pGeometryCollasIGeometry;

IGraphicsContainerpGC=this.axMapControl1.ActiveView.GraphicsContainer;

pGC.AddElement(pElement,0);

this.axMapControl1.Refresh();

---------------------------------------------------------------------------------------------------------

          ╔════════╗

╠════╣    第A5个   ╠══════════════════════════════════════════════════╣

           ╚════════╝

●·● 绘制几何图形——椭圆弧:

1.实现画¼圆弧:

ConstructanellipticarcthatstartsatfromPoint,goestotoPoint,andspansanangleofpi/2.Therotationoftheellipsewillbeeither0orpi/2.

IPointpPoint1=newPointClass();

pPoint1.PutCoords(105,20);

IPointpPoint2=newPointClass();

pPoint2.PutCoords(130,35);

IEnvelopepEnvelope=newEnvelopeClass();

pEnvelope.LowerLeft=pPoint1;

pEnvelope.UpperRight=pPoint2;

IConstructEllipticArcpConstructEllipticArc=newEllipticArcClass();

pConstructEllipticArc.ConstructQuarterEllipse(pPoint1,pPoint2,true);  //第三个参数决定顺逆时针!

ISegmentpSegment=pConstructEllipticArcasISegment;

ISegmentCollectionpSegmentCollection=newRingClass();

objecto=Type.Missing;

pSegmentCollection.AddSegment(pSegment,refo,refo);

IRingpRing=pSegmentCollectionasIRing;

IGeometryCollectionpGeometryColl=newPolygonClass();

pGeometryColl.AddGeometry(pRing,refo,refo);

ISimpleLineSymbolpSimpleLineSym=newSimpleLineSymbol();

pSimpleLineSym.Color=GetColor(0,0,0);

pSimpleLineSym.Width=2;

ISimpleFillSymbolpSimpleFillSym=newSimpleFillSymbol();

IRgbColorpColor=newRgbColor();

pColor.Red=255;

pSimpleFillSym.Color=pColor;

pSimpleFillSym.Outline=pSimpleLineSym;

IElementpElement=newEllipseElementClass();

pElement.Geometry=pGeometryCollasIGeometry;

IFillShapeElementpFillShapeElement=pElementasIFillShapeElement;

pFillShapeElement.Symbol=pSimpleFillSym;

IGraphicsContainerpGC=axMapControl1.ActiveView.GraphicsContainer;

pGC.AddElement(pElement,0);

axMapControl1.Refresh();

2.实现根据起始点,以及限制在一个矩形中:

ConstructanellipticarcthatstartsatfromPoint,goestotoPoint,andtriestohavetheembeddedellipseinscribedinthesuggestedEnvelope.Theresultwillhaverotationof0orpi/2.

IPointpPoint1=newPointClass();

pPoint1.PutCoords(80,20);

IPointpPoint2=newPointClass();

pPoint2.PutCoords(130,50);

IPointpPoint3=newPointClass();

pPoint3.PutCoords(50,20);

IPointpPoint4=newPointClass();

pPoint4.PutCoords(140,60);

IEnvelopepEnvelope=newEnvelopeClass();

pEnvelope.LowerLeft=pPoint3;

pEnvelope.UpperRight=pPoint4;

IConstructEllipticArcpConstructEllipticArc=newEllipticArcClass();

pConstructEllipticArc.ConstructTwoPointsEnvelope(pPoint1,pPoint2,pEnvelope,esriArcOrientation.esriArcMajor);

ISegmentpSegment=pConstructEllipticArcasISegment;

ISegmentCollectionpSegmentCollection=newRingClass();

objecto=Type.Missing;

pSegmentCollection.AddSegment(pSegment,refo,refo);

IRingpRing=pSegmentCollectionasIRing;

IGeometryCollectionpGeometryColl=newPolygonClass();

pGeometryColl.AddGeometry(pRing,refo,refo);

ISimpleLineSymbolpSimpleLineSym=newSimpleLineSymbol();

pSimpleLineSym.Color=GetColor(0,0,0);

pSimpleLineSym.Width=2;

ISimpleFillSymbolpSimpleFillSym=newSimpleFillSymbol();

IRgbColorpColor=newRgbColor();

pColor.Red=255;

pColor.Transparency=0;

pSimpleFillSym.Color=pColor;

pSimpleFillSym.Outline=pSimpleLineSym;

IElementpElement2=newRectangleElementClass();

pElement2.Geometry=pEnvelope;

IFillShapeElementpFillShapeElement2=pElement2asIFillShapeElement;

pFillShapeElement2.Symbol=pSimpleFillSym;

IElementpElement=newEllipseElementClass();

pElement.Geometry=pGeometryCollasIGeometry;

IFillShapeElementpFi

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 经管营销 > 财务管理

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1