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


C++ GraphicObject::getApex方法代码示例

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


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

示例1: generatePolygonalLayer


//.........这里部分代码省略.........
            {
               mXml.pushAddPoint(mXml.addElement("Point"));
               mXml.addText(QString::number(order).toAscii().data(), mXml.addElement("drawOrder"));
               LocationType geo = pGeoElement->convertPixelToGeocoord(*vertex);
               mXml.addText(QString("%1,%2").arg(geo.mY, 0, 'f', 10).arg(geo.mX, 0, 'f', 10).toAscii().data(),
                  mXml.addElement("coordinates"));
               mXml.popAddPoint(); // Point
            }
            mXml.popAddPoint();
            break;
         }
      case LINE_OBJECT:
      case POLYLINE_OBJECT:
      case HLINE_OBJECT:
      case VLINE_OBJECT:
      case ROW_OBJECT:
      case COLUMN_OBJECT:
         {
            mXml.pushAddPoint(mXml.addElement("LineString"));
            mXml.addText(QString::number(order).toAscii().data(), mXml.addElement("drawOrder"));
            mXml.addText("1", mXml.addElement("tessellate"));
            QStringList coords;
            vector<LocationType> vertices;
            if (pObject->getGraphicObjectType() == POLYLINE_OBJECT)
            {
               vertices = static_cast<PolylineObject*>(pObject)->getVertices();
            }
            else
            {
               LocationType ll = pObject->getLlCorner();
               LocationType ur = pObject->getUrCorner();
               vertices.push_back(ll);
               vertices.push_back(ur);
            }
            for (vector<LocationType>::const_iterator vertex = vertices.begin(); vertex != vertices.end(); ++vertex)
            {
               LocationType geo = pGeoElement->convertPixelToGeocoord(*vertex);
               coords << QString("%1,%2").arg(geo.mY, 0, 'f', 10).arg(geo.mX, 0, 'f', 10);
            }
            mXml.addText(coords.join(" ").toAscii().data(), mXml.addElement("coordinates"));
            mXml.popAddPoint(); // LineString
            break;
         }
      case RECTANGLE_OBJECT:
      case TRIANGLE_OBJECT:
      case POLYGON_OBJECT:
         {
            mXml.pushAddPoint(mXml.addElement("Polygon"));
            mXml.addText(QString::number(order).toAscii().data(), mXml.addElement("drawOrder"));
            mXml.addText("1", mXml.addElement("tessellate"));
            mXml.pushAddPoint(mXml.addElement("LinearRing", mXml.addElement("outerBoundaryIs")));
            QStringList coords;
            vector<LocationType> vertices;
            LocationType ll = pObject->getLlCorner();
            LocationType ur = pObject->getUrCorner();
            LocationType center = (ll + ur);
            center.mX /= 2.0;
            center.mY /= 2.0;
            if (pObject->getGraphicObjectType() == RECTANGLE_OBJECT)
            {
               vertices.push_back(ll);
               vertices.push_back(LocationType(ll.mX, ur.mY));
               vertices.push_back(ur);
               vertices.push_back(LocationType(ur.mX, ll.mY));
            }
            else if (pObject->getGraphicObjectType() == TRIANGLE_OBJECT)
            {
               double apex = pObject->getApex();
               vertices.push_back(ll);
               vertices.push_back(LocationType(ur.mX, ll.mY));
               vertices.push_back(LocationType(ll.mX + apex * (ur.mX - ll.mX), ur.mY));
               vertices.push_back(ll);
            }
            else
            {
               vertices = static_cast<PolygonObject*>(pObject)->getVertices();
            }
            QPointF qcenter(center.mX, center.mY);
            QMatrix matrix;
            matrix.rotate(pObject->getRotation());
            for (vector<LocationType>::const_iterator vertex = vertices.begin(); vertex != vertices.end(); ++vertex)
            {
               QPointF point(vertex->mX - center.mX, vertex->mY - center.mY);
               point = point * matrix;
               point += qcenter;
               LocationType geo = pGeoElement->convertPixelToGeocoord(LocationType(point.x(), point.y()));
               coords << QString("%1,%2").arg(geo.mY, 0, 'f', 10).arg(geo.mX, 0, 'f', 10);
            }
            mXml.addText(coords.join(" ").toAscii().data(), mXml.addElement("coordinates"));
            mXml.popAddPoint(); // LinearRing
            mXml.popAddPoint(); // Polygon
            break;
         }
      default: // not supported
         break;
      }
      mXml.popAddPoint(); // Placemark
   }
   mXml.popAddPoint(); // Folder
}
开发者ID:Tom-VdE,项目名称:opticks,代码行数:101,代码来源:Kml.cpp


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