mapeditor.cpp
changeset 837 5ecd0462f76b
parent 835 31841b366d5e
child 841 46553c106c52
     1.1 --- a/mapeditor.cpp	Mon Mar 15 15:32:37 2010 +0000
     1.2 +++ b/mapeditor.cpp	Thu Mar 18 11:31:02 2010 +0000
     1.3 @@ -230,7 +230,7 @@
     1.4  
     1.5  	if (scrollBarPosTarget==getScrollBarPos()) return;
     1.6  
     1.7 -	if (scrollBarPosAnimation.state()==QtAbstractAnimation::Running)
     1.8 +	if (scrollBarPosAnimation.state()==QAbstractAnimation::Running)
     1.9  		scrollBarPosAnimation.stop();
    1.10  	
    1.11  	if (settings.value ("/animation/use/",true).toBool() )
    1.12 @@ -238,7 +238,7 @@
    1.13  		scrollBarPosAnimation.setTargetObject (this);
    1.14  		scrollBarPosAnimation.setPropertyName ("scrollBarPos");
    1.15  		scrollBarPosAnimation.setDuration(1000);
    1.16 -		scrollBarPosAnimation.setEasingCurve ( QtEasingCurve::OutQuint);
    1.17 +		scrollBarPosAnimation.setEasingCurve ( QEasingCurve::OutQuint);
    1.18  		scrollBarPosAnimation.setStartValue(
    1.19  			QPointF (horizontalScrollBar()->value() ,
    1.20  					 verticalScrollBar()->value() ) );
    1.21 @@ -270,7 +270,7 @@
    1.22  void MapEditor::setZoomFactorTarget (const qreal &zft)
    1.23  {
    1.24  	zoomFactorTarget=zft;
    1.25 -	if (zoomAnimation.state()==QtAbstractAnimation::Running)
    1.26 +	if (zoomAnimation.state()==QAbstractAnimation::Running)
    1.27  		zoomAnimation.stop();
    1.28  	if (settings.value ("/animation/use/",true).toBool() )
    1.29  	{
    1.30 @@ -278,7 +278,7 @@
    1.31  		zoomAnimation.setTargetObject (this);
    1.32  		zoomAnimation.setPropertyName ("zoomFactor");
    1.33  		zoomAnimation.setDuration(1000);
    1.34 -		zoomAnimation.setEasingCurve ( QtEasingCurve::OutQuint);
    1.35 +		zoomAnimation.setEasingCurve ( QEasingCurve::OutQuint);
    1.36  		zoomAnimation.setStartValue(zoomFactor);
    1.37  		zoomAnimation.setEndValue(zft);
    1.38  		zoomAnimation.start();
    1.39 @@ -565,18 +565,20 @@
    1.40  						// Move also away if centroids are identical
    1.41  						if (v.isNull()) 
    1.42  						{
    1.43 -							//qDebug() << "v==0="<<polys[i].centroid()<<polys[j].centroid()<<" "<<v;
    1.44  							v.setX (rand()%200 -100);
    1.45  							v.setY (rand()%200 -100);
    1.46 -							//qDebug() << v;
    1.47  						}
    1.48 +						// Add random direction
    1.49 +						Vector w (cos (rand()%1000),sin(rand()%1000));
    1.50 +						
    1.51 +						// Scale translation vector by area of polygons
    1.52  						v.normalize();
    1.53 -						//qDebug() <<  "  v="<<v;
    1.54  						vectors[j]=v*10000/polys.at(j).weight();		
    1.55  						vectors[i]=v*10000/polys.at(i).weight();		
    1.56  						vectors[i].invert();
    1.57  						//FIXME-3 outer loop, "i" get's changed several times...
    1.58 -						// Better not move away from centroid of 2 colliding polys, but from centroid of _all_
    1.59 +						// Better not move away from centroid of 2 colliding polys, 
    1.60 +						// but from centroid of _all_
    1.61  					}  
    1.62  				}
    1.63  			}