diff -r 53efc2562a7d -r 5db8dfd30ea2 linkablemapobj.cpp --- a/linkablemapobj.cpp Mon Nov 20 12:12:02 2006 +0000 +++ b/linkablemapobj.cpp Thu Nov 23 16:18:26 2006 +0000 @@ -45,7 +45,7 @@ delete (l); break; case StyleParabel: - segment.clear(); + while (!segment.isEmpty()) delete segment.takeFirst(); break; case StylePolyLine: delete (p); @@ -53,7 +53,7 @@ break; case StylePolyParabel: delete (p); - segment.clear(); + while (!segment.isEmpty()) delete segment.takeFirst(); break; default: break; @@ -76,7 +76,6 @@ thickness_start=8; style=StyleUndef; linkpos=LinkBottom; - segment.setAutoDelete (TRUE); arcsegs=13; Q3PointArray pa(arcsegs*2+2); @@ -198,8 +197,7 @@ LinkStyle LinkableMapObj::getDefLinkStyle () { - if (!mapEditor) return StyleUndef; - + if (mapEditor==0) return StyleUndef; LinkStyle ls=mapEditor->getMapLinkStyle(); switch (ls) { @@ -257,7 +255,7 @@ { cl = new Q3CanvasLine(canvas); cl->setPen( QPen(linkcolor, 1) ); - cl->setPoints( 0,0,i*10,100); + cl->setPoints( i*5,0,i*10,100); cl->setZ(Z_LINK); if (visible) cl->show(); @@ -305,7 +303,7 @@ { cl = new Q3CanvasLine(canvas); cl->setPen( QPen(linkcolor, 1) ); - cl->setPoints( 0,0,i*10,100); + cl->setPoints( 5*i,0,i*10,100); cl->setZ(Z_LINK); if (visible) cl->show(); @@ -360,15 +358,14 @@ { linkcolor=col; bottomline->setPen( QPen(linkcolor, 1) ); - Q3CanvasLine *cl; switch (style) { case StyleLine: l->setPen( QPen(col,1)); break; case StyleParabel: - for (cl=segment.first(); cl; cl=segment.next() ) - cl->setPen( QPen(col,1)); + for (int i=0; isetPen( QPen(col,1)); break; case StylePolyLine: p->setBrush( QBrush(col)); @@ -376,8 +373,8 @@ break; case StylePolyParabel: p->setBrush( QBrush(col)); - for (cl=segment.first(); cl; cl=segment.next() ) - cl->setPen( QPen(col,1)); + for (int i=0; isetPen( QPen(col,1)); break; default: break; @@ -412,7 +409,6 @@ void LinkableMapObj::setVisibility (bool v) { - Q3CanvasLine* cl; MapObj::setVisibility (v); bool visnow=visible; @@ -429,16 +425,16 @@ if (l) l->show(); break; case StyleParabel: - for (cl=segment.first(); cl; cl=segment.next() ) - cl->show(); + for (int i=0; ishow(); break; case StylePolyLine: if (p) p->show(); if (l) l->show(); break; case StylePolyParabel: - for (cl=segment.first(); cl; cl=segment.next() ) - cl->show(); + for (int i=0; ishow(); if (p) p->show(); break; default: @@ -453,16 +449,16 @@ if (l) l->hide(); break; case StyleParabel: - for (cl=segment.first(); cl; cl=segment.next() ) - cl->hide(); + for (int i=0; ihide(); break; case StylePolyLine: if (p) p->hide(); if (l) l->hide(); break; case StylePolyParabel: - for (cl=segment.first(); cl; cl=segment.next() ) - cl->hide(); + for (int i=0; ihide(); if (p) p->hide(); break; default: @@ -562,10 +558,6 @@ // "turning point" for drawing polygonal links QPoint tp (-qRound(sin (a)*thickness_start), qRound(cos (a)*thickness_start)); - Q3CanvasLine *cl; - - int i; - // Draw the link switch (style) { @@ -577,12 +569,8 @@ break; case StyleParabel: parabel (pa0, p1x,p1y,p2x,p2y); - i=0; - for (cl=segment.first(); cl; cl=segment.next() ) - { - cl->setPoints( pa0.point(i).x(), pa0.point(i).y(),pa0.point(i+1).x(),pa0.point(i+1).y()); - i++; - } + for (int i=0; isetPoints( pa0.point(i).x(), pa0.point(i).y(),pa0.point(i+1).x(),pa0.point(i+1).y()); break; case StylePolyLine: pa0[0]=QPoint (qRound(p2x+tp.x()), qRound(p2y+tp.y())); @@ -598,19 +586,15 @@ case StylePolyParabel: parabel (pa1, p1x,p1y,p2x+tp.x(),p2y+tp.y()); parabel (pa2, p1x,p1y,p2x-tp.x(),p2y-tp.y()); - for (i=0;i<=arcsegs;i++) + for (int i=0;i<=arcsegs;i++) { // Combine the arrays to a single one pa0[i]=pa1[i]; pa0[i+arcsegs+1]=pa2[arcsegs-i]; } p->setPoints (pa0); - i=0; - for (cl=segment.first(); cl; cl=segment.next() ) - { - cl->setPoints( pa1.point(i).x(), pa1.point(i).y(),pa1.point(i+1).x(),pa1.point(i+1).y()); - i++; - } + for (int i=0; isetPoints( pa1.point(i).x(), pa1.point(i).y(),pa1.point(i+1).x(),pa1.point(i+1).y()); break; default: break; @@ -646,7 +630,7 @@ break; } else if (typ=="bo:") - lmo=((BranchObj*)(lmo))->getBranchNum (num.toUInt()); + lmo=((BranchObj*)(lmo))->getBranchNum (num.toInt()); else if (typ=="fi:") lmo=((BranchObj*)(lmo))->getFloatImageNum (num.toUInt());