Commit 604fc47d authored by Beuster's avatar Beuster
Browse files

Add TestExampleAABB

Test for model with Error RingSelfInt. Gets Vertices and BoundingBox
parent 3d6aafce
Pipeline #11355 passed with stage
in 1 minute and 35 seconds
/*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 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 3 of the License, or
* (at your option) any later version.
*
* CityDoctor2 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 CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package de.hft.stuttgart.citydoctor2.check;
import java.util.Collections;
import java.util.Set;
/**
*
* This class serves as a Parent for non-validating checks that want to use the CheckEngine's Visitor-pattern for the
* implementation of utility functions like e.g. collecting the sub-CityObjects in a Feature.
*
*
* @author Matthias Betz
*
*/
public abstract class AbstractCheck extends Check {
@Override
public Set<Requirement> appliesToRequirements() {
return Collections.emptySet();
}
@Override
public CheckId getCheckId() {
return null;
}
@Override
public RequirementType getType() {
return null;
}
@Override
public Check createNewInstance() {
return null;
}
@Override
public final boolean isValidator() {
return false;
}
}
package de.hft.stuttgart.citydoctor2.utils.visitors.bht;
import de.hft.stuttgart.citydoctor2.check.AbstractVisitor;
import de.hft.stuttgart.citydoctor2.datastructure.CityObject;
import java.util.HashSet;
import java.util.Set;
/**
* This Visitor collects all sub-CityObjects that are in the datastructure of a CityObject (including itself) in a Set.
*/
public class PolygonCollector extends AbstractVisitor {
// private final Set<CityObject> objects = new HashSet<>();
//
// /**
// * Returns the collected CityObjects.
// *
// * @return A set of CityObjects
// */
// public Set<CityObject> getCityObjects() {
// return objects;
// }
//
// @Override
// public void check(CityObject co) {
// objects.add(co);
// }
}
......@@ -3,6 +3,17 @@ package de.hft.stuttgart.citydoctor2.healer.bht;
import java.util.ArrayList;
import java.util.*;
import de.hft.stuttgart.citydoctor2.edge.Point3d;
import de.hft.stuttgart.citydoctor2.edge.GmPlane;
import de.hft.stuttgart.citydoctor2.datastructure.Vertex;
import de.hft.stuttgart.citydoctor2.math.UnitVector3d;
import de.hft.stuttgart.citydoctor2.datastructure.Edge;
import de.hft.stuttgart.citydoctor2.math.Edge2d;
public class HealingBySweepPlanarity {
// public static void main(String[] args) {
......@@ -14,8 +25,8 @@ public class HealingBySweepPlanarity {
// boolean IgnoreMultiplePoints;
double Eps_PlanarityTolerance;
// public boolean isPointInPlane(GmPlane plane, Point3d point, double tolerance)
// {
public boolean isPointInPlane(GmPlane plane, Point3d point, double tolerance)
{
// Point3d foot = plane.project(point);
// double dist = (point - foot).getLength();
//
......@@ -24,50 +35,50 @@ public class HealingBySweepPlanarity {
// return false;
// }
//
// return true;
// }
return true;
}
//
// public Point3dList getComplexPoints(Face cpFace)
// public List<Point3d> getComplexPoints(Face Face)
// {
//
// Point3dList multiplePoints = new Point3dList();
// List<Point3d> multiplePoints = new ArrayList<>();
//
// VertexList vertices = getAllVerticesForFace(cpFace);
// List<Vertex> vertices = getAllVerticesForFace(Face);
//
// for (Vertex pVertex : vertices)
// for (Vertex Vertex : vertices)
// {
// Point3d point = pVertex.getPositionOnGeometry();
// LinkedList<Edge > otherEdges = getOtherEdges(pVertex, cpFace);
// Point3d point = Vertex.getPositionOnGeometry();
// LinkedList<Edge > otherEdges = getOtherEdges(Vertex, Face);
//
// if (otherEdges.size() >= 2)
// {
// multiplePoints.push_back(pVertex.getPositionOnGeometry());
// multiplePoints.push_back(Vertex.getPositionOnGeometry());
// }
// }
//
// return new Point3dList(multiplePoints);
// return new List<Point3d>(multiplePoints);
//
// }
//
// public LinkedList<Vertex > splitVertexCut(Vertex pVertexToSplit, Face pSweepFace)
// public LinkedList<Vertex > splitVertexCut(Vertex VertexToSplit, Face SweepFace)
// {
//
// LinkedList<Vertex > allSplitVertices = new LinkedList<Vertex >();
//
// LinkedList<Face > allFacesOfVertex = getFacesForVertex(pVertexToSplit);
// LinkedList<Face > allFacesOfVertex = getFacesForVertex(VertexToSplit);
// LinkedList<SplitCutTriple> unsortedTriple = new LinkedList<SplitCutTriple>();
// for (Face middleFace : allFacesOfVertex)
// {
//
// SplitCutTriple aTriple = new SplitCutTriple();
//
// aTriple.pFace_center = middleFace;
// aTriple.Face_center = middleFace;
//
// LinkedList<Edge > faceEdges = getAllEdgesForFace(pVertexToSplit, middleFace);
// LinkedList<Edge > faceEdges = getAllEdgesForFace(VertexToSplit, middleFace);
// if (faceEdges.size() != 2)
// {
// EDGE_ERROR << "there should be two edges. faceEdges.size() = " << faceEdges.size() << EDGE_ENDL;
......@@ -75,38 +86,38 @@ public class HealingBySweepPlanarity {
// System.out.print(faceEdges.size());
// System.out.println();
//
// for (Edge pTempEdge : faceEdges)
// for (Edge TempEdge : faceEdges)
// {
// System.out.print(" ");
// System.out.print(pTempEdge);
// System.out.print(TempEdge);
// System.out.println();
// }
//
// return new LinkedList<Vertex>();
// }
//
// aTriple.pEdge_left = faceEdges.getFirst();
// aTriple.pEdge_rigth = faceEdges.getLast();
// aTriple.Edge_left = faceEdges.getFirst();
// aTriple.Edge_rigth = faceEdges.getLast();
//
// aTriple.pFace_left = (Face)getFacePartner(faceEdges.getFirst(), middleFace);
// aTriple.pFace_rigth = (Face)getFacePartner(faceEdges.getLast(), middleFace);
// aTriple.Face_left = (Face)getFacePartner(faceEdges.getFirst(), middleFace);
// aTriple.Face_rigth = (Face)getFacePartner(faceEdges.getLast(), middleFace);
//
// unsortedTriple.addLast(aTriple);
// }
//
// LinkedList<SplitCutTriple> sortedTriples = sortSplitCutTriples(unsortedTriple, pSweepFace);
// LinkedList<SplitCutTriple> sortedTriples = sortSplitCutTriples(unsortedTriple, SweepFace);
//
//
// // only output
//
// /* cout << "main Face : " << pSweepFace << "\n";
// /* cout << "main Face : " << SweepFace << "\n";
// System.out.print("main vertex : ");
// System.out.print(pVertexToSplit);
// System.out.print(VertexToSplit);
// System.out.println();
// for (Face pFaceOfAll : allFacesOfVertex)
// for (Face FaceOfAll : allFacesOfVertex)
// {
// System.out.print(" one of the faces : ");
// System.out.print(pFaceOfAll);
// System.out.print(FaceOfAll);
// ystem.out.println();
// }
// for (SplitCutTriple aTriple : sortedTriples)
......@@ -114,19 +125,19 @@ public class HealingBySweepPlanarity {
// System.out.print(" Triple ");
// System.out.println();
// System.out.print(" right Face : ");
// System.out.print(aTriple.pFace_left);
// System.out.print(aTriple.Face_left);
// System.out.println();
// System.out.print(" middle Face : ");
// System.out.print(aTriple.pFace_center);
// System.out.print(aTriple.Face_center);
// System.out.println();
// System.out.print(" left Face : ");
// System.out.print(aTriple.pFace_rigth);
// System.out.print(aTriple.Face_rigth);
// System.out.println();
// System.out.print(" right Edge : ");
// System.out.print(aTriple.pEdge_left);
// System.out.print(aTriple.Edge_left);
// System.out.println();
// System.out.print(" left Edge : ");
// System.out.print(aTriple.pFace_rigth);
// System.out.print(aTriple.Face_rigth);
// System.out.println();
//
// }*/
......@@ -134,57 +145,57 @@ public class HealingBySweepPlanarity {
// // only output end
//
// LinkedList<Edge> allUnprocessedEdgesOfVertex;
// for (Base baseElement : pVertexToSplit.getEdges())
// for (Base baseElement : VertexToSplit.getEdges())
// {
// allUnprocessedEdgesOfVertex.push_back((Edge)baseElement);
// }
//
// Vertex pLastVertex = pVertexToSplit;
// Point3d pointCopy = pVertexToSplit.getPositionOnGeometry();
// Vertex LastVertex = VertexToSplit;
// Point3d pointCopy = VertexToSplit.getPositionOnGeometry();
//
// CoEdge pNewCenterCoEdge = null;
// CoEdge pNewMainCoEdge = null;
// CoEdge NewCenterCoEdge = null;
// CoEdge NewMainCoEdge = null;
//
// for (SplitCutTriple aTriple : sortedTriples)
// {
// if (aTriple.pFace_rigth == pSweepFace || aTriple.pFace_center == pSweepFace)
// if (aTriple.Face_rigth == SweepFace || aTriple.Face_center == SweepFace)
// {
// //System.out.print("don't have to process first and last triple");
// //System.out.println();
// allUnprocessedEdgesOfVertex.remove(aTriple.pEdge_rigth);
// allUnprocessedEdgesOfVertex.remove(aTriple.Edge_rigth);
// }
// else if (aTriple.pFace_left == pSweepFace)
// else if (aTriple.Face_left == SweepFace)
// {
// //System.out.print("don't have to process second triple - just to push the first pair<Vertex *, Edge *>");
// //System.out.println();
// allSplitVertices.addLast(pLastVertex);
// allUnprocessedEdgesOfVertex.remove(aTriple.pEdge_rigth);
// allSplitVertices.addLast(LastVertex);
// allUnprocessedEdgesOfVertex.remove(aTriple.Edge_rigth);
// }
// else
// {
//
// // duplicate vertex
// Vertex pNewVertex = new Vertex(pointCopy);
// Vertex NewVertex = new Vertex(pointCopy);
// allSplitVertices.addLast(pNewVertex);
// //System.out.print("duplicated vertex ");
// //System.out.print(pNewVertex);
// //System.out.print(NewVertex);
// //System.out.println();
//
// // set some of the edgepoints to duplicated one
// for (Edge pEdgeToSet : allUnprocessedEdgesOfVertex)
// {
// //System.out.print("start : ");
// //System.out.print(pEdgeToSet.getStartVertex());
// //System.out.print(EdgeToSet.getStartVertex());
// //System.out.print(" end : ");
// //System.out.print(pEdgeToSet.getEndVertex());
// //System.out.print(EdgeToSet.getEndVertex());
// //System.out.println();
// if (pEdgeToSet.getStartVertex() == pLastVertex)
// if (EdgeToSet.getStartVertex() == LastVertex)
// {
// pEdgeToSet.setStartVertex(pNewVertex);
// pEdgeToSet.setStartVertex(NewVertex);
// }
// else if (pEdgeToSet.getEndVertex() == pLastVertex)
// else if (EdgeToSet.getEndVertex() == LastVertex)
// {
// pEdgeToSet.setEndVertex(pNewVertex);
// EdgeToSet.setEndVertex(NewVertex);
// }
// else
// {
......@@ -193,41 +204,41 @@ public class HealingBySweepPlanarity {
// }
//
// // create Edge (between last and new vertex) and CoEdges
// GmStraight gmStraight = new GmStraight(pLastVertex.getPositionOnGeometry(), pNewVertex.getPositionOnGeometry());
// GmStraight gmStraight = new GmStraight(LastVertex.getPositionOnGeometry(), NewVertex.getPositionOnGeometry());
// Straight straight = new Straight(gmStraight);
// Edge pNewEdge = new Edge(straight, Topology.FORWARD, pLastVertex, pNewVertex);
// Edge NewEdge = new Edge(straight, Topology.FORWARD, LastVertex, NewVertex);
//
// // get the two loops
// Loop pLoopCenter = (Loop)aTriple.pFace_center.getLoop();
// Loop pLoopMain = (Loop)pSweepFace.getLoop();
// Loop LoopCenter = (Loop)aTriple.Face_center.getLoop();
// Loop LoopMain = (Loop)SweepFace.getLoop();
//
// // get the corresponding coedges of the loops
// CoEdge pCoEdgeCenterRight = getCorrespondingCoEdge(aTriple.pEdge_rigth, aTriple.pFace_center);
// CoEdge pCoEdgeCenterLeft = getCorrespondingCoEdge(aTriple.pEdge_left, aTriple.pFace_center);
// CoEdge pCoEdgeMainRight = getCorrespondingCoEdge(sortedTriples.getFirst().pEdge_rigth, pSweepFace);
// CoEdge pCoEdgeMainLeft = getCorrespondingCoEdge(sortedTriples.getFirst().pEdge_left, pSweepFace);
// if (pNewMainCoEdge != null)
// CoEdge pCoEdgeCenterRight = getCorrespondingCoEdge(aTriple.Edge_rigth, aTriple.Face_center);
// CoEdge pCoEdgeCenterLeft = getCorrespondingCoEdge(aTriple.Edge_left, aTriple.Face_center);
// CoEdge pCoEdgeMainRight = getCorrespondingCoEdge(sortedTriples.getFirst().Edge_rigth, SweepFace);
// CoEdge pCoEdgeMainLeft = getCorrespondingCoEdge(sortedTriples.getFirst().Edge_left, SweepFace);
// if (NewMainCoEdge != null)
// {
// pCoEdgeMainRight = pNewMainCoEdge;
// CoEdgeMainRight = NewMainCoEdge;
// }
//
// // get the previous and next coedge as well as the sense for the new center coEdge
// CoEdge pCoEdgeCenterNext = null;
// CoEdge pCoEdgeCenterPrev = null;
// CoEdge CoEdgeCenterNext = null;
// CoEdge CoEdgeCenterPrev = null;
// Topology.Sense centerSense = Topology.UNKNOWN;
// Topology.Sense mainSense = Topology.UNKNOWN;
//
// if (pCoEdgeCenterRight.getPrevious() == pCoEdgeCenterLeft)
// if (CoEdgeCenterRight.getPrevious() == CoEdgeCenterLeft)
// {
// pCoEdgeCenterPrev = pCoEdgeCenterLeft;
// pCoEdgeCenterNext = pCoEdgeCenterRight;
// CoEdgeCenterPrev = CoEdgeCenterLeft;
// CoEdgeCenterNext = CoEdgeCenterRight;
// centerSense = Topology.FORWARD;
// mainSense = Topology.REVERSED;
// }
// else if (pCoEdgeCenterRight.getNext() == pCoEdgeCenterLeft)
// else if (CoEdgeCenterRight.getNext() == CoEdgeCenterLeft)
// {
// pCoEdgeCenterNext = pCoEdgeCenterLeft;
// pCoEdgeCenterPrev = pCoEdgeCenterRight;
// CoEdgeCenterNext = CoEdgeCenterLeft;
// CoEdgeCenterPrev = CoEdgeCenterRight;
// centerSense = Topology.REVERSED;
// mainSense = Topology.FORWARD;
// }
......@@ -237,18 +248,18 @@ public class HealingBySweepPlanarity {
// }
//
// // ..same for the new main coEdge
// CoEdge pCoEdgeMainNext = null;
// CoEdge pCoEdgeMainPrev = null;
// CoEdge CoEdgeMainNext = null;
// CoEdge CoEdgeMainPrev = null;
//
// if (pCoEdgeMainRight.getPrevious() == pCoEdgeMainLeft)
// if (CoEdgeMainRight.getPrevious() == CoEdgeMainLeft)
// {
// pCoEdgeMainPrev = pCoEdgeMainLeft;
// pCoEdgeMainNext = pCoEdgeMainRight;
// CoEdgeMainPrev = CoEdgeMainLeft;
// CoEdgeMainNext = CoEdgeMainRight;
// }
// else if (pCoEdgeMainRight.getNext() == pCoEdgeMainLeft)
// else if (CoEdgeMainRight.getNext() == CoEdgeMainLeft)
// {
// pCoEdgeMainNext = pCoEdgeMainLeft;
// pCoEdgeMainPrev = pCoEdgeMainRight;
// CoEdgeMainNext = CoEdgeMainLeft;
// CoEdgeMainPrev = CoEdgeMainRight;
// }
// else
// {
......@@ -256,49 +267,49 @@ public class HealingBySweepPlanarity {
// }
//
// // create the new coedges and set relations to other coedges
// pNewCenterCoEdge = new CoEdge(pNewEdge, centerSense);
// pNewMainCoEdge = new CoEdge(pNewEdge, mainSense);
// setGeometryForCoEdge(pNewCenterCoEdge);
// setGeometryForCoEdge(pNewMainCoEdge);
// NewCenterCoEdge = new CoEdge(NewEdge, centerSense);
// NewMainCoEdge = new CoEdge(NewEdge, mainSense);
// setGeometryForCoEdge(NewCenterCoEdge);
// setGeometryForCoEdge(NewMainCoEdge);
//
// pNewCenterCoEdge.setPartner(pNewMainCoEdge);
// pNewMainCoEdge.setPartner(pNewCenterCoEdge);
// NewCenterCoEdge.setPartner(NewMainCoEdge);
// NewMainCoEdge.setPartner(NewCenterCoEdge);
//
// pNewCenterCoEdge.setNext(pCoEdgeCenterNext);
// pNewCenterCoEdge.setPrevious(pCoEdgeCenterPrev);
// NewCenterCoEdge.setNext(CoEdgeCenterNext);
// NewCenterCoEdge.setPrevious(CoEdgeCenterPrev);
//
// pNewMainCoEdge.setNext(pCoEdgeMainNext);
// pNewMainCoEdge.setPrevious(pCoEdgeMainPrev);
// NewMainCoEdge.setNext(CoEdgeMainNext);
// NewMainCoEdge.setPrevious(CoEdgeMainPrev);
//
// // add CoEdges to loop
// pLoopCenter.addCoEdge(pNewCenterCoEdge);
// pLoopMain.addCoEdge(pNewMainCoEdge);
// LoopCenter.addCoEdge(NewCenterCoEdge);
// LoopMain.addCoEdge(NewMainCoEdge);
//
//
// // output
// if (mPrintInfo)
// {
// System.out.print(" SPLIT VERTEX (CUT) ");
// System.out.print(pLastVertex);
// System.out.print(LastVertex);
// System.out.print(" NEW VERTEX : ");
// System.out.print(pNewVertex);
// System.out.print(NewVertex);
// System.out.print(" NEW EDGE : ");
// System.out.print(pNewEdge);
// System.out.print(NewEdge);
// System.out.println();
// }
//
//
// // set up for next iteration
// //cout << "allUnprocessedEdgesOfVertex.size before " << allUnprocessedEdgesOfVertex.size() << endl;
// allUnprocessedEdgesOfVertex.remove(aTriple.pEdge_rigth);
// allUnprocessedEdgesOfVertex.remove(aTriple.Edge_rigth);
// //cout << "allUnprocessedEdgesOfVertex.size after " << allUnprocessedEdgesOfVertex.size() << endl;
// pLastVertex = pNewVertex;
// LastVertex = NewVertex;
//
// // save changes in Trackchanges
// mpBuilding.getTrackChanges().addNewVertex(pNewVertex);
// for (Face cpFace : getFacesForVertex(pNewVertex))
// Building.getTrackChanges().addNewVertex(NewVertex);
// for (Face Face : getFacesForVertex(NewVertex))
// {
// mpBuilding.getTrackChanges().changeFace((Face)cpFace);
// Building.getTrackChanges().changeFace((Face)cpFace);
// }
// }
//
......@@ -319,7 +330,7 @@ public class HealingBySweepPlanarity {
//
// for (SplitCutTriple aTriple : unsortedTriples)
// {
// if (aTriple.pFace_center == pMainFace)
// if (aTriple.Face_center == MainFace)
// {
// sortedTriples.addLast(aTriple);
// unsortedTriples.remove(aTriple);
......@@ -327,30 +338,30 @@ public class HealingBySweepPlanarity {
// }
// }
//
// Face pCurrFace = sortedTriples.getFirst().pFace_center;
// Face pNextFace = sortedTriples.getFirst().pFace_rigth;
// Face CurrFace = sortedTriples.getFirst().Face_center;
// Face NextFace = sortedTriples.getFirst().Face_rigth;
//
// while (unsortedTriples.size() != 0)
// {
//
// for (SplitCutTriple aTriple : unsortedTriples)
// {
// if (aTriple.pFace_center == pNextFace)
// if (aTriple.Face_center == NextFace)
// {
//
// if (aTriple.pFace_rigth == pCurrFace)
// if (aTriple.Face_rigth == CurrFace)
// {
// Edge pTempEdge = aTriple.pEdge_left;
// aTriple.pEdge_left = aTriple.pEdge_rigth;
// aTriple.pEdge_rigth = pTempEdge;
// Edge TempEdge = aTriple.Edge_left;
// aTriple.Edge_left = aTriple.Edge_rigth;
// aTriple.Edge_rigth = TempEdge;
//
// Face pTempFace = aTriple.pFace_left;
// aTriple.pFace_left = aTriple.pFace_rigth;
// aTriple.pFace_rigth = pTempFace;
// Face pTempFace = aTriple.Face_left;
// aTriple.Face_left = aTriple.Face_rigth;
// aTriple.Face_rigth = TempFace;
// }
//
// pNextFace = aTriple.pFace_rigth;
// pCurrFace = aTriple.pFace_center;
// NextFace = aTriple.Face_rigth;
// CurrFace = aTriple.Face_center;
//
// sortedTriples.addLast(aTriple);
// unsortedTriples.remove(aTriple);
......@@ -367,7 +378,7 @@ public class HealingBySweepPlanarity {
//
// public Vertex splitVertexPull(Vertex pVertexToSplit, Face pFaceToSweep, final LinkedList<Face> newNeighborFaces, LinkedList<Edge > edgesToElongateList)
// public Vertex splitVertexPull(Vertex pVertexToSplit, Face FaceToSweep, final LinkedList<Face> newNeighborFaces, LinkedList<Edge > edgesToElongateList)
// {
// // --------------------------------------------------------------------
// // check if there are 2 neighbor faces of pFaceToSweep that are connected to the vertex
......@@ -376,30 +387,30 @@ public class HealingBySweepPlanarity {
// if (newNeighborFaces.size() != 2)
// {
// EDGE_WARNING << " size of newNeighborFaces should be 2 - this case is not handled yet " << EDGE_ENDL;
// EDGE_WARNING << " this occures for face " << pFaceToSweep << " and vertex " << pVertexToSplit << "." << EDGE_ENDL;
// EDGE_WARNING << " this occures for face " << FaceToSweep << " and vertex " << VertexToSplit << "." << EDGE_ENDL;
// }
//
// // --------------------------------------------------------------------
// // get the two planes of the neighbor faces
// // --------------------------------------------------------------------
//
// Face cpNeighborFace1 = newNeighborFaces.getFirst();
// Face NeighborFace1 = newNeighborFaces.getFirst();
// Face cpNeighborFace2 = newNeighborFaces.getLast();
// Surface cpSurface1 = cpNeighborFace1.getGeometry();
// Surface cpSurface2 = cpNeighborFace2.getGeometry();
// if (!cpSurface1.isOfType(Plane.getClassTypeId()))
// Surface Surface1 = NeighborFace1.getGeometry();
// Surface Surface2 = NeighborFace2.getGeometry();
// if (!Surface1.isOfType(Plane.getClassTypeId()))
// {
// EDGE_ERROR << " Face " << cpNeighborFace1 << " has no Plane" << EDGE_ENDL;
// EDGE_ERROR << " Face " << NeighborFace1 << " has no Plane" << EDGE_ENDL;
// }
// if (!cpSurface1.isOfType(Plane.getClassTypeId()))
// if (!Surface1.isOfType(Plane.getClassTypeId()))
// {
// EDGE_ERROR << " Face " << cpNeighborFace2 << " has no Plane" << EDGE_ENDL;
// EDGE_ERROR << " Face " << NeighborFace2 << " has no Plane" << EDGE_ENDL;
// }
//
// Plane pPlane1 = (Plane)cpSurface1;
// GmPlane gmPlane1 = pPlane1.getEquation();
// Plane pPlane2 = (Plane)cpSurface2;
// GmPlane gmPlane2 = pPlane2.getEquation();
// Plane Plane1 = (Plane)Surface1;
// GmPlane gmPlane1 = Plane1.getEquation();
// Plane Plane2 = (Plane)Surface2;
// GmPlane gmPlane2 = Plane2.getEquation();
//
//
// // --------------------------------------------------------------------
......@@ -420,11 +431,11 @@ public class HealingBySweepPlanarity {
// UnitVector3d intersetionDirection = interesctionStraight.getDir();
//
// // --------------------------------------------------------------------
// // create new pNewVertex
// // create new NewVertex
// // --------------------------------------------------------------------
//
// Point3d pointCopy = pVertexToSplit.getPositionOnGeometry();
// Vertex pNewVertex = new Vertex(pointCopy);
// Point3d pointCopy = VertexToSplit.getPositionOnGeometry();
// Vertex NewVertex = new Vertex(pointCopy);
//
// // --------------------------------------------------------------------
// // create new Edge and connect pVertex with pNewVertex ( use straight from above)
......@@ -432,54 +443,54 @@ public class HealingBySweepPlanarity {
//
// GmStraight gmStraight = new GmStraight(pVertexToSplit.getPositionOnGeometry(), intersetionDirection);
// Straight straight = new Straight(gmStraight); // TODO : simply use method getIntersectionStraight
// Edge pNewEdge = new Edge(straight, Topology.FORWARD, pVertexToSplit, pNewVertex);
// Edge pNewEdge = new Edge(straight, Topology.FORWARD, VertexToSplit, NewVertex);
//
//
// // --------------------------------------------------------------------
// / get the two neighbor loops
// // --------------------------------------------------------------------
//
// Loop pLoop1 = (Loop)cpNeighborFace1.getLoop();
// Loop pLoop2 = (Loop)cpNeighborFace2.getLoop();
// Loop pLoop1 = (Loop)NeighborFace1.getLoop();
// Loop pLoop2 = (Loop)NeighborFace2.getLoop();
//
// // --------------------------------------------------------------------
// // get the corresponding coEdges of the loops where the new Coedges should be placed
// // --------------------------------------------------------------------
//
// CoEdge pPrevCoEdge1;
// CoEdge pNextCoEdge1;
// CoEdge pPrevCoEdge2;
// CoEdge pNextCoEdge2;
// findPrevAndNextCoEdge(pVertexToSplit, pLoop1, pPrevCoEdge1, pNextCoEdge1);
// findPrevAndNextCoEdge(pVertexToSplit, pLoop2, pPrevCoEdge2, pNextCoEdge2);
// CoEdge PrevCoEdge1;
// CoEdge NextCoEdge1;
// CoEdge PrevCoEdge2;
// CoEdge NextCoEdge2;
// findPrevAndNextCoEdge(VertexToSplit, Loop1, PrevCoEdge1, NextCoEdge1);
// findPrevAndNextCoEdge(VertexToSplit, Loop2, PrevCoEdge2, NextCoEdge2);
//
//
// // --------------------------------------------------------------------
// // set new relationship between pNewVertex and edges
// // set new relationship between NewVertex and edges
// // --------------------------------------------------------------------
// for (Edge pTempEdge : getAllEdgesForVertex(pVertexToSplit))
// for (Edge TempEdge : getAllEdgesForVertex(VertexToSplit))
// {
// // the two edges of the sweepface will get the pNewVertex (all other edges with that vertex will keep it)
// if (pTempEdge == pNewEdge)
// // the two edges of the sweepface will get the NewVertex (all other edges with that vertex will keep it)
// if (TempEdge == NewEdge)
// {
// // pTempEdge is pNewEdge -> ignore
// // TempEdge is NewEdge -> ignore
// continue;
// }
//
// if (edgesToElongateList.contains(pTempEdge))
// if (edgesToElongateList.contains(TempEdge))
// {
// // pTempEdge is elongated edge -> ignore
// // TempEdge is elongated edge -> ignore
// continue;
// }
//
// if (pTempEdge.getStartVertex() == pVertexToSplit)
// if (TempEdge.getStartVertex() == VertexToSplit)
// {
//
// ((Edge)pTempEdge).setStartVertex(pNewVertex);
// ((Edge)TempEdge).setStartVertex(NewVertex);
// }
// else if (pTempEdge.getEndVertex() == pVertexToSplit)
// else if (TempEdge.getEndVertex() == VertexToSplit)
// {
// ((Edge)pTempEdge).setEndVertex(pNewVertex);
// ((Edge)TempEdge).setEndVertex(NewVertex);
// }
// else
// {
......@@ -491,56 +502,56 @@ public class HealingBySweepPlanarity {
// // create coEdges; the two faces are the corresponding faces to the coEdges
// // --------------------------------------------------------------------
//
// CoEdge pNewCoEdge1;
// if (pPrevCoEdge1.getEndVertex() == pNewEdge.getStartVertex() || pPrevCoEdge1.getStartVertex() == pNewEdge.getEndVertex())
// CoEdge NewCoEdge1;
// if (PrevCoEdge1.getEndVertex() == NewEdge.getStartVertex() || PrevCoEdge1.getStartVertex() == NewEdge.getEndVertex())
// {
// pNewCoEdge1 = new CoEdge(pNewEdge, Topology.FORWARD);
// NewCoEdge1 = new CoEdge(NewEdge, Topology.FORWARD);
// }
// else if (pPrevCoEdge1.getEndVertex() == pNewEdge.getEndVertex() || pPrevCoEdge1.getStartVertex() == pNewEdge.getStartVertex())
// else if (PrevCoEdge1.getEndVertex() == NewEdge.getEndVertex() || PrevCoEdge1.getStartVertex() == NewEdge.getStartVertex())
// {
// pNewCoEdge1 = new CoEdge(pNewEdge, Topology.REVERSED);
// NewCoEdge1 = new CoEdge(NewEdge, Topology.REVERSED);
// }
// setGeometryForCoEdge(pNewCoEdge1);
// setGeometryForCoEdge(NewCoEdge1);
//
// CoEdge pNewCoEdge2;
// if (pPrevCoEdge2.getEndVertex() == pNewEdge.getStartVertex() || pPrevCoEdge2.getStartVertex() == pNewEdge.getEndVertex())
// CoEdge NewCoEdge2;
// if (PrevCoEdge2.getEndVertex() == NewEdge.getStartVertex() || PrevCoEdge2.getStartVertex() == NewEdge.getEndVertex())
// {
// pNewCoEdge2 = new CoEdge(pNewEdge, Topology.FORWARD);
// NewCoEdge2 = new CoEdge(NewEdge, Topology.FORWARD);
// }
// else if (pPrevCoEdge2.getEndVertex() == pNewEdge.getEndVertex() || pPrevCoEdge2.getStartVertex() == pNewEdge.getStartVertex())
// else if (PrevCoEdge2.getEndVertex() == NewEdge.getEndVertex() || PrevCoEdge2.getStartVertex() == NewEdge.getStartVertex())
// {
// pNewCoEdge2 = new CoEdge(pNewEdge, Topology.REVERSED);
// NewCoEdge2 = new CoEdge(NewEdge, Topology.REVERSED);
// }
// setGeometryForCoEdge(pNewCoEdge2);
// setGeometryForCoEdge(NewCoEdge2);
//
// pNewCoEdge1.setPartner(pNewCoEdge2);
// pNewCoEdge2.setPartner(pNewCoEdge1);
// pNewCoEdge1.setPrevious(pPrevCoEdge1);
// pNewCoEdge1.setNext(pNextCoEdge1);
// pNewCoEdge2.setPrevious(pPrevCoEdge2);
// pNewCoEdge2.setNext(pNextCoEdge2);
// NewCoEdge1.setPartner(NewCoEdge2);
// NewCoEdge2.setPartner(NewCoEdge1);
// NewCoEdge1.setPrevious(PrevCoEdge1);
// NewCoEdge1.setNext(NextCoEdge1);
// NewCoEdge2.setPrevious(PrevCoEdge2);
// NewCoEdge2.setNext(NextCoEdge2);
//
// pLoop1.addCoEdge(pNewCoEdge1);
// pLoop2.addCoEdge(pNewCoEdge2);
// Loop1.addCoEdge(NewCoEdge1);
// Loop2.addCoEdge(NewCoEdge2);
//
// if (mPrintInfo)
// {
// System.out.print(" SPLIT VERTEX (PULL) ");
// System.out.print(pVertexToSplit);
// System.out.print(VertexToSplit);
// System.out.print(" NEW VERTEX : ");
// System.out.print(pNewVertex);
// System.out.print(NewVertex);
// System.out.print(" NEW EDGE : ");
// System.out.print(pNewEdge);
// System.out.print(NewEdge);
// System.out.println();
// }
//
// // save changes in Trackchanges
// mpBuilding.getTrackChanges().addNewVertex(pNewVertex);
// for (Face cpFace : getFacesForVertex(pNewVertex))
// Building.getTrackChanges().addNewVertex(NewVertex);
// for (Face Face : getFacesForVertex(NewVertex))
// {
// mpBuilding.getTrackChanges().changeFace((Face)cpFace);
// mpBuilding.getTrackChanges().changeFace((Face)Face);
// }
// return pNewVertex;
// return NewVertex;
//
// }
......
package de.hft.stuttgart.citydoctor2.healer.bht;
import de.hft.stuttgart.citydoctor2.datastructure.Edge;
import de.hft.stuttgart.citydoctor2.math.Edge2d;
public class SplitCutTriple {
// public static void main(String[] args) {
......@@ -7,15 +10,15 @@ public class SplitCutTriple {
//
// }
// public Face pFace_left;
// public Edge pEdge_left;
// public Face pFace_center;
// public Edge pEdge_rigth;
// public Face pFace_rigth;
//
// public Face Face_left;
public Edge Edge_left;
// public Face Face_center;
public Edge Edge_rigth;
// public Face Face_rigth;
// public boolean equalsTo(SplitCutTriple st)
// {
// if (st.pFace_center == pFace_center)
// if (st.Face_center == Face_center)
// {
// return true;
// }
......
......@@ -3,22 +3,28 @@ package de.hft.stuttgart.citydoctor2.healing.bht;
import java.io.IOException;
//import java.io.InputStream; //new
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Scanner; //new
import org.junit.Test;
import de.hft.stuttgart.citydoctor2.check.AbstractVisitor;
import de.hft.stuttgart.citydoctor2.check.CheckableUtilsVisitor;
import de.hft.stuttgart.citydoctor2.check.CheckableVisitor;
import de.hft.stuttgart.citydoctor2.check.Check;
import de.hft.stuttgart.citydoctor2.check.ValidationConfiguration;
import de.hft.stuttgart.citydoctor2.datastructure.Building;
import de.hft.stuttgart.citydoctor2.datastructure.CityDoctorModel;
import de.hft.stuttgart.citydoctor2.datastructure.CityObject;
import de.hft.stuttgart.citydoctor2.datastructure.ConcretePolygon;
import de.hft.stuttgart.citydoctor2.datastructure.Geometry;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
import de.hft.stuttgart.citydoctor2.datastructure.LinearRing;
import de.hft.stuttgart.citydoctor2.datastructure.LinearRing.LinearRingType;
import de.hft.stuttgart.citydoctor2.datastructure.Vertex;
import de.hft.stuttgart.citydoctor2.exceptions.CityDoctorWriteException;
import de.hft.stuttgart.citydoctor2.healing.TestUtil;
import de.hft.stuttgart.citydoctor2.parser.CityGmlParseException;
......@@ -33,107 +39,196 @@ public class TestExample {
public static void main(String[] args) throws CityGmlParseException, IOException, InvalidGmlFileException {
System.out.println("Start TestExample... \n"); //new
// String path = args[0];
// String path = "src/test/resources/SimpleSolid_SrefBS.gml"; //new
String path = "src/test/resources/TestBuilding1.gml"; //new
// String path = args[0];
// String path = "src/test/resources/SimpleSolid_SrefBS.gml"; //new valid LoD2 model
// String path = "src/test/resources/TestBuilding1.gml"; //new block model
String path = "src/test/resources/bht/SimpleSolid_SrefBS-GE-gml-PO-0001-T0002.gml"; //new valid model with inner rings
// String path = "src/test/resources/bht/KreishausFeuerwache.gml"; // too big, main gets terminated
// String path = "src/test/resources/bht/TestBuilding_SelfInt.gml";
ValidationConfiguration config = ValidationConfiguration.loadStandardValidationConfig();
CityDoctorModel model = TestUtil.loadCityModel(path, config);
System.out.println("\nModel has been loaded..."); //new
// //inside class Geometry
// @Override
// public void accept(Check c) {
// super.accept(c);
// if (c.canExecute(this)) {
// c.check(this);
// }
// for (Polygon p : polygons) {
// p.accept(c);
// }
// }
// visitor
// filter duplicate polygons out
Set<ConcretePolygon> allBuildingPolygons = new HashSet<>();
for (Building b : model.getBuildings()) {
b.accept(new AbstractVisitor() {
b.accept(new CheckableUtilsVisitor() {
public void check(Polygon poly) {
allBuildingPolygons.add(poly.getOriginal());
}
});
}
System.out.println("\nConcretePolygon HashSet elements:" + allBuildingPolygons); //new
System.out.println("\nPolygons via visitor:" + allBuildingPolygons); //new
// for loop
List<Polygon> allBuildingPolygons2 = new ArrayList<>();
// // for loop
// List<Polygon> allBuildingPolygons2 = new ArrayList<>();
// for (Building b : model.getBuildings()) {
// for (Geometry geom : b.getGeometries()) {
// for (Polygon p : geom.getPolygons()) {
// allBuildingPolygons2.add(p);
//// allBuildingPolygons2.add(p.getOriginal()); //new
// }
// }
// }
// System.out.println("\nPolygon List:" + allBuildingPolygons2); //new
// new: LinearRings
// visitor
// filter duplicate linear rings out
Set<LinearRing> allBuildingLinearRings = new HashSet<>();
for (Building b : model.getBuildings()) {
for (Geometry geom : b.getGeometries()) {
for (Polygon p : geom.getPolygons()) {
allBuildingPolygons2.add(p);
b.accept(new CheckableUtilsVisitor() {
public void check(LinearRing ring) {
allBuildingLinearRings.add(ring);
}
}
});
}
System.out.println("\nPolygon List:" + allBuildingPolygons2); //new
// //inside class ConcretePolygon
// @Override
// public void accept(Check c) {
// super.accept(c);
// if (c.canExecute(this)) {
// c.check(this);
// }
// if (exterior != null) {
// exterior.accept(c);
// }
// if (innerRings != null) {
// for (LinearRing lr : innerRings) {
// lr.accept(c);
System.out.println("\nLinearRings via visitor:" + allBuildingLinearRings); //new
// new: ExteriorRings
// visitor
// filter duplicate exterior rings out
Set<LinearRing> allBuildingExteriorRings = new HashSet<>();
for (Building b : model.getBuildings()) {
b.accept(new CheckableUtilsVisitor() {
public void check(LinearRing ring) {
allBuildingExteriorRings.add(ring.getParent().getExteriorRing());
}
});
}
System.out.println("\nExteriorRings via visitor:" + allBuildingExteriorRings); //new
// // new: ExteriorRings (List)
// // for loop
// List<LinearRing> allBuildingExteriorRings2 = new ArrayList<>();
// for (Building b : model.getBuildings()) {
// for (Geometry geom : b.getGeometries()) {
// for (Polygon p : geom.getPolygons()) {
// allBuildingExteriorRings2.add(p.getOriginal().getExteriorRing());
// }
// }
// }
// System.out.println("\nExteriorRing List:" + allBuildingExteriorRings2); //new
// new: InnerRings
// visitor
// filter duplicate polygons out
Set<ConcretePolygon> allBuildingInnerRings = new HashSet<>();
// filter duplicate inner rings out
Set<LinearRing> allBuildingInnerRings = new HashSet<>();
for (Building b : model.getBuildings()) {
b.accept(new AbstractVisitor() {
b.accept(new CheckableUtilsVisitor() {
public void check(Polygon poly) {
allBuildingInnerRings.add(poly.getOriginal());
allBuildingInnerRings.addAll(poly.getOriginal().getInnerRings());
}
});
}
System.out.println("\nConcretePolygon HashSet elements:" + allBuildingInnerRings); //new
System.out.println("\nInnerRings via visitor:" + allBuildingInnerRings); //new
// new: LinearRing from ConcretePolygon
// for loop
List<LinearRing> allBuildingInnerRings2 = new ArrayList<>();
for (Building b : model.getBuildings()) {
for (Geometry geom : b.getGeometries()) {
for (Polygon p : geom.getPolygons()) {
for (LinearRing lr : p.getInnerRings()) {
allBuildingInnerRings2.add(lr);
}
// for (LinearRing extRing : p.getExteriorRing()) {
//allBuildingInnerRings.add(extRing);
// for (LinearRing lr : extRing.getLinearRings()) {
// allBuildingInnerRings.add(lr);
// }
// // new: InnerRings (List)
// // for loop
// List<LinearRing> allBuildingInnerRings2 = new ArrayList<>();
// for (Building b : model.getBuildings()) {
// for (Geometry geom : b.getGeometries()) {
// for (Polygon p : geom.getPolygons()) {
// for (LinearRing lr : p.getInnerRings()) {
// allBuildingInnerRings2.add(lr);
// }
}
}
}
System.out.println("\nInnerRing List:" + allBuildingInnerRings2); //new
//
// }
// }
// }
// System.out.println("\nInnerRing List:" + allBuildingInnerRings2); //new
}
// //@Test
// public void testMain() throws CityGmlParseException, IOException, InvalidGmlFileException {
// TestExample.main(new String[]{});
// }
// // get Vertices for LinearRing, ExteriorRing and InteriorRing
// // new: LinearRingVertices
// // visitor
// // filter duplicate linear rings out
// Set<Vertex> allBuildingLinearRingVertices = new HashSet<>();
// for (Building b : model.getBuildings()) {
// b.accept(new CheckableUtilsVisitor() {
// public void check(LinearRing ring) {
// allBuildingLinearRingVertices.addAll(ring.getVertices());
// }
//
// });
// }
// System.out.println("\nLinearRingVertices via visitor:" + allBuildingLinearRingVertices); //new
// // new: ExteriorRingVertices
// // visitor
// // filter duplicate exterior rings out
// Set<Vertex> allBuildingExteriorRingVertices = new HashSet<>();
// for (Building b : model.getBuildings()) {
// b.accept(new CheckableUtilsVisitor() {
// public void check(LinearRing ring) {
// allBuildingExteriorRingVertices.addAll(ring.getParent().getOriginal().getExteriorRing().getVertices());
// }
//
// });
// }
// System.out.println("\nExteriorRingVertices via visitor:" + allBuildingExteriorRingVertices); //new
// // new: ExteriorRingVertices (List)
// // for loop
// List<Vertex> allBuildingExteriorRingVertices2 = new ArrayList<>();
// for (Building b : model.getBuildings()) {
// for (Geometry geom : b.getGeometries()) {
// for (Polygon p : geom.getPolygons()) {
// for (Vertex v : p.getOriginal().getExteriorRing().getVertices()) {
// allBuildingExteriorRingVertices2.add(v);
// }
// }
// }
// }
// System.out.println("\nExteriorRingVertices List:" + allBuildingExteriorRingVertices2); //new
// // new: InnerRingVertices
// // visitor
// // filter duplicate linear vertices out
// Set<Vertex> allBuildingInnerRingVertices = new HashSet<>();
// for (Building b : model.getBuildings()) {
// b.accept(new CheckableUtilsVisitor() {
// public void check(Polygon poly) {
// poly.getOriginal().getInnerRings().forEach(ring->allBuildingInnerRingVertices.addAll(ring.getVertices()));
// }
// });
// }
// System.out.println("\nInnerRingVertices via visitor:" + allBuildingInnerRingVertices); //new
// // new: InnerRingVertices (List)
// // for loop
// List<Vertex> allInnerRingVertices2 = new ArrayList<>();
// for (Building b : model.getBuildings()) {
// for (Geometry geom : b.getGeometries()) {
// for (Polygon p : geom.getPolygons()) {
// for (LinearRing lr : p.getInnerRings()) {
// for (Vertex v : lr.getVertices()) {
// allInnerRingVertices2.add(v);
// }
// }
//
// }
// }
// }
// System.out.println("\nInnerRingVertices List:" + allInnerRingVertices2); //new
// // TODO: HashMap to show Ring and gmlId
// Map<LinearRing, Set<Vertex>> test = new HashMap<>();
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment