Commit 8bafe709 authored by Matthias Betz's avatar Matthias Betz
Browse files

Added citygml4j quality ade integration

Removed produce consumer from stream reading
Added -out parameter to validation streams for writing quality ade stuff
parent b0bdd91b
Pipeline #1910 failed with stage
in 38 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.error;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.util.Optional;
import org.junit.Test;
import de.hft.stuttgart.citydoctor2.datastructure.ConcretePolygon;
import de.hft.stuttgart.citydoctor2.datastructure.GmlId;
import de.hft.stuttgart.citydoctor2.datastructure.LinearRing;
import de.hft.stuttgart.citydoctor2.datastructure.LinearRing.LinearRingType;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
import de.hft.stuttgart.quality.model.InnerRingsNested;
import de.hft.stuttgart.quality.model.ValidationError;
public class NestedRingErrorTest {
@Test
public void testConvertToQualityAdeDatastructure() {
Polygon p1 = new ConcretePolygon();
GmlId p1Id = new GmlId("p1Id");
p1.setGmlId(p1Id);
LinearRing r1 = new LinearRing(LinearRingType.INTERIOR);
GmlId r1Id = new GmlId("r1Id");
r1.setGmlId(r1Id);
LinearRing r2 = new LinearRing(LinearRingType.INTERIOR);
GmlId r2Id = new GmlId("r2Id");
r2.setGmlId(r2Id);
NestedRingError err = new NestedRingError(p1, r1, r2);
Optional<ValidationError> optional = err.convertToQualityAdeDatastructure();
assertTrue(optional.isPresent());
InnerRingsNested validationError = (InnerRingsNested) optional.get();
assertEquals(p1Id.getGmlString(), validationError.getPolygonId());
assertEquals(r1Id.getGmlString(), validationError.getLinearRingId1());
assertEquals(r2Id.getGmlString(), validationError.getLinearRingId2());
}
}
/*-
* 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.error;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import org.junit.Test;
import de.hft.stuttgart.citydoctor2.datastructure.Edge;
import de.hft.stuttgart.citydoctor2.datastructure.Geometry;
import de.hft.stuttgart.citydoctor2.datastructure.GeometryType;
import de.hft.stuttgart.citydoctor2.datastructure.GmlId;
import de.hft.stuttgart.citydoctor2.datastructure.Lod;
import de.hft.stuttgart.citydoctor2.datastructure.Vertex;
import de.hft.stuttgart.quality.model.NonManifoldEdge;
import de.hft.stuttgart.quality.model.ValidationError;
public class NonManifoldEdgeErrorTest {
@Test
public void testConvertToQualityAdeDatastructure() {
Geometry geom = new Geometry(GeometryType.SOLID, Lod.LOD2);
GmlId geomId = new GmlId("geomId");
geom.setGmlId(geomId);
Vertex v1 = new Vertex(1, 2, 3);
Vertex v2 = new Vertex(4, 5, 6);
Vertex v3 = new Vertex(7, 8, 9);
Edge e1 = new Edge(v1, v2);
Edge e2 = new Edge(v2, v3);
List<Edge> edges = new ArrayList<>();
edges.add(e1);
edges.add(e2);
NonManifoldEdgeError err = new NonManifoldEdgeError(geom, edges);
Optional<ValidationError> optional = err.convertToQualityAdeDatastructure();
assertTrue(optional.isPresent());
NonManifoldEdge validationError = (NonManifoldEdge) optional.get();
assertEquals(geomId.getGmlString(), validationError.getGeometryId());
List<de.hft.stuttgart.quality.model.Edge> adeEdges = validationError.getEdges();
de.hft.stuttgart.quality.model.Edge adeE1 = adeEdges.get(0);
de.hft.stuttgart.quality.model.Edge adeE2 = adeEdges.get(1);
assertEquals(1, adeE1.getFrom().getValue().get(0), 0.00001);
assertEquals(4, adeE1.getTo().getValue().get(0), 0.00001);
assertEquals(7, adeE2.getTo().getValue().get(0), 0.00001);
}
}
/*-
* 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.error;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import org.junit.Test;
import de.hft.stuttgart.citydoctor2.datastructure.ConcretePolygon;
import de.hft.stuttgart.citydoctor2.datastructure.Geometry;
import de.hft.stuttgart.citydoctor2.datastructure.GeometryType;
import de.hft.stuttgart.citydoctor2.datastructure.GmlId;
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.quality.model.NonManifoldVertex;
import de.hft.stuttgart.quality.model.ValidationError;
public class NonManifoldVertexErrorTest {
@Test
public void testConvertToQualityAdeDatastructure() {
Geometry geom = new Geometry(GeometryType.SOLID, Lod.LOD2);
GmlId geomId = new GmlId("geomId");
geom.setGmlId(geomId);
Polygon p1 = new ConcretePolygon();
GmlId p1Id = new GmlId("p1Id");
p1.setGmlId(p1Id);
Polygon p2 = new ConcretePolygon();
GmlId p2Id = new GmlId("p2Id");
p2.setGmlId(p2Id);
Polygon p3 = new ConcretePolygon();
GmlId p3Id = new GmlId("p3Id");
p3.setGmlId(p3Id);
List<List<Polygon>> components = new ArrayList<>();
List<Polygon> component1 = new ArrayList<>();
component1.add(p1);
component1.add(p2);
components.add(component1);
List<Polygon> component2 = new ArrayList<>();
component2.add(p3);
components.add(component2);
Vertex v1 = new Vertex(1, 2, 3);
NonManifoldVertexError err = new NonManifoldVertexError(geom, components, v1);
Optional<ValidationError> optional = err.convertToQualityAdeDatastructure();
assertTrue(optional.isPresent());
NonManifoldVertex validationError = (NonManifoldVertex) optional.get();
assertEquals(geomId.getGmlString(), validationError.getGeometryId());
assertEquals(1, validationError.getVertex().getValue().get(0), 0.0001);
}
}
/*-
* 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.error;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.util.Optional;
import org.junit.Test;
import de.hft.stuttgart.citydoctor2.datastructure.ConcretePolygon;
import de.hft.stuttgart.citydoctor2.datastructure.GmlId;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
import de.hft.stuttgart.citydoctor2.datastructure.Vertex;
import de.hft.stuttgart.quality.model.NonPlanarDistancePlane;
import de.hft.stuttgart.quality.model.ValidationError;
public class NonPlanarPolygonDistancePlaneErrorTest {
@Test
public void testConvertToQualityAdeDatastructure() {
Polygon p1 = new ConcretePolygon();
GmlId p1Id = new GmlId("p1Id");
p1.setGmlId(p1Id);
Vertex v = new Vertex(1, 2, 3);
NonPlanarPolygonDistancePlaneError err = new NonPlanarPolygonDistancePlaneError(p1, 5, v, null);
Optional<ValidationError> optional = err.convertToQualityAdeDatastructure();
assertTrue(optional.isPresent());
NonPlanarDistancePlane error = (NonPlanarDistancePlane) optional.get();
assertEquals(p1Id.getGmlString(), error.getPolygonId());
assertEquals(1, error.getVertex().getValue().get(0), 0.00001);
assertEquals(5, error.getDistance().getValue(), 0.000001);
}
}
\ No newline at end of file
/*-
* 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.error;
import static org.junit.Assert.*;
import java.util.Optional;
import org.junit.Test;
import de.hft.stuttgart.citydoctor2.datastructure.ConcretePolygon;
import de.hft.stuttgart.citydoctor2.datastructure.GmlId;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
import de.hft.stuttgart.quality.model.NonPlanarNormalsDeviation;
import de.hft.stuttgart.quality.model.ValidationError;
public class NonPlanarPolygonNormalsDeviationTest {
@Test
public void testConvertToQualityAdeDatastructure() {
Polygon p1 = new ConcretePolygon();
GmlId p1Id = new GmlId("p1Id");
p1.setGmlId(p1Id);
NonPlanarPolygonNormalsDeviation err = new NonPlanarPolygonNormalsDeviation(p1, 5);
Optional<ValidationError> optional = err.convertToQualityAdeDatastructure();
assertTrue(optional.isPresent());
NonPlanarNormalsDeviation error = (NonPlanarNormalsDeviation) optional.get();
assertEquals(5, error.getDeviation().getValue(), 0.00001);
assertEquals(p1Id.getGmlString(), error.getPolygonId());
}
}
/*-
* 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.error;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.util.Optional;
import org.junit.Test;
import de.hft.stuttgart.citydoctor2.datastructure.Edge;
import de.hft.stuttgart.citydoctor2.datastructure.GmlId;
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.quality.model.RingSelfIntersection;
import de.hft.stuttgart.quality.model.ValidationError;
public class PointTouchesEdgeErrorTest {
@Test
public void testConvertToQualityAdeDatastructure() {
LinearRing lr = new LinearRing(LinearRingType.EXTERIOR);
GmlId id = new GmlId("id");
lr.setGmlId(id);
Vertex v1 = new Vertex(1, 2, 3);
Vertex v2 = new Vertex(4, 5, 6);
Edge e1 = new Edge(v1, v2);
PointTouchesEdgeError err = new PointTouchesEdgeError(lr, e1, v1);
Optional<ValidationError> optional = err.convertToQualityAdeDatastructure();
assertTrue(optional.isPresent());
RingSelfIntersection error = (RingSelfIntersection) optional.get();
assertEquals(id.getGmlString(), error.getLinearRingId());
assertEquals(1, error.getVertex1().getValue().get(0), 0.00001);
assertEquals(1, error.getEdge1().getFrom().getValue().get(0), 0.000001);
assertEquals(4, error.getEdge1().getTo().getValue().get(0), 0.000001);
}
}
/*-
* 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.error;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import org.junit.Test;
import de.hft.stuttgart.citydoctor2.datastructure.ConcretePolygon;
import de.hft.stuttgart.citydoctor2.datastructure.GmlId;
import de.hft.stuttgart.citydoctor2.datastructure.LinearRing;
import de.hft.stuttgart.citydoctor2.datastructure.LinearRing.LinearRingType;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
import de.hft.stuttgart.quality.model.HoleOutside;
import de.hft.stuttgart.quality.model.ValidationError;
public class PolygonHoleOutsideErrorTest {
@Test
public void testConvertToQualityAdeDatastructure() {
Polygon p1 = new ConcretePolygon();
GmlId p1Id = new GmlId("p1Id");
p1.setGmlId(p1Id);
LinearRing r1 = new LinearRing(LinearRingType.INTERIOR);
GmlId r1Id = new GmlId("r1Id");
r1.setGmlId(r1Id);
List<LinearRing> rings = new ArrayList<>();
rings.add(r1);
PolygonHoleOutsideError err = new PolygonHoleOutsideError(p1, rings);
Optional<ValidationError> optional = err.convertToQualityAdeDatastructure();
assertTrue(optional.isPresent());
HoleOutside validationError = (HoleOutside) optional.get();
assertEquals(p1Id.getGmlString(), validationError.getPolygonId());
assertEquals(r1Id.getGmlString(), validationError.getLinearRingId());
}
}
/*-
* 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.error;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.util.Optional;
import org.junit.Test;
import de.hft.stuttgart.citydoctor2.datastructure.ConcretePolygon;
import de.hft.stuttgart.citydoctor2.datastructure.GmlId;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
import de.hft.stuttgart.quality.model.InteriorDisconnected;
import de.hft.stuttgart.quality.model.ValidationError;
public class PolygonInteriorDisconnectedErrorTest {
@Test
public void testConvertToQualityAdeDatastructure() {
Polygon p1 = new ConcretePolygon();
GmlId p1Id = new GmlId("p1Id");
p1.setGmlId(p1Id);
PolygonInteriorDisconnectedError err = new PolygonInteriorDisconnectedError(p1, null);
Optional<ValidationError> optional = err.convertToQualityAdeDatastructure();
assertTrue(optional.isPresent());
InteriorDisconnected adeErr = (InteriorDisconnected) optional.get();
assertEquals(p1Id.getGmlString(), adeErr.getPolygonId());
}
}
/*-
* 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.error;
import static org.junit.Assert.*;
import java.util.Optional;
import org.junit.Test;
import de.hft.stuttgart.citydoctor2.datastructure.ConcretePolygon;
import de.hft.stuttgart.citydoctor2.datastructure.GmlId;
import de.hft.stuttgart.citydoctor2.datastructure.LinearRing;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
import de.hft.stuttgart.citydoctor2.datastructure.LinearRing.LinearRingType;
import de.hft.stuttgart.citydoctor2.utils.SerializablePair;
import de.hft.stuttgart.quality.model.IntersectingRings;
import de.hft.stuttgart.quality.model.ValidationError;
public class PolygonIntersectingRingsErrorTest {
@Test
public void testConvertToQualityAdeDatastructure() {
Polygon p1 = new ConcretePolygon();
GmlId p1Id = new GmlId("p1Id");
p1.setGmlId(p1Id);
LinearRing r1 = new LinearRing(LinearRingType.INTERIOR);
GmlId r1Id = new GmlId("r1Id");
r1.setGmlId(r1Id);
LinearRing r2 = new LinearRing(LinearRingType.INTERIOR);
GmlId r2Id = new GmlId("r2Id");
r2.setGmlId(r2Id);
SerializablePair<LinearRing, LinearRing> pair = new SerializablePair<>(r1, r2);
PolygonIntersectingRingsError err = new PolygonIntersectingRingsError(p1, pair);
Optional<ValidationError> optional = err.convertToQualityAdeDatastructure();
assertTrue(optional.isPresent());
IntersectingRings error = (IntersectingRings) optional.get();
assertEquals(p1Id.getGmlString(), error.getPolygonId());
assertEquals(r1Id.getGmlString(), error.getLinearRingId1());
assertEquals(r2Id.getGmlString(), error.getLinearRingId2());
}
}
/*-
* 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.error;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.util.Optional;
import org.junit.Test;
import de.hft.stuttgart.citydoctor2.datastructure.ConcretePolygon;
import de.hft.stuttgart.citydoctor2.datastructure.GmlId;
import de.hft.stuttgart.citydoctor2.datastructure.LinearRing;
import de.hft.stuttgart.citydoctor2.datastructure.LinearRing.LinearRingType;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
import de.hft.stuttgart.quality.model.OrientationRingsSame;
import de.hft.stuttgart.quality.model.ValidationError;
public class PolygonSameOrientationErrorTest {
@Test
public void testConvertToQualityAdeDatastructure() {
Polygon p1 = new ConcretePolygon();
GmlId p1Id = new GmlId("p1Id");
p1.setGmlId(p1Id);
LinearRing r1 = new LinearRing(LinearRingType.INTERIOR);
GmlId r1Id = new GmlId("r1Id");
r1.setGmlId(r1Id);
PolygonSameOrientationError err = new PolygonSameOrientationError(p1, r1);
Optional<ValidationError> optional = err.convertToQualityAdeDatastructure();
assertTrue(optional.isPresent());
OrientationRingsSame adeErr = (OrientationRingsSame) optional.get();
assertEquals(p1Id.getGmlString(), adeErr.getPolygonId());
assertEquals(r1Id.getGmlString(), adeErr.getLinearRingId());
}
}
/*-
* 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.error;
import static org.junit.Assert.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import org.junit.Test;
import de.hft.stuttgart.citydoctor2.datastructure.Edge;
import de.hft.stuttgart.citydoctor2.datastructure.Geometry;
import de.hft.stuttgart.citydoctor2.datastructure.GeometryType;
import de.hft.stuttgart.citydoctor2.datastructure.GmlId;
import de.hft.stuttgart.citydoctor2.datastructure.Lod;
import de.hft.stuttgart.citydoctor2.datastructure.Vertex;
import de.hft.stuttgart.quality.model.PolygonWrongOrientation;
import de.hft.stuttgart.quality.model.ValidationError;
public class PolygonWrongOrientationErrorTest {
@Test
public void testConvertToQualityAdeDatastructure() {
Geometry geom = new Geometry(GeometryType.SOLID, Lod.LOD2);
GmlId geomId = new GmlId("geomId");
geom.setGmlId(geomId);
Vertex v1 = new Vertex(1, 2, 3);
Vertex v2 = new Vertex(4, 5, 6);
Vertex v3 = new Vertex(7, 8, 9);
Edge e1 = new Edge(v1, v2);
Edge e2 = new Edge(v2, v3);
List<Edge> edges = new ArrayList<>();
edges.add(e1);
edges.add(e2);
PolygonWrongOrientationError err = new PolygonWrongOrientationError(geom, edges);
Optional<ValidationError> optional = err.convertToQualityAdeDatastructure();
assertTrue(optional.isPresent());
PolygonWrongOrientation adeErr = (PolygonWrongOrientation) optional.get();
assertEquals(geomId.getGmlString(), adeErr.getGeometryId());
List<de.hft.stuttgart.quality.model.Edge> adeEdges = adeErr.getEdges();
de.hft.stuttgart.quality.model.Edge adeE1 = adeEdges.get(0);
de.hft.stuttgart.quality.model.Edge adeE2 = adeEdges.get(1);
assertEquals(1, adeE1.getFrom().getValue().get(0), 0.00001);
assertEquals(4, adeE1.getTo().getValue().get(0), 0.00001);
assertEquals(7, adeE2.getTo().getValue().get(0), 0.00001);
}
}
/*-
* 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.error;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.util.Optional;
import org.junit.Test;
import de.hft.stuttgart.citydoctor2.datastructure.GmlId;
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.quality.model.RingSelfIntersection;
import de.hft.stuttgart.quality.model.ValidationError;
public class RingDuplicatePointErrorTest {
@Test
public void testConvertToQualityAdeDatastructure() {
LinearRing lr = new LinearRing(LinearRingType.EXTERIOR);
GmlId id = new GmlId("id");
lr.setGmlId(id);
Vertex p1 = new Vertex(1, 2, 3);
Vertex p2 = new Vertex(4, 5, 6);
RingDuplicatePointError err = new RingDuplicatePointError(lr, p1, p2);
Optional<ValidationError> optional = err.convertToQualityAdeDatastructure();
assertTrue(optional.isPresent());
RingSelfIntersection adeErr = (RingSelfIntersection) optional.get();
assertEquals(id.getGmlString(), adeErr.getLinearRingId());
assertEquals(1, adeErr.getVertex1().getValue().get(0), 0.00001);
assertEquals(4, adeErr.getVertex2().getValue().get(0), 0.00001);
}
}
/*-
* 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.error;
import static org.junit.Assert.*;
import java.util.Optional;
import org.junit.Test;
import de.hft.stuttgart.citydoctor2.datastructure.Edge;
import de.hft.stuttgart.citydoctor2.datastructure.GmlId;
import de.hft.stuttgart.citydoctor2.datastructure.LinearRing;
import de.hft.stuttgart.citydoctor2.datastructure.Vertex;
import de.hft.stuttgart.quality.model.RingSelfIntersection;
import de.hft.stuttgart.quality.model.ValidationError;
import de.hft.stuttgart.citydoctor2.datastructure.LinearRing.LinearRingType;
public class RingEdgeIntersectionErrorTest {
@Test
public void testConvertToQualityAdeDatastructure() {
LinearRing lr = new LinearRing(LinearRingType.EXTERIOR);
GmlId id = new GmlId("id");
lr.setGmlId(id);
Vertex v1 = new Vertex(1, 2, 3);
Vertex v2 = new Vertex(4, 5, 6);
Vertex v3 = new Vertex(7, 8, 9);
Edge e1 = new Edge(v1, v2);
Edge e2 = new Edge(v2, v3);
RingEdgeIntersectionError err = new RingEdgeIntersectionError(lr, e1, e2, v1);
Optional<ValidationError> optional = err.convertToQualityAdeDatastructure();
assertTrue(optional.isPresent());
RingSelfIntersection adeErr = (RingSelfIntersection) optional.get();
assertEquals(id.getGmlString(), adeErr.getLinearRingId());
assertEquals(1, adeErr.getEdge1().getFrom().getValue().get(0), 0.00001);
assertEquals(4, adeErr.getEdge1().getTo().getValue().get(0), 0.00001);
assertEquals(4, adeErr.getEdge2().getFrom().getValue().get(0), 0.00001);
assertEquals(7, adeErr.getEdge2().getTo().getValue().get(0), 0.00001);
assertEquals(1, adeErr.getVertex1().getValue().get(0), 0.00001);
}
}
/*-
* 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.error;
import static org.junit.Assert.*;
import java.util.Optional;
import org.junit.Test;
import de.hft.stuttgart.citydoctor2.datastructure.GmlId;
import de.hft.stuttgart.citydoctor2.datastructure.LinearRing;
import de.hft.stuttgart.citydoctor2.datastructure.LinearRing.LinearRingType;
import de.hft.stuttgart.quality.model.RingNotClosed;
import de.hft.stuttgart.quality.model.ValidationError;
public class RingNotClosedErrorTest {
@Test
public void testConvertToQualityAdeDatastructure() {
LinearRing r1 = new LinearRing(LinearRingType.INTERIOR);
GmlId r1Id = new GmlId("r1Id");
r1.setGmlId(r1Id);
RingNotClosedError err = new RingNotClosedError(r1);
Optional<ValidationError> optional = err.convertToQualityAdeDatastructure();
assertTrue(optional.isPresent());
RingNotClosed adeErr = (RingNotClosed) optional.get();
assertEquals(r1Id.getGmlString(), adeErr.getLinearRingId());
}
}
/*-
* 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.error;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.util.Optional;
import org.junit.Test;
import de.hft.stuttgart.citydoctor2.datastructure.GmlId;
import de.hft.stuttgart.citydoctor2.datastructure.LinearRing;
import de.hft.stuttgart.citydoctor2.datastructure.LinearRing.LinearRingType;
import de.hft.stuttgart.quality.model.TooFewPoints;
import de.hft.stuttgart.quality.model.ValidationError;
public class RingTooFewPointsErrorTest {
@Test
public void testConvertToQualityAdeDatastructure() {
LinearRing r1 = new LinearRing(LinearRingType.INTERIOR);
GmlId r1Id = new GmlId("r1Id");
r1.setGmlId(r1Id);
RingTooFewPointsError err = new RingTooFewPointsError(r1);
Optional<ValidationError> optional = err.convertToQualityAdeDatastructure();
assertTrue(optional.isPresent());
TooFewPoints adeErr = (TooFewPoints) optional.get();
assertEquals(r1Id.getGmlString(), adeErr.getLinearRingId());
}
}
/*-
* 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.error;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import org.junit.Test;
import de.hft.stuttgart.citydoctor2.datastructure.Edge;
import de.hft.stuttgart.citydoctor2.datastructure.Geometry;
import de.hft.stuttgart.citydoctor2.datastructure.GeometryType;
import de.hft.stuttgart.citydoctor2.datastructure.GmlId;
import de.hft.stuttgart.citydoctor2.datastructure.Lod;
import de.hft.stuttgart.citydoctor2.datastructure.Vertex;
import de.hft.stuttgart.quality.model.SolidNotClosed;
import de.hft.stuttgart.quality.model.ValidationError;
public class SolidNotClosedErrorTest {
@Test
public void testConvertToQualityAdeDatastructure() {
Geometry geom = new Geometry(GeometryType.SOLID, Lod.LOD2);
GmlId geomId = new GmlId("geomId");
geom.setGmlId(geomId);
Vertex v1 = new Vertex(1, 2, 3);
Vertex v2 = new Vertex(4, 5, 6);
Vertex v3 = new Vertex(7, 8, 9);
Edge e1 = new Edge(v1, v2);
Edge e2 = new Edge(v2, v3);
List<Edge> edges = new ArrayList<>();
edges.add(e1);
edges.add(e2);
SolidNotClosedError err = new SolidNotClosedError(geom, edges);
Optional<ValidationError> optional = err.convertToQualityAdeDatastructure();
assertTrue(optional.isPresent());
SolidNotClosed validationError = (SolidNotClosed) optional.get();
assertEquals(geomId.getGmlString(), validationError.getGeometryId());
List<de.hft.stuttgart.quality.model.Edge> adeEdges = validationError.getEdges();
de.hft.stuttgart.quality.model.Edge adeE1 = adeEdges.get(0);
de.hft.stuttgart.quality.model.Edge adeE2 = adeEdges.get(1);
assertEquals(1, adeE1.getFrom().getValue().get(0), 0.00001);
assertEquals(4, adeE1.getTo().getValue().get(0), 0.00001);
assertEquals(7, adeE2.getTo().getValue().get(0), 0.00001);
}
}
/*-
* 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.error;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import org.junit.Test;
import de.hft.stuttgart.citydoctor2.datastructure.ConcretePolygon;
import de.hft.stuttgart.citydoctor2.datastructure.Geometry;
import de.hft.stuttgart.citydoctor2.datastructure.GeometryType;
import de.hft.stuttgart.citydoctor2.datastructure.GmlId;
import de.hft.stuttgart.citydoctor2.datastructure.Lod;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
import de.hft.stuttgart.citydoctor2.utils.PolygonIntersection;
import de.hft.stuttgart.quality.model.SolidSelfIntersection;
import de.hft.stuttgart.quality.model.ValidationError;
public class SolidSelfIntErrorTest {
@Test
public void testConvertToQualityAdeDatastructure() {
Geometry geom = new Geometry(GeometryType.SOLID, Lod.LOD2);
GmlId geomId = new GmlId("geomId");
geom.setGmlId(geomId);
Polygon p1 = new ConcretePolygon();
GmlId p1Id = new GmlId("p1Id");
p1.setGmlId(p1Id);
Polygon p2 = new ConcretePolygon();
GmlId p2Id = new GmlId("p2Id");
p2.setGmlId(p2Id);
PolygonIntersection inter = PolygonIntersection.lines(null, p1, p2);
List<PolygonIntersection> intersections = new ArrayList<>();
intersections.add(inter);
SolidSelfIntError err = new SolidSelfIntError(geom, intersections);
Optional<ValidationError> optional = err.convertToQualityAdeDatastructure();
assertTrue(optional.isPresent());
SolidSelfIntersection adeErr = (SolidSelfIntersection) optional.get();
assertEquals(geomId.getGmlString(), adeErr.getGeometryId());
assertEquals(p1Id.getGmlString(), adeErr.getPolygonId1());
assertEquals(p2Id.getGmlString(), adeErr.getPolygonId2());
}
}
/*-
* 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.error;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.util.Optional;
import org.junit.Test;
import de.hft.stuttgart.citydoctor2.datastructure.Geometry;
import de.hft.stuttgart.citydoctor2.datastructure.GeometryType;
import de.hft.stuttgart.citydoctor2.datastructure.GmlId;
import de.hft.stuttgart.citydoctor2.datastructure.Lod;
import de.hft.stuttgart.quality.model.TooFewPolygons;
import de.hft.stuttgart.quality.model.ValidationError;
public class TooFewPolygonsErrorTest {
@Test
public void testConvertToQualityAdeDatastructure() {
Geometry geom = new Geometry(GeometryType.SOLID, Lod.LOD2);
GmlId geomId = new GmlId("geomId");
geom.setGmlId(geomId);
TooFewPolygonsError err = new TooFewPolygonsError(geom);
Optional<ValidationError> optional = err.convertToQualityAdeDatastructure();
assertTrue(optional.isPresent());
TooFewPolygons adeErr = (TooFewPolygons) optional.get();
assertEquals(geomId.getGmlString(), adeErr.getGeometryId());
}
}
......@@ -25,13 +25,14 @@ import java.util.List;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.citygml4j.builder.jaxb.CityGMLBuilderException;
import org.citygml4j.xml.io.writer.CityGMLWriteException;
import de.hft.stuttgart.citydoctor2.check.Checker;
import de.hft.stuttgart.citydoctor2.check.ValidationConfiguration;
import de.hft.stuttgart.citydoctor2.datastructure.CityDoctorModel;
import de.hft.stuttgart.citydoctor2.parameter.ArgumentParser;
import de.hft.stuttgart.citydoctor2.parser.CityGmlParseException;
import de.hft.stuttgart.citydoctor2.parser.ParserConfiguration;
import de.hft.stuttgart.citydoctor2.parser.CityGmlParser;
import de.hft.stuttgart.citydoctor2.parser.InvalidGmlFileException;
......@@ -55,23 +56,42 @@ public class CityDoctorValidation {
* parameters happens here, then the validation process is called.
*
* @param args command line parameters
* @throws InterruptedException When the reading thread gets interrupted.
* @throws IOException When an exception while writing the report
* files happens.
* @throws CityGmlParseException When an error while parsing the cityGML file
* happens.
* @throws InvalidGmlFileException If the cityGML file is not valid according to
* the cityGML schema.
* @throws CityGMLWriteException
* @throws CityGMLBuilderException
*/
public static void main(String[] args)
throws CityGmlParseException, IOException, InterruptedException, InvalidGmlFileException {
public static void main(String[] args) throws CityGmlParseException, IOException, InvalidGmlFileException, CityGMLBuilderException, CityGMLWriteException {
ArgumentParser argParser = new ArgumentParser(args);
String inputFile = getInputFile(argParser);
String xmlOutput = getXmlOutput(argParser);
String pdfOutput = getPdfOutput(argParser);
String outputFile = getOutputFile(argParser, true);
ValidationConfiguration config = getValidationConfig(argParser);
startValidationProcess(inputFile, xmlOutput, pdfOutput, config);
startValidationProcess(new File(inputFile), xmlOutput, pdfOutput, config, outputFile);
}
private static String getOutputFile(ArgumentParser argParser, boolean optional) {
String outputFile;
if (!argParser.containsOption("out")) {
if (optional) {
return null;
}
logger.error("No output file specified. (-out [FILE])");
System.exit(11);
}
List<String> outFiles = argParser.getValues("out");
if (outFiles.size() != 1) {
logger.error("Specify exactly one file as output.");
System.exit(12);
}
outputFile = outFiles.get(0);
return outputFile;
}
/**
......@@ -89,7 +109,7 @@ public class CityDoctorValidation {
* the cityGML schema.
*/
public static void validate(File inputFile, File xmlOutput, File pdfOutput)
throws InterruptedException, IOException, CityGmlParseException, InvalidGmlFileException {
throws IOException, CityGmlParseException, InvalidGmlFileException {
validate(inputFile, xmlOutput, pdfOutput, null);
}
......@@ -100,7 +120,6 @@ public class CityDoctorValidation {
* @param xmlOutput The XML report file location. Can be null.
* @param pdfOutput The PDF report file location. Can be null.
* @param validationConfigFile The validation configuration file location.
* @throws InterruptedException When the reading thread gets interrupted.
* @throws IOException When an exception while writing the report
* files happens.
* @throws CityGmlParseException When an error while parsing the cityGML file
......@@ -109,7 +128,7 @@ public class CityDoctorValidation {
* the cityGML schema.
*/
public static void validate(File inputFile, File xmlOutput, File pdfOutput, File validationConfigFile)
throws InterruptedException, IOException, CityGmlParseException, InvalidGmlFileException {
throws IOException, CityGmlParseException, InvalidGmlFileException {
ValidationConfiguration config;
if (validationConfigFile == null) {
config = ValidationConfiguration.loadStandardValidationConfig();
......@@ -125,20 +144,43 @@ public class CityDoctorValidation {
if (pdfOutput != null) {
pdfOutputPath = pdfOutput.getAbsolutePath();
}
startValidationProcess(inputFile.getAbsolutePath(), xmlOutputPath, pdfOutputPath, config);
try {
startValidationProcess(inputFile, xmlOutputPath, pdfOutputPath, config, null);
} catch (CityGMLBuilderException | CityGMLWriteException e) {
// this does not happen as no output file is specified
logger.catching(e);
}
}
public static void startValidationProcess(String inputFile, String xmlOutput, String pdfOutput,
ValidationConfiguration config)
throws InterruptedException, IOException, CityGmlParseException, InvalidGmlFileException {
ParserConfiguration parserConfig = config.getParserConfiguration();
/**
* This function will handle the complete validation process
*
* @param inputFile the gml file path that is going to be checked
* @param xmlOutput the output path for the xml report (optional)
* @param pdfOutput the output path for the pdf report (optional)
* @param config the configuration path for the validation plan
* @param outputFile storing the validated gml file with quality ade
* @throws IOException
* @throws CityGmlParseException
* @throws InvalidGmlFileException
* @throws CityGMLWriteException if something goes wrong while writing the gml
* file
* @throws CityGMLBuilderException
*/
public static void startValidationProcess(File inputFile, String xmlOutput, String pdfOutput,
ValidationConfiguration config, String outputFile) throws IOException, CityGmlParseException,
InvalidGmlFileException, CityGMLBuilderException, CityGMLWriteException {
if (config.isUseStreaming()) {
Checker.streamCheck(CityGmlParser.streamCityGml(inputFile, parserConfig), xmlOutput, pdfOutput, config);
Checker.streamCheck(inputFile, xmlOutput, pdfOutput, config, outputFile);
} else {
CityDoctorModel model = CityGmlParser.parseCityGmlFile(inputFile, parserConfig);
CityDoctorModel model = CityGmlParser.parseCityGmlFile(inputFile.getAbsolutePath(),
config.getParserConfiguration());
Checker c = new Checker(config, model);
c.runChecks(xmlOutput, pdfOutput, null);
if (outputFile != null) {
model.saveAs(outputFile);
}
}
}
......@@ -169,8 +211,9 @@ public class CityDoctorValidation {
private static ValidationConfiguration getValidationConfig(ArgumentParser argParser) throws FileNotFoundException {
return getValidationConfig(argParser, true);
}
public static ValidationConfiguration getValidationConfig(ArgumentParser argParser, boolean optional) throws FileNotFoundException {
public static ValidationConfiguration getValidationConfig(ArgumentParser argParser, boolean optional)
throws FileNotFoundException {
if (argParser.containsOption("config")) {
List<String> configFiles = argParser.getValues("config");
if (configFiles.size() != 1) {
......@@ -207,7 +250,7 @@ public class CityDoctorValidation {
private static String getInputFile(ArgumentParser argParser) {
return getInputFile(argParser, false);
}
public static String getInputFile(ArgumentParser argParser, boolean optional) {
String inputFile;
if (!argParser.containsOption("in")) {
......
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