|
[code]Acad::ErrorStatus es;
AcDbDatabase *pDb =
acdbHostApplicationServices()->workingDatabase();
AcDbObjectId geodataId = AcDbObjectId::kNull;
acdbGetGeoDataObjId(pDb, geodataId);
if (geodataId.isNull() == Adesk::kFalse)
{
AcDbTransactionManager *pTM
= pDb->transactionManager();
AcTransaction *pTransaction
= pTM->startTransaction();
AcDbObject *pObj = NULL;
pTransaction->getObject(pObj,
geodataId,
AcDb::kForRead);
AcDbGeoData *pGeoData = AcDbGeoData::cast(pObj);
if (pGeoData != NULL)
{
pGeoData->upgradeOpen();
// convert from drawing point to Geolocation
AcGePoint3d geoPoint(dblLongitude,
dblLatitude,
dblAltitude);
AcGePoint3d drawingPt = AcGePoint3d::kOrigin;
es = pGeoData->transformFromLonLatAlt(
geoPoint, drawingPt);
// convert from Geolocation to drawing point
es = pGeoData->transformToLonLatAlt(
dblDwgX, dblDwgY, dblDwgZ,
dblLongitude, dblLatitude, dblAltitude);
pTM->endTransaction();
}
else
pTM->abortTransaction();
}[/code] |
|