00001
00002
00003 #ifndef LINE_H
00004 #define LINE_H
00005
00006 #include <qcolor.h>
00007 #include <qpainter.h>
00008 #include <qstringlist.h>
00009 #include "Point.h"
00010 #include "Arrow.h"
00011
00012 class Line
00013 {
00014 public:
00015 Line(Point s=0,Point e=0,QColor c=QColor("black"),int w=1);
00016 QStringList Info();
00017 void save(QTextStream *t);
00018 void open(QTextStream *t,int version);
00019 QDomElement saveXML(QDomDocument doc);
00020 void openXML(QDomNode node);
00021 Point startPoint() { return start; }
00022 Point endPoint() { return end; }
00023 void setStartPoint(double x, double y) { start=Point(x,y);}
00024 void setEndPoint(double x, double y) { end=Point(x,y);}
00025 int Width() { return width; }
00026 void setWidth(int w) { width=w; }
00027 QColor Color() { return color; }
00028 void setColor(QColor c) { color=c; }
00029 void setColor(QString c) { color=QColor(c); }
00030 Arrow* startArrow() { return sarrow; }
00031 Arrow* endArrow() { return earrow; }
00032 void setStartArrow(Arrow *a) { sarrow = a; }
00033 void setEndArrow(Arrow *e) { earrow = e; }
00034 void draw(QPainter *p, int w, int h);
00035 bool inside(int x, int y, int w, int h);
00036 protected:
00037 Point start, end;
00038 QColor color;
00039 int width;
00040 Arrow *sarrow, *earrow;
00041 };
00042
00043 #endif //LINE_H