Commit 67343044 authored by Matthias Betz's avatar Matthias Betz
Browse files

replace copy mechanism

logo now in jar, extracted when needed to temp dir
change version to 3.10
parent 3d26f0e9
Pipeline #5579 failed with stage
in 39 seconds
...@@ -231,7 +231,7 @@ public class Vector3d implements Serializable { ...@@ -231,7 +231,7 @@ public class Vector3d implements Serializable {
* *
* @return a copy of this vector * @return a copy of this vector
*/ */
public Vector3d copy() { public Vector3d copyVector() {
return new Vector3d(coords[0], coords[1], coords[2]); return new Vector3d(coords[0], coords[1], coords[2]);
} }
......
...@@ -98,10 +98,10 @@ public class KDTree { ...@@ -98,10 +98,10 @@ public class KDTree {
public List<Vertex> getNodesInRange(Vertex node, double radius) { public List<Vertex> getNodesInRange(Vertex node, double radius) {
// construct box: // construct box:
Vector3d leftBotFront = node.copy(); Vector3d leftBotFront = node.copyVector();
leftBotFront.plus(-radius); leftBotFront.plus(-radius);
Vector3d topRightBehind = node.copy(); Vector3d topRightBehind = node.copyVector();
topRightBehind.plus(radius); topRightBehind.plus(radius);
List<Vertex> nodesInRangeBox = getNodesInRange(leftBotFront, topRightBehind, new ArrayList<>()); List<Vertex> nodesInRangeBox = getNodesInRange(leftBotFront, topRightBehind, new ArrayList<>());
......
...@@ -117,5 +117,9 @@ public class ParserConfiguration implements Serializable { ...@@ -117,5 +117,9 @@ public class ParserConfiguration implements Serializable {
public boolean useLowMemoryConsumption() { public boolean useLowMemoryConsumption() {
return useLowMemoryConsumption; return useLowMemoryConsumption;
} }
public void setUseLowMemoryConsumption(boolean useLowMemoryConsumption) {
this.useLowMemoryConsumption = useLowMemoryConsumption;
}
} }
/*-
* 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.utils;
public class Copy {
private Copy() {
}
public static <T extends Copyable> T copy(T original) {
CopyHandler handler = new CopyHandler();
return handler.copy(original);
}
}
/*-
* 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.utils;
import java.util.Collection;
import java.util.HashSet;
import java.util.IdentityHashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
public class CopyHandler {
private Set<Copyable> toBeDoneInstances = new HashSet<>();
private Map<Copyable, Copyable> finishedInstances = new IdentityHashMap<>();
@SuppressWarnings("unchecked")
public <T extends Copyable> T copy(T original) {
toBeDoneInstances.add(original);
while (!toBeDoneInstances.isEmpty()) {
handleNextInstance();
}
for (Entry<Copyable, Copyable> e : finishedInstances.entrySet()) {
e.getValue().fillValues(e.getKey(), this);
}
return (T) finishedInstances.get(original);
}
@SuppressWarnings("unchecked")
public <T extends Copyable> T getCopyInstance(T original) {
if (original == null) {
// null gets copied to null
return null;
}
return (T) finishedInstances.get(original);
}
public void addInstance(Copyable copyable) {
if (copyable == null) {
// don't care for null instances
return;
}
if (finishedInstances.containsKey(copyable)) {
// already processed
return;
}
toBeDoneInstances.add(copyable);
}
private void handleNextInstance() {
Iterator<Copyable> iterator = toBeDoneInstances.iterator();
Copyable next = iterator.next();
iterator.remove();
finishedInstances.put(next, next.createCopyInstance());
next.collectInstances(this);
}
public void addInstance(Collection<? extends Copyable> collection) {
if (collection == null) {
return;
}
for (Copyable c : collection) {
addInstance(c);
}
}
}
/*-
* 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.utils;
public interface Copyable {
public void collectInstances(CopyHandler handler);
public Copyable createCopyInstance();
public void fillValues(Copyable original, CopyHandler handler);
}
...@@ -51,14 +51,13 @@ import de.hft.stuttgart.citydoctor2.check.CheckId; ...@@ -51,14 +51,13 @@ import de.hft.stuttgart.citydoctor2.check.CheckId;
import de.hft.stuttgart.citydoctor2.check.CheckResult; import de.hft.stuttgart.citydoctor2.check.CheckResult;
import de.hft.stuttgart.citydoctor2.check.ResultStatus; import de.hft.stuttgart.citydoctor2.check.ResultStatus;
import de.hft.stuttgart.citydoctor2.parser.ParserConfiguration; import de.hft.stuttgart.citydoctor2.parser.ParserConfiguration;
import de.hft.stuttgart.citydoctor2.utils.Copyable;
public class AbstractBuildingTest { public class AbstractBuildingTest {
@Test @Test
public void testAccept() { public void testAccept() {
AbstractBuilding ab = new AbstractBuilding() { AbstractBuilding ab = createAbstractBuilding();
private static final long serialVersionUID = -2487075796550827114L;
};
ab.addBoundarySurface(new BoundarySurface(null)); ab.addBoundarySurface(new BoundarySurface(null));
ab.addBuildingInstallation(new BuildingInstallation()); ab.addBuildingInstallation(new BuildingInstallation());
ab.addBuildingInstallation(new BuildingInstallation()); ab.addBuildingInstallation(new BuildingInstallation());
...@@ -98,9 +97,7 @@ public class AbstractBuildingTest { ...@@ -98,9 +97,7 @@ public class AbstractBuildingTest {
BuildingInstallation biMock = mock(BuildingInstallation.class); BuildingInstallation biMock = mock(BuildingInstallation.class);
BoundarySurface bsMock = mock(BoundarySurface.class); BoundarySurface bsMock = mock(BoundarySurface.class);
AbstractBuilding ab = new AbstractBuilding() { AbstractBuilding ab = createAbstractBuilding();
private static final long serialVersionUID = -448362592456318541L;
};
ab.addBoundarySurface(bsMock); ab.addBoundarySurface(bsMock);
ab.addBuildingInstallation(biMock); ab.addBuildingInstallation(biMock);
ab.prepareForChecking(); ab.prepareForChecking();
...@@ -113,9 +110,7 @@ public class AbstractBuildingTest { ...@@ -113,9 +110,7 @@ public class AbstractBuildingTest {
BuildingInstallation biMock = mock(BuildingInstallation.class); BuildingInstallation biMock = mock(BuildingInstallation.class);
BoundarySurface bsMock = mock(BoundarySurface.class); BoundarySurface bsMock = mock(BoundarySurface.class);
AbstractBuilding ab = new AbstractBuilding() { AbstractBuilding ab = createAbstractBuilding();
private static final long serialVersionUID = -448362592456318541L;
};
ab.addBoundarySurface(bsMock); ab.addBoundarySurface(bsMock);
ab.addBuildingInstallation(biMock); ab.addBuildingInstallation(biMock);
ab.clearMetaInformation(); ab.clearMetaInformation();
...@@ -125,9 +120,7 @@ public class AbstractBuildingTest { ...@@ -125,9 +120,7 @@ public class AbstractBuildingTest {
@Test @Test
public void testContainsError() { public void testContainsError() {
AbstractBuilding ab = new AbstractBuilding() { AbstractBuilding ab = createAbstractBuilding();
private static final long serialVersionUID = -448362592456318541L;
};
assertFalse(ab.containsError(CheckId.C_GE_P_HOLE_OUTSIDE)); assertFalse(ab.containsError(CheckId.C_GE_P_HOLE_OUTSIDE));
ab.addCheckResult(new CheckResult(CheckId.C_GE_P_HOLE_OUTSIDE, ResultStatus.ERROR, mock(CheckError.class))); ab.addCheckResult(new CheckResult(CheckId.C_GE_P_HOLE_OUTSIDE, ResultStatus.ERROR, mock(CheckError.class)));
assertTrue(ab.containsError(CheckId.C_GE_P_HOLE_OUTSIDE)); assertTrue(ab.containsError(CheckId.C_GE_P_HOLE_OUTSIDE));
...@@ -135,9 +128,7 @@ public class AbstractBuildingTest { ...@@ -135,9 +128,7 @@ public class AbstractBuildingTest {
@Test @Test
public void testContainsErrorInBs() { public void testContainsErrorInBs() {
AbstractBuilding ab = new AbstractBuilding() { AbstractBuilding ab = createAbstractBuilding();
private static final long serialVersionUID = -448362592456318541L;
};
BoundarySurface bsMock = mock(BoundarySurface.class); BoundarySurface bsMock = mock(BoundarySurface.class);
ab.addBoundarySurface(bsMock); ab.addBoundarySurface(bsMock);
assertFalse(ab.containsError(CheckId.C_GE_P_HOLE_OUTSIDE)); assertFalse(ab.containsError(CheckId.C_GE_P_HOLE_OUTSIDE));
...@@ -147,9 +138,7 @@ public class AbstractBuildingTest { ...@@ -147,9 +138,7 @@ public class AbstractBuildingTest {
@Test @Test
public void testContainsErrorInBi() { public void testContainsErrorInBi() {
AbstractBuilding ab = new AbstractBuilding() { AbstractBuilding ab = createAbstractBuilding();
private static final long serialVersionUID = -448362592456318541L;
};
BuildingInstallation biMock = mock(BuildingInstallation.class); BuildingInstallation biMock = mock(BuildingInstallation.class);
ab.addBuildingInstallation(biMock); ab.addBuildingInstallation(biMock);
assertFalse(ab.containsError(CheckId.C_GE_P_HOLE_OUTSIDE)); assertFalse(ab.containsError(CheckId.C_GE_P_HOLE_OUTSIDE));
...@@ -162,9 +151,7 @@ public class AbstractBuildingTest { ...@@ -162,9 +151,7 @@ public class AbstractBuildingTest {
BuildingInstallation biMock = mock(BuildingInstallation.class); BuildingInstallation biMock = mock(BuildingInstallation.class);
BoundarySurface bsMock = mock(BoundarySurface.class); BoundarySurface bsMock = mock(BoundarySurface.class);
AbstractBuilding ab = new AbstractBuilding() { AbstractBuilding ab = createAbstractBuilding();
private static final long serialVersionUID = -448362592456318541L;
};
ab.addCheckResult(new CheckResult(CheckId.C_GE_P_HOLE_OUTSIDE, ResultStatus.OK, null)); ab.addCheckResult(new CheckResult(CheckId.C_GE_P_HOLE_OUTSIDE, ResultStatus.OK, null));
ab.addBoundarySurface(bsMock); ab.addBoundarySurface(bsMock);
ab.addBuildingInstallation(biMock); ab.addBuildingInstallation(biMock);
...@@ -178,9 +165,7 @@ public class AbstractBuildingTest { ...@@ -178,9 +165,7 @@ public class AbstractBuildingTest {
@Test @Test
public void testContainsAnyError() { public void testContainsAnyError() {
AbstractBuilding ab = new AbstractBuilding() { AbstractBuilding ab = createAbstractBuilding();
private static final long serialVersionUID = -448362592456318541L;
};
assertFalse(ab.containsAnyError()); assertFalse(ab.containsAnyError());
ab.addCheckResult(new CheckResult(CheckId.C_GE_P_HOLE_OUTSIDE, ResultStatus.OK, null)); ab.addCheckResult(new CheckResult(CheckId.C_GE_P_HOLE_OUTSIDE, ResultStatus.OK, null));
assertFalse(ab.containsAnyError()); assertFalse(ab.containsAnyError());
...@@ -191,9 +176,7 @@ public class AbstractBuildingTest { ...@@ -191,9 +176,7 @@ public class AbstractBuildingTest {
@Test @Test
public void testContainsAnyErrorInBs() { public void testContainsAnyErrorInBs() {
AbstractBuilding ab = new AbstractBuilding() { AbstractBuilding ab = createAbstractBuilding();
private static final long serialVersionUID = -448362592456318541L;
};
BoundarySurface bsMock = mock(BoundarySurface.class); BoundarySurface bsMock = mock(BoundarySurface.class);
ab.addBoundarySurface(bsMock); ab.addBoundarySurface(bsMock);
assertFalse(ab.containsAnyError()); assertFalse(ab.containsAnyError());
...@@ -203,9 +186,7 @@ public class AbstractBuildingTest { ...@@ -203,9 +186,7 @@ public class AbstractBuildingTest {
@Test @Test
public void testContainsAnyErrorInBi() { public void testContainsAnyErrorInBi() {
AbstractBuilding ab = new AbstractBuilding() { AbstractBuilding ab = createAbstractBuilding();
private static final long serialVersionUID = -448362592456318541L;
};
BuildingInstallation biMock = mock(BuildingInstallation.class); BuildingInstallation biMock = mock(BuildingInstallation.class);
ab.addBuildingInstallation(biMock); ab.addBuildingInstallation(biMock);
assertFalse(ab.containsAnyError()); assertFalse(ab.containsAnyError());
...@@ -218,9 +199,7 @@ public class AbstractBuildingTest { ...@@ -218,9 +199,7 @@ public class AbstractBuildingTest {
BuildingInstallation biMock = mock(BuildingInstallation.class); BuildingInstallation biMock = mock(BuildingInstallation.class);
BoundarySurface bsMock = mock(BoundarySurface.class); BoundarySurface bsMock = mock(BoundarySurface.class);
AbstractBuilding ab = new AbstractBuilding() { AbstractBuilding ab = createAbstractBuilding();
private static final long serialVersionUID = -448362592456318541L;
};
ab.addBoundarySurface(bsMock); ab.addBoundarySurface(bsMock);
ab.addBuildingInstallation(biMock); ab.addBuildingInstallation(biMock);
ab.addCheckResult(new CheckResult(CheckId.C_GE_P_HOLE_OUTSIDE, ResultStatus.ERROR, mock(CheckError.class))); ab.addCheckResult(new CheckResult(CheckId.C_GE_P_HOLE_OUTSIDE, ResultStatus.ERROR, mock(CheckError.class)));
...@@ -235,9 +214,7 @@ public class AbstractBuildingTest { ...@@ -235,9 +214,7 @@ public class AbstractBuildingTest {
public void testReCreateGeometriesSolid() { public void testReCreateGeometriesSolid() {
Geometry geom = GeometryTestUtils.createDummyGeometry(GeometryType.SOLID); Geometry geom = GeometryTestUtils.createDummyGeometry(GeometryType.SOLID);
AbstractBuilding ab = new AbstractBuilding() { AbstractBuilding ab = createAbstractBuilding();
private static final long serialVersionUID = -448362592456318541L;
};
org.citygml4j.model.citygml.building.AbstractBuilding gmlAb = new org.citygml4j.model.citygml.building.Building(); org.citygml4j.model.citygml.building.AbstractBuilding gmlAb = new org.citygml4j.model.citygml.building.Building();
ab.setCityGmlBuilding(gmlAb); ab.setCityGmlBuilding(gmlAb);
ab.addGeometry(geom); ab.addGeometry(geom);
...@@ -270,9 +247,7 @@ public class AbstractBuildingTest { ...@@ -270,9 +247,7 @@ public class AbstractBuildingTest {
public void testReCreateGeometriesMultiSurface() { public void testReCreateGeometriesMultiSurface() {
Geometry geom = GeometryTestUtils.createDummyGeometry(GeometryType.MULTI_SURFACE); Geometry geom = GeometryTestUtils.createDummyGeometry(GeometryType.MULTI_SURFACE);
AbstractBuilding ab = new AbstractBuilding() { AbstractBuilding ab = createAbstractBuilding();
private static final long serialVersionUID = -448362592456318541L;
};
org.citygml4j.model.citygml.building.AbstractBuilding gmlAb = new org.citygml4j.model.citygml.building.Building(); org.citygml4j.model.citygml.building.AbstractBuilding gmlAb = new org.citygml4j.model.citygml.building.Building();
ab.setCityGmlBuilding(gmlAb); ab.setCityGmlBuilding(gmlAb);
ab.addGeometry(geom); ab.addGeometry(geom);
...@@ -286,9 +261,7 @@ public class AbstractBuildingTest { ...@@ -286,9 +261,7 @@ public class AbstractBuildingTest {
@Test @Test
public void testReCreateGeometriesBs() { public void testReCreateGeometriesBs() {
BoundarySurface bsMock = mock(BoundarySurface.class); BoundarySurface bsMock = mock(BoundarySurface.class);
AbstractBuilding ab = new AbstractBuilding() { AbstractBuilding ab = createAbstractBuilding();
private static final long serialVersionUID = -448362592456318541L;
};
List<Geometry> geometries = new ArrayList<>(); List<Geometry> geometries = new ArrayList<>();
geometries.add(GeometryTestUtils.createDummyGeometry(GeometryType.MULTI_SURFACE)); geometries.add(GeometryTestUtils.createDummyGeometry(GeometryType.MULTI_SURFACE));
Mockito.when(bsMock.getGeometries()).thenReturn(geometries); Mockito.when(bsMock.getGeometries()).thenReturn(geometries);
...@@ -306,9 +279,7 @@ public class AbstractBuildingTest { ...@@ -306,9 +279,7 @@ public class AbstractBuildingTest {
WallSurface ws = new WallSurface(); WallSurface ws = new WallSurface();
BoundarySurface bsMock = mock(BoundarySurface.class); BoundarySurface bsMock = mock(BoundarySurface.class);
Mockito.when(bsMock.getGmlObject()).thenReturn(ws); Mockito.when(bsMock.getGmlObject()).thenReturn(ws);
AbstractBuilding ab = new AbstractBuilding() { AbstractBuilding ab = createAbstractBuilding();
private static final long serialVersionUID = -448362592456318541L;
};
ab.addBoundarySurface(bsMock); ab.addBoundarySurface(bsMock);
GMLGeometryFactory factory = new GMLGeometryFactory(); GMLGeometryFactory factory = new GMLGeometryFactory();
ParserConfiguration config = new ParserConfiguration(8, false); ParserConfiguration config = new ParserConfiguration(8, false);
...@@ -326,9 +297,7 @@ public class AbstractBuildingTest { ...@@ -326,9 +297,7 @@ public class AbstractBuildingTest {
@Test @Test
public void testReCreateGeometriesEmptyBi() { public void testReCreateGeometriesEmptyBi() {
BuildingInstallation biMock = mock(BuildingInstallation.class); BuildingInstallation biMock = mock(BuildingInstallation.class);
AbstractBuilding ab = new AbstractBuilding() { AbstractBuilding ab = createAbstractBuilding();
private static final long serialVersionUID = -448362592456318541L;
};
ab.addBuildingInstallation(biMock); ab.addBuildingInstallation(biMock);
GMLGeometryFactory factory = new GMLGeometryFactory(); GMLGeometryFactory factory = new GMLGeometryFactory();
ParserConfiguration config = new ParserConfiguration(8, false); ParserConfiguration config = new ParserConfiguration(8, false);
...@@ -343,9 +312,7 @@ public class AbstractBuildingTest { ...@@ -343,9 +312,7 @@ public class AbstractBuildingTest {
BuildingInstallation biMock = mock(BuildingInstallation.class); BuildingInstallation biMock = mock(BuildingInstallation.class);
BoundarySurface bsMock = mock(BoundarySurface.class); BoundarySurface bsMock = mock(BoundarySurface.class);
AbstractBuilding ab = new AbstractBuilding() { AbstractBuilding ab = createAbstractBuilding();
private static final long serialVersionUID = -448362592456318541L;
};
ab.addBoundarySurface(bsMock); ab.addBoundarySurface(bsMock);
ab.addBuildingInstallation(biMock); ab.addBuildingInstallation(biMock);
org.citygml4j.model.citygml.building.AbstractBuilding gmlAb = new org.citygml4j.model.citygml.building.Building(); org.citygml4j.model.citygml.building.AbstractBuilding gmlAb = new org.citygml4j.model.citygml.building.Building();
...@@ -373,10 +340,21 @@ public class AbstractBuildingTest { ...@@ -373,10 +340,21 @@ public class AbstractBuildingTest {
@Test @Test
public void testGetFeatureType() { public void testGetFeatureType() {
AbstractBuilding ab = createAbstractBuilding();
assertEquals(FeatureType.BUILDING, ab.getFeatureType());
}
private AbstractBuilding createAbstractBuilding() {
AbstractBuilding ab = new AbstractBuilding() { AbstractBuilding ab = new AbstractBuilding() {
private static final long serialVersionUID = -448362592456318541L; private static final long serialVersionUID = -448362592456318541L;
@Override
public Copyable createCopyInstance() {
return null;
}
}; };
assertEquals(FeatureType.BUILDING, ab.getFeatureType()); return ab;
} }
} }
...@@ -379,12 +379,6 @@ public class BoundarySurfaceTest { ...@@ -379,12 +379,6 @@ public class BoundarySurfaceTest {
assertNull(ws.getLod4MultiSurface()); assertNull(ws.getLod4MultiSurface());
} }
@Test(expected = UnsupportedOperationException.class)
public void testCopy() {
BoundarySurface bs = new BoundarySurface(SurfaceFeatureType.TUNNEL, BoundarySurfaceType.WALL, null);
bs.copy();
}
@Test @Test
public void testGetFeatureType() { public void testGetFeatureType() {
BoundarySurface bs = new BoundarySurface(SurfaceFeatureType.TUNNEL, BoundarySurfaceType.WALL, null); BoundarySurface bs = new BoundarySurface(SurfaceFeatureType.TUNNEL, BoundarySurfaceType.WALL, null);
......
...@@ -28,6 +28,7 @@ import org.citygml4j.model.gml.basicTypes.Code; ...@@ -28,6 +28,7 @@ import org.citygml4j.model.gml.basicTypes.Code;
import org.junit.Test; import org.junit.Test;
import de.hft.stuttgart.citydoctor2.datastructure.LinearRing.LinearRingType; import de.hft.stuttgart.citydoctor2.datastructure.LinearRing.LinearRingType;
import de.hft.stuttgart.citydoctor2.utils.Copy;
/** /**
* *
...@@ -64,11 +65,10 @@ public class BuildingTest { ...@@ -64,11 +65,10 @@ public class BuildingTest {
surface.addGeometry(geomSurface); surface.addGeometry(geomSurface);
b.addBoundarySurface(surface); b.addBoundarySurface(surface);
Building copy = b.copy(); Building copy = Copy.copy(b);
assertNotSame(b, copy); assertNotSame(b, copy);
assertEquals(b.getGmlId(), copy.getGmlId()); assertEquals(b.getGmlId(), copy.getGmlId());
assertNotSame(b.getGmlId(), copy.getGmlId());
Geometry copyGeom = copy.getGeometries().get(0); Geometry copyGeom = copy.getGeometries().get(0);
assertNotSame(geom, copyGeom); assertNotSame(geom, copyGeom);
...@@ -110,7 +110,6 @@ public class BuildingTest { ...@@ -110,7 +110,6 @@ public class BuildingTest {
assertNotNull(copyAdjacentPoly); assertNotNull(copyAdjacentPoly);
assertNotSame(adjacentPoly, copyAdjacentPoly); assertNotSame(adjacentPoly, copyAdjacentPoly);
assertNotSame(b.getGmlObject(), copy.getGmlObject());
assertEquals(b.getGmlObject().getFunction().get(0).getValue(), copy.getGmlObject().getFunction().get(0).getValue()); assertEquals(b.getGmlObject().getFunction().get(0).getValue(), copy.getGmlObject().getFunction().get(0).getValue());
} }
......
/*-
* 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.utils;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotSame;
import org.junit.Test;
import de.hft.stuttgart.citydoctor2.datastructure.Geometry;
import de.hft.stuttgart.citydoctor2.datastructure.GeometryTestUtils;
import de.hft.stuttgart.citydoctor2.datastructure.GeometryType;
public class CopyTest {
@Test
public void testCopy() {
Geometry geometry = GeometryTestUtils.createDummyGeometry(GeometryType.COMPOSITE_SURFACE);
Geometry copy = Copy.copy(geometry);
assertEquals(geometry.getType(), copy.getType());
assertEquals(geometry.getLod(), copy.getLod());
assertEquals(geometry.getGmlId(), copy.getGmlId());
assertNotSame(geometry, copy);
}
}
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<parent> <parent>
<groupId>de.hft.stuttgart</groupId> <groupId>de.hft.stuttgart</groupId>
<artifactId>CityDoctorParent</artifactId> <artifactId>CityDoctorParent</artifactId>
<version>3.10.0-SNAPSHOT</version> <version>3.10.0</version>
</parent> </parent>
<artifactId>CityDoctorValidation</artifactId> <artifactId>CityDoctorValidation</artifactId>
<name>CityDoctorValidation</name> <name>CityDoctorValidation</name>
...@@ -39,6 +39,20 @@ ...@@ -39,6 +39,20 @@
<dependency> <dependency>
<groupId>org.apache.xmlgraphics</groupId> <groupId>org.apache.xmlgraphics</groupId>
<artifactId>fop</artifactId> <artifactId>fop</artifactId>
<exclusions>
<exclusion>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
</exclusion>
<exclusion>
<groupId>java.xml</groupId>
<artifactId>java.xml</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>batik-ext</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.jdom</groupId> <groupId>org.jdom</groupId>
......
...@@ -16,11 +16,6 @@ ...@@ -16,11 +16,6 @@
</dependencySet> </dependencySet>
</dependencySets> </dependencySets>
<fileSets> <fileSets>
<fileSet>
<directory>./assets/</directory>
<useDefaultExcludes>true</useDefaultExcludes>
<outputDirectory>./assets</outputDirectory>
</fileSet>
<fileSet> <fileSet>
<directory>${project.build.directory}</directory> <directory>${project.build.directory}</directory>
<outputDirectory>/</outputDirectory> <outputDirectory>/</outputDirectory>
......
...@@ -577,8 +577,7 @@ public class Checker { ...@@ -577,8 +577,7 @@ public class Checker {
parameterMap.compute(proto.getCheckId(), (k, v) -> { parameterMap.compute(proto.getCheckId(), (k, v) -> {
if (v == null) { if (v == null) {
v = new HashMap<>(); v = new HashMap<>();
v.put(GlobalParameters.NUMBER_OF_ROUNDING_PLACES, v.put(GlobalParameters.NUMBER_OF_ROUNDING_PLACES, config.getNumberOfRoundingPlacesAsString());
config.getNumberOfRoundingPlacesAsString());
v.put(GlobalParameters.MIN_VERTEX_DISTANCE, config.getMinVertexDistanceAsString()); v.put(GlobalParameters.MIN_VERTEX_DISTANCE, config.getMinVertexDistanceAsString());
} }
v.putAll(e.getValue().getParameters()); v.putAll(e.getValue().getParameters());
...@@ -682,7 +681,8 @@ public class Checker { ...@@ -682,7 +681,8 @@ public class Checker {
} }
/** /**
* Executes all checks for the checkable. This will bypass the filters. * Executes all checks for the checkable. This will bypass the filters. This
* will clear the old check results
* *
* @param co the checkable. * @param co the checkable.
*/ */
...@@ -795,8 +795,7 @@ public class Checker { ...@@ -795,8 +795,7 @@ public class Checker {
return pdfReporter; return pdfReporter;
} }
public static void writeReport(StreamReporter reporter) public static void writeReport(StreamReporter reporter) throws CheckReportWriteException {
throws CheckReportWriteException {
if (reporter != null) { if (reporter != null) {
reporter.finishReport(); reporter.finishReport();
} }
...@@ -810,6 +809,15 @@ public class Checker { ...@@ -810,6 +809,15 @@ public class Checker {
return xmlOutput != null ? new BufferedOutputStream(new FileOutputStream(xmlOutput)) : null; return xmlOutput != null ? new BufferedOutputStream(new FileOutputStream(xmlOutput)) : null;
} }
/**
* Checks the city object and writes report information into reporters. Clears
* old check results. If the city object would be filtered by the configured
* filters it is ignored and old check results are not cleared.
*
* @param xmlReporter a xml reporter
* @param pdfReporter a pdf reporter
* @param co the city object to be checked
*/
public void checkFeature(XmlStreamReporter xmlReporter, PdfStreamReporter pdfReporter, CityObject co) { public void checkFeature(XmlStreamReporter xmlReporter, PdfStreamReporter pdfReporter, CityObject co) {
if (logger.isDebugEnabled()) { if (logger.isDebugEnabled()) {
logger.debug(Localization.getText("Checker.checkFeature"), co); logger.debug(Localization.getText("Checker.checkFeature"), co);
......
...@@ -59,7 +59,7 @@ public class ValidationConfiguration implements Serializable { ...@@ -59,7 +59,7 @@ public class ValidationConfiguration implements Serializable {
private static final Logger logger = LogManager.getLogger(ValidationConfiguration.class); private static final Logger logger = LogManager.getLogger(ValidationConfiguration.class);
private Map<String, String> globalParameters; private Map<String, String> globalParameters = new HashMap<>();
private boolean xmlValidation = false; private boolean xmlValidation = false;
private boolean useStreaming = false; private boolean useStreaming = false;
private FilterConfiguration filter; private FilterConfiguration filter;
...@@ -91,12 +91,14 @@ public class ValidationConfiguration implements Serializable { ...@@ -91,12 +91,14 @@ public class ValidationConfiguration implements Serializable {
config.requirements.put(req.getId(), reqConfig); config.requirements.put(req.getId(), reqConfig);
} }
} }
config.globalParameters = new HashMap<>();
config.globalParameters.put(GlobalParameters.NUMBER_OF_ROUNDING_PLACES, NUMBER_OF_ROUNDING_PLACES_DEFAULT); config.globalParameters.put(GlobalParameters.NUMBER_OF_ROUNDING_PLACES, NUMBER_OF_ROUNDING_PLACES_DEFAULT);
config.globalParameters.put(GlobalParameters.MIN_VERTEX_DISTANCE, MIN_VERTEX_DISTANCE_DEFAULT); config.globalParameters.put(GlobalParameters.MIN_VERTEX_DISTANCE, MIN_VERTEX_DISTANCE_DEFAULT);
config.setSchematronFilePathInGlobalParameters(CHECK_FOR_SOLID_XML); config.setSchematronFilePathInGlobalParameters(CHECK_FOR_SOLID_XML);
return config; return config;
} }
private ValidationConfiguration() {
}
public void saveAs(File f) throws IOException { public void saveAs(File f) throws IOException {
DumperOptions options = new DumperOptions(); DumperOptions options = new DumperOptions();
...@@ -142,9 +144,6 @@ public class ValidationConfiguration implements Serializable { ...@@ -142,9 +144,6 @@ public class ValidationConfiguration implements Serializable {
} }
public Map<String, String> getGlobalParameters() { public Map<String, String> getGlobalParameters() {
if (globalParameters == null) {
globalParameters = new HashMap<>();
}
return globalParameters; return globalParameters;
} }
......
...@@ -96,7 +96,6 @@ public class DuplicatePointsCheck extends Check { ...@@ -96,7 +96,6 @@ public class DuplicatePointsCheck extends Check {
Vertex point2 = pointList.get(i + 1); Vertex point2 = pointList.get(i + 1);
if (point1.equalsWithEpsilon(point2, epsilon)) { if (point1.equalsWithEpsilon(point2, epsilon)) {
// consecutive points same // consecutive points same
System.out.println(point1.getDistance(point2));
CheckError err = new ConsecutivePointSameError(lr, point1, point2); CheckError err = new ConsecutivePointSameError(lr, point1, point2);
CheckResult cr = new CheckResult(this, ResultStatus.ERROR, err); CheckResult cr = new CheckResult(this, ResultStatus.ERROR, err);
lr.addCheckResult(cr); lr.addCheckResult(cr);
......
...@@ -21,7 +21,6 @@ package de.hft.stuttgart.citydoctor2.checks.util; ...@@ -21,7 +21,6 @@ package de.hft.stuttgart.citydoctor2.checks.util;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.StringJoiner;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
...@@ -47,8 +46,6 @@ import de.hft.stuttgart.citydoctor2.datastructure.Polygon; ...@@ -47,8 +46,6 @@ import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
import de.hft.stuttgart.citydoctor2.datastructure.Vertex; import de.hft.stuttgart.citydoctor2.datastructure.Vertex;
import de.hft.stuttgart.citydoctor2.edge.MeshSurface; import de.hft.stuttgart.citydoctor2.edge.MeshSurface;
import de.hft.stuttgart.citydoctor2.edge.MeshSurfaceUtils; import de.hft.stuttgart.citydoctor2.edge.MeshSurfaceUtils;
import de.hft.stuttgart.citydoctor2.edge.PolyLine;
import de.hft.stuttgart.citydoctor2.edge.PolyLineSegment;
import de.hft.stuttgart.citydoctor2.edge.PolygonPolygonIntersection; import de.hft.stuttgart.citydoctor2.edge.PolygonPolygonIntersection;
import de.hft.stuttgart.citydoctor2.math.MovedPolygon; import de.hft.stuttgart.citydoctor2.math.MovedPolygon;
import de.hft.stuttgart.citydoctor2.math.MovedRing; import de.hft.stuttgart.citydoctor2.math.MovedRing;
...@@ -98,54 +95,24 @@ public class SelfIntersectionUtil { ...@@ -98,54 +95,24 @@ public class SelfIntersectionUtil {
List<PolygonPolygonIntersection> selfIntersects = MeshSurfaceUtils.selfIntersects(meshSurface, 0.000001, 0.001); List<PolygonPolygonIntersection> selfIntersects = MeshSurfaceUtils.selfIntersects(meshSurface, 0.000001, 0.001);
if (!selfIntersects.isEmpty()) { if (!selfIntersects.isEmpty()) {
PolygonPolygonIntersection polygonPolygonIntersection = selfIntersects.get(0); PolygonPolygonIntersection polygonPolygonIntersection = selfIntersects.get(0);
// DebugUtils.printGeoknechtPolygon(polygonPolygonIntersection.getPolygon1(), polygonPolygonIntersection.getPolygon2());
Polygon p1 = polygonPolygonIntersection.getPolygon1().getOriginal(); Polygon p1 = polygonPolygonIntersection.getPolygon1().getOriginal();
Polygon p2 = polygonPolygonIntersection.getPolygon2().getOriginal(); Polygon p2 = polygonPolygonIntersection.getPolygon2().getOriginal();
System.out.println(); // DebugUtils.printPolygon3d(polygonPolygonIntersection.getPolygon1(), polygonPolygonIntersection.getPolygon2());
for (Vertex v : p1.getExteriorRing().getVertices()) {
System.out.println(v);
}
System.out.println();
for (Vertex v : p2.getExteriorRing().getVertices()) {
System.out.println(v);
}
de.hft.stuttgart.citydoctor2.edge.IntersectionType intersectionType = polygonPolygonIntersection.getIntersectionType();
System.out.println(intersectionType);
PolyLine polyLine = polygonPolygonIntersection.getPolyLine();
PolyLineSegment firstSegment = polyLine.getFirstSegment();
PolyLineSegment next = firstSegment.getNext();
System.out.println(firstSegment.getStart());
while (firstSegment != next && next != null) {
System.out.println(next.getStart());
next = next.getNext();
}
Vertex movedBy = p1.getExteriorRing().getVertices().get(0); // int counter = 0;
MovedPolygon movedPolygon = MovedPolygon.ofPolygon(p1, movedBy); // for (Vertex v : p1.getExteriorRing().getVertices()) {
MovedPolygon movedPolygon2 = MovedPolygon.ofPolygon(p2, p1.getExteriorRing().getVertices().get(0)); // System.out.println("Vertex v" + counter + " = new Vertex(" + v.getX() + ", " + v.getY() + ", " + v.getZ());
// counter++;
StringJoiner sj = new StringJoiner(" ", "polygon(", ")"); // }
for (Vector3d v : movedPolygon.getExteriorRing().getVertices()) { // System.out.println();
StringJoiner sj2 = new StringJoiner("|"); // counter = 0;
sj2.add("" + v.getX()); // for (Vertex v : p2.getExteriorRing().getVertices()) {
sj2.add("" + v.getY()); // System.out.println("Vertex v" + counter + " = new Vertex(" + v.getX() + ", " + v.getY() + ", " + v.getZ());
sj2.add("" + v.getZ()); // counter++;
sj.add(sj2.toString()); // }
}
System.out.println(sj);
sj = new StringJoiner(" ", "polygon(", ")");
for (Vector3d v : movedPolygon2.getExteriorRing().getVertices()) {
StringJoiner sj2 = new StringJoiner("|");
sj2.add("" + v.getX());
sj2.add("" + v.getY());
sj2.add("" + v.getZ());
sj.add(sj2.toString());
}
System.out.println(sj);
// DebugUtils.printPolygon3d(polygonPolygonIntersection.getPolygon1()); // DebugUtils.printPolygon3d(polygonPolygonIntersection.getPolygon1(), polygonPolygonIntersection.getPolygon2());
// System.out.println(); // System.out.println();
// DebugUtils.printPolygon3d(polygonPolygonIntersection.getPolygon2()); // DebugUtils.printPolygon3d(polygonPolygonIntersection.getPolygon2());
intersections.add(PolygonIntersection.lines(Collections.emptyList(), p1, p2)); intersections.add(PolygonIntersection.lines(Collections.emptyList(), p1, p2));
......
...@@ -22,6 +22,8 @@ import java.io.File; ...@@ -22,6 +22,8 @@ import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.net.URI; import java.net.URI;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
import java.time.ZonedDateTime; import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -83,7 +85,7 @@ public class PdfReport { ...@@ -83,7 +85,7 @@ public class PdfReport {
static final Namespace FO_NS = Namespace.getNamespace("fo", "http://www.w3.org/1999/XSL/Format"); static final Namespace FO_NS = Namespace.getNamespace("fo", "http://www.w3.org/1999/XSL/Format");
static final Namespace SVG_NS = Namespace.getNamespace("svg", "http://www.w3.org/2000/svg"); static final Namespace SVG_NS = Namespace.getNamespace("svg", "http://www.w3.org/2000/svg");
private static final String COPY_RIGHT = "Copyright (c) 2020 HFT Stuttgart. All rights reserved." private static final String COPY_RIGHT = "Copyright (c) 2021 HFT Stuttgart. All rights reserved."
+ " HFT Stuttgart and its licensors retain all intellectual property" + " HFT Stuttgart and its licensors retain all intellectual property"
+ " and proprietary rights in and to this software and related documentation." + " and proprietary rights in and to this software and related documentation."
+ " Any use, reproduction, disclosure, or distribution of this software and" + " Any use, reproduction, disclosure, or distribution of this software and"
...@@ -97,12 +99,14 @@ public class PdfReport { ...@@ -97,12 +99,14 @@ public class PdfReport {
private List<Section> sections; private List<Section> sections;
private Element externalPicture;
static { static {
URI uri = new File(".").toURI(); URI uri = new File(".").toURI();
FOP_FACTORY = FopFactory.newInstance(uri); FOP_FACTORY = FopFactory.newInstance(uri);
} }
public PdfReport(String logoPath) { public PdfReport() {
doc = new Document(); doc = new Document();
sections = new ArrayList<>(); sections = new ArrayList<>();
Element root = new Element("root", FO_NS); Element root = new Element("root", FO_NS);
...@@ -110,7 +114,7 @@ public class PdfReport { ...@@ -110,7 +114,7 @@ public class PdfReport {
root.addNamespaceDeclaration(FO_NS); root.addNamespaceDeclaration(FO_NS);
createLayout(root); createLayout(root);
writeFrontPage(root, logoPath); writeFrontPage(root);
writeTableOfContent(root); writeTableOfContent(root);
createHeaderAndFooter(root); createHeaderAndFooter(root);
...@@ -163,9 +167,23 @@ public class PdfReport { ...@@ -163,9 +167,23 @@ public class PdfReport {
} }
} }
} }
File tempFile = null;
try {
// write logo file into temp dir
tempFile = File.createTempFile("logo", ".png");
Files.copy(getClass().getResourceAsStream("/Logo.png"), tempFile.toPath(),
StandardCopyOption.REPLACE_EXISTING);
externalPicture.setAttribute("src", tempFile.toURI().toASCIIString());
} catch (IOException e) {
logger.warn("Could not write logo into temporary file. Report won't contain the CityDoctor logo", e);
if (tempFile != null) {
tempFile.delete();
}
}
try { try {
FOUserAgent userAgent = FOP_FACTORY.newFOUserAgent(); FOUserAgent userAgent = FOP_FACTORY.newFOUserAgent();
userAgent.setDocumentHandlerOverride(null);
userAgent.getEventBroadcaster().addEventListener(event -> { userAgent.getEventBroadcaster().addEventListener(event -> {
EventSeverity severity = event.getSeverity(); EventSeverity severity = event.getSeverity();
String msg = EventFormatter.format(event); String msg = EventFormatter.format(event);
...@@ -183,7 +201,7 @@ public class PdfReport { ...@@ -183,7 +201,7 @@ public class PdfReport {
TransformerFactory factory = TransformerFactory.newInstance(); TransformerFactory factory = TransformerFactory.newInstance();
// deactivate external dtds because of security issues // deactivate external dtds because of security issues
factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
// identity transformer // identity transformer
Transformer transformer = factory.newTransformer(); Transformer transformer = factory.newTransformer();
...@@ -194,6 +212,10 @@ public class PdfReport { ...@@ -194,6 +212,10 @@ public class PdfReport {
outFile.flush(); outFile.flush();
} catch (FOPException | JDOMException | TransformerException | IOException e) { } catch (FOPException | JDOMException | TransformerException | IOException e) {
throw new CheckReportWriteException(e); throw new CheckReportWriteException(e);
} finally {
if (tempFile != null) {
tempFile.delete();
}
} }
} }
...@@ -244,7 +266,7 @@ public class PdfReport { ...@@ -244,7 +266,7 @@ public class PdfReport {
title.addContent("Table of Contents"); title.addContent("Table of Contents");
} }
private void writeFrontPage(Element root, String logoPath) { private void writeFrontPage(Element root) {
Element pageSequence = new Element(PAGE_SEQUENCE, FO_NS); Element pageSequence = new Element(PAGE_SEQUENCE, FO_NS);
root.addContent(pageSequence); root.addContent(pageSequence);
pageSequence.setAttribute(MASTER_REFERENCE, FRONT_PAGE); pageSequence.setAttribute(MASTER_REFERENCE, FRONT_PAGE);
...@@ -262,9 +284,8 @@ public class PdfReport { ...@@ -262,9 +284,8 @@ public class PdfReport {
Element blockPicture = new Element(BLOCK, FO_NS); Element blockPicture = new Element(BLOCK, FO_NS);
frontPageFlow.addContent(blockPicture); frontPageFlow.addContent(blockPicture);
blockPicture.setAttribute(TEXT_ALIGN, CENTER); blockPicture.setAttribute(TEXT_ALIGN, CENTER);
Element externalPicture = new Element("external-graphic", FO_NS); externalPicture = new Element("external-graphic", FO_NS);
blockPicture.addContent(externalPicture); blockPicture.addContent(externalPicture);
externalPicture.setAttribute("src", logoPath);
fileElement = new Element(BLOCK, FO_NS); fileElement = new Element(BLOCK, FO_NS);
frontPageFlow.addContent(fileElement); frontPageFlow.addContent(fileElement);
......
...@@ -113,7 +113,7 @@ public class PdfStreamReporter implements StreamReporter { ...@@ -113,7 +113,7 @@ public class PdfStreamReporter implements StreamReporter {
this.config = config; this.config = config;
errorStatistics = new HashMap<>(); errorStatistics = new HashMap<>();
outFile = pdfOutputFile; outFile = pdfOutputFile;
report = new PdfReport(logoPath); report = new PdfReport();
report.writeSourceFileName(fileName); report.writeSourceFileName(fileName);
writeEnvironment(); writeEnvironment();
......
...@@ -18,13 +18,21 @@ ...@@ -18,13 +18,21 @@
*/ */
package de.hft.stuttgart.citydoctor2.checks.geometry; package de.hft.stuttgart.citydoctor2.checks.geometry;
import static org.junit.Assert.assertFalse;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import de.hft.stuttgart.citydoctor2.check.CheckResult; import de.hft.stuttgart.citydoctor2.check.CheckResult;
import de.hft.stuttgart.citydoctor2.check.Checker;
import de.hft.stuttgart.citydoctor2.check.ResultStatus; import de.hft.stuttgart.citydoctor2.check.ResultStatus;
import de.hft.stuttgart.citydoctor2.check.ValidationConfiguration;
import de.hft.stuttgart.citydoctor2.checks.util.GeometryTestUtils; import de.hft.stuttgart.citydoctor2.checks.util.GeometryTestUtils;
import de.hft.stuttgart.citydoctor2.datastructure.CityDoctorModel;
import de.hft.stuttgart.citydoctor2.datastructure.Geometry; import de.hft.stuttgart.citydoctor2.datastructure.Geometry;
import de.hft.stuttgart.citydoctor2.parser.CityGmlParseException;
import de.hft.stuttgart.citydoctor2.parser.CityGmlParser;
import de.hft.stuttgart.citydoctor2.parser.InvalidGmlFileException;
/** /**
* *
...@@ -54,5 +62,15 @@ public class SolidSelfIntCheckTest { ...@@ -54,5 +62,15 @@ public class SolidSelfIntCheckTest {
Assert.assertNotNull(cr); Assert.assertNotNull(cr);
Assert.assertEquals(ResultStatus.ERROR, cr.getResultStatus()); Assert.assertEquals(ResultStatus.ERROR, cr.getResultStatus());
} }
@Test
public void testSolidSelfIntTest1() throws CityGmlParseException, InvalidGmlFileException {
ValidationConfiguration config = ValidationConfiguration.loadStandardValidationConfig();
config.setSchematronFilePathInGlobalParameters(null);
CityDoctorModel m = CityGmlParser.parseCityGmlFile("src/test/resources/SolidSelfIntTest1.gml", config.getParserConfiguration());
Checker c = new Checker(config, m);
c.runChecks();
assertFalse(m.getBuildings().get(0).containsAnyError());
}
} }
Markdown is supported
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