1.1 --- a/linkablemapobj.cpp Mon Mar 27 20:21:57 2006 +0000
1.2 +++ b/linkablemapobj.cpp Tue Sep 05 15:05:18 2006 +0000
1.3 @@ -5,6 +5,8 @@
1.4 #include "mapeditor.h"
1.5
1.6 #include "version.h"
1.7 +//Added by qt3to4:
1.8 +#include <Q3PointArray>
1.9
1.10
1.11 /////////////////////////////////////////////////////////////////
1.12 @@ -17,7 +19,7 @@
1.13 init ();
1.14 }
1.15
1.16 -LinkableMapObj::LinkableMapObj(QCanvas* c) :MapObj(c)
1.17 +LinkableMapObj::LinkableMapObj(Q3Canvas* c) :MapObj(c)
1.18 {
1.19 // cout << "Const LinkableMapObj\n";
1.20 init ();
1.21 @@ -77,15 +79,15 @@
1.22 linkpos=LinkBottom;
1.23 segment.setAutoDelete (TRUE);
1.24 arcsegs=13;
1.25 - QPointArray pa(arcsegs*2+2);
1.26 + Q3PointArray pa(arcsegs*2+2);
1.27
1.28 - bottomline=new QCanvasLine(canvas);
1.29 + bottomline=new Q3CanvasLine(canvas);
1.30 bottomline->setPen( QPen(linkcolor, 1) );
1.31 bottomline->setZ(Z_LINK);
1.32 bottomline->show();
1.33
1.34 // Prepare showing the selection of a MapObj
1.35 - selbox = new QCanvasRectangle (canvas);
1.36 + selbox = new Q3CanvasRectangle (canvas);
1.37 selbox->setZ(Z_SELBOX);
1.38 selbox->setBrush( QColor(255,255,0) );
1.39 selbox->setPen( QPen(QColor(255,255,0) ));
1.40 @@ -152,8 +154,7 @@
1.41 {
1.42 if (parObj)
1.43 {
1.44 - relPos.setX (absPos.x() - parObj->getChildPos().x() );
1.45 - relPos.setY (absPos.y() - parObj->getChildPos().y() );
1.46 + relPos=getRelPos();
1.47
1.48 parObj->calcBBoxSize();
1.49 parObj->requestReposition();
1.50 @@ -169,6 +170,14 @@
1.51 }
1.52 }
1.53
1.54 +QPoint LinkableMapObj::getRelPos()
1.55 +{
1.56 + if (!parObj) return QPoint();
1.57 + relPos.setX (absPos.x() - parObj->getChildPos().x() );
1.58 + relPos.setY (absPos.y() - parObj->getChildPos().y() );
1.59 + return relPos;
1.60 +}
1.61 +
1.62 int LinkableMapObj::getTopPad()
1.63 {
1.64 return topPad;
1.65 @@ -225,14 +234,14 @@
1.66 if (childObj!=NULL && parObj != NULL)
1.67 {
1.68 int i;
1.69 - QCanvasLine* cl;
1.70 + Q3CanvasLine* cl;
1.71 switch (style)
1.72 {
1.73 case StyleUndef:
1.74 bottomline->hide();
1.75 break;
1.76 case StyleLine:
1.77 - l = new QCanvasLine(canvas);
1.78 + l = new Q3CanvasLine(canvas);
1.79 l->setPen( QPen(linkcolor, 1) );
1.80 l->setZ(Z_LINK);
1.81 if (visible)
1.82 @@ -243,7 +252,7 @@
1.83 case StyleParabel:
1.84 for (i=0;i<arcsegs;i++)
1.85 {
1.86 - cl = new QCanvasLine(canvas);
1.87 + cl = new Q3CanvasLine(canvas);
1.88 cl->setPen( QPen(linkcolor, 1) );
1.89 cl->setPoints( 0,0,i*10,100);
1.90 cl->setZ(Z_LINK);
1.91 @@ -256,7 +265,7 @@
1.92 pa0.resize (arcsegs+1);
1.93 break;
1.94 case StylePolyLine:
1.95 - p = new QCanvasPolygon(canvas);
1.96 + p = new Q3CanvasPolygon(canvas);
1.97 p->setBrush( linkcolor );
1.98 p->setZ(Z_LINK);
1.99 if (visible)
1.100 @@ -266,7 +275,7 @@
1.101 pa0.resize (3);
1.102 // TODO a bit awkward: draw the lines additionally to polygon, to avoid
1.103 // missing pixels, when polygon is extremly flat
1.104 - l = new QCanvasLine(canvas);
1.105 + l = new Q3CanvasLine(canvas);
1.106 l->setPen( QPen(linkcolor, 1) );
1.107 l->setZ(Z_LINK);
1.108 if (visible)
1.109 @@ -275,7 +284,7 @@
1.110 l->hide();
1.111 break;
1.112 case StylePolyParabel:
1.113 - p = new QCanvasPolygon(canvas);
1.114 + p = new Q3CanvasPolygon(canvas);
1.115 p->setBrush( linkcolor );
1.116 p->setZ(Z_LINK);
1.117 if (visible)
1.118 @@ -291,7 +300,7 @@
1.119 // if polygon is extremly flat
1.120 for (i=0;i<arcsegs;i++)
1.121 {
1.122 - cl = new QCanvasLine(canvas);
1.123 + cl = new Q3CanvasLine(canvas);
1.124 cl->setPen( QPen(linkcolor, 1) );
1.125 cl->setPoints( 0,0,i*10,100);
1.126 cl->setZ(Z_LINK);
1.127 @@ -348,7 +357,7 @@
1.128 {
1.129 linkcolor=col;
1.130 bottomline->setPen( QPen(linkcolor, 1) );
1.131 - QCanvasLine *cl;
1.132 + Q3CanvasLine *cl;
1.133 switch (style)
1.134 {
1.135 case StyleLine:
1.136 @@ -400,7 +409,7 @@
1.137
1.138 void LinkableMapObj::setVisibility (bool v)
1.139 {
1.140 - QCanvasLine* cl;
1.141 + Q3CanvasLine* cl;
1.142 MapObj::setVisibility (v);
1.143 bool visnow=visible;
1.144
1.145 @@ -550,7 +559,7 @@
1.146 // "turning point" for drawing polygonal links
1.147 QPoint tp (-qRound(sin (a)*thickness_start), qRound(cos (a)*thickness_start));
1.148
1.149 - QCanvasLine *cl;
1.150 + Q3CanvasLine *cl;
1.151
1.152 int i;
1.153
1.154 @@ -663,21 +672,6 @@
1.155 return parPos;
1.156 }
1.157
1.158 -QPoint LinkableMapObj::getRelPos()
1.159 -{
1.160 - return relPos;
1.161 -/* FIXME not needed? relPos was moved in 1.7.10 from
1.162 - floatobj to linkablemapobj. Before we had:
1.163 -
1.164 - if (!parObj) return QPoint (0,0);
1.165 - return QPoint(
1.166 - absPos.x() - parObj->x(),
1.167 - absPos.y() - parObj->y()
1.168 - );
1.169 -*/
1.170 -}
1.171 -
1.172 -
1.173 void LinkableMapObj::setUseOrientation (const bool &b)
1.174 {
1.175 if (useOrientation!=b)
1.176 @@ -802,7 +796,7 @@
1.177 setVisibility (visible);
1.178 }
1.179
1.180 -void LinkableMapObj::parabel (QPointArray &ya, double p1x, double p1y, double p2x, double p2y)
1.181 +void LinkableMapObj::parabel (Q3PointArray &ya, double p1x, double p1y, double p2x, double p2y)
1.182
1.183 {
1.184 double vx=p2x - p1x; // V=P2-P1