summaryrefslogtreecommitdiffstats
path: root/src/libcola/tests/overlappingClusters02.cpp
diff options
context:
space:
mode:
authorMarc Jeanmougin <marc.jeanmougin@telecom-paristech.fr>2018-04-29 14:25:32 +0000
committerMarc Jeanmougin <marc.jeanmougin@telecom-paristech.fr>2018-04-29 14:25:32 +0000
commitab5f8ff5869021958f4ae8b838c3d707a2e85eaa (patch)
tree4907675828a5401d013b7587538cc8541edd2764 /src/libcola/tests/overlappingClusters02.cpp
parentmoved libcroco, libuemf, libdepixelize to 3rdparty folder (diff)
downloadinkscape-ab5f8ff5869021958f4ae8b838c3d707a2e85eaa.tar.gz
inkscape-ab5f8ff5869021958f4ae8b838c3d707a2e85eaa.zip
Put adaptagrams into its own folder
Diffstat (limited to 'src/libcola/tests/overlappingClusters02.cpp')
-rw-r--r--src/libcola/tests/overlappingClusters02.cpp100
1 files changed, 0 insertions, 100 deletions
diff --git a/src/libcola/tests/overlappingClusters02.cpp b/src/libcola/tests/overlappingClusters02.cpp
deleted file mode 100644
index d721e9409..000000000
--- a/src/libcola/tests/overlappingClusters02.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-// Based on Euler Diagram generation example discussed with Aidan Delaney.
-//
-// B
-// +-----------------------------+
-// A | 2 C |
-// +-----------+----------------+ +---+ |
-// | | 1 | | 0 | |
-// | | | +---+ |
-// | 3 +----------------+------------+
-// | |
-// | | 4
-// +----------------------------+
-//
-
-#include <vector>
-#include <utility>
-#include <cstdlib>
-#include "libcola/cola.h"
-using namespace cola;
-int main(void) {
- CompoundConstraints ccs;
- std::vector<Edge> es;
- EdgeLengths eLengths;
- double defaultEdgeLength=10;
- std::vector<vpsc::Rectangle*> rs;
- vpsc::Rectangle *rect = NULL;
-
- double width = 5;
- double height = 5;
- double pos = 0;
-
- size_t nodes = 5;
- for (size_t i = 0; i < nodes; ++i)
- {
- rect = new vpsc::Rectangle(pos, pos +width, pos, pos +height);
- rs.push_back(rect);
-
- // XXX randomness is needed because COLA doesn't currently untangle
- // the graph properly if all the nodes begin at the same position.
- pos += (rand() % 10) - 5;
- }
-
- // Euler dual graph (optional)
- es.push_back(std::make_pair(2, 4));
- es.push_back(std::make_pair(3, 4));
- es.push_back(std::make_pair(1, 3));
- es.push_back(std::make_pair(2, 1));
- es.push_back(std::make_pair(2, 0));
-
- // Padding around the inside of clusters.
- double padding = 3;
-
- ConstrainedFDLayout alg(rs, es, defaultEdgeLength, eLengths);
- alg.setAvoidNodeOverlaps(true);
- RootCluster *rootCluster = new RootCluster();
-
- // A contains 1, 3
- RectangularCluster *clusterA = new RectangularCluster();
- clusterA->setPadding(padding);
- clusterA->addChildNode(1);
- clusterA->addChildNode(3);
-
- // C contains 0
- RectangularCluster *clusterC = new RectangularCluster();
- clusterC->setPadding(padding);
- clusterC->addChildNode(0);
-
- // B contains 1, 2, C
- RectangularCluster *clusterB = new RectangularCluster();
- clusterB->setPadding(padding);
- clusterB->addChildNode(1);
- clusterB->addChildNode(2);
- clusterB->addChildCluster(clusterC);
-
- // node 4 is in the empty set.
-
- rootCluster->addChildCluster(clusterA);
- rootCluster->addChildCluster(clusterB);
-
- alg.setConstraints(ccs);
-
- UnsatisfiableConstraintInfos unsatisfiableX, unsatisfiableY;
- alg.setUnsatisfiableConstraintInfo(&unsatisfiableX, &unsatisfiableY);
-
- alg.setClusterHierarchy(rootCluster);
- //alg.makeFeasible();
- alg.run();
- alg.outputInstanceToSVG("overlappingClusters02");
-
- for (size_t i = 0; i < unsatisfiableX.size(); ++i)
- {
- printf("%s\n", unsatisfiableX[i]->toString().c_str());
- }
- for (size_t i = 0; i < unsatisfiableY.size(); ++i)
- {
- printf("%s\n", unsatisfiableY[i]->toString().c_str());
- }
- alg.freeAssociatedObjects();
- return (unsatisfiableX.empty() && unsatisfiableY.empty()) ? 0 : 1;
-};