Commit 4b27a7e4 authored by Luna Riegel's avatar Luna Riegel
Browse files

Merge branch 'dev_db_config' into 'dev'

Version 3.18.2

See merge request !39
parents d3ca6500 45d4909d
Pipeline #12347 passed with stage
in 2 minutes and 5 seconds
package de.hft.stuttgart.citydoctor2.gui; package de.hft.stuttgart.citydoctor2.gui;
import java.awt.*;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
...@@ -10,6 +13,12 @@ import java.util.List; ...@@ -10,6 +13,12 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import javafx.scene.control.Alert;
import javafx.scene.control.ButtonType;
import javafx.scene.control.Hyperlink;
import javafx.scene.control.Tooltip;
import javafx.scene.input.Clipboard;
import javafx.scene.input.ClipboardContent;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
...@@ -112,6 +121,18 @@ public class CheckDialog { ...@@ -112,6 +121,18 @@ public class CheckDialog {
@FXML @FXML
private Button selectBtn; private Button selectBtn;
@FXML
private Button selectAllGCBtn;
@FXML
private Button selectNoneGCBtn;
@FXML
private Button selectAllSCBtn;
@FXML
private Button selectNoneSCBtn;
@FXML @FXML
private TextField schematronField; private TextField schematronField;
...@@ -133,6 +154,12 @@ public class CheckDialog { ...@@ -133,6 +154,12 @@ public class CheckDialog {
@FXML @FXML
private Label schematronFileLabel; private Label schematronFileLabel;
@FXML
private Label checkDescriptionsLabel;
@FXML
private Hyperlink homepageHyperlink;
@FXML @FXML
private CheckBox streamCheckOption; private CheckBox streamCheckOption;
@FXML @FXML
...@@ -153,6 +180,7 @@ public class CheckDialog { ...@@ -153,6 +180,7 @@ public class CheckDialog {
private CityDoctorController controller; private CityDoctorController controller;
private FilterPane filterPane; private FilterPane filterPane;
private MainWindow window; private MainWindow window;
private IndeterminateSpinnerDialog waitingDialog;
public CheckDialog(MainWindow window, Window parent, CityDoctorController controller) throws IOException { public CheckDialog(MainWindow window, Window parent, CityDoctorController controller) throws IOException {
this.window = window; this.window = window;
...@@ -190,9 +218,15 @@ public class CheckDialog { ...@@ -190,9 +218,15 @@ public class CheckDialog {
geometricChecksLabel.setText(Localization.getText("CheckDialog.geometricChecksLabel")); geometricChecksLabel.setText(Localization.getText("CheckDialog.geometricChecksLabel"));
semanticChecksLabel.setText(Localization.getText("CheckDialog.semanticChecksLabel")); semanticChecksLabel.setText(Localization.getText("CheckDialog.semanticChecksLabel"));
schematronFileLabel.setText(Localization.getText("CheckDialog.schematronFileLabel")); schematronFileLabel.setText(Localization.getText("CheckDialog.schematronFileLabel"));
checkDescriptionsLabel.setText(Localization.getText("CheckDialog.checkDescriptionsLabel"));
homepageHyperlink.setText(Localization.getText("CheckDialog.clickHereToOpen"));
selectBtn.setText(Localization.getText("CheckDialog.selectBtn")); selectBtn.setText(Localization.getText("CheckDialog.selectBtn"));
checkBtn.setText(Localization.getText("CheckDialog.checkBtn")); checkBtn.setText(Localization.getText("CheckDialog.checkBtn"));
cancelBtn.setText(Localization.getText("CheckDialog.cancelBtn")); cancelBtn.setText(Localization.getText("CheckDialog.cancelBtn"));
selectAllGCBtn.setText(Localization.getText("CheckDialog.selectAllChecksBtn"));
selectNoneGCBtn.setText(Localization.getText("CheckDialog.unselectAllChecksBtn"));
selectAllSCBtn.setText(Localization.getText("CheckDialog.selectAllChecksBtn"));
selectNoneSCBtn.setText(Localization.getText("CheckDialog.unselectAllChecksBtn"));
List<TableColumn<GlobalParameter, ?>> columns = globalParametersTable.getColumns(); List<TableColumn<GlobalParameter, ?>> columns = globalParametersTable.getColumns();
TableColumn<GlobalParameter, String> nameCol = new TableColumn<>(NAME); TableColumn<GlobalParameter, String> nameCol = new TableColumn<>(NAME);
...@@ -258,8 +292,52 @@ public class CheckDialog { ...@@ -258,8 +292,52 @@ public class CheckDialog {
// failed to read config, ignore as default values are still available // failed to read config, ignore as default values are still available
} }
} }
selectAllGCBtn.setOnAction(ae ->
geometricTable.getRoot().getChildren().forEach(item -> item.getValue().setEnabled(true)));
selectNoneGCBtn.setOnAction(ae ->
geometricTable.getRoot().getChildren().forEach(item -> item.getValue().setEnabled(false)));
selectAllSCBtn.setOnAction(ae ->
semanticTable.getRoot().getChildren().forEach(item -> item.getValue().setEnabled(true)));
selectNoneSCBtn.setOnAction(ae ->
semanticTable.getRoot().getChildren().forEach(item -> item.getValue().setEnabled(false)));
try {
homepageHyperlink.setTooltip(new Tooltip(Localization.getText("CheckDialog.homepageHyperlink")));
final URI hpUrl = new URI(Localization.getText("CheckDialog.homepageHyperlink"));
homepageHyperlink.setOnAction(event -> {
try {
Desktop.getDesktop().browse(hpUrl);
} catch (IOException e) {
homepageHyperlink.setText("[Hyperlink blocked]");
Alert alert = new Alert(Alert.AlertType.ERROR,
"Opening of hyperlink was blocked by the system, URL has been copied to Clipboard",
ButtonType.OK);
Clipboard cb = Clipboard.getSystemClipboard();
ClipboardContent content = new ClipboardContent();
content.putString(hpUrl.toString());
cb.setContent(content);
alert.showAndWait();
}
});
} catch (URISyntaxException e) {
//Should never actually occur
homepageHyperlink.setText("[Hyperlink missing/invalid]");
}
try{
waitingDialog = new IndeterminateSpinnerDialog(window.getMainStage(),"Schematron still running, please wait");
} catch (IOException e) {
logger.error("Failed to load IndeterminateSpinnerDialog");
}
} }
private void setupValueColumns(List<TableColumn<GlobalParameter, ?>> columns) { private void setupValueColumns(List<TableColumn<GlobalParameter, ?>> columns) {
TableColumn<GlobalParameter, String> valueCol = new TableColumn<>(VALUE); TableColumn<GlobalParameter, String> valueCol = new TableColumn<>(VALUE);
columns.add(valueCol); columns.add(valueCol);
...@@ -462,7 +540,12 @@ public class CheckDialog { ...@@ -462,7 +540,12 @@ public class CheckDialog {
ProgressListener l = new ProgressListener() { ProgressListener l = new ProgressListener() {
@Override @Override
public void updateProgress(float state) { public void updateProgress(float state) {
Platform.runLater(() -> progress.setProgress(state)); Platform.runLater(() -> {
progress.setProgress(state);
if (state < 0 ){
waitingDialog.show();
}
});
} }
}; };
controller.startChecks(config, l); controller.startChecks(config, l);
...@@ -484,6 +567,7 @@ public class CheckDialog { ...@@ -484,6 +567,7 @@ public class CheckDialog {
Platform.runLater(() -> { Platform.runLater(() -> {
checkBtn.setDisable(false); checkBtn.setDisable(false);
cancelBtn.setDisable(false); cancelBtn.setDisable(false);
waitingDialog.hide();
stage.setOnCloseRequest(null); stage.setOnCloseRequest(null);
stage.close(); stage.close();
}); });
......
...@@ -1379,7 +1379,9 @@ public class CityDoctorController { ...@@ -1379,7 +1379,9 @@ public class CityDoctorController {
if (model == null) { if (model == null) {
return; return;
} }
buildTrees(); mainWindow.rebuildErrorFilterTrees();
// buildTrees();
} }
public Series<String, Number> createErrorSeries() { public Series<String, Number> createErrorSeries() {
...@@ -1414,7 +1416,8 @@ public class CityDoctorController { ...@@ -1414,7 +1416,8 @@ public class CityDoctorController {
List<GmlId> idList = model.getBuildingIds(); List<GmlId> idList = model.getBuildingIds();
foundBuildings.removeIf(gmlId -> (!idList.contains(gmlId))); foundBuildings.removeIf(gmlId -> (!idList.contains(gmlId)));
Supplier<Stream<Building>> supply = () -> model.getCache().getStream(foundBuildings).map(co -> (Building) co); //Supplier<Stream<Building>> supply = () -> model.getCache().getStream(foundBuildings).map(co -> (Building) co);
Supplier<Stream<Building>> supply = () -> model.getCache().getAll(foundBuildings).stream().map(co -> (Building) co);
buildBuildingTreeFromList(supply, root); buildBuildingTreeFromList(supply, root);
updateTree(root); updateTree(root);
addMoreButtonForBuildings(buildingsView, root, buildingChunkNr, supply, foundBuildings.size()); addMoreButtonForBuildings(buildingsView, root, buildingChunkNr, supply, foundBuildings.size());
...@@ -1659,6 +1662,8 @@ public class CityDoctorController { ...@@ -1659,6 +1662,8 @@ public class CityDoctorController {
public void errorFilterIndexChanged(Number newV) { public void errorFilterIndexChanged(Number newV) {
mainWindow.getMeshGroup().getChildren().clear(); mainWindow.getMeshGroup().getChildren().clear();
mainWindow.unselectEverything(); mainWindow.unselectEverything();
mainWindow.resetSearchBar();
renderer.clearCurrentRender();
if (newV.intValue() == 0) { // Error filter was set to "All" if (newV.intValue() == 0) { // Error filter was set to "All"
buildTrees(); buildTrees();
updateFeatureTrees(); updateFeatureTrees();
......
package de.hft.stuttgart.citydoctor2.gui;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.layout.VBox;
import javafx.stage.Modality;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import javafx.stage.Window;
import java.io.IOException;
public class IndeterminateSpinnerDialog {
private Stage stage;
@FXML
private Label messageLbl;
public IndeterminateSpinnerDialog(Window parent, String message) throws IOException {
FXMLLoader loader = new FXMLLoader(LoadingInfoDialog.class.getResource("IndeterminateSpinnerDialog.fxml"));
loader.setController(this);
VBox box = loader.load();
stage = new Stage(StageStyle.UNDECORATED);
Scene scene = new Scene(box);
scene.setFill(null);
stage.setScene(scene);
stage.initOwner(parent);
stage.initModality(Modality.APPLICATION_MODAL);
messageLbl.setText(message);
}
public void changeMessage(String message){
messageLbl.setText(message);
}
public void show() {
stage.show();
}
public void hide() {
stage.hide();
}
}
...@@ -592,6 +592,10 @@ public class MainWindow extends Application { ...@@ -592,6 +592,10 @@ public class MainWindow extends Application {
showCityObjectsCombo.getSelectionModel().selectedIndexProperty().addListener(filterChangeListener); showCityObjectsCombo.getSelectionModel().selectedIndexProperty().addListener(filterChangeListener);
} }
public void rebuildErrorFilterTrees(){
controller.errorFilterIndexChanged(showCityObjectsCombo.getSelectionModel().getSelectedIndex());
}
private ChangeListener<Number> setupFilterSelectionListener() { private ChangeListener<Number> setupFilterSelectionListener() {
return (obs, oldV, newV) -> controller.errorFilterIndexChanged(newV); return (obs, oldV, newV) -> controller.errorFilterIndexChanged(newV);
} }
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
<?import javafx.geometry.Insets?> <?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?> <?import javafx.scene.control.Button?>
<?import javafx.scene.control.Hyperlink?>
<?import javafx.scene.control.Label?> <?import javafx.scene.control.Label?>
<?import javafx.scene.control.ProgressBar?> <?import javafx.scene.control.ProgressBar?>
<?import javafx.scene.control.Tab?> <?import javafx.scene.control.Tab?>
...@@ -60,6 +61,15 @@ ...@@ -60,6 +61,15 @@
<Font size="16.0" /> <Font size="16.0" />
</font> </font>
</Label> </Label>
<Label fx:id="checkDescriptionsLabel" layoutX="10.0" layoutY="10.0" text="Check Descriptions Available At:">
<font>
<Font size="16.0" />
</font>
<HBox.margin>
<Insets left="100.0" />
</HBox.margin>
</Label>
<Hyperlink fx:id="homepageHyperlink" alignment="CENTER" text="Hyperlink" />
</children> </children>
</HBox> </HBox>
<HBox spacing="5.0" VBox.vgrow="ALWAYS"> <HBox spacing="5.0" VBox.vgrow="ALWAYS">
...@@ -71,6 +81,16 @@ ...@@ -71,6 +81,16 @@
<Font size="16.0" /> <Font size="16.0" />
</font> </font>
</Label> </Label>
<HBox>
<children>
<Button fx:id="selectAllGCBtn" mnemonicParsing="false" text="Select All" />
<Button fx:id="selectNoneGCBtn" layoutX="10.0" layoutY="10.0" mnemonicParsing="false" text="Select None">
<HBox.margin>
<Insets left="10.0" />
</HBox.margin>
</Button>
</children>
</HBox>
<TreeTableView fx:id="geometricTable" editable="true" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="400.0" minWidth="400.0" prefWidth="600.0" showRoot="false" VBox.vgrow="ALWAYS" /> <TreeTableView fx:id="geometricTable" editable="true" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="400.0" minWidth="400.0" prefWidth="600.0" showRoot="false" VBox.vgrow="ALWAYS" />
</children> </children>
</VBox> </VBox>
...@@ -81,6 +101,16 @@ ...@@ -81,6 +101,16 @@
<Font size="16.0" /> <Font size="16.0" />
</font> </font>
</Label> </Label>
<HBox>
<children>
<Button fx:id="selectAllSCBtn" mnemonicParsing="false" text="Select All" />
<Button fx:id="selectNoneSCBtn" layoutX="10.0" layoutY="10.0" mnemonicParsing="false" text="Select None">
<HBox.margin>
<Insets left="10.0" />
</HBox.margin>
</Button>
</children>
</HBox>
<TreeTableView fx:id="semanticTable" editable="true" maxHeight="1.7976931348623157E308" minWidth="400.0" prefWidth="600.0" showRoot="false" VBox.vgrow="ALWAYS" /> <TreeTableView fx:id="semanticTable" editable="true" maxHeight="1.7976931348623157E308" minWidth="400.0" prefWidth="600.0" showRoot="false" VBox.vgrow="ALWAYS" />
</children> </children>
</VBox> </VBox>
......
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.ProgressIndicator?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>
<VBox alignment="CENTER" maxHeight="-Infinity" maxWidth="-Infinity" minWidth="300.0" spacing="10.0" style="-fx-border-image-width: 2; -fx-border-color: BLACK;" xmlns="http://javafx.com/javafx/22" xmlns:fx="http://javafx.com/fxml/1">
<children>
<Label fx:id="messageLbl" text="Message">
<font>
<Font size="14.0" />
</font>
</Label>
<ProgressIndicator />
</children>
<padding>
<Insets bottom="20.0" left="20.0" right="20.0" top="20.0" />
</padding>
</VBox>
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<parent> <parent>
<groupId>de.hft.stuttgart</groupId> <groupId>de.hft.stuttgart</groupId>
<artifactId>CityDoctorParent</artifactId> <artifactId>CityDoctorParent</artifactId>
<version>3.18.1</version> <version>3.18.2</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>
<artifactId>CityDoctorHealer</artifactId> <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; ...@@ -12,6 +12,9 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects; 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.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.citygml4j.core.ade.ADEException; import org.citygml4j.core.ade.ADEException;
...@@ -64,7 +67,7 @@ public class Healer { ...@@ -64,7 +67,7 @@ public class Healer {
private Checker checker; private Checker checker;
private ModificationListener l; private ModificationListener l;
private HealingPlan plan; private HealingPlan plan;
private CityObjectCache cache;
static { static {
// CppInitializer.initCpp(); // CppInitializer.initCpp();
} }
...@@ -187,6 +190,12 @@ public class Healer { ...@@ -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; this.l = l;
} }
...@@ -208,7 +217,12 @@ public class Healer { ...@@ -208,7 +217,12 @@ public class Healer {
} }
public void healModel(CityDoctorModel model) { public void healModel(CityDoctorModel model) {
try (AutoCloseable checkingContext = model.getCache().startCheckingMode()){
model.createFeatureStream().forEach(this::healCityObject); 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) { public void healCityObject(CityObject co) {
...@@ -282,9 +296,7 @@ public class Healer { ...@@ -282,9 +296,7 @@ public class Healer {
* *
* @param aco the feature to write * @param aco the feature to write
* @return the byte array containing the feature * @return the byte array containing the feature
* @throws ADEException * @throws CityGMLWriteException if writing of the CityGML file fails
* @throws CityGMLBuilderException
* @throws CityGMLWriteException
*/ */
private byte[] writeCityGml(AbstractCityObject aco) throws CityGMLWriteException { private byte[] writeCityGml(AbstractCityObject aco) throws CityGMLWriteException {
CityModel model = new CityModel(); CityModel model = new CityModel();
...@@ -348,6 +360,8 @@ public class Healer { ...@@ -348,6 +360,8 @@ public class Healer {
if (checker.getConfig().getParserConfiguration().useLowMemoryConsumption()) { if (checker.getConfig().getParserConfiguration().useLowMemoryConsumption()) {
co.clearMetaInformation(); 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,8 @@ import java.io.IOException; ...@@ -29,6 +29,8 @@ import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import de.hft.stuttgart.citydoctor2.database.UnconnectedCache;
import org.citygml4j.core.model.CityGMLVersion;
import org.citygml4j.core.model.core.AbstractThematicSurface; import org.citygml4j.core.model.core.AbstractThematicSurface;
import org.citygml4j.core.model.core.CityModel; import org.citygml4j.core.model.core.CityModel;
import org.junit.Rule; import org.junit.Rule;
...@@ -70,7 +72,8 @@ public class HealMissingSolidTest { ...@@ -70,7 +72,8 @@ public class HealMissingSolidTest {
@Test @Test
public void testCreateSolid() throws CityDoctorWriteException, IOException, CityGmlParseException, InvalidGmlFileException { public void testCreateSolid() throws CityDoctorWriteException, IOException, CityGmlParseException, InvalidGmlFileException {
ValidationConfiguration config = ValidationConfiguration.loadStandardValidationConfig(); ValidationConfiguration config = ValidationConfiguration.loadStandardValidationConfig();
CityDoctorModel model = new CityDoctorModel(config.getParserConfiguration(), new File("test")); CityDoctorModel model = new CityDoctorModel(config.getParserConfiguration(), new File("test"), new UnconnectedCache());
model.setParsedCityGMLVersion(CityGMLVersion.v3_0);
model.setCityModel(new CityModel()); model.setCityModel(new CityModel());
Building b = new Building(); Building b = new Building();
model.addBuilding(b); model.addBuilding(b);
......
...@@ -7,6 +7,7 @@ import java.io.IOException; ...@@ -7,6 +7,7 @@ import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import de.hft.stuttgart.citydoctor2.connect.edge.CppTest;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
...@@ -31,6 +32,7 @@ import de.hft.stuttgart.citydoctor2.datastructure.Geometry.Orientation; ...@@ -31,6 +32,7 @@ import de.hft.stuttgart.citydoctor2.datastructure.Geometry.Orientation;
import de.hft.stuttgart.citydoctor2.healer.Healer; import de.hft.stuttgart.citydoctor2.healer.Healer;
import de.hft.stuttgart.citydoctor2.parser.CityGmlParseException; import de.hft.stuttgart.citydoctor2.parser.CityGmlParseException;
import de.hft.stuttgart.citydoctor2.parser.InvalidGmlFileException; import de.hft.stuttgart.citydoctor2.parser.InvalidGmlFileException;
import org.junit.experimental.categories.Category;
public class HealPlanarPolygonErrorTest { public class HealPlanarPolygonErrorTest {
...@@ -47,7 +49,6 @@ public class HealPlanarPolygonErrorTest { ...@@ -47,7 +49,6 @@ public class HealPlanarPolygonErrorTest {
Assert.assertTrue(geom.containsError(CheckId.C_GE_P_NON_PLANAR)); Assert.assertTrue(geom.containsError(CheckId.C_GE_P_NON_PLANAR));
Healer healer = new Healer(c); Healer healer = new Healer(c);
healer.setNumberOfIterations(2);
healer.healCityObject(model.getBuildings().toList().get(0)); healer.healCityObject(model.getBuildings().toList().get(0));
Assert.assertFalse(geom.containsError(CheckId.C_GE_P_NON_PLANAR)); Assert.assertFalse(geom.containsError(CheckId.C_GE_P_NON_PLANAR));
...@@ -55,6 +56,7 @@ public class HealPlanarPolygonErrorTest { ...@@ -55,6 +56,7 @@ public class HealPlanarPolygonErrorTest {
} }
@Test @Test
@Category(CppTest.class)
public void testNonplanarPolygon() { public void testNonplanarPolygon() {
CppInitializer.initCpp(); CppInitializer.initCpp();
Building b = new Building(); Building b = new Building();
...@@ -160,6 +162,7 @@ public class HealPlanarPolygonErrorTest { ...@@ -160,6 +162,7 @@ public class HealPlanarPolygonErrorTest {
} }
@Test @Test
@Category(CppTest.class)
public void testNonplanarPolygon_Split() { public void testNonplanarPolygon_Split() {
CppInitializer.initCpp(); CppInitializer.initCpp();
Building b = new Building(); Building b = new Building();
...@@ -274,6 +277,7 @@ public class HealPlanarPolygonErrorTest { ...@@ -274,6 +277,7 @@ public class HealPlanarPolygonErrorTest {
} }
@Test @Test
@Category(CppTest.class)
public void testNonplanarPolygon_Split2() { public void testNonplanarPolygon_Split2() {
CppInitializer.initCpp(); CppInitializer.initCpp();
Building b = new Building(); Building b = new Building();
......
...@@ -4,8 +4,11 @@ import static org.junit.Assert.assertEquals; ...@@ -4,8 +4,11 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import java.io.File;
import java.io.IOException; 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.citygml4j.xml.writer.CityGMLWriteException;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
...@@ -33,13 +36,16 @@ import de.hft.stuttgart.citydoctor2.datastructure.Geometry.Orientation; ...@@ -33,13 +36,16 @@ import de.hft.stuttgart.citydoctor2.datastructure.Geometry.Orientation;
import de.hft.stuttgart.citydoctor2.healer.Healer; import de.hft.stuttgart.citydoctor2.healer.Healer;
import de.hft.stuttgart.citydoctor2.parser.CityGmlParseException; import de.hft.stuttgart.citydoctor2.parser.CityGmlParseException;
import de.hft.stuttgart.citydoctor2.parser.InvalidGmlFileException; import de.hft.stuttgart.citydoctor2.parser.InvalidGmlFileException;
import org.junit.experimental.categories.Category;
public class HealSolidNotClosedErrorTest { public class HealSolidNotClosedErrorTest {
/** /**
* One polygon is split up in 3 but has not matching edges * One polygon is split up in 3 but has not matching edges
*/ */
@Test @Test
@Category(CppTest.class)
public void testVertexCloseToEdge() { public void testVertexCloseToEdge() {
CppInitializer.initCpp(); CppInitializer.initCpp();
Building b = new Building(); //Angelika: als Test eingefügt Building b = new Building(); //Angelika: als Test eingefügt
...@@ -164,6 +170,7 @@ public class HealSolidNotClosedErrorTest { ...@@ -164,6 +170,7 @@ public class HealSolidNotClosedErrorTest {
} }
@Test @Test
@Category(CppTest.class)
public void testMissingPolygon() { public void testMissingPolygon() {
CppInitializer.initCpp(); CppInitializer.initCpp();
Building b = new Building(); Building b = new Building();
...@@ -343,6 +350,7 @@ public class HealSolidNotClosedErrorTest { ...@@ -343,6 +350,7 @@ public class HealSolidNotClosedErrorTest {
} }
@Test @Test
@Category(CppTest.class)
public void test2MissingPolygonsCpp() { public void test2MissingPolygonsCpp() {
CppInitializer.initCpp(); CppInitializer.initCpp();
Building b = new Building(); Building b = new Building();
...@@ -421,6 +429,8 @@ public class HealSolidNotClosedErrorTest { ...@@ -421,6 +429,8 @@ public class HealSolidNotClosedErrorTest {
assertEquals(ResultStatus.OK, cr.getResultStatus()); assertEquals(ResultStatus.OK, cr.getResultStatus());
} }
/** /**
* Missing Polygon has a self intersection * Missing Polygon has a self intersection
* @throws IOException * @throws IOException
...@@ -431,24 +441,22 @@ public class HealSolidNotClosedErrorTest { ...@@ -431,24 +441,22 @@ public class HealSolidNotClosedErrorTest {
*/ */
@Test @Test
public void testMissingPolygon2() throws CityGmlParseException, IOException, InvalidGmlFileException { 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-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(); ValidationConfiguration config = ValidationConfiguration.loadStandardValidationConfig();
CityDoctorModel model = TestUtil.loadCityModel(path, config); CityDoctorModel model = TestUtil.loadCityModel(path, config);
Checker c = new Checker(config, model); Checker c = new Checker(config, model);
c.runChecks(); c.runChecks();
Geometry geom = model.getBuildings().toList().get(0).getGeometries().get(0); 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)); Assert.assertTrue(geom.containsError(CheckId.C_GE_S_NOT_CLOSED));
Healer healer = new Healer(c); Healer healer = new Healer(c);
//healer.setNumberOfIterations(2); healer.setNumberOfIterations(2);
healer.healCityObject(model.getBuildings().toList().get(0)); healer.healCityObject(model.getBuildings().toList().get(0));
Assert.assertFalse(geom.containsError(CheckId.C_GE_S_NOT_CLOSED)); Assert.assertFalse(geom.containsError(CheckId.C_GE_S_NOT_CLOSED));
......
...@@ -150,15 +150,14 @@ public class TestHealer { ...@@ -150,15 +150,14 @@ public class TestHealer {
Checker c = new Checker(config, model); Checker c = new Checker(config, model);
c.runChecks(); c.runChecks();
Building b = model.getBuildings().toList().get(0);
Geometry geom = model.getBuildings().toList().get(0).getGeometries().get(0); Geometry geom = b.getGeometries().get(0);
Healer healer = new Healer(c); Healer healer = new Healer(c);
healer.setNumberOfIterations(33); healer.healCityObject(b);
healer.healCityObject(model.getBuildings().toList().get(0));
c.runChecks(); c.runChecks();
assertFalse(geom.containsAnyError()); assertFalse(geom.containsAnyError());
} }
@Test @Test
...@@ -193,7 +192,6 @@ public class TestHealer { ...@@ -193,7 +192,6 @@ public class TestHealer {
Geometry geom = model.getBuildings().toList().get(0).getGeometries().get(0); Geometry geom = model.getBuildings().toList().get(0).getGeometries().get(0);
Healer healer = new Healer(c); Healer healer = new Healer(c);
healer.setNumberOfIterations(83);
healer.healCityObject(model.getBuildings().toList().get(0)); healer.healCityObject(model.getBuildings().toList().get(0));
c.runChecks(); c.runChecks();
...@@ -213,7 +211,6 @@ public class TestHealer { ...@@ -213,7 +211,6 @@ public class TestHealer {
Geometry geom = model.getBuildings().toList().get(0).getGeometries().get(0); Geometry geom = model.getBuildings().toList().get(0).getGeometries().get(0);
Healer healer = new Healer(c); Healer healer = new Healer(c);
healer.setNumberOfIterations(165);
healer.healCityObject(model.getBuildings().toList().get(0)); healer.healCityObject(model.getBuildings().toList().get(0));
c.runChecks(); c.runChecks();
...@@ -264,7 +261,6 @@ public class TestHealer { ...@@ -264,7 +261,6 @@ public class TestHealer {
Geometry geom = model.getBuildings().toList().get(0).getGeometries().get(0); Geometry geom = model.getBuildings().toList().get(0).getGeometries().get(0);
Healer healer = new Healer(c); Healer healer = new Healer(c);
healer.setNumberOfIterations(45);
healer.healCityObject(model.getBuildings().toList().get(0)); healer.healCityObject(model.getBuildings().toList().get(0));
c.runChecks(); c.runChecks();
...@@ -282,7 +278,6 @@ public class TestHealer { ...@@ -282,7 +278,6 @@ public class TestHealer {
Healer healer = new Healer(c); Healer healer = new Healer(c);
healer.setNumberOfIterations(45);
healer.healModel(model); healer.healModel(model);
} }
...@@ -299,7 +294,7 @@ public class TestHealer { ...@@ -299,7 +294,7 @@ public class TestHealer {
Geometry geom = model.getBuildings().toList().get(0).getGeometries().get(0); Geometry geom = model.getBuildings().toList().get(0).getGeometries().get(0);
Healer healer = new Healer(c); Healer healer = new Healer(c);
healer.setNumberOfIterations(100);
healer.healCityObject(model.getBuildings().toList().get(0)); healer.healCityObject(model.getBuildings().toList().get(0));
c.runChecks(); c.runChecks();
......
...@@ -31,7 +31,7 @@ public class TestUtil { ...@@ -31,7 +31,7 @@ public class TestUtil {
} }
public static CityDoctorModel loadCityModel(String path, ValidationConfiguration config) throws CityGmlParseException, IOException, InvalidGmlFileException { public static CityDoctorModel loadCityModel(String path, ValidationConfiguration config) throws CityGmlParseException, IOException, InvalidGmlFileException {
return CityGmlParser.parseCityGmlFile(path, config.getParserConfiguration()); return CityGmlParser.nestedCityGmlFileParse(path, config.getParserConfiguration());
} }
public static Polygon getPolygonById(String gmlId, CityDoctorModel model) { public static Polygon getPolygonById(String gmlId, CityDoctorModel model) {
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<parent> <parent>
<groupId>de.hft.stuttgart</groupId> <groupId>de.hft.stuttgart</groupId>
<artifactId>CityDoctorParent</artifactId> <artifactId>CityDoctorParent</artifactId>
<version>3.18.1</version> <version>3.18.2</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>
<artifactId>CityDoctorHealerGUI</artifactId> <artifactId>CityDoctorHealerGUI</artifactId>
......
...@@ -538,8 +538,7 @@ public class HealerController { ...@@ -538,8 +538,7 @@ public class HealerController {
// if (model == null || currentFeature == null) { // if (model == null || currentFeature == null) {
// return; // return;
// } // }
model.getBuildings().forEach(b -> {
for (Building b : model.getBuildings()) {
// collect polygons // collect polygons
Map<Lod, List<Polygon>> availablePolygons = new EnumMap<>(Lod.class); Map<Lod, List<Polygon>> availablePolygons = new EnumMap<>(Lod.class);
Map<Lod, Set<Polygon>> existingPolygons = new EnumMap<>(Lod.class); Map<Lod, Set<Polygon>> existingPolygons = new EnumMap<>(Lod.class);
...@@ -568,7 +567,7 @@ public class HealerController { ...@@ -568,7 +567,7 @@ public class HealerController {
insertSolidGeometry(availablePolygons, part, existingPolygons, Lod.LOD4); insertSolidGeometry(availablePolygons, part, existingPolygons, Lod.LOD4);
} }
} }
} });
} }
......
<?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
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<parent> <parent>
<groupId>de.hft.stuttgart</groupId> <groupId>de.hft.stuttgart</groupId>
<artifactId>CityDoctorParent</artifactId> <artifactId>CityDoctorParent</artifactId>
<version>3.18.1</version> <version>3.18.2</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>
<artifactId>CityDoctorHealerGenetic</artifactId> <artifactId>CityDoctorHealerGenetic</artifactId>
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>de.hft.stuttgart</groupId> <groupId>de.hft.stuttgart</groupId>
<artifactId>CityDoctorParent</artifactId> <artifactId>CityDoctorParent</artifactId>
<version>3.18.1</version> <version>3.18.2</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>CityDoctorParent</name> <name>CityDoctorParent</name>
<properties> <properties>
...@@ -41,6 +41,9 @@ ...@@ -41,6 +41,9 @@
<excludes> <excludes>
<exclude>**/SolidSelfIntCheckFalsePositiveBigMeshTest.java</exclude> <exclude>**/SolidSelfIntCheckFalsePositiveBigMeshTest.java</exclude>
</excludes> </excludes>
<excludedGroups>
de.hft.stuttgart.citydoctor2.connect.edge.CppTest
</excludedGroups>
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>
...@@ -303,9 +306,9 @@ ...@@ -303,9 +306,9 @@
<!--CityDoctor2 Extension Modules--> <!--CityDoctor2 Extension Modules-->
<module>Extensions/CityDoctorGUI</module> <module>Extensions/CityDoctorGUI</module>
<!-- <module>Extensions/CityDoctorAutoPro</module>--> <!-- <module>Extensions/CityDoctorAutoPro</module>-->
<!-- <module>Extensions/CityDoctorHealer</module>--> <module>Extensions/CityDoctorHealer</module>
<!-- <module>Extensions/CityDoctorHealerGenetic</module>--> <!-- <module>Extensions/CityDoctorHealerGenetic</module>-->
<!-- <module>Extensions/CityDoctorHealerGUI</module>--> <module>Extensions/CityDoctorHealerGUI</module>
</modules> </modules>
</project> </project>
\ No newline at end of file
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