diff -r 7d67be709091 -r cac93797c580 mapeditor.cpp --- a/mapeditor.cpp Tue Sep 08 12:15:39 2009 +0000 +++ b/mapeditor.cpp Wed Sep 09 12:57:06 2009 +0000 @@ -562,11 +562,15 @@ // Create list with all bounding polygons QList mapobjects; QList polys; + ConvexPolygon p; QList vectors; QList orgpos; + QStringList headings; //FIXME-3 testing only + Vector v; BranchItem *bi; + BranchItem *bi2; BranchObj *bo; - TreeItem *ri=model->getRootItem(); + BranchItem *ri=model->getRootItem(); for (int i=0;ibranchCount();++i) { bi=ri->getBranchNum (i); @@ -574,11 +578,28 @@ if (bo) { mapobjects.append (bo); - polys.append(bo->getBoundingPolygon()); - polys[i].calcCentroid(); + p=bo->getBoundingPolygon(); + p.calcCentroid(); + polys.append(p); vectors.append (QPointF(0,0)); - orgpos.append (polys[i].at(0)); - } + orgpos.append (p.at(0)); + headings.append (bi->getHeading()); + } + for (int j=0;jbranchCount();++j) + { + bi2=bi->getBranchNum (j); + bo=(BranchObj*)bi2->getLMO(); + if (bo) + { + mapobjects.append (bo); + p=bo->getBoundingPolygon(); + p.calcCentroid(); + polys.append(p); + vectors.append (QPointF(0,0)); + orgpos.append (p.at(0)); + headings.append (bi2->getHeading()); + } + } } // Iterate moving bounding polygons until we have no more collisions @@ -593,25 +614,31 @@ if (polygonCollision (polys.at(i),polys.at(j), QPointF(0,0)).intersect ) { collisions++; - Vector v=polys.at(j).centroid()-polys.at(i).centroid(); + v=polys.at(j).centroid()-polys.at(i).centroid(); // Move also away if centroids are identical if (v.isNull()) { + //cout << "v==0="<