In my previous blog post, I talked about the conversion of notes, but the conversion does not contain space reference information. Therefore, I wrote another article to record the conversion of Space reference information.
First, it is the key to obtain reference information in the DWG file.CodeAs follows:
Iworkspaceptr ipwork;
Iworkspacefactoryptr ipwfactory (clsid_cadworkspacefactory );
Hresult result = Ipwfactory -> Openfromfile (ccombstr (PATH ),
Null, & Ipwork );
Ifeatureworkspaceptr ipfwork = Ipwork;
Ifeaturedatasetptr ipdataset;
Result = Ipfwork -> Openfeaturedataset (ccombstr (filename ), & Ipdataset );
Ifeatureclasscontainerptr ipfcontainer = Ipdataset;
Iarrayptr arrlayer (clsid_array );
Long Lclasscount = 0 ;
Ipfcontainer -> Get_classcount ( & Lclasscount );
For ( Long I = 0 ; I < Lclasscount; I ++ )
{
Ifeatureclassptr ipfclass;
Result = Ipfcontainer -> Get_class (I, & Ipfclass );
Esrifeaturetype;
Ipfclass -> Get_featuretype ( & Type );
// Determine whether it is a note Layer
If (Esriftcoverageannotation ! = Type)
Continue ;
Igeodatasetptr ipgeodataset (ipfclass );
Ispatialreferenceptr ipsparef;
Ipgeodataset -> Get_spatialreference ( & Ipsparef );
}
Next, set the retrieved space reference information to annotation features in SDE. You can set it through interfaces such as ifeaturelayer and ilayer. Because it is relatively simple, the Code is not pasted out. If you have other good solutions, please leave a message.