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 GEOMETRY_H
00027 #define GEOMETRY_H
00028 #include <QObject>
00029 #include <QPainter>
00030 #include <QDebug>
00031 #include "mapadapter.h"
00032
00033 namespace qmapcontrol
00034 {
00035 class Point;
00037
00046 class Geometry : public QObject
00047 {
00048 friend class LineString;
00049 Q_OBJECT
00050 public:
00051 explicit Geometry(QString name = QString());
00052 virtual ~Geometry();
00053
00054 QString GeometryType;
00055
00057
00062 bool Equals(Geometry* geom);
00063
00065
00069 QString toString();
00070
00072
00075 QString name() const;
00076
00078
00082 Geometry* parentGeometry() const;
00083
00085
00088 bool isVisible() const;
00089
00091
00094 void setName(QString name);
00095
00097
00101 QPen* pen() const;
00102
00104
00108 virtual QRectF boundingBox()=0;
00109 virtual bool Touches(Point* geom, const MapAdapter* mapadapter)=0;
00110 virtual void draw(QPainter* painter, const MapAdapter* mapadapter, const QRect &viewport, const QPoint offset)=0;
00111 virtual bool hasPoints() const;
00112 virtual bool hasClickedPoints() const;
00113 virtual void setPen(QPen* pen);
00114 virtual QList<Geometry*> clickedPoints();
00115 virtual QList<Point*> points()=0;
00116
00117 private:
00118 Geometry* myparentGeometry;
00119 Geometry(const Geometry& old);
00120 Geometry& operator=(const Geometry& rhs);
00121
00122 protected:
00123 QPen* mypen;
00124 bool visible;
00125 QString myname;
00126 void setParentGeometry(Geometry* geom);
00127
00128 signals:
00129 void updateRequest(Geometry* geom);
00130 void updateRequest(QRectF rect);
00132
00138 void geometryClicked(Geometry* geometry, QPoint point);
00139
00141
00144 void positionChanged(Geometry* geom);
00145
00146 public slots:
00148
00151 virtual void setVisible(bool visible);
00152 };
00153 }
00154 #endif