summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFriedrich W. H. Kossebau <kossebau@kde.org>2016-07-21 03:37:27 (GMT)
committerFriedrich W. H. Kossebau <kossebau@kde.org>2016-07-21 05:30:24 (GMT)
commit2d27a6eac09f5eaf5dfdabe6d82819b1d424fbce (patch)
tree15f055bced76efb44fed5461bf7cd27e81c88b39
parent671256d72267b88790fef1ecf94a8cf8cd6f6cca (diff)
QList<PolylineNode> -> QVector<PolylineNode>
-rw-r--r--src/plugins/render/annotate/AreaAnnotation.cpp22
-rw-r--r--src/plugins/render/annotate/AreaAnnotation.h10
-rw-r--r--src/plugins/render/annotate/PolylineAnnotation.cpp1
-rw-r--r--src/plugins/render/annotate/PolylineAnnotation.h6
-rw-r--r--src/plugins/render/annotate/PolylineNode.h2
5 files changed, 24 insertions, 17 deletions
diff --git a/src/plugins/render/annotate/AreaAnnotation.cpp b/src/plugins/render/annotate/AreaAnnotation.cpp
index e2b977f..ec5e076 100644
--- a/src/plugins/render/annotate/AreaAnnotation.cpp
+++ b/src/plugins/render/annotate/AreaAnnotation.cpp
@@ -278,8 +278,8 @@ void AreaAnnotation::deleteAllSelectedNodes()
// If it proves inefficient, try something different.
GeoDataLinearRing initialOuterRing = polygon->outerBoundary();
QVector<GeoDataLinearRing> initialInnerRings = polygon->innerBoundaries();
- QList<PolylineNode> initialOuterNodes = m_outerNodesList;
- QList< QList<PolylineNode> > initialInnerNodes = m_innerNodesList;
+ const QVector<PolylineNode> initialOuterNodes = m_outerNodesList;
+ const QVector< QVector<PolylineNode> > initialInnerNodes = m_innerNodesList;
for ( int i = 0; i < outerRing.size(); ++i ) {
if ( m_outerNodesList.at(i).isSelected() ) {
@@ -351,8 +351,8 @@ void AreaAnnotation::deleteClickedNode()
// If it proves inefficient, try something different.
GeoDataLinearRing initialOuterRing = polygon->outerBoundary();
QVector<GeoDataLinearRing> initialInnerRings = polygon->innerBoundaries();
- QList<PolylineNode> initialOuterNodes = m_outerNodesList;
- QList< QList<PolylineNode> > initialInnerNodes = m_innerNodesList;
+ const QVector<PolylineNode> initialOuterNodes = m_outerNodesList;
+ const QVector< QVector<PolylineNode> > initialInnerNodes = m_innerNodesList;
int i = m_clickedNodeIndexes.first;
int j = m_clickedNodeIndexes.second;
@@ -587,7 +587,7 @@ void AreaAnnotation::dealWithStateChange( SceneGraphicsItem::ActionState previou
GeoDataPolygon *polygon = static_cast<GeoDataPolygon*>( placemark()->geometry() );
QVector<GeoDataLinearRing> &innerBounds = polygon->innerBoundaries();
- m_innerNodesList.append( QList<PolylineNode>() );
+ m_innerNodesList.append(QVector<PolylineNode>());
innerBounds.append( GeoDataLinearRing( Tessellate ) );
} else if ( state() == SceneGraphicsItem::MergingNodes ) {
m_firstMergedNode = QPair<int, int>( -1, -1 );
@@ -643,7 +643,8 @@ void AreaAnnotation::setupRegionsLists( GeoPainter *painter )
foreach ( const GeoDataLinearRing &innerRing, innerRings ) {
QVector<GeoDataCoordinates>::ConstIterator itBegin = innerRing.constBegin();
QVector<GeoDataCoordinates>::ConstIterator itEnd = innerRing.constEnd();
- QList<PolylineNode> innerNodes;
+ QVector<PolylineNode> innerNodes;
+ innerNodes.reserve(innerRing.size());
for ( ; itBegin != itEnd; ++itBegin ) {
const PolylineNode newNode = PolylineNode( painter->regionFromEllipse( *itBegin, regularDim, regularDim ) );
@@ -681,8 +682,9 @@ void AreaAnnotation::updateRegions( GeoPainter *painter )
}
m_innerVirtualNodes.clear();
+ m_innerVirtualNodes.reserve(innerRings.size());
for ( int i = 0; i < innerRings.size(); ++i ) {
- m_innerVirtualNodes.append( QList<PolylineNode>() );
+ m_innerVirtualNodes.append(QVector<PolylineNode>());
const QRegion firstRegion( painter->regionFromEllipse( innerRings.at(i).first().interpolate(
innerRings.at(i).last(), 0.5 ), hoveredDim, hoveredDim ) );
m_innerVirtualNodes[i].append( PolylineNode( firstRegion ) );
@@ -1344,7 +1346,8 @@ bool AreaAnnotation::processAddingNodesOnPress( QMouseEvent *mouseEvent )
if ( i != -1 && j == -1 ) {
GeoDataLinearRing newRing( Tessellate );
- QList<PolylineNode> newList;
+ QVector<PolylineNode> newList;
+ newList.reserve(outerRing.size());
for ( int k = i; k < i + outerRing.size(); ++k ) {
newRing.append( outerRing.at(k % outerRing.size()) );
@@ -1364,7 +1367,8 @@ bool AreaAnnotation::processAddingNodesOnPress( QMouseEvent *mouseEvent )
Q_ASSERT( i != -1 && j != -1 );
GeoDataLinearRing newRing( Tessellate );
- QList<PolylineNode> newList;
+ QVector<PolylineNode> newList;
+ newList.reserve(innerRings.at(i).size());
for ( int k = j; k < j + innerRings.at(i).size(); ++k ) {
newRing.append( innerRings.at(i).at(k % innerRings.at(i).size()) );
diff --git a/src/plugins/render/annotate/AreaAnnotation.h b/src/plugins/render/annotate/AreaAnnotation.h
index b1809bf..b740a78 100644
--- a/src/plugins/render/annotate/AreaAnnotation.h
+++ b/src/plugins/render/annotate/AreaAnnotation.h
@@ -234,11 +234,11 @@ private:
bool m_regionsInitialized;
bool m_busy;
- QList<PolylineNode> m_outerNodesList;
- QList<PolylineNode> m_outerVirtualNodes;
- QList< QList<PolylineNode> > m_innerNodesList;
- QList< QList<PolylineNode> > m_innerVirtualNodes;
- QVector<QRegion> m_boundariesList;
+ QVector<PolylineNode> m_outerNodesList;
+ QVector<PolylineNode> m_outerVirtualNodes;
+ QVector< QVector<PolylineNode> > m_innerNodesList;
+ QVector< QVector<PolylineNode> > m_innerVirtualNodes;
+ QVector<QRegion> m_boundariesList;
// Used in the Editing state
enum EditingInteractingObject {
diff --git a/src/plugins/render/annotate/PolylineAnnotation.cpp b/src/plugins/render/annotate/PolylineAnnotation.cpp
index d022e3e..aca2f4b 100644
--- a/src/plugins/render/annotate/PolylineAnnotation.cpp
+++ b/src/plugins/render/annotate/PolylineAnnotation.cpp
@@ -88,6 +88,7 @@ void PolylineAnnotation::setupRegionsLists( GeoPainter *painter )
QVector<GeoDataCoordinates>::ConstIterator itEnd = line.constEnd();
m_nodesList.clear();
+ m_nodesList.reserve(line.size());
for ( ; itBegin != itEnd; ++itBegin ) {
const PolylineNode newNode = PolylineNode( painter->regionFromEllipse( *itBegin, regularDim, regularDim ) );
m_nodesList.append( newNode );
diff --git a/src/plugins/render/annotate/PolylineAnnotation.h b/src/plugins/render/annotate/PolylineAnnotation.h
index 9e134b2..aecfbac 100644
--- a/src/plugins/render/annotate/PolylineAnnotation.h
+++ b/src/plugins/render/annotate/PolylineAnnotation.h
@@ -210,9 +210,9 @@ private:
bool m_regionsInitialized;
bool m_busy;
- QList<PolylineNode> m_nodesList;
- QList<PolylineNode> m_virtualNodesList;
- QRegion m_polylineRegion;
+ QVector<PolylineNode> m_nodesList;
+ QVector<PolylineNode> m_virtualNodesList;
+ QRegion m_polylineRegion;
// Used in Editing state
enum EditingInteractingObject {
diff --git a/src/plugins/render/annotate/PolylineNode.h b/src/plugins/render/annotate/PolylineNode.h
index 705cc32..2214a95 100644
--- a/src/plugins/render/annotate/PolylineNode.h
+++ b/src/plugins/render/annotate/PolylineNode.h
@@ -52,4 +52,6 @@ private:
}
+Q_DECLARE_TYPEINFO(Marble::PolylineNode, Q_MOVABLE_TYPE);
+
#endif