CAD与GIS转换:注记转换及角度问题

CAD注记旋转方向用的是弧度;

GIS注记旋转方向用的是角度;

二者使用需要转换。

 

示例过程:

一、GIS注记转CAD

1.1获得GIS注记文字、尺寸、角度

//Author:AllenRobin http://gisrsman.cnblogs.com
IAnnotationFeature pAnnoFeature = pFeature
as IAnnotationFeature;
ITextElement pTextElement = pAnnoFeature.Annotation as ITextElement;
string pAnnoText = pTextElement.Text;
double pAnnoSize = pTextElement.Symbol.Size;
 double pAnnoAngle = pTextElement.Symbol.Angle;

1.2 在CAD中插入AcadText

//Author:AllenRobin http://gisrsman.cnblogs.com
double
[] pCenterPoint=new double[3]; pCenterPoint[0] = (pElement.Geometry.Envelope.XMin + pElement.Geometry.Envelope.XMax)/2; pCenterPoint[1] = (pElement.Geometry.Envelope.YMin + pElement.Geometry.Envelope.YMax) / 2; pCenterPoint[2] = 0; AcadText pAcadText = CadModelSpace.AddText(pAnnoText, pCenterPoint, textHeight);

 

1.3从GIS获得注记角度需要转换为弧度

//Author:AllenRobin http://gisrsman.cnblogs.com
double
anlgeReal = pAnnoAngle * Math.PI / 180; pAcadText.Rotate(pCenterPoint, anlgeReal);

 

posted @ 2015-06-05 14:25  AllenRobin  阅读(1106)  评论(1编辑  收藏  举报