First results in moving colliding MapCenters apart
authorinsilmaril
Tue Sep 08 12:15:39 2009 +0000 (2009-09-08)
changeset 7927d67be709091
parent 791 f1006de05c54
child 793 cac93797c580
First results in moving colliding MapCenters apart
branchobj.cpp
branchobj.h
geometry.cpp
geometry.h
mainwindow.cpp
mapeditor.cpp
mapobj.cpp
mapobj.h
misc.cpp
misc.h
version.h
vymmodel.cpp
xml-vym.cpp
     1.1 --- a/branchobj.cpp	Mon Sep 07 15:36:57 2009 +0000
     1.2 +++ b/branchobj.cpp	Tue Sep 08 12:15:39 2009 +0000
     1.3 @@ -143,7 +143,9 @@
     1.4  	if (parObj->getTreeItem()->depth()==0)	
     1.5  	{	// new parent is a mapcenter
     1.6  
     1.7 -		QPointF p= normalize ( QPointF (m.x() - o->getChildPos().x(),
     1.8 +		//FIXME-2 rewrite to us new normalize QPointF p= normalize ( QPointF (m.x() - o->getChildPos().x(),
     1.9 +		//								  m.y() - o->getChildPos().y() ));
    1.10 +		QPointF p= ( QPointF (m.x() - o->getChildPos().x(),
    1.11  									  m.y() - o->getChildPos().y() ));
    1.12  		if (p.x()<0) p.setX( p.x()-bbox.width() );
    1.13  		move2RelPos (p);
     2.1 --- a/branchobj.h	Mon Sep 07 15:36:57 2009 +0000
     2.2 +++ b/branchobj.h	Tue Sep 08 12:15:39 2009 +0000
     2.3 @@ -6,7 +6,6 @@
     2.4  #include "ornamentedobj.h"
     2.5  #include "xlinkobj.h"
     2.6  
     2.7 -
     2.8  bool isAbove(BranchObj*,BranchObj*);
     2.9  
    2.10  /*! \brief A branch visible in the map */
     3.1 --- a/geometry.cpp	Mon Sep 07 15:36:57 2009 +0000
     3.2 +++ b/geometry.cpp	Tue Sep 08 12:15:39 2009 +0000
     3.3 @@ -3,6 +3,8 @@
     3.4  #include <math.h>
     3.5  #include "misc.h"
     3.6  
     3.7 +#include <QString>
     3.8 +
     3.9  #include <iostream>
    3.10  using namespace std;
    3.11  
    3.12 @@ -46,6 +48,48 @@
    3.13      return false;	
    3.14  }
    3.15  
    3.16 +Vector::Vector ():QPointF ()
    3.17 +{
    3.18 +}
    3.19 +
    3.20 +Vector::Vector (const QPointF &p):QPointF (p)
    3.21 +{
    3.22 +}
    3.23 +
    3.24 +Vector::Vector (qreal x, qreal y):QPointF (x,y)
    3.25 +{
    3.26 +}
    3.27 +
    3.28 +//! Normalize vector
    3.29 +void Vector::normalize ()
    3.30 +{
    3.31 +	if (x()==0 && y()==0) return;
    3.32 +	qreal l=sqrt ( x()*x() + y()*y() );
    3.33 +	setX (x()/l);
    3.34 +	setY (y()/l);
    3.35 +}
    3.36 +
    3.37 +//! Dot product of two vectors
    3.38 +qreal Vector::dotProduct (const QPointF &b)
    3.39 +{
    3.40 +	return x()*b.x() + y()*b.y();
    3.41 +}
    3.42 +
    3.43 +
    3.44 +void Vector::scale (const qreal &f)
    3.45 +{
    3.46 +	setX (x()*f);
    3.47 +	setY (y()*f);
    3.48 +}
    3.49 +
    3.50 +void Vector::invert ()
    3.51 +{
    3.52 +	setX (-x());
    3.53 +	setY (-y());
    3.54 +}
    3.55 +
    3.56 +/*! Calculate the projection of a polygon on an axis
    3.57 +    and returns it as a [min, max] interval  */
    3.58  ConvexPolygon::ConvexPolygon ()
    3.59  {
    3.60  }
    3.61 @@ -89,45 +133,43 @@
    3.62  	return _area;
    3.63  }
    3.64  
    3.65 -//! Normalize vector
    3.66 -QPointF normalize (const QPointF &p)
    3.67 +std::string ConvexPolygon::toStdString()
    3.68  {
    3.69 -	if (p==QPointF(0,0)) return p;
    3.70 -	qreal l=sqrt ( p.x()*p.x() + p.y()*p.y() );
    3.71 -	return QPointF (p.x()/l,p.y()/l);
    3.72 +	QString s ("(");
    3.73 +	for (int i=0;i<size();++i)
    3.74 +	{
    3.75 +		s+=QString("(%1,%2)").arg(at(i).x()).arg(at(i).y());
    3.76 +		if (i<size()-1) s+=",";
    3.77 +	}
    3.78 +	s+=")";	
    3.79 +	return s.toStdString();
    3.80  }
    3.81  
    3.82 -//! Dot product of two vectors
    3.83 -qreal dotProduct (const QPointF &a, const QPointF &b)
    3.84 +Vector ConvexPolygon::at(const int &i) const
    3.85  {
    3.86 -	return a.x()*b.x() + a.y()*b.y();
    3.87 +	return Vector (QPolygonF::at(i).x(),QPolygonF::at(i).y());
    3.88  }
    3.89  
    3.90 +void ConvexPolygon::translate ( const Vector & offset )
    3.91 +{ translate (offset.x(),offset.y());}
    3.92  
    3.93 -QPointF scale (const QPointF &v,const qreal &f)
    3.94 +void ConvexPolygon::translate ( qreal dx, qreal dy )
    3.95  {
    3.96 -	return QPointF (v.x()*f,v.y()*f);
    3.97 +	QPolygonF::translate (dx,dy);
    3.98 +	_centroid=_centroid+QPointF (dx,dy);
    3.99  }
   3.100  
   3.101 -QPointF invert (const QPointF &v)
   3.102 -{
   3.103 -	return QPointF (-v.x(),-v.y());
   3.104 -}
   3.105 -
   3.106 -/*! Calculate the projection of a polygon on an axis
   3.107 -    and returns it as a [min, max] interval  */
   3.108 -
   3.109 -void projectPolygon(QPointF axis, QPolygonF polygon, qreal &min, qreal &max) 
   3.110 +void projectPolygon(Vector axis, ConvexPolygon polygon, qreal &min, qreal &max) 
   3.111  {
   3.112      // To project a point on an axis use the dot product
   3.113  
   3.114  	//cout << "Projecting on "<< axis<<endl;
   3.115 -    qreal d = dotProduct(axis,polygon.at(0));
   3.116 +    qreal d = axis.dotProduct(polygon.at(0));
   3.117      min = d;
   3.118      max = d;
   3.119      for (int i = 0; i < polygon.size(); i++) 
   3.120  	{
   3.121 -        d= dotProduct (polygon.at(i),axis);
   3.122 +        d= polygon.at(i).dotProduct (axis);
   3.123          if (d < min) 
   3.124              min = d;
   3.125          else 
   3.126 @@ -153,8 +195,8 @@
   3.127   of the polygons (i.e. velocityA - velocityB)
   3.128  */
   3.129  
   3.130 -PolygonCollisionResult polygonCollision(QPolygonF polygonA, 
   3.131 -                              QPolygonF polygonB, QPointF velocity) 
   3.132 +PolygonCollisionResult polygonCollision(ConvexPolygon polygonA, 
   3.133 +                              ConvexPolygon polygonB, Vector velocity) 
   3.134  {
   3.135      PolygonCollisionResult result;
   3.136      result.intersect = true;
   3.137 @@ -207,8 +249,8 @@
   3.138  
   3.139          // Find the axis perpendicular to the current edge
   3.140  
   3.141 -        QPointF axis (-edge.y(), edge.x());
   3.142 -        axis=normalize(axis);
   3.143 +        Vector axis (-edge.y(), edge.x());
   3.144 +        axis.normalize();
   3.145  
   3.146          // Find the projection of the polygon on the current axis
   3.147  
   3.148 @@ -226,7 +268,7 @@
   3.149  
   3.150          // Project the velocity on the current axis
   3.151  
   3.152 -        qreal velocityProjection = dotProduct(axis,velocity);
   3.153 +        qreal velocityProjection = axis.dotProduct(velocity);
   3.154  
   3.155          // Get the projection of polygon A during the movement
   3.156  
     4.1 --- a/geometry.h	Mon Sep 07 15:36:57 2009 +0000
     4.2 +++ b/geometry.h	Tue Sep 08 12:15:39 2009 +0000
     4.3 @@ -6,6 +6,23 @@
     4.4  QRectF addBBox(QRectF r1, QRectF r2);
     4.5  bool isInBox(const QPointF &p, const QRectF &box);
     4.6  
     4.7 +
     4.8 +class Vector:public QPointF
     4.9 +{
    4.10 +public:
    4.11 +	Vector ();
    4.12 +	Vector (const QPointF &p);
    4.13 +	Vector (qreal x, qreal y);
    4.14 +
    4.15 +	friend inline bool operator==(const Vector &v1, const Vector &v2 )
    4.16 +	{ return v1.x()==v2.x() && v1.y()==v2.y(); }
    4.17 +
    4.18 +	virtual void normalize ();
    4.19 +	virtual qreal dotProduct (const QPointF &b);
    4.20 +	virtual void scale  (const qreal &f);
    4.21 +	virtual void invert ();
    4.22 +};
    4.23 +
    4.24  class ConvexPolygon:public QPolygonF
    4.25  {
    4.26  public:
    4.27 @@ -14,19 +31,15 @@
    4.28  	void calcCentroid() ;
    4.29  	QPointF centroid() const;
    4.30  	qreal weight() const;
    4.31 +	std::string toStdString ();
    4.32 +	Vector at (const int &i) const ; 
    4.33 +	virtual void translate ( const Vector &offset );
    4.34 +	virtual void translate ( qreal dx, qreal dy );
    4.35  private:
    4.36 -	QPointF _centroid;
    4.37 +	Vector _centroid;
    4.38  	qreal _area;
    4.39  };
    4.40  
    4.41 -QPointF normalize (const QPointF &p);
    4.42 -
    4.43 -
    4.44 -qreal dotProduct (const QPointF &a, const QPointF &b);
    4.45 -
    4.46 -QPointF scale  (const QPointF &v,const qreal &f);
    4.47 -QPointF invert (const QPointF &v);
    4.48 -
    4.49  class PolygonCollisionResult {
    4.50  public:
    4.51      // Are the polygons going to intersect forward in time?
    4.52 @@ -40,10 +53,10 @@
    4.53  };
    4.54  
    4.55  
    4.56 -void projectPolygon(QPointF axis, QPolygonF polygon, qreal &min, qreal &max) ;
    4.57 +void projectPolygon(Vector axis, ConvexPolygon polygon, qreal &min, qreal &max) ;
    4.58  
    4.59  qreal intervalDistance(qreal minA, qreal maxA, qreal minB, qreal maxB);
    4.60 -PolygonCollisionResult polygonCollision(QPolygonF polygonA, 
    4.61 -                              QPolygonF polygonB, QPointF velocity);
    4.62 +PolygonCollisionResult polygonCollision(ConvexPolygon polygonA, 
    4.63 +                              ConvexPolygon polygonB, Vector velocity);
    4.64  
    4.65  #endif
    4.66 \ No newline at end of file
     5.1 --- a/mainwindow.cpp	Mon Sep 07 15:36:57 2009 +0000
     5.2 +++ b/mainwindow.cpp	Tue Sep 08 12:15:39 2009 +0000
     5.3 @@ -3595,7 +3595,7 @@
     5.4  void Main::testFunction2()
     5.5  {
     5.6  	if (!currentMapEditor()) return;
     5.7 -	currentMapEditor()->setFocus();
     5.8 +	currentMapEditor()->testFunction2();
     5.9  }
    5.10  
    5.11  void Main::testCommand()
     6.1 --- a/mapeditor.cpp	Mon Sep 07 15:36:57 2009 +0000
     6.2 +++ b/mapeditor.cpp	Tue Sep 08 12:15:39 2009 +0000
     6.3 @@ -7,6 +7,7 @@
     6.4  #include <QObject>
     6.5  
     6.6  #include "branchitem.h"
     6.7 +#include "geometry.h"
     6.8  #include "mainwindow.h"
     6.9  #include "misc.h"
    6.10  #include "warningdialog.h"
    6.11 @@ -545,10 +546,6 @@
    6.12  	}	
    6.13  	cout <<"  hidemode="<<hidemode<<endl;
    6.14  	*/
    6.15 -}
    6.16 -	
    6.17 -void MapEditor::testFunction2()
    6.18 -{
    6.19  
    6.20  /*
    6.21  	// Toggle hidemode
    6.22 @@ -557,6 +554,73 @@
    6.23  	else	
    6.24  		setHideTmpMode (HideExport);
    6.25  */		
    6.26 +
    6.27 +}
    6.28 +	
    6.29 +void MapEditor::testFunction2()
    6.30 +{
    6.31 +	// Create list with all bounding polygons
    6.32 +	QList <MapObj*> mapobjects;
    6.33 +	QList <ConvexPolygon> polys; 
    6.34 +	QList <Vector> vectors;
    6.35 +	QList <Vector> orgpos;
    6.36 +	BranchItem *bi;
    6.37 +	BranchObj *bo;
    6.38 +	TreeItem *ri=model->getRootItem();
    6.39 +	for (int i=0;i<ri->branchCount();++i)
    6.40 +	{
    6.41 +		bi=ri->getBranchNum (i);
    6.42 +		bo=(BranchObj*)bi->getLMO();
    6.43 +		if (bo)
    6.44 +		{
    6.45 +			mapobjects.append (bo);
    6.46 +			polys.append(bo->getBoundingPolygon());
    6.47 +			polys[i].calcCentroid();
    6.48 +			vectors.append (QPointF(0,0));
    6.49 +			orgpos.append (polys[i].at(0));
    6.50 +		}	
    6.51 +	}
    6.52 +
    6.53 +	// Iterate moving bounding polygons until we have no more collisions
    6.54 +	int collisions=1;
    6.55 +	while (collisions>0)
    6.56 +	{
    6.57 +		collisions=0;
    6.58 +		for (int i=0; i<polys.size()-1; ++i)
    6.59 +		{
    6.60 +			for (int j=i+1; j<polys.size();++j)
    6.61 +			{
    6.62 +				if (polygonCollision (polys.at(i),polys.at(j), QPointF(0,0)).intersect )
    6.63 +				{
    6.64 +					collisions++;
    6.65 +					Vector v=polys.at(j).centroid()-polys.at(i).centroid();
    6.66 +					// Move also away if centroids are identical
    6.67 +					if (v.isNull()) 
    6.68 +					{
    6.69 +						v.setX (rand()%200 -100);
    6.70 +						v.setY (rand()%200 -100);
    6.71 +					}
    6.72 +					v.normalize();
    6.73 +					cout << "v="<<v<<endl;
    6.74 +					v.scale (2);
    6.75 +					vectors[j]=v;
    6.76 +					vectors[i]=v;
    6.77 +					vectors[i].invert();
    6.78 +				} 
    6.79 +			}
    6.80 +		}
    6.81 +		for (int i=0;i<vectors.size();i++)
    6.82 +			polys[i].translate (vectors[i]);
    6.83 +		//cout << "Collisions: "<<collisions<<endl;
    6.84 +	}	
    6.85 +
    6.86 +	// Finally move the real objects and update 
    6.87 +	for (int i=0;i<polys.size();i++)
    6.88 +	{
    6.89 +		Vector v=polys[i].at(0)-orgpos[i];
    6.90 +		mapobjects[i]->moveBy(v.x(),v.y() );
    6.91 +	}	
    6.92 +	model->reposition();	
    6.93  }
    6.94  
    6.95  BranchItem* MapEditor::getBranchDirectAbove (BranchItem *bi)
    6.96 @@ -1050,8 +1114,8 @@
    6.97  			if ( e->modifiers()==Qt::ShiftModifier && dsti &&  dsti != seli->parent()  )
    6.98  			{
    6.99  				// Also save the move which was done so far
   6.100 -				QString pold=qpointfToString(movingObj_orgRelPos);
   6.101 -				QString pnow=qpointfToString(fio->getRelPos());
   6.102 +				QString pold=qpointFToString(movingObj_orgRelPos);
   6.103 +				QString pnow=qpointFToString(fio->getRelPos());
   6.104  				model->saveState(
   6.105  					seli,
   6.106  					"moveRel "+pold,
   6.107 @@ -1205,8 +1269,8 @@
   6.108  			if(fio)
   6.109  			{
   6.110  				// Moved FloatObj. Maybe we need to reposition
   6.111 -				QString pold=qpointfToString(movingObj_orgRelPos);
   6.112 -				QString pnow=qpointfToString(fio->getRelPos());
   6.113 +				QString pold=qpointFToString(movingObj_orgRelPos);
   6.114 +				QString pnow=qpointFToString(fio->getRelPos());
   6.115  				model->saveState(
   6.116  					seli,
   6.117  					"moveRel "+pold,
   6.118 @@ -1225,8 +1289,8 @@
   6.119  		{	
   6.120              if (movingObj_orgPos != bi->getBranchObj()->getAbsPos())	// FIXME-3 check getBO here...
   6.121              {
   6.122 -                QString pold=qpointfToString(movingObj_orgPos);
   6.123 -                QString pnow=qpointfToString(bi->getBranchObj()->getAbsPos());		// FIXME-3 check getBO here...
   6.124 +                QString pold=qpointFToString(movingObj_orgPos);
   6.125 +                QString pnow=qpointFToString(bi->getBranchObj()->getAbsPos());		// FIXME-3 check getBO here...
   6.126  
   6.127                  model->saveState(
   6.128                      bi,
   6.129 @@ -1311,9 +1375,9 @@
   6.130                      QPointF rp(lmosel->getRelPos());
   6.131                      if (rp != movingObj_orgRelPos)
   6.132                      {
   6.133 -                        QString ps=qpointfToString(rp);
   6.134 +                        QString ps=qpointFToString(rp);
   6.135                          model->saveState(
   6.136 -                            model->getSelectString(lmosel), "moveRel "+qpointfToString(movingObj_orgRelPos), 
   6.137 +                            model->getSelectString(lmosel), "moveRel "+qpointFToString(movingObj_orgRelPos), 
   6.138                              preSelStr, "moveRel "+ps, 
   6.139                              QString("Move %1 to relative position %2").arg(model->getObjectName(lmosel)).arg(ps));
   6.140                      }
     7.1 --- a/mapobj.cpp	Mon Sep 07 15:36:57 2009 +0000
     7.2 +++ b/mapobj.cpp	Tue Sep 08 12:15:39 2009 +0000
     7.3 @@ -90,7 +90,7 @@
     7.4  
     7.5  QString MapObj::getPos()
     7.6  {
     7.7 -	return qpointfToString(absPos);
     7.8 +	return qpointFToString(absPos);
     7.9  }
    7.10  
    7.11  void MapObj::move (double x, double y) 
    7.12 @@ -120,6 +120,13 @@
    7.13      return bbox;
    7.14  }
    7.15  
    7.16 +ConvexPolygon MapObj::getBoundingPolygon()
    7.17 +{
    7.18 +	QPolygonF p;
    7.19 +	p<<bbox.topLeft()<<bbox.topRight()<<bbox.bottomRight()<<bbox.bottomLeft();
    7.20 +	return p;
    7.21 +}
    7.22 +
    7.23  QRectF MapObj::getClickBox()
    7.24  {
    7.25      return clickBox;
     8.1 --- a/mapobj.h	Mon Sep 07 15:36:57 2009 +0000
     8.2 +++ b/mapobj.h	Tue Sep 08 12:15:39 2009 +0000
     8.3 @@ -16,6 +16,7 @@
     8.4  #define Z_TEXT     100
     8.5  #define Z_LINEEDIT 110
     8.6  
     8.7 +class ConvexPolygon;
     8.8  
     8.9  class TreeItem;
    8.10  
    8.11 @@ -40,26 +41,27 @@
    8.12  	virtual qreal width();
    8.13  	virtual qreal height();
    8.14  	virtual QPointF getAbsPos();
    8.15 -	virtual QString getPos();					// Return position as string (x,y)
    8.16 -    virtual void move (double x,double y);      // move to absolute Position
    8.17 +	virtual QString getPos();					//! Return position as string (x,y)
    8.18 +    virtual void move (double x,double y);      //! move to absolute Position
    8.19      virtual void move (QPointF p);
    8.20 -    virtual void moveBy (double x,double y);    // move to relative Position
    8.21 -    virtual QRectF getBBox();					// returns bounding box
    8.22 -    virtual QRectF getClickBox();				// returns box to click
    8.23 +    virtual void moveBy (double x,double y);    //! move to relative Position
    8.24 +    virtual QRectF getBBox();					//! returns bounding box
    8.25 +    virtual ConvexPolygon getBoundingPolygon();	//! return bounding convex polygon
    8.26 +    virtual QRectF getClickBox();				//! returns box to click
    8.27  	virtual bool isInClickBox (const QPointF &p);	//! Checks if p is in clickBox
    8.28 -    virtual QSizeF getSize();					// returns size of bounding box
    8.29 +    virtual QSizeF getSize();					//! returns size of bounding box
    8.30      virtual bool isVisibleObj();
    8.31      virtual void setVisibility(bool);
    8.32      virtual void positionBBox()=0;       
    8.33  	virtual void calcBBoxSize()=0;
    8.34  protected:  
    8.35      QGraphicsScene* scene;
    8.36 -    QRectF bbox;									// bounding box of MO itself
    8.37 -	QRectF clickBox;								// area where mouseclicks are found
    8.38 -    QPointF absPos;							    // Position on canvas
    8.39 +    QRectF bbox;					// bounding box of MO itself
    8.40 +	QRectF clickBox;				// area where mouseclicks are found
    8.41 +    QPointF absPos;				    // Position on canvas
    8.42      bool visible;
    8.43  
    8.44 -	TreeItem *treeItem;				// Crossrefence to treemodel
    8.45 +	TreeItem *treeItem;				//! Crossrefence to treemodel
    8.46  
    8.47  };
    8.48  
     9.1 --- a/misc.cpp	Mon Sep 07 15:36:57 2009 +0000
     9.2 +++ b/misc.cpp	Tue Sep 08 12:15:39 2009 +0000
     9.3 @@ -1,20 +1,21 @@
     9.4  #include <math.h>
     9.5  
     9.6  #include <qregexp.h>
     9.7 -#include <qpoint.h>
     9.8 +//#include <qpoint.h>
     9.9  #include <stdlib.h>
    9.10  
    9.11  #include "misc.h"
    9.12  
    9.13 +#include "geometry.h"
    9.14 +
    9.15  QString qpointToString (const QPoint &p)
    9.16 -{
    9.17 -	return "(" + QString("%1").arg(p.x()) +","+ QString ("%1").arg (p.y()) +")";
    9.18 -}
    9.19 +{ return "(" + QString("%1").arg(p.x()) +","+ QString ("%1").arg (p.y()) +")"; }
    9.20  
    9.21 -QString qpointfToString (const QPointF &p)
    9.22 -{
    9.23 -	return "(" + QString("%1").arg(p.x()) +","+ QString ("%1").arg (p.y()) +")";
    9.24 -}
    9.25 +QString qpointFToString (const QPointF &p)
    9.26 +{ return "(" + QString("%1").arg(p.x()) +","+ QString ("%1").arg (p.y()) +")"; }
    9.27 +
    9.28 +QString VectorToString (const Vector &p)
    9.29 +{ return "(" + QString("%1").arg(p.x()) +","+ QString ("%1").arg (p.y()) +")"; }
    9.30  
    9.31  ostream &operator<< (ostream &stream, QPoint const &p)
    9.32  { 
    9.33 @@ -28,6 +29,12 @@
    9.34  	return stream;
    9.35  }
    9.36  
    9.37 +ostream &operator<< (ostream &stream, Vector const &p)
    9.38 +{ 
    9.39 +	stream << "("<<p.x()<<","<<p.y()<<")";
    9.40 +	return stream;
    9.41 +}
    9.42 +
    9.43  qreal getAngle(const QPointF &p)
    9.44  {	
    9.45  	// Calculate angle of vector to y-axis
    10.1 --- a/misc.h	Mon Sep 07 15:36:57 2009 +0000
    10.2 +++ b/misc.h	Tue Sep 08 12:15:39 2009 +0000
    10.3 @@ -1,18 +1,23 @@
    10.4  #ifndef MISC_H
    10.5  #define MISC_H
    10.6  
    10.7 -#include <qpoint.h>
    10.8 -#include <qdir.h>
    10.9  #include <iostream>
   10.10 -
   10.11  using namespace std;
   10.12  
   10.13 +class QString;
   10.14 +class QPoint;
   10.15 +class QPointF;
   10.16 +class Vector;
   10.17  
   10.18  /////////////////////////////////////////////////////////////////////////////
   10.19  QString qpointToString (const QPoint &p);
   10.20 -QString qpointfToString (const QPointF &p);
   10.21 +QString qpointFToString (const QPointF &p);
   10.22 +QString VectorToString (const Vector &p);
   10.23 +
   10.24 +
   10.25  extern ostream &operator<< (ostream &stream, QPoint const &p);
   10.26  extern ostream &operator<< (ostream &stream, QPointF const &p);
   10.27 +extern ostream &operator<< (ostream &stream, Vector const &p);
   10.28  qreal getAngle(const QPointF &);
   10.29  qreal max (qreal,qreal);
   10.30  
    11.1 --- a/version.h	Mon Sep 07 15:36:57 2009 +0000
    11.2 +++ b/version.h	Tue Sep 08 12:15:39 2009 +0000
    11.3 @@ -7,7 +7,7 @@
    11.4  #define __VYM_VERSION "1.13.0"
    11.5  //#define __VYM_CODENAME "Codename: RC-1"
    11.6  #define __VYM_CODENAME "Codename: development version, not for production!"
    11.7 -#define __VYM_BUILD_DATE "2009-09-07"
    11.8 +#define __VYM_BUILD_DATE "2009-09-08"
    11.9  
   11.10  
   11.11  bool checkVersion(const QString &);
    12.1 --- a/vymmodel.cpp	Mon Sep 07 15:36:57 2009 +0000
    12.2 +++ b/vymmodel.cpp	Tue Sep 08 12:15:39 2009 +0000
    12.3 @@ -2341,15 +2341,13 @@
    12.4  				"delete ()",
    12.5  				QString("Delete %1").arg(getObjectName(ti))
    12.6  			);
    12.7 +			unselect();
    12.8 +			deleteItem (ti);
    12.9 +			emitDataHasChanged (pi);
   12.10 +			select (pi);
   12.11 +			reposition();
   12.12 +			emitShowSelection();
   12.13  		}
   12.14 -		// FIXME-1 savestate missing for deletion of other types than above
   12.15 -		unselect();
   12.16 -		deleteItem (ti);
   12.17 -		emitDataHasChanged (pi);
   12.18 -		select (pi);
   12.19 -		reposition();
   12.20 -		emitShowSelection();
   12.21 -		return;
   12.22  	}
   12.23  }
   12.24  
   12.25 @@ -4028,6 +4026,7 @@
   12.26  
   12.27  	for (int i=0;i<rootItem->branchCount(); i++)
   12.28  		rootItem->getBranchObjNum(i)->reposition();	//	for positioning heading
   12.29 +	emitSelectionChanged();	
   12.30  }
   12.31  
   12.32  /*
    13.1 --- a/xml-vym.cpp	Mon Sep 07 15:36:57 2009 +0000
    13.2 +++ b/xml-vym.cpp	Tue Sep 08 12:15:39 2009 +0000
    13.3 @@ -145,7 +145,7 @@
    13.4  		{
    13.5  			// Treat the found mapcenter as a branch 
    13.6  			// in an existing map
    13.7 -			BranchItem *bi=model->getSelectedBranch();	//FIXME-3 selection is no longer used here... //FIXME-2 really? we are adding to a map...
    13.8 +			BranchItem *bi=model->getSelectedBranch();	//FIXME-2 selection is no longer used here... 
    13.9  			if (bi)
   13.10  			{
   13.11  				lastBranch=bi;
   13.12 @@ -153,7 +153,7 @@
   13.13  				{
   13.14  					lastBranch=model->createBranch(lastBranch);
   13.15  				} //else
   13.16 -					//lastBranch->clear(); //FIXME-1 clear not really defined!
   13.17 +					//lastBranch->clear(); //FIXME-2 clear not really defined!
   13.18  			} else
   13.19  				// add mapCenter without parent
   13.20  				lastBranch=model->createMapCenter();