From fd733201b82f39655488a286c89142f321ef9dc9 Mon Sep 17 00:00:00 2001 From: Sylvain Chiron Date: Sat, 1 Jul 2017 13:36:41 +0200 Subject: Updated libs from the Adaptagrams project: libavoid, libcola and libvspc; changed the code to match the new API Signed-off-by: Sylvain Chiron --- src/libvpsc/remove_rectangle_overlap.cpp | 106 ------------------------------- 1 file changed, 106 deletions(-) delete mode 100644 src/libvpsc/remove_rectangle_overlap.cpp (limited to 'src/libvpsc/remove_rectangle_overlap.cpp') diff --git a/src/libvpsc/remove_rectangle_overlap.cpp b/src/libvpsc/remove_rectangle_overlap.cpp deleted file mode 100644 index d667ffb1e..000000000 --- a/src/libvpsc/remove_rectangle_overlap.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/* - * remove overlaps between a set of rectangles. - * - * Authors: - * Tim Dwyer - * - * Copyright (C) 2005 Authors - * - * Released under GNU LGPL. Read the file 'COPYING' for more information. - */ - -#include -#include -#include "generate-constraints.h" -#include "solve_VPSC.h" -#include "variable.h" -#include "constraint.h" -#include "remove_rectangle_overlap.h" /* own include */ -#ifdef RECTANGLE_OVERLAP_LOGGING -#include -#include "blocks.h" -using std::ios; -using std::ofstream; -using std::endl; -#endif - -#define EXTRA_GAP 0.0001 -using namespace vpsc; - -double Rectangle::xBorder=0; -double Rectangle::yBorder=0; - -void removeRectangleOverlap(unsigned n, Rectangle *rs[], double xBorder, double yBorder) { - try { - // The extra gap avoids numerical imprecision problems - Rectangle::setXBorder(xBorder+EXTRA_GAP); - Rectangle::setYBorder(yBorder+EXTRA_GAP); - Variable **vs=new Variable*[n]; - for(unsigned i=0;idesiredPosition; - } - Solver vpsc_x(n,vs,m,cs); -#ifdef RECTANGLE_OVERLAP_LOGGING - ofstream f(LOGFILE,ios::app); - f<<"Calling VPSC: Horizontal pass 1"<moveCentreX(vs[i]->position()); - } - for(unsigned i = 0; i < m; ++i) { - delete cs[i]; - } - delete [] cs; - // Removing the extra gap here ensures things that were moved to be adjacent to - // one another above are not considered overlapping - Rectangle::setXBorder(Rectangle::xBorder-EXTRA_GAP); - m=generateYConstraints(n,rs,vs,cs); - Solver vpsc_y(n,vs,m,cs); -#ifdef RECTANGLE_OVERLAP_LOGGING - f.open(LOGFILE,ios::app); - f<<"Calling VPSC: Vertical pass"<moveCentreY(vs[i]->position()); - rs[i]->moveCentreX(oldX[i]); - } - delete [] oldX; - for(unsigned i = 0; i < m; ++i) { - delete cs[i]; - } - delete [] cs; - Rectangle::setYBorder(Rectangle::yBorder-EXTRA_GAP); - m=generateXConstraints(n,rs,vs,cs,false); - Solver vpsc_x2(n,vs,m,cs); -#ifdef RECTANGLE_OVERLAP_LOGGING - f.open(LOGFILE,ios::app); - f<<"Calling VPSC: Horizontal pass 2"<moveCentreX(vs[i]->position()); - delete vs[i]; - } - delete [] vs; - } catch (char const *str) { - std::cerr<