linkablemapobj.cpp
author insilmaril
Tue, 21 Feb 2006 16:18:23 +0000
changeset 216 d5a0ea67c91d
parent 175 728f51b71e71
child 218 160459d924a1
permissions -rw-r--r--
rudimentary mmap import
     1 #include <math.h>
     2 
     3 #include "linkablemapobj.h"
     4 #include "branchobj.h"
     5 #include "mapeditor.h"
     6 
     7 #include "version.h"
     8 
     9 
    10 /////////////////////////////////////////////////////////////////
    11 // LinkableMapObj
    12 /////////////////////////////////////////////////////////////////
    13 
    14 LinkableMapObj::LinkableMapObj():MapObj()
    15 {
    16   //  cout << "Const LinkableMapObj ()\n";
    17     init ();
    18 }
    19 
    20 LinkableMapObj::LinkableMapObj(QCanvas* c) :MapObj(c)
    21 {
    22 //    cout << "Const LinkableMapObj\n";
    23     init ();
    24 }
    25 
    26 LinkableMapObj::LinkableMapObj (LinkableMapObj* lmo) : MapObj (lmo->canvas)
    27 {
    28     copy (lmo);
    29 }
    30 
    31 LinkableMapObj::~LinkableMapObj()
    32 {
    33     delete (bottomline);
    34     delete (selbox);
    35 	delete (frame);
    36 	delLink();
    37 }
    38 
    39 void LinkableMapObj::delLink()
    40 {
    41 	switch (style)
    42 	{
    43 		case StyleLine:
    44 			delete (l);
    45 			break;
    46 		case StyleParabel:
    47 			segment.clear();
    48 			break;
    49 		case StylePolyLine:
    50 			delete (p);
    51 			delete (l);
    52 			break;
    53 		case StylePolyParabel:
    54 			delete (p);
    55 			segment.clear();
    56 			break;
    57 		default:
    58 			break;
    59 	}		
    60 }
    61 
    62 void LinkableMapObj::init ()
    63 {
    64     depth=-1;	
    65 	mapEditor=NULL;
    66     childObj=NULL;
    67     parObj=NULL;
    68     parObjTmpBuf=NULL;
    69     parPos=QPoint(0,0);
    70     childPos=QPoint(0,0);
    71 	link2ParPos=false;
    72     l=NULL;
    73     orientation=OrientUndef;
    74     linkwidth=20;		
    75 	thickness_start=8;
    76     style=StyleUndef;
    77 	linkpos=LinkBottom;
    78     segment.setAutoDelete (TRUE);
    79     arcsegs=13;
    80 	QPointArray pa(arcsegs*2+2);
    81     
    82     bottomline=new QCanvasLine(canvas);
    83     bottomline->setPen( QPen(linkcolor, 1) );
    84     bottomline->setZ(Z_LINK);
    85     bottomline->show();
    86 
    87     // Prepare showing the selection of a MapObj
    88     selbox = new QCanvasRectangle (canvas);
    89     selbox->setZ(Z_SELBOX);
    90     selbox->setBrush( QColor(255,255,0) );
    91     selbox->setPen( QPen(QColor(255,255,0) ));
    92     selbox->hide();
    93     selected=false;
    94 
    95 	hideLinkUnselected=false;
    96 
    97 	topPad=botPad=leftPad=rightPad=0;
    98 
    99 	// initialize frame
   100 	frame = new FrameObj (canvas);
   101 	
   102 	repositionRequest=false;
   103 }
   104 
   105 void LinkableMapObj::copy (LinkableMapObj* other)
   106 {
   107     MapObj::copy(other);
   108 	bboxTotal=other->bboxTotal;
   109     setLinkStyle(other->style);
   110     setLinkColor (other->linkcolor);
   111 }
   112 
   113 void LinkableMapObj::setChildObj(LinkableMapObj* o)
   114 {
   115     childObj=o;
   116 }
   117 
   118 void LinkableMapObj::setParObj(LinkableMapObj* o)
   119 {
   120     parObj=o;
   121 	mapEditor=parObj->getMapEditor();
   122 }
   123 
   124 void LinkableMapObj::setParObjTmp(LinkableMapObj*,QPoint,int)
   125 {
   126 }
   127 
   128 void LinkableMapObj::unsetParObjTmp()
   129 {
   130 }
   131 
   132 bool LinkableMapObj::hasParObjTmp()
   133 {
   134 	if (parObjTmpBuf) return true;
   135 	return false;
   136 }
   137 
   138 int LinkableMapObj::getTopPad()
   139 {
   140 	return topPad;
   141 }
   142 
   143 int LinkableMapObj::getLeftPad()
   144 {
   145 	return leftPad;
   146 }
   147 
   148 int LinkableMapObj::getRightPad()
   149 {
   150 	return rightPad;
   151 }
   152 
   153 LinkStyle LinkableMapObj::getDefLinkStyle ()
   154 {
   155 	if (!mapEditor) return StyleUndef;
   156 
   157 	LinkStyle ls=mapEditor->getLinkStyle();
   158 	switch (ls)
   159 	{
   160 		case StyleLine: 
   161 			return ls;
   162 			break;
   163 		case StyleParabel:
   164 			return ls;
   165 			break;
   166 		case StylePolyLine:	
   167 			if (depth>1)
   168 				return StyleLine;
   169 			else	
   170 				return ls;
   171 			break;
   172 		case StylePolyParabel:	
   173 			if (depth>1)
   174 				return StyleParabel;
   175 			else	
   176 				return ls;
   177 			break;
   178 		default: 
   179 			break;	
   180 	}	
   181 	return StyleUndef;
   182 }
   183 
   184 void LinkableMapObj::setLinkStyle(LinkStyle newstyle)
   185 {
   186 	//if (newstyle=style) return;
   187 	delLink();
   188 		
   189 	style=newstyle;
   190 
   191     if (childObj!=NULL && parObj != NULL)
   192     {
   193 		int i;
   194 		QCanvasLine* cl;
   195 		switch (style)
   196 		{
   197 			case StyleUndef:
   198 				bottomline->hide();
   199 				break;
   200 			case StyleLine: 
   201 				l = new QCanvasLine(canvas);
   202 				l->setPen( QPen(linkcolor, 1) );
   203 				l->setZ(Z_LINK);
   204 				if (visible)
   205 					l->show();
   206 				else
   207 					l->hide();
   208 				break;
   209 			case StyleParabel:
   210 				for (i=0;i<arcsegs;i++)
   211 				{
   212 					cl = new QCanvasLine(canvas);
   213 					cl->setPen( QPen(linkcolor, 1) );
   214 					cl->setPoints( 0,0,i*10,100);
   215 					cl->setZ(Z_LINK);
   216 					if (visible)
   217 						cl->show();
   218 					else
   219 						cl->hide();
   220 					segment.append(cl);
   221 				}
   222 				pa0.resize (arcsegs+1);
   223 				break;
   224 			case StylePolyLine:	
   225 				p = new QCanvasPolygon(canvas);
   226 				p->setBrush( linkcolor );
   227 				p->setZ(Z_LINK);
   228 				if (visible)
   229 					p->show();
   230 				else
   231 					p->hide();
   232 				pa0.resize (3);
   233 				// TODO a bit awkward: draw the lines additionally to polygon, to avoid
   234 				// missing pixels, when polygon is extremly flat
   235 				l = new QCanvasLine(canvas);
   236 				l->setPen( QPen(linkcolor, 1) );
   237 				l->setZ(Z_LINK);
   238 				if (visible)
   239 					l->show();
   240 				else
   241 					l->hide();
   242 				break;
   243 			case StylePolyParabel:	
   244 				p = new QCanvasPolygon(canvas);
   245 				p->setBrush( linkcolor );
   246 				p->setZ(Z_LINK);
   247 				if (visible)
   248 					p->show();
   249 				else
   250 					p->hide();
   251 				pa0.resize (arcsegs*2+2);
   252 				pa1.resize (arcsegs+1);
   253 				pa2.resize (arcsegs+1);
   254 
   255 				// TODO a bit awkward: draw the lines additionally 
   256 				// to polygon, to avoid missing pixels, 
   257 				// if polygon is extremly flat
   258 				for (i=0;i<arcsegs;i++)
   259 				{
   260 					cl = new QCanvasLine(canvas);
   261 					cl->setPen( QPen(linkcolor, 1) );
   262 					cl->setPoints( 0,0,i*10,100);
   263 					cl->setZ(Z_LINK);
   264 					if (visible)
   265 						cl->show();
   266 					else
   267 						cl->hide();
   268 					segment.append(cl);
   269 				}
   270 				break;
   271 			default: 
   272 				break;	
   273 		}	
   274 	} 
   275 }
   276 
   277 LinkStyle LinkableMapObj::getLinkStyle()
   278 {
   279 	return style;
   280 }
   281 
   282 void LinkableMapObj::setHideLinkUnselected(bool b)
   283 {
   284 	hideLinkUnselected=b;
   285 	setVisibility (visible);
   286 	updateLink();
   287 }
   288 
   289 bool LinkableMapObj::getHideLinkUnselected()
   290 {
   291 	return hideLinkUnselected;
   292 }
   293 
   294 void LinkableMapObj::setLinkPos(LinkPos lp)
   295 {
   296 	linkpos=lp;
   297 }
   298 
   299 LinkPos LinkableMapObj::getLinkPos()
   300 {
   301 	return linkpos;
   302 }
   303 
   304 
   305 void LinkableMapObj::setLinkColor()
   306 {
   307 	// Overloaded in BranchObj and childs
   308 	// here only set default color
   309 	if (mapEditor)
   310 		setLinkColor (mapEditor->getDefLinkColor());
   311 }
   312 
   313 void LinkableMapObj::setLinkColor(QColor col)
   314 {
   315 	linkcolor=col;
   316     bottomline->setPen( QPen(linkcolor, 1) );
   317 	QCanvasLine *cl;
   318 	switch (style)
   319 	{
   320 		case StyleLine:
   321 			l->setPen( QPen(col,1));
   322 			break;	
   323 		case StyleParabel:	
   324 			for (cl=segment.first(); cl; cl=segment.next() )
   325 				cl->setPen( QPen(col,1));
   326 			break;
   327 		case StylePolyLine:
   328 			p->setBrush( QBrush(col));
   329 			l->setPen( QPen(col,1));
   330 			break;
   331 		case StylePolyParabel:	
   332 			p->setBrush( QBrush(col));
   333 			for (cl=segment.first(); cl; cl=segment.next() )
   334 				cl->setPen( QPen(col,1));
   335 			break;
   336 		default:
   337 			break;
   338 	} // switch (style)	
   339 }
   340 
   341 QColor LinkableMapObj::getLinkColor()
   342 {
   343 	return linkcolor;
   344 }
   345 
   346 FrameType LinkableMapObj::getFrameType()
   347 {
   348 	return frame->getFrameType();
   349 }
   350 
   351 void LinkableMapObj::setFrameType(const FrameType &t)
   352 {
   353 	frame->setFrameType(t);
   354 	calcBBoxSize();
   355 	positionBBox();
   356 	requestReposition();
   357 }
   358 
   359 void LinkableMapObj::setFrameType(const QString &t)
   360 {
   361 	frame->setFrameType(t);
   362 	calcBBoxSize();
   363 	positionBBox();
   364 	requestReposition();
   365 }
   366 
   367 void LinkableMapObj::setVisibility (bool v)
   368 {
   369 	QCanvasLine* cl;
   370 	MapObj::setVisibility (v);
   371 	bool visnow=visible;
   372 	if (hideLinkUnselected && !selected)
   373 		visnow=false;
   374 
   375 	if (visnow) 
   376 	{
   377 		bottomline->show();
   378 		switch (style)
   379 		{
   380 			case StyleLine:
   381 				if (l) l->show();
   382 				break;
   383 			case StyleParabel:	
   384 				for (cl=segment.first(); cl; cl=segment.next() )
   385 					cl->show();
   386 				break;	
   387 			case StylePolyLine:
   388 				if (p) p->show();
   389 				if (l) l->show();
   390 				break;
   391 			case StylePolyParabel:	
   392 				for (cl=segment.first(); cl; cl=segment.next() )
   393 					cl->show();
   394 				if (p) p->show();
   395 				break;
   396 			default:
   397 				break;
   398 		}
   399 	} else 
   400 	{
   401 		bottomline->hide();
   402 		switch (style)
   403 		{
   404 			case StyleLine:
   405 				if (l) l->hide();
   406 				break;
   407 			case StyleParabel:	
   408 				for (cl=segment.first(); cl; cl=segment.next() )
   409 					cl->hide();
   410 				break;	
   411 			case StylePolyLine:
   412 				if (p) p->hide();
   413 				if (l) l->hide();
   414 				break;
   415 			case StylePolyParabel:	
   416 				for (cl=segment.first(); cl; cl=segment.next() )
   417 					cl->hide();
   418 				if (p) p->hide();
   419 				break;
   420 			default:
   421 				break;
   422 		}
   423 	}	
   424 }
   425 
   426 void LinkableMapObj::updateLink()
   427 {
   428     // needs:
   429     //	childPos of parent
   430     //	orient   of parent
   431     //	style
   432     // 
   433     // sets:
   434     //	orientation
   435     //	childPos
   436     //	parPos
   437 	//  bottomlineY
   438     //	drawing of the link itself
   439 
   440 
   441 	// updateLink is called from move, but called from constructor we don't
   442 	// have parents yet...
   443 	if (style==StyleUndef) return;	
   444 
   445 	if (frame->getFrameType() == NoFrame)
   446 		linkpos=LinkBottom;
   447 	else	
   448 		linkpos=LinkMiddle;
   449 	switch (linkpos)
   450 	{
   451 		case LinkMiddle:
   452 			bottomlineY=clickBox.top()+clickBox.height() /2;	// draw link to middle (of frame)
   453 			break;
   454 		default :
   455 			bottomlineY=clickBox.bottom()-1;	// draw link to bottom of bbox
   456 			break;
   457 	}
   458 	
   459     double p2x,p2y;								// Set P2 Before setting
   460 	if (!link2ParPos)
   461 	{
   462 		p2x=QPoint( parObj->getChildPos() ).x();	// P1, we have to look at
   463 		p2y=QPoint( parObj->getChildPos() ).y();	// orientation
   464 	} else	
   465 	{
   466 		p2x=QPoint( parObj->getParPos() ).x();	
   467 		p2y=QPoint( parObj->getParPos() ).y();
   468 	} 
   469 
   470 	LinkOrient orientOld=orientation;
   471 
   472     // Set orientation, first look for orientation of parent
   473     if (parObj->getOrientation() != OrientUndef ) 
   474 		// use the orientation of the parent:
   475 		orientation=parObj->getOrientation();
   476     else
   477     {
   478 		// calc orientation depending on position rel to mapCenter
   479 		if (absPos.x() < QPoint(parObj->getChildPos() ).x() )
   480 			orientation=OrientLeftOfCenter; 
   481 		else
   482 			orientation=OrientRightOfCenter;
   483     }
   484 
   485 	if ((orientation!=orientOld) && (orientOld!= OrientUndef))
   486 	{
   487 		// Orientation just changed. Reorient this subbranch, because move is called
   488 		// before updateLink => Position is still the old one, which could lead to 
   489 		// linking of subranch to itself => segfault
   490 		//
   491 		// Also possible: called in BranchObj::init(), then orientOld==OrientUndef,
   492 		// no need to reposition now
   493 		reposition();
   494 	}
   495 	
   496     if (orientation==OrientLeftOfCenter )
   497     {
   498 		childPos=QPoint (absPos.x(),bottomlineY);
   499 		parPos=QPoint (absPos.x()+ bbox.width(),  bottomlineY );
   500     } else
   501     {
   502 		childPos=QPoint (absPos.x()+ bbox.width(), bottomlineY ); 
   503 		parPos=QPoint (absPos.x(),bottomlineY);
   504     }
   505 
   506 	double p1x=parPos.x();	// Link is drawn from P1 to P2
   507 	double p1y=parPos.y();
   508 
   509 	double vx=p2x - p1x;	// V=P2-P1
   510 	double vy=p2y - p1y;
   511 
   512 	// Draw the horizontal line below heading (from ChildPos to ParPos)
   513 	bottomline->setPoints (qRound(childPos.x()),
   514 		qRound(childPos.y()),
   515 		qRound(p1x),
   516 		qRound(p1y) );
   517 
   518 	double a;	// angle
   519 	if (vx > -0.000001 && vx < 0.000001)
   520 		a=M_PI_2;
   521 	else
   522 		a=atan( vy / vx );
   523 	// "turning point" for drawing polygonal links
   524 	QPoint tp (-qRound(sin (a)*thickness_start), qRound(cos (a)*thickness_start));	
   525 	
   526 	QCanvasLine *cl;
   527 
   528 	int i;
   529 
   530     // Draw the link
   531 	switch (style)
   532 	{
   533 		case StyleLine:
   534 			l->setPoints( qRound (parPos.x()),
   535 				qRound(parPos.y()),
   536 				qRound(p2x),
   537 				qRound(p2y) );
   538 			break;	
   539 		case StyleParabel:	
   540 			parabel (pa0, p1x,p1y,p2x,p2y);
   541 			i=0;
   542 			for (cl=segment.first(); cl; cl=segment.next() )
   543 			{	
   544 				cl->setPoints( pa0.point(i).x(), pa0.point(i).y(),pa0.point(i+1).x(),pa0.point(i+1).y());
   545 				i++;
   546 			}
   547 			break;
   548 		case StylePolyLine:
   549 			pa0[0]=QPoint (qRound(p2x+tp.x()), qRound(p2y+tp.y()));
   550 			pa0[1]=QPoint (qRound(p2x-tp.x()), qRound(p2y-tp.y()));
   551 			pa0[2]=QPoint (qRound (parPos.x()), qRound(parPos.y()) );
   552 			p->setPoints (pa0);
   553 			// here too, draw line to avoid missing pixels
   554 			l->setPoints( qRound (parPos.x()),
   555 				qRound(parPos.y()),
   556 				qRound(p2x),
   557 				qRound(p2y) );
   558 			break;
   559 		case StylePolyParabel:	
   560 			parabel (pa1, p1x,p1y,p2x+tp.x(),p2y+tp.y());
   561 			parabel (pa2, p1x,p1y,p2x-tp.x(),p2y-tp.y());
   562 			for (i=0;i<=arcsegs;i++)
   563 			{
   564 				// Combine the arrays to a single one
   565 				pa0[i]=pa1[i];
   566 				pa0[i+arcsegs+1]=pa2[arcsegs-i];
   567 			}	
   568 			p->setPoints (pa0);
   569 			i=0;
   570 			for (cl=segment.first(); cl; cl=segment.next() )
   571 			{	
   572 				cl->setPoints( pa1.point(i).x(), pa1.point(i).y(),pa1.point(i+1).x(),pa1.point(i+1).y());
   573 				i++;
   574 			}
   575 			break;
   576 		default:
   577 			break;
   578 	} // switch (style)	
   579 }
   580 	
   581 LinkableMapObj* LinkableMapObj::getChildObj()
   582 {
   583     return childObj;
   584 }
   585 
   586 LinkableMapObj* LinkableMapObj::getParObj()
   587 {
   588     return parObj;
   589 }
   590 
   591 LinkableMapObj* LinkableMapObj::findObjBySelect (QString s)
   592 {
   593 	LinkableMapObj *lmo=this;
   594 	QString part;
   595 	QString typ;
   596 	QString num;
   597 	while (!s.isEmpty() )
   598 	{
   599 		part=s.section(",",0,0);
   600 		typ=part.left (3);
   601 		num=part.right(part.length() - 3);
   602 		if (typ=="mc:")
   603 		{
   604 			if (depth>0)
   605 				return false;	// in a subtree there is no center
   606 			else
   607 				break;
   608 		} else
   609 			if (typ=="bo:")
   610 				lmo=((BranchObj*)(lmo))->getBranchNum (num.toUInt());
   611 			else
   612 				if (typ=="fi:")
   613 					lmo=((BranchObj*)(lmo))->getFloatImageNum (num.toUInt());
   614 		if (!lmo) break;
   615 		
   616 		if (s.contains(","))
   617 			s=s.right(s.length() - part.length() -1 );
   618 		else	
   619 			break;
   620 	}
   621 	return lmo;
   622 }
   623 
   624 QPoint LinkableMapObj::getChildPos()
   625 {
   626     return childPos;
   627 }
   628 
   629 QPoint LinkableMapObj::getParPos()
   630 {
   631     return parPos;
   632 }
   633 
   634 QPoint LinkableMapObj::getRelPos()
   635 {
   636 	if (!parObj) return QPoint (0,0);
   637     return QPoint(
   638 		absPos.x() - parObj->x(),
   639 		absPos.y() - parObj->y()
   640 	);
   641 }
   642 
   643 LinkOrient LinkableMapObj::getOrientation()
   644 {
   645     return orientation;
   646 }
   647 
   648 int LinkableMapObj::getDepth()
   649 {
   650     return depth;
   651 }
   652 
   653 void LinkableMapObj::setMapEditor (MapEditor *me)
   654 {
   655 	mapEditor=me;
   656 }
   657 
   658 MapEditor* LinkableMapObj::getMapEditor ()
   659 {
   660 	return mapEditor;
   661 }
   662 
   663 QPoint LinkableMapObj::getRandPos()
   664 {
   665 	// Choose a random position with given distance to parent:
   666 	double a=rand()%360 * 2 * M_PI / 360;
   667     return QPoint ( (int)( + 150*cos (a)),
   668                     (int)( + 150*sin (a)));
   669 }
   670 
   671 void LinkableMapObj::alignRelativeTo (QPoint ref)
   672 {
   673 	// FIXME testing, seems not to be used right now...
   674 	cout << "LMO::alignRelTo   ref="<<ref<<endl;
   675 }
   676 
   677 void LinkableMapObj::reposition()
   678 {
   679 	if (depth==0)
   680 	{
   681 		// only calculate the sizes once. If the deepest LMO changes its height,
   682 		// all upper LMOs have to change, too.
   683 		calcBBoxSizeWithChilds();
   684 
   685 	    alignRelativeTo ( QPoint (absPos.x(),
   686 							absPos.y()-(bboxTotal.height()-bbox.height())/2) );
   687 	} else
   688 	{
   689 		// This is only important for moving branches:
   690 		// For editing a branch it isn't called...
   691 	    alignRelativeTo ( QPoint (absPos.x(),
   692 							absPos.y()-(bboxTotal.height()-bbox.height())/2) );
   693 	}
   694 }
   695 
   696 void LinkableMapObj::requestReposition()
   697 {
   698 	if (!repositionRequest)
   699 	{
   700 		// Pass on the request to parental objects, if this hasn't
   701 		// been done yet
   702 		repositionRequest=true;
   703 		if (parObj) parObj->requestReposition();
   704 	}
   705 }
   706 
   707 void LinkableMapObj::forceReposition()
   708 {
   709 	// Sometimes a reposition has to be done immediatly: For example
   710 	// if the note editor flag changes, there is no user event in mapeditor
   711 	// which could collect requests for a reposition.
   712 	// Then we have to call forceReposition()
   713 	// But no rule without exception: While loading a map or undoing it,
   714 	// we want to block expensive repositioning, but just do it once at
   715 	// the end, thus check first:
   716 
   717 	if (mapEditor->isRepositionBlocked()) return;
   718 	
   719 	// Pass on the request to parental objects, if this hasn't been done yet
   720 	
   721 	if (parObj) 
   722 		parObj->forceReposition(); 
   723 	else 
   724 		reposition(); 
   725 }
   726 
   727 bool LinkableMapObj::repositionRequested()
   728 {
   729 	return repositionRequest;
   730 }
   731 
   732 
   733 void LinkableMapObj::setSelBox()
   734 {
   735     selbox->setX (clickBox.x() );
   736     selbox->setY (clickBox.y() );
   737     selbox->setSize (clickBox.width(), clickBox.height() );
   738 }
   739 
   740 void LinkableMapObj::select()
   741 {
   742 	setSelBox();
   743     selected=true;
   744     selbox->show();
   745 	setVisibility (visible);
   746 }
   747 
   748 
   749 void LinkableMapObj::unselect()
   750 {
   751     selected=false;
   752     selbox->hide();
   753 	setVisibility (visible);
   754 }
   755 
   756 void LinkableMapObj::parabel (QPointArray &ya, double p1x, double p1y, double p2x, double p2y)
   757 
   758 {
   759 	double vx=p2x - p1x;	// V=P2-P1
   760 	double vy=p2y - p1y;
   761 
   762 	double dx;				// delta x during calculation of parabel
   763 	
   764 	double pnx;				// next point
   765 	double pny;
   766 	double m;
   767 
   768 	if (vx > -0.0001 && vx < 0.0001)
   769 		m=0;
   770 	else	
   771 		m=(vy / (vx*vx));
   772 	dx=vx/(arcsegs);
   773 	int i;
   774 	ya.setPoint (0,QPoint (qRound(p1x),qRound(p1y)));
   775 	for (i=1;i<=arcsegs;i++)
   776 	{	
   777 		pnx=p1x+dx;
   778 		pny=m*(pnx-parPos.x())*(pnx-parPos.x())+parPos.y();
   779 		ya.setPoint (i,QPoint (qRound(pnx),qRound(pny)));
   780 		p1x=pnx;
   781 		p1y=pny;
   782 	}	
   783 }
   784 
   785 QString LinkableMapObj::getLinkAttr ()
   786 {
   787 	if (hideLinkUnselected)
   788 		return attribut ("hideLink","true");
   789 	else
   790 		return attribut ("hideLink","false");
   791 	
   792 }