本文整理汇总了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
}