From ab5f8ff5869021958f4ae8b838c3d707a2e85eaa Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Sun, 29 Apr 2018 16:25:32 +0200 Subject: Put adaptagrams into its own folder --- src/libcola/tests/planar.cpp | 287 ------------------------------------------- 1 file changed, 287 deletions(-) delete mode 100644 src/libcola/tests/planar.cpp (limited to 'src/libcola/tests/planar.cpp') diff --git a/src/libcola/tests/planar.cpp b/src/libcola/tests/planar.cpp deleted file mode 100644 index 19deb8718..000000000 --- a/src/libcola/tests/planar.cpp +++ /dev/null @@ -1,287 +0,0 @@ -/* - * vim: ts=4 sw=4 et tw=0 wm=0 - * - * libcola - A library providing force-directed network layout using the - * stress-majorization method subject to separation constraints. - * - * Copyright (C) 2006-2008 Monash University - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file LICENSE; if not, - * write to the Free Software Foundation, Inc., 59 Temple Place, - * Suite 330, Boston, MA 02111-1307 USA - * -*/ - -/** \file topology.cpp - * - * tests topology preserving layout. graph is a triangle. - * We have a fourth disconnected node starting inside the triangle. - * We give the disconnected node a desired position outside the triangle - * and begin layout. Layout should converge to near zero stress as all - * edges should be able to reach their desired lengths, and disconnected - * node should still be inside the triangle at the end. - */ -/* -* Authors: -* Tim Dwyer -*/ -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include "graphlayouttest.h" -using namespace std; -using namespace cola; - -struct TestCase { - topology::Nodes vs; - topology::Edges tes; - topology::EdgePoints ps; - vector rs; - vector es; - void addNode(double minX, double minY, double w, double h) { - vpsc::Rectangle* r = new Rectangle(minX, minX+w, minY, minY+h); - rs.push_back(r); - topology::Node *v = new topology::Node(vs.size(), r); - vs.push_back(v); - } - void addToPath(unsigned vID, topology::EdgePoint::RectIntersect i) { - ps.push_back(new topology::EdgePoint(vs[vID],i)); - } - void addEdge(double l) { - tes.push_back(new topology::Edge(l, ps)); - es.push_back(make_pair(ps[0]->node->id,ps[ps.size()-1]->node->id)); - ps.clear(); - } - ~TestCase() { - for_each(rs.begin(),rs.end(),delete_object()); - for_each(tes.begin(),tes.end(),delete_object()); - for_each(vs.begin(),vs.end(),delete_object()); - } -}; -void writeFile(const topology::Nodes& vs, const topology::Edges& es, const char *outputFileName) { - const unsigned n=vs.size(); - vector cedges; - - for(unsigned i=0;i routes; - for(topology::Edges::const_iterator e=es.begin();e!=es.end();++e) { - routes.push_back((*e)->getRoute()); - } - - vector labels(n); - for(unsigned i=0;i rs; - for(topology::Nodes::const_iterator i=vs.begin();i!=vs.end();++i) { - rs.push_back((*i)->rect); - } - OutputFile of(rs,cedges,NULL,outputFileName,true,false); - of.setLabels(labels); - of.routes=&routes; - of.generate(); - - for_each(routes.begin(),routes.end(),delete_object()); -} -struct Test : TestConvergence { - Test(const double d,const unsigned i,topology::Nodes& vs, topology::Edges& es) : TestConvergence(d,i), vs(vs), es(es) {} - bool operator()(const double new_stress, valarray & X, valarray & Y) { - cout << "stress="<