Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef CLUSTER_H
00027 #define CLUSTER_H
00028
00029 #include <QGpCoreTools.h>
00030
00031 #include "TapePositioningSystemDLLExport.h"
00032
00033 namespace TapePositioningSystem {
00034
00035 class Node;
00036 class Anchoring;
00037
00038 class TAPEPOSITIONINGSYSTEM_EXPORT Cluster
00039 {
00040 public:
00041 Cluster();
00042 Cluster(const Cluster& o);
00043 ~Cluster() {}
00044
00045 bool operator==(const Cluster& o) const;
00046 bool operator<(const Cluster& o) const;
00047
00048 enum Type {None, Quad, StrongQuad, WeakQuad};
00049
00050 Type type() const {return _type;}
00051 QString name() const;
00052 double distance(Node * node1, Node * node2) const;
00053 Point2D coordinates(Node * node) const {return _nodes[node];}
00054
00055 void setOrigin(Node * node);
00056 bool setQuad(QList<Node *> nodes);
00057 bool setCoordinateSystem(Node * origin, Node * north, Node * eastward);
00058
00059 Anchoring * anchoring(const Cluster& quad) const;
00060 bool add(const Cluster& quad, const Anchoring * anchoring);
00061
00062 bool isRobustQuad(double stddev) const;
00063
00064 QList<Node *> nodes() const {return _nodes.keys();}
00065 int count() const {return _nodes.count();}
00066 QMap<Node *, Point2D>::const_iterator find(Node * node) const {return _nodes.find(node);}
00067 QMap<Node *, Point2D>::const_iterator end() const {return _nodes.end();}
00068 bool contains(Node * node) const {return _nodes.contains(node);}
00069
00070 static bool lessThan(const Cluster * c1, const Cluster * c2) {return *c1<*c2;}
00071 static bool equal(const Cluster * c1, const Cluster * c2) {return *c1==*c2;}
00072 private:
00073 bool calculateStrongQuad(QList<Node *> nodes);
00074 bool calculateWeakQuad(Node * a, QList<Node *> nodes);
00075 static bool isRobustTriangle(const Point2D& a, const Point2D& b, const Point2D& c, double stddev);
00076
00077 Type _type;
00078 Node * _origin;
00079 QMap<Node *, Point2D> _nodes;
00080 };
00081
00082 }
00083
00084 #endif // CLUSTER_H