天气与日历 切换到窄版

 找回密码
 立即注册
中国膜结构网
十大进口膜材评选 十大国产膜材评选 十大膜结构设计评选 十大膜结构公司评选
查看: 53|回复: 0

‎使用 ObjectARX 定位地理标记‎ 坐标转换

[复制链接]

该用户从未签到

主题

0

回帖

2912

积分

管理员

积分
2912
发表于 2024-6-22 09:46:18 | 显示全部楼层 |阅读模式
[code]void GeographicLocationMarker( )

{

      /*Map Projection type*/

    const AcString csId(L"UTM84-43N");

  /*Creating the projected Coordinate Sytem */

  Acad::ErrorStatus es;

    AcDbGeoCoordinateSystem* pGeoCS;

    AcDbGeoCoordinateSystem::create(csId, pGeoCS);

     if (NULL == pGeoCS)

        return;

     AcString xmlStr;

   /*Get XML type*/

   es = pGeoCS->getXmlRepresentation(xmlStr);

  /*Checking the output of CRS*/

  acutPrintf(_T("\ncrsName: %s"),xmlStr.kACharPtr());



    if(xmlStr.isEmpty()) return;



    AcDbObjectId geoId;

    AcDbObjectPointer<AcDbGeoData> pGeoData;

    AcDbDatabase* pDb = acdbHostApplicationServices()->workingDatabase();

    acdbGetGeoDataObjId(pDb, geoId);



  /*Post our Geodata to Database,

  AcDbGeoData is not an Entity, it is stored in Model-Space's Extension Dictionary*/

    if (geoId.isNull())

    {

        pGeoData.create();

        pGeoData->setBlockTableRecordId(acdbSymUtil()->blockModelSpaceId(pDb));

        pGeoData->postToDb(geoId);

    }

    else

    {

        pGeoData.open(geoId, AcDb::kForWrite);

    }



    if (NULL == pGeoData.object())

        return;

  /* The spatial coordinate system string.

  It can be the id of the coordinate system or the XML/WKT representation*/

     es = pGeoData->setCoordinateSystem(xmlStr);

  /* The design coordinate system is considered to be local, aka

     an engineering coordinate system.*/

  es = pGeoData->setCoordinateType(AcDbGeoData::kCoordTypLocal);

    es = pGeoData->setHorizontalUnits(AcDb::kUnitsMillimeters);

    es = pGeoData->setVerticalUnits(AcDb::kUnitsMillimeters);

    es = pGeoData->setDesignPoint(AcGePoint3d::kOrigin);

    es = pGeoData->setUpDirection(AcGeVector3d::kZAxis);

    /*Lat and Long of Hyderabad : 17.434586,78.384402*/

  /*Note: AcGePoint3d expected to be Long,Lat,alt*/

  AcGePoint3d refPtInUTM84, refPtInLatLong(78.384402,17.434586,0.0);

    /*Get WCS point*/

  pGeoData->transformFromLonLatAlt(refPtInLatLong,refPtInUTM84);

  pGeoData->setReferencePoint(refPtInUTM84);

  pGeoData->setNorthDirectionVector(AcGeVector2d::kYAxis);



      /*clean up*/

    delete pGeoCS;

    pGeoData.close();





  }[/code]

 

 

 

 

‎使用 ObjectARX 定位地理标记‎ 坐标转换
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|中国膜结构网|中国膜结构协会|进口膜材|国产膜材|ETFE|PVDF|PTFE|设计|施工|安装|车棚|看台|污水池|中国膜结构网_中国空间膜结构协会

GMT+8, 2024-11-1 13:34 , Processed in 0.125381 second(s), 24 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表