本文整理汇总了C++中GeoDataLineString::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ GeoDataLineString::clear方法的具体用法?C++ GeoDataLineString::clear怎么用?C++ GeoDataLineString::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GeoDataLineString
的用法示例。
在下文中一共展示了GeoDataLineString::clear方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: processEditingOnMove
bool PolylineAnnotation::processEditingOnMove( QMouseEvent *mouseEvent )
{
if ( !m_viewport ) {
return false;
}
qreal lon, lat;
m_viewport->geoCoordinates( mouseEvent->pos().x(),
mouseEvent->pos().y(),
lon, lat,
GeoDataCoordinates::Radian );
const GeoDataCoordinates newCoords( lon, lat );
if ( m_interactingObj == InteractingNode ) {
GeoDataLineString *line = static_cast<GeoDataLineString*>( placemark()->geometry() );
line->at(m_clickedNodeIndex) = newCoords;
return true;
} else if ( m_interactingObj == InteractingPolyline ) {
GeoDataLineString *lineString = static_cast<GeoDataLineString*>( placemark()->geometry() );
const GeoDataLineString oldLineString = *lineString;
lineString->clear();
const qreal deltaLat = lat - m_movedPointCoords.latitude();
const qreal deltaLon = lon - m_movedPointCoords.longitude();
Quaternion latRectAxis = Quaternion::fromEuler( 0, lon, 0);
Quaternion latAxis = Quaternion::fromEuler( -deltaLat, 0, 0);
Quaternion lonAxis = Quaternion::fromEuler(0, deltaLon, 0);
Quaternion rotAxis = latRectAxis * latAxis * latRectAxis.inverse() * lonAxis;
qreal lonRotated, latRotated;
for ( int i = 0; i < oldLineString.size(); ++i ) {
Quaternion qpos = oldLineString.at(i).quaternion();
qpos.rotateAroundAxis(rotAxis);
qpos.getSpherical( lonRotated, latRotated );
GeoDataCoordinates movedPoint( lonRotated, latRotated, 0 );
lineString->append( movedPoint );
}
m_movedPointCoords = newCoords;
return true;
}
return dealWithHovering( mouseEvent );
}
示例2: move
void PolylineAnnotation::move( const GeoDataCoordinates &source, const GeoDataCoordinates &destination )
{
GeoDataLineString *lineString = static_cast<GeoDataLineString*>( placemark()->geometry() );
GeoDataLineString oldLineString = *lineString;
lineString->clear();
const qreal deltaLat = destination.latitude() - source.latitude();
const qreal deltaLon = destination.longitude() - source.longitude();
Quaternion latRectAxis = Quaternion::fromEuler( 0, destination.longitude(), 0);
Quaternion latAxis = Quaternion::fromEuler( -deltaLat, 0, 0);
Quaternion lonAxis = Quaternion::fromEuler(0, deltaLon, 0);
Quaternion rotAxis = latRectAxis * latAxis * latRectAxis.inverse() * lonAxis;
qreal lonRotated, latRotated;
for ( int i = 0; i < oldLineString.size(); ++i ) {
Quaternion qpos = oldLineString.at(i).quaternion();
qpos.rotateAroundAxis(rotAxis);
qpos.getSpherical( lonRotated, latRotated );
GeoDataCoordinates movedPoint( lonRotated, latRotated, 0 );
lineString->append( movedPoint );
}
}