当前位置: 首页>>代码示例>>C++>>正文


C++ RasterElement::convertPixelsToGeocoords方法代码示例

本文整理汇总了C++中RasterElement::convertPixelsToGeocoords方法的典型用法代码示例。如果您正苦于以下问题:C++ RasterElement::convertPixelsToGeocoords方法的具体用法?C++ RasterElement::convertPixelsToGeocoords怎么用?C++ RasterElement::convertPixelsToGeocoords使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RasterElement的用法示例。


在下文中一共展示了RasterElement::convertPixelsToGeocoords方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: generateBoundingBox

void Kml::generateBoundingBox(const Layer* pGeoLayer)
{
   VERIFYNRV(pGeoLayer != NULL);

   // Translate the view's corner coordinates into layer coordinates
   View* pView = pGeoLayer->getView();
   VERIFYNRV(pView != NULL);

   LocationType worldLowerLeft;
   LocationType worldUpperLeft;
   LocationType worldUpperRight;
   LocationType worldLowerRight;
   pView->getVisibleCorners(worldLowerLeft, worldUpperLeft, worldUpperRight, worldLowerRight);

   LocationType dataLowerLeft;
   LocationType dataUpperLeft;
   LocationType dataUpperRight;
   LocationType dataLowerRight;
   pGeoLayer->translateWorldToData(worldLowerLeft.mX, worldLowerLeft.mY, dataLowerLeft.mX, dataLowerLeft.mY);
   pGeoLayer->translateWorldToData(worldUpperLeft.mX, worldUpperLeft.mY, dataUpperLeft.mX, dataUpperLeft.mY);
   pGeoLayer->translateWorldToData(worldUpperRight.mX, worldUpperRight.mY, dataUpperRight.mX, dataUpperRight.mY);
   pGeoLayer->translateWorldToData(worldLowerRight.mX, worldLowerRight.mY, dataLowerRight.mX, dataLowerRight.mY);

   // Translate the layer coordinates into geocoordinates
   vector<LocationType> corners;
   corners.push_back(dataLowerLeft);
   corners.push_back(dataUpperLeft);
   corners.push_back(dataUpperRight);
   corners.push_back(dataLowerRight);

   RasterElement* pGeoElement = dynamic_cast<RasterElement*>(pGeoLayer->getDataElement());
   VERIFYNRV(pGeoElement != NULL);

   vector<LocationType> geoCorners = pGeoElement->convertPixelsToGeocoords(corners);

   // Determine the geo bounding box
   double north = -90.0;
   double south = 90.0;
   double east = -180.0;
   double west = 180.0;

   for (vector<LocationType>::iterator iter = geoCorners.begin(); iter != geoCorners.end(); ++iter)
   {
      LocationType geocoord = *iter;
      north = std::max(geocoord.mX, north);
      south = std::min(geocoord.mX, south);
      east = std::max(geocoord.mY, east);
      west = std::min(geocoord.mY, west);
   }

   // Write the info to the file calling StringUtilities first to get higher precision
   // instead of calling XmlWriter::addText() and passing in the double value
   string northText = StringUtilities::toXmlString(north);
   string southText = StringUtilities::toXmlString(south);
   string eastText = StringUtilities::toXmlString(east);
   string westText = StringUtilities::toXmlString(west);

   mXml.pushAddPoint(mXml.addElement("LatLonAltBox"));
   mXml.addText(northText, mXml.addElement("north"));
   mXml.addText(southText, mXml.addElement("south"));
   mXml.addText(eastText, mXml.addElement("east"));
   mXml.addText(westText, mXml.addElement("west"));
   mXml.popAddPoint();
}
开发者ID:Tom-VdE,项目名称:opticks,代码行数:64,代码来源:Kml.cpp


注:本文中的RasterElement::convertPixelsToGeocoords方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。