private void addFictive() {
ListIterator li = f.getEdges()
.listIterator();
while (li.hasNext()) {
SimpleEdge edge = (SimpleEdge) li.next();
if (((Integer) iTurn.get(edge)).intValue() == -1) {
SimpleEdge front = (SimpleEdge) eFront.get(edge);
SimpleVertex corner = (SimpleVertex) vCorner.get(edge);
double nx;
double ny;
if (front.isHorizontal()) {
nx = corner.getOrthX();
ny = front.getSource()
.getOrthY();
} else {
nx = front.getSource()
.getOrthX();
ny = corner.getOrthY();
}
SimpleVertex project = new SimpleVertex();
project.setOrthX(nx);
project.setOrthY(ny);
if (front.getProperty(FICTIVEFACE_KEY) == null) {
project.setProperty(FICTIVEFACE_KEY, front);
} else {
project.setProperty(FICTIVEFACE_KEY,
front.getProperty(FICTIVEFACE_KEY));
}
boolean newvertex;
if (CompactionHelper.equalsOrth(project,
front.getSource())) {
project = front.getSource();
newvertex = false;
} else if (CompactionHelper.equalsOrth(
project,
front.getTarget())) {
project = front.getTarget();
newvertex = false;
} else {
newvertex = true;
}
if (newvertex) {
// added a new vertex
if (edge.getProperty(DEFFEREDFRONT_KEY) == null) {
sg.addVertex(project);
sg.removeEdge(front);
SimpleEdge extend = new SimpleEdge(corner, project);
extend.setProperty(FICTIVEFACE_KEY, FICTIVE_VALUE);
sg.addEdge(extend);
addededges.add(extend);
SimpleEdge e1 = new SimpleEdge(front.getSource(),
project);
e1.setProperty(FICTIVEFACE_KEY, front);
sg.addEdge(e1);
SimpleEdge e2 = new SimpleEdge(project,
front.getTarget());
e2.setProperty(FICTIVEFACE_KEY, front);
sg.addEdge(e2);
refineFronts(front, e1, e2);
} else {
// no need to remove front
sg.addVertex(project);
SimpleEdge extend = new SimpleEdge(corner, project);
extend.setProperty(FICTIVEFACE_KEY, FICTIVE_VALUE);
sg.addEdge(extend);
addededges.add(extend);
project.setProperty(DEFFEREDFRONT_KEY, front);
edge.setProperty(DEFFEREDFRONT_KEY, project);
}
// evertyng added is not in face (this is no error)
// cause we do not use faces in compaction algorithm
} else {
SimpleEdge extend = new SimpleEdge(corner, project);
addededges.add(extend);
extend.setProperty(FICTIVEFACE_KEY, FICTIVE_VALUE);
sg.addEdge(extend);
}
}
}
}