2007-06-30 17:41:07 +00:00
|
|
|
#ifndef PART_POLYGON_H
|
|
|
|
#define PART_POLYGON_H
|
|
|
|
#include <QtGui>
|
|
|
|
#include "customelementgraphicpart.h"
|
|
|
|
class PolygonEditor;
|
2007-10-21 16:10:21 +00:00
|
|
|
/**
|
|
|
|
Cette classe represente un polygone pouvant etre utilise pour composer le
|
|
|
|
dessin d'un element dans l'editeur d'element.
|
|
|
|
*/
|
2007-06-30 17:41:07 +00:00
|
|
|
class PartPolygon : public QGraphicsPolygonItem, public CustomElementGraphicPart {
|
|
|
|
// constructeurs, destructeur
|
|
|
|
public:
|
2007-08-25 03:43:05 +00:00
|
|
|
PartPolygon(QETElementEditor *, QGraphicsItem * = 0, QGraphicsScene * = 0);
|
2007-09-10 19:42:16 +00:00
|
|
|
virtual ~PartPolygon() {}
|
2007-06-30 17:41:07 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
PartPolygon(const PartPolygon &);
|
|
|
|
|
|
|
|
// attributs
|
|
|
|
private:
|
|
|
|
bool closed;
|
|
|
|
PolygonEditor *informations;
|
|
|
|
|
|
|
|
/**
|
|
|
|
constructeur
|
|
|
|
paint()
|
|
|
|
widget bidon pour l'edition
|
|
|
|
methode pour poser le polygone :
|
|
|
|
-mousePressEvent = pose un nouveau point
|
|
|
|
-mouseMoveEvent = deplace ce point
|
|
|
|
-mouveReleaseEvent = finalise ce point
|
|
|
|
utiliser QPolygonF ; memoriser le point en cours (tout comme le
|
|
|
|
partploygon en cours) et ne l'ajouter au qpolygonf que lors du
|
|
|
|
mouseReleaseEvent
|
|
|
|
*/
|
|
|
|
// methodes
|
|
|
|
public:
|
2007-10-07 18:52:01 +00:00
|
|
|
enum { Type = UserType + 1105 };
|
|
|
|
virtual int type() const { return Type; }
|
2007-11-07 20:23:24 +00:00
|
|
|
virtual QString name() const { return(QObject::tr("polygone")); }
|
2007-06-30 17:41:07 +00:00
|
|
|
void fromXml(const QDomElement &);
|
|
|
|
const QDomElement toXml(QDomDocument &) const;
|
|
|
|
void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *);
|
|
|
|
void setClosed(bool c);
|
|
|
|
bool isClosed() const;
|
2007-08-25 03:43:05 +00:00
|
|
|
void setProperty(const QString &, const QVariant &);
|
|
|
|
virtual QVariant property(const QString &);
|
2007-06-30 17:41:07 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
QVariant itemChange(GraphicsItemChange, const QVariant &);
|
|
|
|
};
|
|
|
|
/**
|
|
|
|
Specifie si le polygone doit etre ferme
|
|
|
|
@param c true pour un polygone ferme, false sinon
|
|
|
|
*/
|
|
|
|
inline void PartPolygon::setClosed(bool c) {
|
|
|
|
closed = c;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
Indique si le polygone est ferme
|
|
|
|
@return true si le polygone est ferme, false sinon
|
|
|
|
*/
|
|
|
|
inline bool PartPolygon::isClosed() const {
|
|
|
|
return(closed);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|