Commit 6d0d664e authored by Matthias Betz's avatar Matthias Betz
Browse files

Merge remote-tracking branch 'remotes/origin/dev' into dev_baris_aabb_auto_mergeable

parents a7ed4b64 cc4fe260
Pipeline #12443 passed with stage
in 2 minutes and 42 seconds
#version 330 core
layout(location = 0) in vec3 aPos;
layout(location = 1) in vec3 aColor;
uniform mat4 uMVP;
out vec3 vColorG;
void main() {
gl_Position = uMVP * vec4(aPos, 1.0);
vColorG = aColor;
}
#version 330 core
in vec3 vColor;
out vec4 fragColor;
void main() {
fragColor = vec4(vColor, 1.0);
}
#version 330 core
layout(location = 0) in vec3 aPos;
layout(location = 1) in vec3 aColor;
uniform mat4 uMVP;
out vec3 vColor;
void main() {
gl_Position = uMVP * vec4(aPos, 1.0);
vColor = aColor;
}
package de.hft.stuttgart.citydoctor2.gui.gl;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
public class FloatListTest {
@Test
public void growsBeyondInitialCapacityAndPreservesOrder() {
FloatList list = new FloatList(2);
for (int i = 0; i < 10; i++) {
list.add(i);
}
assertEquals(10, list.size());
float[] expected = {0,1,2,3,4,5,6,7,8,9};
assertArrayEquals(expected, list.toArray(), 0.0f);
}
@Test
public void addThreeAddsAllInOrder() {
FloatList list = new FloatList(1);
list.add(1f, 2f, 3f);
assertArrayEquals(new float[]{1,2,3}, list.toArray(), 0.0f);
}
@Test
public void clearResetsSizeAndArray() {
FloatList list = new FloatList(4);
list.add(1f, 2f, 3f);
list.add(4f);
list.clear();
assertEquals(0, list.size());
assertEquals(0, list.toArray().length);
}
}
package de.hft.stuttgart.citydoctor2.gui.gl;
import static org.junit.Assert.assertArrayEquals;
import java.util.Arrays;
import java.util.List;
import java.util.function.Predicate;
import org.junit.Test;
public class IndexSetBuilderTest {
@Test
public void includesOnlyTrianglesMatchingThePredicate() {
List<TriangleMeta> metas = Arrays.asList(
new TriangleMeta(0, null, 1, false),
new TriangleMeta(1, null, 2, false),
new TriangleMeta(2, null, 1, false));
Predicate<TriangleMeta> onlyGroup1 = m -> m.lod() == 1;
int[] indices = IndexSetBuilder.build(metas, onlyGroup1);
assertArrayEquals(new int[]{0, 1, 2, 6, 7, 8}, indices);
}
@Test
public void emptyWhenNothingMatches() {
List<TriangleMeta> metas = Arrays.asList(new TriangleMeta(0, null, 1, false));
int[] indices = IndexSetBuilder.build(metas, m -> false);
assertArrayEquals(new int[]{}, indices);
}
}
package de.hft.stuttgart.citydoctor2.gui.gl;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
public class Mat4Test {
@Test
public void identityTimesVectorIsUnchanged() {
float[] v = Mat4.transform(Mat4.identity(), 2, 3, 4, 1);
assertArrayEquals(new float[]{2, 3, 4, 1}, v, 1e-6f);
}
@Test
public void translationMovesPoint() {
float[] m = Mat4.translation(5, -2, 1);
float[] v = Mat4.transform(m, 1, 1, 1, 1);
assertArrayEquals(new float[]{6, -1, 2, 1}, v, 1e-6f);
}
@Test
public void multiplyIsIdentityNeutral() {
float[] t = Mat4.translation(1, 2, 3);
assertArrayEquals(t, Mat4.multiply(Mat4.identity(), t), 1e-6f);
assertArrayEquals(t, Mat4.multiply(t, Mat4.identity()), 1e-6f);
}
@Test
public void rotationZ90MapsXAxisToYAxis() {
float[] m = Mat4.rotationZ((float) (Math.PI / 2));
float[] v = Mat4.transform(m, 1, 0, 0, 1);
assertEquals(0f, v[0], 1e-6f);
assertEquals(1f, v[1], 1e-6f);
}
@Test
public void perspectiveHasExpectedDiagonalStructure() {
float[] p = Mat4.perspective((float) Math.toRadians(60), 1.0f, 1f, 100f);
float f = (float) (1.0 / Math.tan(Math.toRadians(60) / 2));
assertEquals(f, p[0], 1e-5f);
assertEquals(f, p[5], 1e-5f);
assertEquals(-1f, p[11], 1e-6f);
}
}
package de.hft.stuttgart.citydoctor2.gui.gl;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import de.hft.stuttgart.citydoctor2.math.Triangle3d;
import de.hft.stuttgart.citydoctor2.math.Vector3d;
import org.junit.Test;
public class MeshAccumulatorTest {
@Test
public void emitsNineFloatsAndThreeIdsPerTriangleRecentered() {
MeshAccumulator acc = new MeshAccumulator(new Vector3d(1, 0, 0));
Triangle3d t = new Triangle3d(
new Vector3d(1, 0, 0), new Vector3d(2, 0, 0), new Vector3d(1, 1, 0));
acc.addTriangle(t, 7, 0.5f, 0.25f, 0.125f);
assertEquals(3, acc.vertexCount());
assertArrayEquals(new float[]{0,0,0, 1,0,0, 0,1,0}, acc.positions(), 1e-6f);
assertArrayEquals(new float[]{0.5f,0.25f,0.125f, 0.5f,0.25f,0.125f, 0.5f,0.25f,0.125f},
acc.colors(), 1e-6f);
assertArrayEquals(new int[]{7, 7, 7}, acc.ids());
}
@Test
public void accumulatesMultipleTriangles() {
MeshAccumulator acc = new MeshAccumulator(new Vector3d(0, 0, 0));
Triangle3d t = new Triangle3d(
new Vector3d(0, 0, 0), new Vector3d(1, 0, 0), new Vector3d(0, 1, 0));
acc.addTriangle(t, 1, 1, 1, 1);
acc.addTriangle(t, 2, 0, 0, 0);
assertEquals(6, acc.vertexCount());
assertEquals(18, acc.positions().length);
assertArrayEquals(new int[]{1, 1, 1, 2, 2, 2}, acc.ids());
}
}
package de.hft.stuttgart.citydoctor2.gui.gl;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
public class OrbitCameraTest {
private static float[] ndc(OrbitCamera cam, float x, float y, float z) {
float[] clip = Mat4.transform(cam.viewProjection(), x, y, z, 1);
return new float[]{clip[0] / clip[3], clip[1] / clip[3], clip[2] / clip[3]};
}
@Test
public void focusPointProjectsToScreenCentre() {
OrbitCamera cam = new OrbitCamera();
cam.setAspect(1.0f);
cam.zoomOutForBoundingBox(50.0);
float[] p = ndc(cam, 0, 0, 0);
assertEquals(0f, p[0], 1e-4f);
assertEquals(0f, p[1], 1e-4f);
assertTrue("origin in front of camera (within clip)", p[2] > -1f && p[2] < 1f);
}
@Test
public void zoomingKeepsFocusCentredButChangesDepth() {
OrbitCamera cam = new OrbitCamera();
cam.setAspect(1.0f);
cam.zoomOutForBoundingBox(50.0);
float depthBefore = ndc(cam, 0, 0, 0)[2];
cam.zoom(1.5);
float[] p = ndc(cam, 0, 0, 0);
assertEquals(0f, p[0], 1e-4f);
assertEquals(0f, p[1], 1e-4f);
assertTrue("depth changes when zooming", Math.abs(p[2] - depthBefore) > 1e-4f);
}
@Test
public void resetRestoresInitialDistanceAndAngles() {
OrbitCamera cam = new OrbitCamera();
cam.setAspect(1.0f);
cam.orbit(40, 25);
cam.pan(10, -5);
cam.zoom(2.0);
cam.reset();
float[] before = cam.viewProjection();
OrbitCamera fresh = new OrbitCamera();
fresh.setAspect(1.0f);
org.junit.Assert.assertArrayEquals(fresh.viewProjection(), before, 1e-5f);
}
}
package de.hft.stuttgart.citydoctor2.gui.gl;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import org.junit.Test;
public class PickRegistryTest {
@Test
public void assignsSequentialNonZeroIdsAndResolvesThem() {
PickRegistry reg = new PickRegistry();
Object a = "a";
Object b = "b";
int idA = reg.register(a);
int idB = reg.register(b);
assertEquals(1, idA);
assertEquals(2, idB);
assertEquals(a, reg.resolve(idA));
assertEquals(b, reg.resolve(idB));
}
@Test
public void resolvesBackgroundAndOutOfRangeToNull() {
PickRegistry reg = new PickRegistry();
reg.register("a");
assertNull(reg.resolve(0));
assertNull(reg.resolve(99));
}
}
package de.hft.stuttgart.citydoctor2.gui.gl;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
public class PickingCodecTest {
@Test
public void roundTripsIdsThroughRgbBytes() {
int[] ids = {1, 255, 256, 65535, 65536, 16777215};
for (int id : ids) {
int r = PickingCodec.red(id);
int g = PickingCodec.green(id);
int b = PickingCodec.blue(id);
assertEquals(id, PickingCodec.decode(r, g, b));
}
}
@Test
public void blackDecodesToZeroBackground() {
assertEquals(0, PickingCodec.decode(0, 0, 0));
}
}
package de.hft.stuttgart.citydoctor2.gui.gl;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import de.hft.stuttgart.citydoctor2.datastructure.CityDoctorModel;
import de.hft.stuttgart.citydoctor2.datastructure.Geometry;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
import de.hft.stuttgart.citydoctor2.parser.CityGmlParser;
import de.hft.stuttgart.citydoctor2.parser.ParserConfiguration;
import java.util.ArrayList;
import java.util.List;
import javafx.scene.paint.Color;
import org.junit.BeforeClass;
import org.junit.Test;
public class SceneBuilderTest {
private static List<Polygon> polygons;
@BeforeClass
public static void loadFixture() throws Exception {
ParserConfiguration config = new ParserConfiguration(8, false);
CityDoctorModel model = CityGmlParser.parseCityGmlFile(
"src/test/resources/SimpleSolid_SrefBS-GE-gml-LR-0001-T0001.gml", config);
polygons = new ArrayList<>();
model.getBuildings().forEach(b -> {
for (Geometry g : b.getGeometries()) {
for (Polygon p : g.getPolygons()) {
if (!p.isLink()) {
polygons.add(p);
}
}
}
for (de.hft.stuttgart.citydoctor2.datastructure.BoundarySurface bs : b.getBoundarySurfaces()) {
for (Geometry g : bs.getGeometries()) {
for (Polygon p : g.getPolygons()) {
if (!p.isLink()) {
polygons.add(p);
}
}
}
}
});
assertTrue("fixture should contain polygons", !polygons.isEmpty());
}
@Test
public void buildsConsistentBufferLengths() {
SceneData data = SceneBuilder.fromPolygons(polygons, Color.WHITE);
int vertices = data.positions().length / 3;
assertEquals(vertices * 3, data.colors().length);
assertEquals(vertices, data.ids().length);
assertEquals(vertices, data.triangleCount() * 3);
}
@Test
public void everyPolygonGetsAPickingIdResolvingToAPolygon() {
SceneData data = SceneBuilder.fromPolygons(polygons, Color.WHITE);
for (int id : data.ids()) {
assertTrue(data.pickRegistry().resolve(id) instanceof Polygon);
}
}
}
package de.hft.stuttgart.citydoctor2.gui.gl;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertSame;
import java.util.List;
import org.junit.Test;
public class SceneDataTest {
@Test
public void exposesItsBuffersAndRegistry() {
float[] pos = {0,0,0, 1,0,0, 0,1,0};
float[] col = {1,1,1, 1,1,1, 1,1,1};
int[] ids = {1,1,1};
PickRegistry reg = new PickRegistry();
List<TriangleMeta> metas = List.of(new TriangleMeta(0, null, 2, false));
SceneData data = new SceneData(pos, col, ids, metas, reg, new double[]{5, 6, 7});
assertSame(pos, data.positions());
assertEquals(1, data.triangleMetas().size());
assertEquals(6.0, data.center()[1], 0.0);
assertSame(reg, data.pickRegistry());
}
}
package de.hft.stuttgart.citydoctor2.gui.gl;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import de.hft.stuttgart.citydoctor2.math.Vector3d;
import javafx.scene.paint.Color;
import org.junit.Test;
public class ShadeColorTest {
@Test
public void brightnessStaysWithinExpectedBand() {
// Shade brightness is acos(normal.AXIS)/PI * 0.6 + 0.3 -> always within [0.3, 0.9].
Vector3d[] normals = {
new Vector3d(1, 0, 0), new Vector3d(0, 1, 0), new Vector3d(0, 0, 1),
new Vector3d(-1, 0, 0), new Vector3d(0.3, -0.7, 0.5)
};
for (Vector3d n : normals) {
Color c = ShadeColor.shade(n.normalize(), Color.WHITE);
assertTrue("brightness >= 0.3", c.getBrightness() >= 0.3 - 1e-6);
assertTrue("brightness <= 0.9", c.getBrightness() <= 0.9 + 1e-6);
}
}
@Test
public void matchesLegacyFormulaForKnownNormal() {
Vector3d axis = new Vector3d(19, 0.8, 1.5).normalize();
Vector3d normal = new Vector3d(0, 0, 1).normalize();
double cos = Math.max(-1.0, Math.min(1.0, normal.dot(axis)));
double shade = Math.acos(cos) / Math.PI * 0.6 + 0.3;
Color expected = Color.WHITE.deriveColor(0, 1.0, shade, 1.0);
Color actual = ShadeColor.shade(normal, Color.WHITE);
assertEquals(expected.getRed(), actual.getRed(), 1e-9);
assertEquals(expected.getGreen(), actual.getGreen(), 1e-9);
assertEquals(expected.getBlue(), actual.getBlue(), 1e-9);
}
}
......@@ -6,7 +6,7 @@
<parent>
<groupId>de.hft.stuttgart</groupId>
<artifactId>CityDoctorParent</artifactId>
<version>3.18.1</version>
<version>3.18.3</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CityDoctorHealer</artifactId>
......
package de.hft.stuttgart.citydoctor2.connect.edge;
/**
* Marker interface for excluding testcases that use the deprecated connection to the C++ library.
* The tests are kept for the Java replacement library that is currently being developed.
*/
public interface CppTest {
}
......@@ -12,6 +12,9 @@ import java.util.List;
import java.util.Map;
import java.util.Objects;
import de.hft.stuttgart.citydoctor2.database.CityObjectCache;
import de.hft.stuttgart.citydoctor2.database.UnconnectedCache;
import de.hft.stuttgart.citydoctor2.exceptions.CityObjectCacheException;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.citygml4j.core.ade.ADEException;
......@@ -64,7 +67,7 @@ public class Healer {
private Checker checker;
private ModificationListener l;
private HealingPlan plan;
private CityObjectCache cache;
static {
// CppInitializer.initCpp();
}
......@@ -187,6 +190,12 @@ public class Healer {
}
};
}
if(checker.getModel() != null){
cache = checker.getModel().getCache();
} else {
//Stream healing is being used, use an unconnected cache
cache = new UnconnectedCache();
}
this.l = l;
}
......@@ -208,7 +217,12 @@ public class Healer {
}
public void healModel(CityDoctorModel model) {
try (AutoCloseable checkingContext = model.getCache().startCheckingMode()){
model.createFeatureStream().forEach(this::healCityObject);
} catch (Exception e) {
throw new CityObjectCacheException("Healer critically failed during attempt to heal the model",e);
}
}
public void healCityObject(CityObject co) {
......@@ -282,9 +296,7 @@ public class Healer {
*
* @param aco the feature to write
* @return the byte array containing the feature
* @throws ADEException
* @throws CityGMLBuilderException
* @throws CityGMLWriteException
* @throws CityGMLWriteException if writing of the CityGML file fails
*/
private byte[] writeCityGml(AbstractCityObject aco) throws CityGMLWriteException {
CityModel model = new CityModel();
......@@ -348,6 +360,8 @@ public class Healer {
if (checker.getConfig().getParserConfiguration().useLowMemoryConsumption()) {
co.clearMetaInformation();
}
//Reinsert object into cache and release locks
cache.put(co);
}
}
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configuration>
<Configuration status="INFO">
<Appenders>
<Console name="console" target="SYSTEM_OUT">
<PatternLayout
pattern="[%-5level] %d{HH:mm:ss.SSS} %c{1} - %msg%n" />
</Console>
</Appenders>
<Loggers>
<Root level="debug" additivity="false">
<AppenderRef ref="console" />
</Root>
<Logger name="com.zaxxer.hikari" level="INFO" additivity="false">
<AppenderRef ref="console"/>
</Logger>
</Loggers>
</Configuration>
\ No newline at end of file
......@@ -29,6 +29,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.citygml4j.core.model.CityGMLVersion;
import org.citygml4j.core.model.core.AbstractThematicSurface;
import org.citygml4j.core.model.core.CityModel;
import org.junit.Rule;
......@@ -42,11 +43,13 @@ import de.hft.stuttgart.citydoctor2.check.Requirement;
import de.hft.stuttgart.citydoctor2.check.RequirementConfiguration;
import de.hft.stuttgart.citydoctor2.check.ValidationConfiguration;
import de.hft.stuttgart.citydoctor2.check.error.AttributeMissingError;
import de.hft.stuttgart.citydoctor2.database.UnconnectedCache;
import de.hft.stuttgart.citydoctor2.datastructure.BoundarySurface;
import de.hft.stuttgart.citydoctor2.datastructure.Building;
import de.hft.stuttgart.citydoctor2.datastructure.CityDoctorModel;
import de.hft.stuttgart.citydoctor2.datastructure.ConcretePolygon;
import de.hft.stuttgart.citydoctor2.datastructure.Geometry;
import de.hft.stuttgart.citydoctor2.datastructure.Geometry.Orientation;
import de.hft.stuttgart.citydoctor2.datastructure.GeometryType;
import de.hft.stuttgart.citydoctor2.datastructure.Installation;
import de.hft.stuttgart.citydoctor2.datastructure.LinearRing;
......@@ -55,14 +58,11 @@ import de.hft.stuttgart.citydoctor2.datastructure.LinkedPolygon;
import de.hft.stuttgart.citydoctor2.datastructure.Lod;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
import de.hft.stuttgart.citydoctor2.datastructure.Vertex;
import de.hft.stuttgart.citydoctor2.datastructure.Geometry.Orientation;
import de.hft.stuttgart.citydoctor2.exceptions.CityDoctorWriteException;
import de.hft.stuttgart.citydoctor2.healer.Healer;
import de.hft.stuttgart.citydoctor2.parser.CityGmlParseException;
import de.hft.stuttgart.citydoctor2.parser.CityGmlParser;
import de.hft.stuttgart.citydoctor2.parser.InvalidGmlFileException;
import de.hft.stuttgart.citydoctor2.database.CityObjectCache;
import de.hft.stuttgart.citydoctor2.database.UnconnectedCache;
public class HealMissingSolidTest {
......@@ -72,13 +72,8 @@ public class HealMissingSolidTest {
@Test
public void testCreateSolid() throws CityDoctorWriteException, IOException, CityGmlParseException, InvalidGmlFileException {
ValidationConfiguration config = ValidationConfiguration.loadStandardValidationConfig();
// edit @Numanoglu
CityDoctorModel model =
new CityDoctorModel(
config.getParserConfiguration(),
new File("test"),
new UnconnectedCache()
);
CityDoctorModel model = new CityDoctorModel(config.getParserConfiguration(), new File("test"), new UnconnectedCache());
model.setParsedCityGMLVersion(CityGMLVersion.v3_0);
model.setCityModel(new CityModel());
Building b = new Building();
model.addBuilding(b);
......
......@@ -7,6 +7,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import de.hft.stuttgart.citydoctor2.connect.edge.CppTest;
import org.junit.Assert;
import org.junit.Test;
......@@ -31,6 +32,7 @@ import de.hft.stuttgart.citydoctor2.datastructure.Geometry.Orientation;
import de.hft.stuttgart.citydoctor2.healer.Healer;
import de.hft.stuttgart.citydoctor2.parser.CityGmlParseException;
import de.hft.stuttgart.citydoctor2.parser.InvalidGmlFileException;
import org.junit.experimental.categories.Category;
public class HealPlanarPolygonErrorTest {
......@@ -47,7 +49,6 @@ public class HealPlanarPolygonErrorTest {
Assert.assertTrue(geom.containsError(CheckId.C_GE_P_NON_PLANAR));
Healer healer = new Healer(c);
healer.setNumberOfIterations(2);
healer.healCityObject(model.getBuildings().toList().get(0));
Assert.assertFalse(geom.containsError(CheckId.C_GE_P_NON_PLANAR));
......@@ -55,6 +56,7 @@ public class HealPlanarPolygonErrorTest {
}
@Test
@Category(CppTest.class)
public void testNonplanarPolygon() {
CppInitializer.initCpp();
Building b = new Building();
......@@ -160,6 +162,7 @@ public class HealPlanarPolygonErrorTest {
}
@Test
@Category(CppTest.class)
public void testNonplanarPolygon_Split() {
CppInitializer.initCpp();
Building b = new Building();
......@@ -274,6 +277,7 @@ public class HealPlanarPolygonErrorTest {
}
@Test
@Category(CppTest.class)
public void testNonplanarPolygon_Split2() {
CppInitializer.initCpp();
Building b = new Building();
......
......@@ -4,8 +4,11 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import de.hft.stuttgart.citydoctor2.connect.edge.CppTest;
import org.citygml4j.xml.writer.CityGMLWriteException;
import org.junit.Assert;
import org.junit.Test;
......@@ -33,13 +36,16 @@ import de.hft.stuttgart.citydoctor2.datastructure.Geometry.Orientation;
import de.hft.stuttgart.citydoctor2.healer.Healer;
import de.hft.stuttgart.citydoctor2.parser.CityGmlParseException;
import de.hft.stuttgart.citydoctor2.parser.InvalidGmlFileException;
import org.junit.experimental.categories.Category;
public class HealSolidNotClosedErrorTest {
/**
* One polygon is split up in 3 but has not matching edges
*/
@Test
@Category(CppTest.class)
public void testVertexCloseToEdge() {
CppInitializer.initCpp();
Building b = new Building(); //Angelika: als Test eingefügt
......@@ -164,6 +170,7 @@ public class HealSolidNotClosedErrorTest {
}
@Test
@Category(CppTest.class)
public void testMissingPolygon() {
CppInitializer.initCpp();
Building b = new Building();
......@@ -343,6 +350,7 @@ public class HealSolidNotClosedErrorTest {
}
@Test
@Category(CppTest.class)
public void test2MissingPolygonsCpp() {
CppInitializer.initCpp();
Building b = new Building();
......@@ -421,6 +429,8 @@ public class HealSolidNotClosedErrorTest {
assertEquals(ResultStatus.OK, cr.getResultStatus());
}
/**
* Missing Polygon has a self intersection
* @throws IOException
......@@ -431,24 +441,22 @@ public class HealSolidNotClosedErrorTest {
*/
@Test
public void testMissingPolygon2() throws CityGmlParseException, IOException, InvalidGmlFileException {
String path = "src/test/resources/SimpleSolid_SrefBS-GE-gml-SO-0002-T0002.gml"; //bei diesem Modell stürzt die VM ab
// String path = "src/test/resources/SimpleSolid_SrefBS-GE-gml-SO-0002-T0002.gml"; //bei diesem Modell stürzt die VM ab
// String path = "src/test/resources/SimpleSolid_SrefBS-GE-gml-SO-0002-T0001.gml"; //hier nur Fehlermeldung
String path = "src/test/resources/SimpleSolid_SrefBS-GE-gml-LR-0004-T0005.gml";
// String path = "src/test/resources/SimpleSolid_SrefBS.gml";
ValidationConfiguration config = ValidationConfiguration.loadStandardValidationConfig();
CityDoctorModel model = TestUtil.loadCityModel(path, config);
Checker c = new Checker(config, model);
c.runChecks();
Geometry geom = model.getBuildings().toList().get(0).getGeometries().get(0);
geom.updateVertices();
for (Vertex v : geom.getVertices()) {
v.setX(v.getX() - 10);
v.setY(v.getY() - 10);
}
Assert.assertTrue(geom.containsError(CheckId.C_GE_S_NOT_CLOSED));
Healer healer = new Healer(c);
//healer.setNumberOfIterations(2);
healer.setNumberOfIterations(2);
healer.healCityObject(model.getBuildings().toList().get(0));
Assert.assertFalse(geom.containsError(CheckId.C_GE_S_NOT_CLOSED));
......
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