summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2009-04-22 15:35:12 -0400
committerBen Boeckel <MathStuf@gmail.com>2009-04-22 15:35:12 -0400
commit214ac803ab9fbfa562d29c3e2e7fa1e5c075e873 (patch)
tree9c14b0af9117c39df1de586fe60b75190d0213b6
parent1f493c3186f672bf5f0473ef84d37d398a1555b6 (diff)
downloadsigen-214ac803ab9fbfa562d29c3e2e7fa1e5c075e873.tar.gz
sigen-214ac803ab9fbfa562d29c3e2e7fa1e5c075e873.tar.xz
sigen-214ac803ab9fbfa562d29c3e2e7fa1e5c075e873.zip
Move the touches method out of WorldPlacement
-rw-r--r--sigmodr/widgets/mapeditor/WorldMapPlacement.cpp30
-rw-r--r--sigmodr/widgets/mapeditor/WorldMapPlacement.h1
2 files changed, 15 insertions, 16 deletions
diff --git a/sigmodr/widgets/mapeditor/WorldMapPlacement.cpp b/sigmodr/widgets/mapeditor/WorldMapPlacement.cpp
index cf7d9ea0..977b17e1 100644
--- a/sigmodr/widgets/mapeditor/WorldMapPlacement.cpp
+++ b/sigmodr/widgets/mapeditor/WorldMapPlacement.cpp
@@ -26,6 +26,21 @@
using namespace Sigmodr::Widgets;
+static bool touches(const QPolygon& polygon1, const QPolygon& polygon2)
+{
+ foreach (const QPoint& point, polygon1)
+ {
+ if (polygon2.containsPoint(point, Qt::OddEvenFill))
+ return true;
+ }
+ foreach (const QPoint& point, polygon2)
+ {
+ if (polygon1.containsPoint(point, Qt::OddEvenFill))
+ return true;
+ }
+ return false;
+}
+
bool WorldMapPlacement::m_cacheGood = false;
QSize WorldMapPlacement::m_size;
QList<QPolygon> WorldMapPlacement::m_polygons;
@@ -172,21 +187,6 @@ void WorldMapPlacement::finalize()
m_cacheGood = true;
}
-bool WorldMapPlacement::touches(const QPolygon& polygon1, const QPolygon& polygon2)
-{
- foreach (const QPoint& point, polygon1)
- {
- if (polygon2.containsPoint(point, Qt::OddEvenFill))
- return true;
- }
- foreach (const QPoint& point, polygon2)
- {
- if (polygon1.containsPoint(point, Qt::OddEvenFill))
- return true;
- }
- return false;
-}
-
QPolygon WorldMapPlacement::mergePolygons(const QPolygon& polygon1, const QPolygon& polygon2)
{
// TODO: merge the polygons
diff --git a/sigmodr/widgets/mapeditor/WorldMapPlacement.h b/sigmodr/widgets/mapeditor/WorldMapPlacement.h
index 19c5e66a..13e4daca 100644
--- a/sigmodr/widgets/mapeditor/WorldMapPlacement.h
+++ b/sigmodr/widgets/mapeditor/WorldMapPlacement.h
@@ -51,7 +51,6 @@ class SIGMODRWIDGETS_NO_EXPORT WorldMapPlacement
};
void finalize();
- bool touches(const QPolygon& polygon1, const QPolygon& polygon2);
QPolygon mergePolygons(const QPolygon& polygon1, const QPolygon& polygon2);
QRect closer(const QRect& rect1, const QRect& rect2, const QPoint& point);