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,Arrow *sa=0, Arrow *ea=0);
00016 QStringList Info();
00017 void save(QTextStream *t);
00018 void open(QTextStream *t,int version);
00019 Point startPoint() { return start; }
00020 Point endPoint() { return end; }
00021 void setStartPoint(double x, double y) { start=Point(x,y);}
00022 void setEndPoint(double x, double y) { end=Point(x,y);}
00023 int Width() { return width; }
00024 void setWidth(int w) { width=w; }
00025 QColor Color() { return color; }
00026 void setColor(QColor c) { color=c; }
00027 void setColor(QString c) { color=QColor(c); }
00028 Arrow* startArrow() { return sarrow; }
00029 Arrow* endArrow() { return earrow; }
00030 void setStartArrow(Arrow *a) { sarrow = a; }
00031 void setEndArrow(Arrow *e) { earrow = e; }
00032 void draw(QPainter *p, int w, int h);
00033 bool inside(int x, int y, int w, int h);
00034 protected:
00035 Point start, end;
00036 QColor color;
00037 int width;
00038 Arrow *sarrow, *earrow;
00039 };
00040
00041 #endif //LINE_H