author | insilmaril |
Tue Sep 04 13:53:33 2007 +0000 (2007-09-04) | |
changeset 593 | e46d634e071c |
parent 408 | c2a05fa925a1 |
child 621 | c60984c46f9f |
permissions | -rw-r--r-- |
insilmaril@95 | 1 |
#ifndef XLINKOBJ_H |
insilmaril@95 | 2 |
#define XLINKOBJ_H |
insilmaril@95 | 3 |
|
insilmaril@95 | 4 |
#include "linkablemapobj.h" |
insilmaril@95 | 5 |
|
insilmaril@95 | 6 |
enum XLinkState {undefinedXLink,initXLink,activeXLink,deleteXLink}; |
insilmaril@95 | 7 |
|
insilmaril@478 | 8 |
/*! \brief xlinks are used to draw arbitrary connections between branches (BranchObj) in the map. */ |
insilmaril@478 | 9 |
|
insilmaril@95 | 10 |
///////////////////////////////////////////////////////////////////////////// |
insilmaril@95 | 11 |
class XLinkObj:public MapObj { |
insilmaril@95 | 12 |
public: |
insilmaril@95 | 13 |
XLinkObj (); |
insilmaril@408 | 14 |
XLinkObj (QGraphicsScene*); |
insilmaril@95 | 15 |
~XLinkObj (); |
insilmaril@95 | 16 |
virtual void init (); |
insilmaril@95 | 17 |
virtual void copy (XLinkObj*); |
insilmaril@95 | 18 |
void setBegin (BranchObj*); |
insilmaril@299 | 19 |
BranchObj* getBegin(); |
insilmaril@95 | 20 |
void setEnd (BranchObj*); |
insilmaril@408 | 21 |
void setEnd (QPointF); |
insilmaril@299 | 22 |
BranchObj* getEnd(); |
insilmaril@95 | 23 |
void setColor(QColor); |
insilmaril@97 | 24 |
QColor getColor(); |
insilmaril@97 | 25 |
void setWidth (int); |
insilmaril@97 | 26 |
int getWidth (); |
insilmaril@95 | 27 |
bool activate (); // Sets pointers in branchObjects |
insilmaril@95 | 28 |
void deactivate(); // removes those pointers |
insilmaril@95 | 29 |
bool isUsed(); // true, if at least on branch uses it |
insilmaril@95 | 30 |
void updateXLink(); |
insilmaril@95 | 31 |
BranchObj* otherBranch (BranchObj*); |
insilmaril@95 | 32 |
void positionBBox(); |
insilmaril@95 | 33 |
void calcBBoxSize(); |
insilmaril@95 | 34 |
void setVisibility (bool); |
insilmaril@95 | 35 |
void setVisibility (); |
insilmaril@95 | 36 |
QString saveToDir (); |
insilmaril@95 | 37 |
|
insilmaril@95 | 38 |
private: |
insilmaril@95 | 39 |
static int arrowSize; |
insilmaril@408 | 40 |
QPen pen; |
insilmaril@97 | 41 |
QColor color; |
insilmaril@97 | 42 |
int width; |
insilmaril@408 | 43 |
QGraphicsLineItem *line; |
insilmaril@408 | 44 |
QGraphicsPolygonItem *poly; |
insilmaril@95 | 45 |
BranchObj *beginBranch; |
insilmaril@95 | 46 |
BranchObj *endBranch; |
insilmaril@95 | 47 |
BranchObj *visBranch; // the "visible" part of a partially scrolled link |
insilmaril@95 | 48 |
XLinkState xLinkState; // init during drawing or active |
insilmaril@408 | 49 |
QPointF beginPos; |
insilmaril@408 | 50 |
QPointF endPos; |
insilmaril@95 | 51 |
}; |
insilmaril@95 | 52 |
|
insilmaril@95 | 53 |
#endif |