summaryrefslogtreecommitdiffstats
path: root/src/libvpsc
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2014-04-01 17:00:00 +0000
committerJabiertxof <jtx@jtx.marker.es>2014-04-01 17:00:00 +0000
commit208ccdf9782984702f79b8ba416e67dd1e2c2dfa (patch)
tree79d15123aa526c49c6386db6245fbfc6b7a63eaf /src/libvpsc
parentupdate to trunk (diff)
parentpartial 2geom update: (diff)
downloadinkscape-208ccdf9782984702f79b8ba416e67dd1e2c2dfa.tar.gz
inkscape-208ccdf9782984702f79b8ba416e67dd1e2c2dfa.zip
update to trunk
(bzr r12588.1.32)
Diffstat (limited to 'src/libvpsc')
-rw-r--r--src/libvpsc/CMakeLists.txt2
-rw-r--r--src/libvpsc/Makefile_insert2
-rw-r--r--src/libvpsc/csolve_VPSC.cpp128
-rw-r--r--src/libvpsc/csolve_VPSC.h72
-rw-r--r--src/libvpsc/generate-constraints.cpp11
5 files changed, 5 insertions, 210 deletions
diff --git a/src/libvpsc/CMakeLists.txt b/src/libvpsc/CMakeLists.txt
index 4099900b5..aa693670c 100644
--- a/src/libvpsc/CMakeLists.txt
+++ b/src/libvpsc/CMakeLists.txt
@@ -3,7 +3,6 @@ set(libvpsc_SRC
block.cpp
blocks.cpp
constraint.cpp
- csolve_VPSC.cpp
generate-constraints.cpp
remove_rectangle_overlap.cpp
solve_VPSC.cpp
@@ -16,7 +15,6 @@ set(libvpsc_SRC
block.h
blocks.h
constraint.h
- csolve_VPSC.h
generate-constraints.h
pairingheap/PairingHeap.h
pairingheap/dsexceptions.h
diff --git a/src/libvpsc/Makefile_insert b/src/libvpsc/Makefile_insert
index 4af86324e..cb05be6c0 100644
--- a/src/libvpsc/Makefile_insert
+++ b/src/libvpsc/Makefile_insert
@@ -11,7 +11,6 @@ libvpsc_libvpsc_a_SOURCES = libvpsc/block.cpp\
libvpsc/pairingheap/PairingHeap.cpp\
libvpsc/remove_rectangle_overlap.cpp\
libvpsc/solve_VPSC.cpp\
- libvpsc/csolve_VPSC.cpp\
libvpsc/variable.cpp\
libvpsc/block.h\
libvpsc/blocks.h\
@@ -21,5 +20,4 @@ libvpsc_libvpsc_a_SOURCES = libvpsc/block.cpp\
libvpsc/pairingheap/dsexceptions.h\
libvpsc/remove_rectangle_overlap.h\
libvpsc/solve_VPSC.h\
- libvpsc/csolve_VPSC.h\
libvpsc/variable.h
diff --git a/src/libvpsc/csolve_VPSC.cpp b/src/libvpsc/csolve_VPSC.cpp
deleted file mode 100644
index 60e88a50b..000000000
--- a/src/libvpsc/csolve_VPSC.cpp
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Bridge for C programs to access solve_VPSC (which is in C++).
- *
- * Authors:
- * Tim Dwyer <tgdwyer@gmail.com>
- *
- * Copyright (C) 2005 Authors
- *
- * Released under GNU LGPL. Read the file 'COPYING' for more information.
- */
-#include <glib.h>
-#include <iostream>
-#include <cassert>
-#include <cstdlib>
-#include "variable.h"
-#include "constraint.h"
-#include "generate-constraints.h"
-#include "solve_VPSC.h"
-#include "csolve_VPSC.h"
-using namespace vpsc;
-extern "C" {
-Variable* newVariable(int id, double desiredPos, double weight) {
- return new Variable(id,desiredPos,weight);
-}
-Constraint* newConstraint(Variable* left, Variable* right, double gap) {
- return new Constraint(left,right,gap);
-}
-Solver* newSolver(int n, Variable* vs[], int m, Constraint* cs[]) {
- return new Solver(n,vs,m,cs);
-}
-Solver* newIncSolver(int n, Variable* vs[], int m, Constraint* cs[]) {
- return (Solver*)new vpsc::IncSolver(n,vs,m,cs);
-}
-
-int genXConstraints(int n, boxf* bb, Variable** vs, Constraint*** cs,int transitiveClosure) {
- Rectangle* rs[n];
- for(int i=0;i<n;i++) {
- rs[i]=new Rectangle(bb[i].LL.x,bb[i].UR.x,bb[i].LL.y,bb[i].UR.y);
- }
- int m = generateXConstraints(n,rs,vs,*cs,transitiveClosure);
- for(int i=0;i<n;i++) {
- delete rs[i];
- }
- return m;
-}
-int genYConstraints(int n, boxf* bb, Variable** vs, Constraint*** cs) {
- g_assert(n > 0);
- Rectangle* rs[n];
- for(int i=0;i<n;i++) {
- rs[i]=new Rectangle(bb[i].LL.x,bb[i].UR.x,bb[i].LL.y,bb[i].UR.y);
- }
- int m = generateYConstraints(n,rs,vs,*cs);
- for(int i=0;i<n;i++) {
- delete rs[i];
- }
- return m;
-}
-
-Constraint** newConstraints(int m) {
- return new Constraint*[m];
-}
-void deleteConstraints(int m, Constraint **cs) {
- for(int i=0;i<m;i++) {
- delete cs[i];
- }
- delete [] cs;
-}
-void deleteConstraint(Constraint* c) {
- delete c;
-}
-void deleteVariable(Variable* v) {
- delete v;
-}
-void satisfyVPSC(Solver* vpsc) {
- try {
- vpsc->satisfy();
- } catch(const char *e) {
- std::cerr << e << std::endl;
- exit(1);
- }
-}
-int getSplitCnt(IncSolver *vpsc) {
- return vpsc->splitCnt;
-}
-void deleteVPSC(Solver *vpsc) {
- assert(vpsc!=NULL);
- delete vpsc;
-}
-void solveVPSC(Solver* vpsc) {
- vpsc->solve();
-}
-void splitIncVPSC(IncSolver* vpsc) {
- vpsc->splitBlocks();
-}
-void setVariableDesiredPos(Variable *v, double desiredPos) {
- v->desiredPosition = desiredPos;
-}
-double getVariablePos(Variable *v) {
- return v->position();
-}
-void remapInConstraints(Variable *u, Variable *v, double dgap) {
- for(Constraints::iterator i=u->in.begin();i!=u->in.end();i++) {
- Constraint* c=*i;
- c->right=v;
- c->gap+=dgap;
- v->in.push_back(c);
- }
- u->in.clear();
-}
-void remapOutConstraints(Variable *u, Variable *v, double dgap) {
- for(Constraints::iterator i=u->out.begin();i!=u->out.end();i++) {
- Constraint* c=*i;
- c->left=v;
- c->gap+=dgap;
- v->out.push_back(c);
- }
- u->out.clear();
-}
-int getLeftVarID(Constraint *c) {
- return c->left->id;
-}
-int getRightVarID(Constraint *c){
- return c->right->id;
-}
-double getSeparation(Constraint *c){
- return c->gap;
-}
-}
diff --git a/src/libvpsc/csolve_VPSC.h b/src/libvpsc/csolve_VPSC.h
deleted file mode 100644
index edfd16657..000000000
--- a/src/libvpsc/csolve_VPSC.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/**
- * @file
- * Bridge for C programs to access solve_VPSC (which is in C++).
- */
-/*
- * Authors:
- * Tim Dwyer <tgdwyer@gmail.com>
- *
- * Copyright (C) 2005 Authors
- *
- * Released under GNU LGPL. Read the file 'COPYING' for more information.
- */
-#ifndef CSOLVE_VPSC_H_
-#define CSOLVE_VPSC_H_
-#ifdef __cplusplus
-namespace vpsc
-{
- class Variable;
- class Constraint;
- class Solver;
- class IncSolver;
-}
-/* TODO 'using' should never be in a .h file. We need a different approach here. */
-using vpsc::Variable;
-using vpsc::Constraint;
-using vpsc::Solver;
-using vpsc::IncSolver;
-extern "C" {
-#else
-typedef struct Variable Variable;
-typedef struct Constraint Constraint;
-typedef struct Solver Solver;
-typedef struct IncSolver IncSolver;
-#endif
-
-Variable* newVariable(int id, double desiredPos, double weight);
-void setVariableDesiredPos(Variable *, double desiredPos);
-double getVariablePos(Variable*);
-
-Constraint* newConstraint(Variable* left, Variable* right, double gap);
-
-Solver* newSolver(int n, Variable* vs[], int m, Constraint* cs[]);
-void deleteSolver(Solver*);
-void deleteConstraint(Constraint*);
-void deleteVariable(Variable*);
-Constraint** newConstraints(int m);
-void deleteConstraints(int m,Constraint**);
-void remapInConstraints(Variable *u, Variable *v, double dgap);
-void remapOutConstraints(Variable *u, Variable *v, double dgap);
-int getLeftVarID(Constraint *c);
-int getRightVarID(Constraint *c);
-double getSeparation(Constraint *c);
-
-#ifndef HAVE_POINTF_S
-typedef struct pointf_s { double x, y; } pointf;
-typedef struct { pointf LL, UR; } boxf;
-#endif
-int genXConstraints(int n, boxf[], Variable** vs, Constraint*** cs,
- int transitiveClosure);
-int genYConstraints(int n, boxf[], Variable** vs, Constraint*** cs);
-
-void satisfyVPSC(Solver*);
-void deleteVPSC(Solver*);
-void solveVPSC(Solver*);
-void splitIncVPSC(IncSolver*);
-Solver* newIncSolver(int n, Variable* vs[], int m, Constraint* cs[]);
-void splitIncSolver(IncSolver*);
-int getSplitCnt(IncSolver *vpsc);
-#ifdef __cplusplus
-}
-#endif
-#endif /* CSOLVE_VPSC_H_ */
diff --git a/src/libvpsc/generate-constraints.cpp b/src/libvpsc/generate-constraints.cpp
index fabe5217f..288e7ed53 100644
--- a/src/libvpsc/generate-constraints.cpp
+++ b/src/libvpsc/generate-constraints.cpp
@@ -209,7 +209,6 @@ int generateXConstraints(const int n, Rectangle** rs, Variable** vars, Constrain
}
} else {
// Close event
- int r;
if(useNeighbourLists) {
for(NodeSet::iterator i=v->leftNeighbours->begin();
i!=v->leftNeighbours->end();i++
@@ -217,7 +216,7 @@ int generateXConstraints(const int n, Rectangle** rs, Variable** vars, Constrain
Node *u=*i;
double sep = (v->r->width()+u->r->width())/2.0;
constraints.push_back(new Constraint(u->v,v->v,sep));
- r=u->rightNeighbours->erase(v);
+ u->rightNeighbours->erase(v);
}
for(NodeSet::iterator i=v->rightNeighbours->begin();
@@ -226,22 +225,22 @@ int generateXConstraints(const int n, Rectangle** rs, Variable** vars, Constrain
Node *u=*i;
double sep = (v->r->width()+u->r->width())/2.0;
constraints.push_back(new Constraint(v->v,u->v,sep));
- r=u->leftNeighbours->erase(v);
+ u->leftNeighbours->erase(v);
}
} else {
Node *l=v->firstAbove, *r=v->firstBelow;
if(l!=NULL) {
double sep = (v->r->width()+l->r->width())/2.0;
constraints.push_back(new Constraint(l->v,v->v,sep));
- l->firstBelow=v->firstBelow;
+ l->firstBelow = v->firstBelow;
}
if(r!=NULL) {
double sep = (v->r->width()+r->r->width())/2.0;
constraints.push_back(new Constraint(v->v,r->v,sep));
- r->firstAbove=v->firstAbove;
+ r->firstAbove = v->firstAbove;
}
}
- r=scanline.erase(v);
+ scanline.erase(v);
delete v;
}
delete e;