xlinkobj.cpp
changeset 97 0b048b6bb6f4
parent 95 f688a9913724
child 102 dba9303a1a5c
     1.1 --- a/xlinkobj.cpp	Mon Apr 18 06:37:48 2005 +0000
     1.2 +++ b/xlinkobj.cpp	Thu Apr 21 19:14:38 2005 +0000
     1.3 @@ -1,5 +1,6 @@
     1.4  #include "xlinkobj.h"
     1.5  #include "branchobj.h"
     1.6 +#include "mapeditor.h"
     1.7  
     1.8  
     1.9  /////////////////////////////////////////////////////////////////
    1.10 @@ -7,7 +8,6 @@
    1.11  /////////////////////////////////////////////////////////////////
    1.12  
    1.13  int XLinkObj::arrowSize=10;						// make instances 
    1.14 -QColor XLinkObj::defXLinkColor=QColor(180,180,180); 
    1.15  
    1.16  XLinkObj::XLinkObj ():MapObj() 
    1.17  {
    1.18 @@ -38,13 +38,16 @@
    1.19  	visBranch=NULL;
    1.20  	xLinkState=undefinedXLink;
    1.21  
    1.22 -	xLinkColor=defXLinkColor;
    1.23 +	width=1;
    1.24 +	color=QColor (180,180,180);
    1.25  	line=new QCanvasLine (canvas);
    1.26  	line->setPoints (0,0,200,200);
    1.27 -	line->setPen (QPen(xLinkColor, 1));
    1.28 +	line->setPen (QPen(color, 1));
    1.29 +	line->setZ (Z_XLINK);
    1.30  
    1.31  	poly=new QCanvasPolygon (canvas);
    1.32 -	poly->setBrush( xLinkColor );
    1.33 +	poly->setBrush( color );
    1.34 +	poly->setZ (Z_XLINK);
    1.35  
    1.36  	setVisibility (false);
    1.37  }
    1.38 @@ -79,9 +82,27 @@
    1.39  	}		
    1.40  }
    1.41  
    1.42 +void XLinkObj::setWidth (int w)
    1.43 +{
    1.44 +	width=w;
    1.45 +	setColor (color);
    1.46 +}
    1.47 +
    1.48 +int XLinkObj::getWidth()
    1.49 +{
    1.50 +	return width;
    1.51 +}
    1.52 +
    1.53  void XLinkObj::setColor(QColor c)
    1.54  {
    1.55 -	xLinkColor=c;
    1.56 +	color=c;
    1.57 +	line->setPen (QPen(color, width));
    1.58 +	poly->setBrush( color );
    1.59 +}
    1.60 +
    1.61 +QColor XLinkObj::getColor()
    1.62 +{
    1.63 +	return color;
    1.64  }
    1.65  
    1.66  void XLinkObj::setEnd (QPoint p)
    1.67 @@ -249,10 +270,11 @@
    1.68  	QString s;
    1.69  	if (beginBranch && endBranch)
    1.70  	{
    1.71 -		QString colAttr=attribut ("color",xLinkColor.name());
    1.72 +		QString colAttr=attribut ("color",color.name());
    1.73 +		QString widAttr=attribut ("width",QString().setNum(width,10));
    1.74  		QString begSelAttr=attribut ("beginBranch",beginBranch->getSelectString());
    1.75  		QString endSelAttr=attribut ("endBranch",  endBranch->getSelectString());
    1.76 -		s=beginElement ("xlink", colAttr +begSelAttr +endSelAttr);
    1.77 +		s=beginElement ("xlink", colAttr +widAttr +begSelAttr +endSelAttr);
    1.78  
    1.79  		s+=endElement ("xlink");
    1.80  	}