1.1 --- a/linkablemapobj.cpp Thu Sep 01 15:35:18 2005 +0000
1.2 +++ b/linkablemapobj.cpp Mon Sep 05 11:56:31 2005 +0000
1.3 @@ -91,6 +91,8 @@
1.4 selbox->hide();
1.5 selected=false;
1.6
1.7 + hideLinkUnselected=false;
1.8 +
1.9 // initialize frame
1.10 frame = new FrameObj (canvas);
1.11
1.12 @@ -258,6 +260,18 @@
1.13 return style;
1.14 }
1.15
1.16 +void LinkableMapObj::setHideLinkUnselected(bool b)
1.17 +{
1.18 + hideLinkUnselected=b;
1.19 + setVisibility (visible);
1.20 + updateLink();
1.21 +}
1.22 +
1.23 +bool LinkableMapObj::getHideLinkUnselected()
1.24 +{
1.25 + return hideLinkUnselected;
1.26 +}
1.27 +
1.28 void LinkableMapObj::setLinkPos(LinkPos lp)
1.29 {
1.30 linkpos=lp;
1.31 @@ -302,7 +316,6 @@
1.32 default:
1.33 break;
1.34 } // switch (style)
1.35 - //FIXME updateLink();
1.36 }
1.37
1.38 QColor LinkableMapObj::getLinkColor()
1.39 @@ -333,32 +346,60 @@
1.40
1.41 void LinkableMapObj::setVisibility (bool v)
1.42 {
1.43 + QCanvasLine* cl;
1.44 MapObj::setVisibility (v);
1.45 - if (visible)
1.46 + bool visnow=visible;
1.47 + if (hideLinkUnselected && !selected)
1.48 + visnow=false;
1.49 +
1.50 + if (visnow)
1.51 {
1.52 bottomline->show();
1.53 - // FIXME lines and segments should be done in LMO?
1.54 - if (style==StyleLine && l)
1.55 + switch (style)
1.56 {
1.57 - l->show();
1.58 - } else
1.59 - {
1.60 - QCanvasLine* cl;
1.61 - for (cl=segment.first(); cl; cl=segment.next() )
1.62 - cl->show();
1.63 - }
1.64 + case StyleLine:
1.65 + if (l) l->show();
1.66 + break;
1.67 + case StyleParabel:
1.68 + for (cl=segment.first(); cl; cl=segment.next() )
1.69 + cl->show();
1.70 + break;
1.71 + case StylePolyLine:
1.72 + if (p) p->show();
1.73 + if (l) l->show();
1.74 + break;
1.75 + case StylePolyParabel:
1.76 + for (cl=segment.first(); cl; cl=segment.next() )
1.77 + cl->show();
1.78 + if (p) p->show();
1.79 + break;
1.80 + default:
1.81 + break;
1.82 + }
1.83 } else
1.84 {
1.85 bottomline->hide();
1.86 - if (style==StyleLine && l)
1.87 + switch (style)
1.88 {
1.89 - l->hide();
1.90 - } else
1.91 - {
1.92 - QCanvasLine* cl;
1.93 - for (cl=segment.first(); cl; cl=segment.next() )
1.94 - cl->hide();
1.95 - }
1.96 + case StyleLine:
1.97 + if (l) l->hide();
1.98 + break;
1.99 + case StyleParabel:
1.100 + for (cl=segment.first(); cl; cl=segment.next() )
1.101 + cl->hide();
1.102 + break;
1.103 + case StylePolyLine:
1.104 + if (p) p->hide();
1.105 + if (l) l->hide();
1.106 + break;
1.107 + case StylePolyParabel:
1.108 + for (cl=segment.first(); cl; cl=segment.next() )
1.109 + cl->hide();
1.110 + if (p) p->hide();
1.111 + break;
1.112 + default:
1.113 + break;
1.114 + }
1.115 }
1.116 }
1.117
1.118 @@ -681,6 +722,7 @@
1.119 setSelBox();
1.120 selected=true;
1.121 selbox->show();
1.122 + setVisibility (visible);
1.123 }
1.124
1.125
1.126 @@ -688,6 +730,7 @@
1.127 {
1.128 selected=false;
1.129 selbox->hide();
1.130 + setVisibility (visible);
1.131 }
1.132
1.133 void LinkableMapObj::parabel (QPointArray &ya, double p1x, double p1y, double p2x, double p2y)
1.134 @@ -719,3 +762,15 @@
1.135 }
1.136 }
1.137
1.138 +QString LinkableMapObj::getLinkAttr ()
1.139 +{
1.140 + QString hideAttr;
1.141 + if (hideLinkUnselected)
1.142 + // Since this is currently the
1.143 + // only attribut and it is switched off by default
1.144 + // don't write <link> at all if it is missing
1.145 + return attribut ("hideLinkUnselected","true");
1.146 + else
1.147 + return "";
1.148 +
1.149 +}