CAD Text轉到SDE Anno FeatureClass

將CAD內的Anno Text轉到sde里的Annotation featureclass.對于CAD Text, 它的geometrytype 為Point, 而sde里Annotation featureclass的geometrytype為Polygon,因此IObjectLoader.LoadObjects不適用于轉CAD Text, 只能用IFDOGLFactory.DoAddElements方法.

IFDOGraphicsLayer是專門用于插入annotation feature到geodatabase annotation featureclass的。關于IFDOGraphicsLayer,EDN里有詳細的備注:

 IFDOGraphicsLayer provides a fast mechanism for inserting annotation features into geodatabase annotation feature classes. Adding annotation feature or element should always be done after calling the BeginAddElements method, and after the features or elements are inserted, be sure to issue a call to the EndAddElements method.

If inserting annotation elements without attributes, use the DoAddElements method which takes an enumeration of GraphicElement objects.  If inserting annotation elements with attributes, use the SetupAttributeConversion method to setup the field mapping between the input features and the target annotation feature class, then call DoAddFeature. DoAddFeature will add the element, the placement polygon shape and populate any attributes that are mapped. The SetupAttributeConversion method cannot be called from Visual Basic. Instead, use the SetupAttributeConversion2 method on IFDOAttributeConversion to setup the field mapping. Field mapping should be setup after the BeginAddElements method is called.

Code

 

下面是里面要用到的兩個function

Code

 

Code

 

posted on 2009-03-18 15:09  炜升  阅读(1085)  评论(0编辑  收藏  举报