Commit 81be0b1d authored by Riegel's avatar Riegel
Browse files

Merge branch 'dev_GUI' into 'dev'

Open source release of CityDoctorGUI and other extensions.

See merge request !6
parents 12d96d95 5a4d0a74
Pipeline #10056 passed with stage
in 1 minute and 6 seconds
package de.hft.stuttgart.citydoctor2.gui.tree;
import java.util.List;
import de.hft.stuttgart.citydoctor2.datastructure.TransportationObject;
import de.hft.stuttgart.citydoctor2.gui.Renderer;
public class AllTransportationNode extends Renderable {
private final List<TransportationObject> transportation;
public AllTransportationNode(List<TransportationObject> transportation) {
this.transportation = transportation;
}
@Override
public void refreshTextColor() {
// no use
}
@Override
public String getText() {
return "Transportation";
}
@Override
public void visit(Renderer renderer) {
renderer.renderTransportation(transportation);
}
}
package de.hft.stuttgart.citydoctor2.gui.tree;
import java.util.List;
import de.hft.stuttgart.citydoctor2.datastructure.Vegetation;
import de.hft.stuttgart.citydoctor2.gui.Renderer;
public class AllVegetationNode extends Renderable {
private final List<Vegetation> vegetation;
public AllVegetationNode(List<Vegetation> vegetation) {
this.vegetation = vegetation;
}
@Override
public void refreshTextColor() {
// no use
}
@Override
public String getText() {
return "Vegetation";
}
@Override
public void visit(Renderer renderer) {
renderer.renderVegetation(vegetation);
}
}
package de.hft.stuttgart.citydoctor2.gui.tree;
import java.util.List;
import de.hft.stuttgart.citydoctor2.datastructure.WaterObject;
import de.hft.stuttgart.citydoctor2.gui.Renderer;
public class AllWaterNode extends Renderable {
private final List<WaterObject> water;
public AllWaterNode(List<WaterObject> water) {
this.water = water;
}
@Override
public void refreshTextColor() {
// no use
}
@Override
public String getText() {
return "Water";
}
@Override
public void visit(Renderer renderer) {
renderer.renderWater(water);
}
}
package de.hft.stuttgart.citydoctor2.gui.tree;
import de.hft.stuttgart.citydoctor2.datastructure.BoundarySurface;
import de.hft.stuttgart.citydoctor2.gui.CheckStatus;
import de.hft.stuttgart.citydoctor2.gui.Renderer;
public class BoundarySurfaceNode extends Renderable {
private final BoundarySurface bs;
public BoundarySurfaceNode(BoundarySurface bs) {
this.bs = bs;
}
@Override
public String getText() {
return bs.getGmlId().getGmlString() + " [" + bs.getType() + "]";
}
@Override
public void visit(Renderer renderer) {
renderer.render(bs);
}
@Override
public void refreshTextColor() {
if (!bs.isValidated()) {
setStatus(CheckStatus.NOT_CHECKED);
} else if (bs.containsAnyError()) {
setStatus(CheckStatus.ERROR);
} else {
setStatus(CheckStatus.OK);
}
}
}
/*-
* Copyright 2023 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.gui.tree;
import de.hft.stuttgart.citydoctor2.datastructure.BridgeConstructiveElement;
import de.hft.stuttgart.citydoctor2.gui.CheckStatus;
import de.hft.stuttgart.citydoctor2.gui.Renderer;
public class BridgeConstructiveElementNode extends Renderable {
private final BridgeConstructiveElement bce;
public BridgeConstructiveElementNode(BridgeConstructiveElement bce) {
this.bce = bce;
}
@Override
public String getText() {
return bce.getGmlId().getGmlString();
}
@Override
public void visit(Renderer renderer) {
renderer.render(bce);
}
@Override
public void refreshTextColor() {
if (!bce.isValidated()) {
setStatus(CheckStatus.NOT_CHECKED);
} else if (bce.containsAnyError()) {
setStatus(CheckStatus.ERROR);
} else {
setStatus(CheckStatus.OK);
}
}
}
/*-
* Copyright 2022 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.gui.tree;
import de.hft.stuttgart.citydoctor2.datastructure.BridgeObject;
import de.hft.stuttgart.citydoctor2.gui.CheckStatus;
import de.hft.stuttgart.citydoctor2.gui.Renderer;
public class BridgeNode extends Renderable {
private final BridgeObject bridge;
public BridgeNode(BridgeObject bridge) {
this.bridge = bridge;
}
@Override
public String getText() {
return bridge.getGmlId().getGmlString();
}
@Override
public void visit(Renderer renderer) {
renderer.render(bridge);
}
@Override
public void refreshTextColor() {
if (!bridge.isValidated()) {
setStatus(CheckStatus.NOT_CHECKED);
} else if (bridge.containsAnyError()) {
setStatus(CheckStatus.ERROR);
} else {
setStatus(CheckStatus.OK);
}
}
}
package de.hft.stuttgart.citydoctor2.gui.tree;
import de.hft.stuttgart.citydoctor2.datastructure.Building;
import de.hft.stuttgart.citydoctor2.gui.CheckStatus;
import de.hft.stuttgart.citydoctor2.gui.Renderer;
public class BuildingNode extends Renderable {
private final Building building;
public BuildingNode(Building building) {
this.building = building;
}
@Override
public String getText() {
return building.getGmlId().getGmlString();
}
public Building getBuilding() {
return building;
}
@Override
public void visit(Renderer renderer) {
renderer.render(building);
}
@Override
public void refreshTextColor() {
if (!building.isValidated()) {
setStatus(CheckStatus.NOT_CHECKED);
} else if (building.containsAnyError()) {
setStatus(CheckStatus.ERROR);
} else {
setStatus(CheckStatus.OK);
}
}
}
package de.hft.stuttgart.citydoctor2.gui.tree;
import de.hft.stuttgart.citydoctor2.datastructure.BuildingPart;
import de.hft.stuttgart.citydoctor2.gui.CheckStatus;
import de.hft.stuttgart.citydoctor2.gui.Renderer;
public class BuildingPartNode extends Renderable {
private final BuildingPart bp;
public BuildingPartNode(BuildingPart bp) {
this.bp = bp;
}
@Override
public String getText() {
return bp.getGmlId().getGmlString();
}
@Override
public void visit(Renderer renderer) {
renderer.render(bp);
}
@Override
public void refreshTextColor() {
if (!bp.isValidated()) {
setStatus(CheckStatus.NOT_CHECKED);
} else if (bp.containsAnyError()) {
setStatus(CheckStatus.ERROR);
} else {
setStatus(CheckStatus.OK);
}
}
}
/*-
* 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.gui.tree;
import de.hft.stuttgart.citydoctor2.gui.Renderer;
public class ButtonRenderable extends Renderable {
private final Runnable run;
public ButtonRenderable(Runnable run) {
this.run = run;
}
public void run() {
run.run();
}
@Override
public void refreshTextColor() {
// nothing to do
}
@Override
public String getText() {
return null;
}
@Override
public void visit(Renderer renderer) {
// nothing to render
}
}
package de.hft.stuttgart.citydoctor2.gui.tree;
import de.hft.stuttgart.citydoctor2.datastructure.CityObject;
import de.hft.stuttgart.citydoctor2.gui.CheckStatus;
import de.hft.stuttgart.citydoctor2.gui.Renderer;
public class CityObjectNode extends Renderable {
private final CityObject co;
public CityObjectNode(CityObject co) {
this.co = co;
}
@Override
public void refreshTextColor() {
if (!co.isValidated()) {
setStatus(CheckStatus.NOT_CHECKED);
} else if (co.containsAnyError()) {
setStatus(CheckStatus.ERROR);
} else {
setStatus(CheckStatus.OK);
}
}
@Override
public String getText() {
return co.getGmlId().getGmlString();
}
@Override
public void visit(Renderer renderer) {
renderer.render(co);
}
}
package de.hft.stuttgart.citydoctor2.gui.tree;
import de.hft.stuttgart.citydoctor2.gui.CityDoctorController;
public interface Displayable {
public void visitForDisplaying(CityDoctorController controller);
}
package de.hft.stuttgart.citydoctor2.gui.tree;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import de.hft.stuttgart.citydoctor2.datastructure.Edge;
import de.hft.stuttgart.citydoctor2.datastructure.Vertex;
import de.hft.stuttgart.citydoctor2.gui.Renderer;
public class EdgeNode extends Renderable {
private static final DecimalFormat nf;
static {
DecimalFormatSymbols dfs = DecimalFormatSymbols.getInstance();
dfs.setDecimalSeparator('.');
nf = new DecimalFormat("#.####", dfs);
}
private static final String SEPERATOR = ", ";
private final Edge e;
private String text;
public EdgeNode(Edge e) {
this.e = e;
}
@Override
public void refreshTextColor() {
// not used
}
@Override
public String getText() {
if (text == null) {
StringBuilder sb = new StringBuilder();
sb.append("Edge from [");
Vertex from = e.getFrom();
sb.append(nf.format(from.getX()));
sb.append(SEPERATOR);
sb.append(nf.format(from.getY()));
sb.append(SEPERATOR);
sb.append(nf.format(from.getZ()));
sb.append("] to [");
Vertex to = e.getTo();
sb.append(nf.format(to.getX()));
sb.append(SEPERATOR);
sb.append(nf.format(to.getY()));
sb.append(SEPERATOR);
sb.append(nf.format(to.getZ()));
sb.append("]");
text = sb.toString();
}
return text;
}
@Override
public void visit(Renderer renderer) {
renderer.highlight(e);
}
}
package de.hft.stuttgart.citydoctor2.gui.tree;
import de.hft.stuttgart.citydoctor2.check.CheckError;
import javafx.scene.control.cell.TextFieldTreeCell;
public class ErrorCell extends TextFieldTreeCell<CheckError> {
@Override
public void updateItem(CheckError item, boolean empty) {
super.updateItem(item, empty);
if (empty || item == null) {
setText(null);
setGraphic(null);
} else {
setText(item.getErrorId().toString());
}
}
}
package de.hft.stuttgart.citydoctor2.gui.tree;
import java.util.List;
import de.hft.stuttgart.citydoctor2.check.CheckError;
import de.hft.stuttgart.citydoctor2.check.ErrorVisitor;
import de.hft.stuttgart.citydoctor2.check.error.AllPolygonsWrongOrientationError;
import de.hft.stuttgart.citydoctor2.check.error.AttributeInvalidError;
import de.hft.stuttgart.citydoctor2.check.error.AttributeMissingError;
import de.hft.stuttgart.citydoctor2.check.error.AttributeValueWrongError;
import de.hft.stuttgart.citydoctor2.check.error.ConsecutivePointSameError;
import de.hft.stuttgart.citydoctor2.check.error.DependenciesNotMetError;
import de.hft.stuttgart.citydoctor2.check.error.MultipleConnectedComponentsError;
import de.hft.stuttgart.citydoctor2.check.error.NestedRingError;
import de.hft.stuttgart.citydoctor2.check.error.NonManifoldEdgeError;
import de.hft.stuttgart.citydoctor2.check.error.NonManifoldVertexError;
import de.hft.stuttgart.citydoctor2.check.error.NonPlanarPolygonDistancePlaneError;
import de.hft.stuttgart.citydoctor2.check.error.NonPlanarPolygonNormalsDeviation;
import de.hft.stuttgart.citydoctor2.check.error.NotCeilingError;
import de.hft.stuttgart.citydoctor2.check.error.NotFloorError;
import de.hft.stuttgart.citydoctor2.check.error.NotGroundError;
import de.hft.stuttgart.citydoctor2.check.error.NotWallError;
import de.hft.stuttgart.citydoctor2.check.error.NullAreaError;
import de.hft.stuttgart.citydoctor2.check.error.PointTouchesEdgeError;
import de.hft.stuttgart.citydoctor2.check.error.PolygonHoleOutsideError;
import de.hft.stuttgart.citydoctor2.check.error.PolygonInteriorDisconnectedError;
import de.hft.stuttgart.citydoctor2.check.error.PolygonIntersectingRingsError;
import de.hft.stuttgart.citydoctor2.check.error.PolygonSameOrientationError;
import de.hft.stuttgart.citydoctor2.check.error.PolygonWithoutSurfaceError;
import de.hft.stuttgart.citydoctor2.check.error.PolygonWrongOrientationError;
import de.hft.stuttgart.citydoctor2.check.error.RingDuplicatePointError;
import de.hft.stuttgart.citydoctor2.check.error.RingEdgeIntersectionError;
import de.hft.stuttgart.citydoctor2.check.error.RingNotClosedError;
import de.hft.stuttgart.citydoctor2.check.error.RingTooFewPointsError;
import de.hft.stuttgart.citydoctor2.check.error.SchematronError;
import de.hft.stuttgart.citydoctor2.check.error.SolidNotClosedError;
import de.hft.stuttgart.citydoctor2.check.error.SolidSelfIntError;
import de.hft.stuttgart.citydoctor2.check.error.SurfaceUnfragmentedError;
import de.hft.stuttgart.citydoctor2.check.error.DegeneratedRingError;
import de.hft.stuttgart.citydoctor2.check.error.TooFewPolygonsError;
import de.hft.stuttgart.citydoctor2.check.error.UnknownCheckError;
import de.hft.stuttgart.citydoctor2.datastructure.Edge;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
import de.hft.stuttgart.citydoctor2.datastructure.Vertex;
import de.hft.stuttgart.citydoctor2.gui.CheckStatus;
import javafx.scene.control.TreeItem;
public class ErrorItemVisitor implements ErrorVisitor {
private static final String NAME_OF_ATTRIBUTE = "Name of Attribute: ";
private static final String CHILD_ID = "ChildId: ";
private final TreeItem<Renderable> root;
public ErrorItemVisitor(TreeItem<Renderable> root) {
this.root = root;
}
@Override
public void visit(PolygonHoleOutsideError err) {
PolygonNode polyNode = new PolygonNode(err.getPolygon(), CheckStatus.NOT_CHECKED);
TreeItem<Renderable> polyItem = new TreeItem<>(polyNode);
root.getChildren().add(polyItem);
}
@Override
public void visit(NonManifoldEdgeError err) {
for (Edge e : err.getEdges()) {
EdgeNode edgeNode = new EdgeNode(e);
TreeItem<Renderable> edgeItem = new TreeItem<>(edgeNode);
root.getChildren().add(edgeItem);
}
}
@Override
public void visit(MultipleConnectedComponentsError err) {
for (int i = 0; i < err.getComponents().size(); i++) {
TextNode textNode = new TextNode("Component " + i);
TreeItem<Renderable> textItem = new TreeItem<>(textNode);
root.getChildren().add(textItem);
List<Polygon> component = err.getComponents().get(i);
for (Polygon p : component) {
PolygonNode polyNode = new PolygonNode(p, CheckStatus.NOT_CHECKED);
TreeItem<Renderable> polyItem = new TreeItem<>(polyNode);
textItem.getChildren().add(polyItem);
}
}
}
@Override
public void visit(NestedRingError err) {
PolygonNode polyNode = new PolygonNode(err.getPolygon(), CheckStatus.NOT_CHECKED);
TreeItem<Renderable> polyItem = new TreeItem<>(polyNode);
root.getChildren().add(polyItem);
}
@Override
public void visit(NonManifoldVertexError err) {
VertexNode vertexNode = new VertexNode(err.getVertex());
TreeItem<Renderable> vertexItem = new TreeItem<>(vertexNode);
root.getChildren().add(vertexItem);
for (int i = 0; i < err.getComponents().size(); i++) {
TextNode textNode = new TextNode("Component " + i);
TreeItem<Renderable> textItem = new TreeItem<>(textNode);
root.getChildren().add(textItem);
List<Polygon> component = err.getComponents().get(i);
for (Polygon p : component) {
PolygonNode polyNode = new PolygonNode(p, CheckStatus.NOT_CHECKED);
TreeItem<Renderable> polyItem = new TreeItem<>(polyNode);
textItem.getChildren().add(polyItem);
}
}
}
@Override
public void visit(PolygonWrongOrientationError err) {
for (Edge e : err.getEdges()) {
EdgeNode edgeNode = new EdgeNode(e);
TreeItem<Renderable> edgeItem = new TreeItem<>(edgeNode);
root.getChildren().add(edgeItem);
}
}
@Override
public void visit(PolygonSameOrientationError err) {
PolygonNode polyNode = new PolygonNode(err.getPolygon(), CheckStatus.NOT_CHECKED);
TreeItem<Renderable> polyItem = new TreeItem<>(polyNode);
root.getChildren().add(polyItem);
}
@Override
public void visit(SolidNotClosedError err) {
for (Edge e : err.getErrorEdges()) {
EdgeNode edgeNode = new EdgeNode(e);
TreeItem<Renderable> edgeItem = new TreeItem<>(edgeNode);
root.getChildren().add(edgeItem);
}
}
@Override
public void visit(DependenciesNotMetError err) {
// not displayed
}
@Override
public void visit(UnknownCheckError err) {
// not displayed
}
@Override
public void visit(RingNotClosedError err) {
LinearRingNode ringNode = new LinearRingNode(err.getRing(), CheckStatus.NOT_CHECKED);
TreeItem<Renderable> ringItem = new TreeItem<>(ringNode);
root.getChildren().add(ringItem);
}
@Override
public void visit(ConsecutivePointSameError err) {
LinearRingNode ringNode = new LinearRingNode(err.getRing(), CheckStatus.NOT_CHECKED);
TreeItem<Renderable> ringItem = new TreeItem<>(ringNode);
root.getChildren().add(ringItem);
VertexNode vertexNode = new VertexNode(err.getVertex1());
TreeItem<Renderable> vertexItem = new TreeItem<>(vertexNode);
root.getChildren().add(vertexItem);
vertexNode = new VertexNode(err.getVertex2());
vertexItem = new TreeItem<>(vertexNode);
root.getChildren().add(vertexItem);
}
@Override
public void visit(AllPolygonsWrongOrientationError err) {
// not displayed
}
@Override
public void visit(PolygonInteriorDisconnectedError err) {
PolygonNode polyNode = new PolygonNode(err.getPolygon(), CheckStatus.NOT_CHECKED);
TreeItem<Renderable> polyItem = new TreeItem<>(polyNode);
root.getChildren().add(polyItem);
}
@Override
public void visit(NullAreaError err) {
LinearRingNode ringNode = new LinearRingNode(err.getRing(), CheckStatus.NOT_CHECKED);
TreeItem<Renderable> ringItem = new TreeItem<>(ringNode);
root.getChildren().add(ringItem);
}
@Override
public void visit(RingTooFewPointsError err) {
LinearRingNode ringNode = new LinearRingNode(err.getRing(), CheckStatus.NOT_CHECKED);
TreeItem<Renderable> ringItem = new TreeItem<>(ringNode);
root.getChildren().add(ringItem);
if (err.getRing().getGmlId().isGenerated()) {
PolygonNode polyNode = new PolygonNode(err.getRing().getParent(), CheckStatus.NOT_CHECKED);
TreeItem<Renderable> polyItem = new TreeItem<>(polyNode);
ringItem.getChildren().add(polyItem);
}
}
@Override
public void visit(NonPlanarPolygonNormalsDeviation err) {
PolygonNode polyNode = new PolygonNode(err.getPolygon(), CheckStatus.NOT_CHECKED);
TreeItem<Renderable> polyItem = new TreeItem<>(polyNode);
root.getChildren().add(polyItem);
TextNode textNode = new TextNode("Deviation: " + err.getDeviation());
TreeItem<Renderable> textItem = new TreeItem<>(textNode);
root.getChildren().add(textItem);
}
@Override
public void visit(NonPlanarPolygonDistancePlaneError err) {
PolygonNode polyNode = new PolygonNode(err.getPolygon(), CheckStatus.NOT_CHECKED);
TreeItem<Renderable> polyItem = new TreeItem<>(polyNode);
root.getChildren().add(polyItem);
VertexNode vertexNode = new VertexNode(err.getVertex());
TreeItem<Renderable> vertexItem = new TreeItem<>(vertexNode);
root.getChildren().add(vertexItem);
TextNode textNode = new TextNode("Distance: " + err.getDistance() + "m");
TreeItem<Renderable> textItem = new TreeItem<>(textNode);
root.getChildren().add(textItem);
}
@Override
public void visit(PolygonIntersectingRingsError err) {
PolygonNode polyNode = new PolygonNode(err.getPolygon(), CheckStatus.NOT_CHECKED);
TreeItem<Renderable> polyItem = new TreeItem<>(polyNode);
root.getChildren().add(polyItem);
}
@Override
public void visit(SolidSelfIntError err) {
PolygonNode polyNode1 = new PolygonNode(err.getIntersections().get(0).getP1(), CheckStatus.NOT_CHECKED);
TreeItem<Renderable> polyItem1 = new TreeItem<>(polyNode1);
root.getChildren().add(polyItem1);
PolygonNode polyNode2 = new PolygonNode(err.getIntersections().get(0).getP2(), CheckStatus.NOT_CHECKED);
TreeItem<Renderable> polyItem2 = new TreeItem<>(polyNode2);
root.getChildren().add(polyItem2);
}
@Override
public void visit(TooFewPolygonsError err) {
// not displayed
}
@Override
public void visit(RingDuplicatePointError err) {
LinearRingNode ringNode = new LinearRingNode(err.getRing(), CheckStatus.NOT_CHECKED);
TreeItem<Renderable> ringItem = new TreeItem<>(ringNode);
root.getChildren().add(ringItem);
VertexNode vertexNode = new VertexNode(err.getVertex1());
TreeItem<Renderable> vertexItem = new TreeItem<>(vertexNode);
root.getChildren().add(vertexItem);
vertexNode = new VertexNode(err.getVertex2());
vertexItem = new TreeItem<>(vertexNode);
root.getChildren().add(vertexItem);
}
@Override
public void visit(RingEdgeIntersectionError err) {
LinearRingNode ringNode = new LinearRingNode(err.getRing(), CheckStatus.NOT_CHECKED);
TreeItem<Renderable> ringItem = new TreeItem<>(ringNode);
root.getChildren().add(ringItem);
EdgeNode edgeNode = new EdgeNode(err.getEdge1());
TreeItem<Renderable> edgeItem = new TreeItem<>(edgeNode);
root.getChildren().add(edgeItem);
EdgeNode edge2Node = new EdgeNode(err.getEdge2());
TreeItem<Renderable> edge2Item = new TreeItem<>(edge2Node);
root.getChildren().add(edge2Item);
VertexNode vertexNode = new VertexNode(new Vertex(err.getIntersection()));
TreeItem<Renderable> vertexItem = new TreeItem<>(vertexNode);
root.getChildren().add(vertexItem);
}
@Override
public void visit(PointTouchesEdgeError err) {
TextNode textNode = new TextNode("Point touches edge");
TreeItem<Renderable> textItem = new TreeItem<>(textNode);
root.getChildren().add(textItem);
VertexNode vertexNode = new VertexNode(err.getVertex());
TreeItem<Renderable> vertexItem = new TreeItem<>(vertexNode);
root.getChildren().add(vertexItem);
EdgeNode edgeNode = new EdgeNode(err.getEdge());
TreeItem<Renderable> edgeItem = new TreeItem<>(edgeNode);
root.getChildren().add(edgeItem);
LinearRingNode ringNode = new LinearRingNode(err.getRing(), CheckStatus.NOT_CHECKED);
TreeItem<Renderable> ringItem = new TreeItem<>(ringNode);
root.getChildren().add(ringItem);
}
@Override
public void visit(NotCeilingError err) {
PolygonNode polyNode = new PolygonNode(err.getPolygon(), CheckStatus.NOT_CHECKED);
TreeItem<Renderable> polyItem = new TreeItem<>(polyNode);
root.getChildren().add(polyItem);
}
@Override
public void visit(NotFloorError err) {
PolygonNode polyNode = new PolygonNode(err.getPolygon(), CheckStatus.NOT_CHECKED);
TreeItem<Renderable> polyItem = new TreeItem<>(polyNode);
root.getChildren().add(polyItem);
}
@Override
public void visit(NotWallError err) {
PolygonNode polyNode = new PolygonNode(err.getPolygon(), CheckStatus.NOT_CHECKED);
TreeItem<Renderable> polyItem = new TreeItem<>(polyNode);
root.getChildren().add(polyItem);
}
@Override
public void visit(NotGroundError err) {
PolygonNode polyNode = new PolygonNode(err.getPolygon(), CheckStatus.NOT_CHECKED);
TreeItem<Renderable> polyItem = new TreeItem<>(polyNode);
root.getChildren().add(polyItem);
}
@Override
public void visit(CheckError err) {
// not used
}
@Override
public void visit(SchematronError err) {
TextNode textNode = new TextNode(err.getErrorIdString());
TreeItem<Renderable> textItem = new TreeItem<>(textNode);
root.getChildren().add(textItem);
}
@Override
public void visit(SurfaceUnfragmentedError err) {
TextNode textNode = new TextNode("Deviation: " + err.getAngleDeviation());
TreeItem<Renderable> textItem = new TreeItem<>(textNode);
root.getChildren().add(textItem);
}
@Override
public void visit(DegeneratedRingError err) {
TextNode textNode = new TextNode("Type: degenerated ring");
TreeItem<Renderable> textItem = new TreeItem<>(textNode);
root.getChildren().add(textItem);
LinearRingNode polyNode = new LinearRingNode(err.getRing(), CheckStatus.NOT_CHECKED);
TreeItem<Renderable> polyItem = new TreeItem<>(polyNode);
root.getChildren().add(polyItem);
}
@Override
public void visit(AttributeMissingError err) {
if (!err.getChildId().isEmpty()) {
TextNode textNode = new TextNode(CHILD_ID + err.getChildId());
TreeItem<Renderable> textItem = new TreeItem<>(textNode);
root.getChildren().add(textItem);
}
TextNode nameNode = new TextNode(NAME_OF_ATTRIBUTE + err.getNameOfAttribute());
TreeItem<Renderable> nameItem = new TreeItem<>(nameNode);
root.getChildren().add(nameItem);
}
@Override
public void visit(AttributeValueWrongError err) {
if (!err.getChildId().isEmpty()) {
TextNode textNode = new TextNode(CHILD_ID + err.getChildId());
TreeItem<Renderable> textItem = new TreeItem<>(textNode);
root.getChildren().add(textItem);
}
TextNode nameNode = new TextNode(NAME_OF_ATTRIBUTE + err.getNameOfAttribute());
TreeItem<Renderable> nameItem = new TreeItem<>(nameNode);
root.getChildren().add(nameItem);
}
@Override
public void visit(AttributeInvalidError err) {
if (!err.getChildId().isEmpty()) {
TextNode textNode = new TextNode(CHILD_ID + err.getChildId());
TreeItem<Renderable> textItem = new TreeItem<>(textNode);
root.getChildren().add(textItem);
}
TextNode nameNode = new TextNode(NAME_OF_ATTRIBUTE + err.getNameOfAttribute());
TreeItem<Renderable> nameItem = new TreeItem<>(nameNode);
root.getChildren().add(nameItem);
}
@Override
public void visit(PolygonWithoutSurfaceError err) {
PolygonNode polyNode = new PolygonNode(err.getPolygon(), CheckStatus.NOT_CHECKED);
TreeItem<Renderable> polyItem = new TreeItem<>(polyNode);
root.getChildren().add(polyItem);
}
}
package de.hft.stuttgart.citydoctor2.gui.tree;
import de.hft.stuttgart.citydoctor2.check.CheckError;
import de.hft.stuttgart.citydoctor2.gui.Renderer;
public class ErrorNode extends Renderable {
private final CheckError err;
public ErrorNode(CheckError e) {
this.err = e;
}
@Override
public void refreshTextColor() {
// not used
}
@Override
public String getText() {
return err.getErrorId().toString();
}
@Override
public void visit(Renderer renderer) {
renderer.highlight(err);
}
}
package de.hft.stuttgart.citydoctor2.gui.tree;
import de.hft.stuttgart.citydoctor2.datastructure.Geometry;
import de.hft.stuttgart.citydoctor2.gui.CheckStatus;
import de.hft.stuttgart.citydoctor2.gui.Renderer;
public class GeometryNode extends Renderable {
private final Geometry geom;
private final String text;
public GeometryNode(Geometry geom) {
this.geom = geom;
StringBuilder sb = new StringBuilder();
sb.append("Geometry [");
sb.append(geom.getType());
sb.append(", ");
sb.append(geom.getLod());
if (geom.getGmlId().isGenerated()) {
sb.append("]");
} else {
sb.append("] ");
sb.append(geom.getGmlId());
}
text = sb.toString();
}
@Override
public void refreshTextColor() {
if (!geom.isValidated()) {
setStatus(CheckStatus.NOT_CHECKED);
} else if (geom.containsAnyError()) {
setStatus(CheckStatus.ERROR);
} else {
setStatus(CheckStatus.OK);
}
}
@Override
public String getText() {
return text;
}
@Override
public void visit(Renderer renderer) {
renderer.render(geom);
}
}
package de.hft.stuttgart.citydoctor2.gui.tree;
import de.hft.stuttgart.citydoctor2.datastructure.Installation;
import de.hft.stuttgart.citydoctor2.gui.CheckStatus;
import de.hft.stuttgart.citydoctor2.gui.Renderer;
public class InstallationNode extends Renderable {
private final Installation bi;
public InstallationNode(Installation bi) {
this.bi = bi;
}
@Override
public String getText() {
return bi.getGmlId().getGmlString();
}
@Override
public void visit(Renderer renderer) {
renderer.render(bi);
}
@Override
public void refreshTextColor() {
if (!bi.isValidated()) {
setStatus(CheckStatus.NOT_CHECKED);
} else if (bi.containsAnyError()) {
setStatus(CheckStatus.ERROR);
} else {
setStatus(CheckStatus.OK);
}
}
}
\ No newline at end of file
/*-
* Copyright 2022 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.gui.tree;
import de.hft.stuttgart.citydoctor2.datastructure.LandObject;
import de.hft.stuttgart.citydoctor2.gui.CheckStatus;
import de.hft.stuttgart.citydoctor2.gui.Renderer;
public class LandUseNode extends Renderable {
private final LandObject landUse;
public LandUseNode(LandObject landUse) {
this.landUse = landUse;
}
@Override
public void refreshTextColor() {
if (!landUse.isValidated()) {
setStatus(CheckStatus.NOT_CHECKED);
} else if (landUse.containsAnyError()) {
setStatus(CheckStatus.ERROR);
} else {
setStatus(CheckStatus.OK);
}
}
@Override
public String getText() {
return "[LandUse] " + landUse.getGmlId().getGmlString();
}
@Override
public void visit(Renderer renderer) {
renderer.render(landUse);
}
}
package de.hft.stuttgart.citydoctor2.gui.tree;
import de.hft.stuttgart.citydoctor2.datastructure.LinearRing;
import de.hft.stuttgart.citydoctor2.gui.CheckStatus;
import de.hft.stuttgart.citydoctor2.gui.Renderer;
public class LinearRingNode extends Renderable {
private final LinearRing lr;
private String text;
public LinearRingNode(LinearRing lr, CheckStatus cs) {
this.lr = lr;
setStatus(cs);
}
@Override
public void refreshTextColor() {
if (!lr.isValidated()) {
setStatus(CheckStatus.NOT_CHECKED);
} else if (lr.containsAnyError()) {
setStatus(CheckStatus.ERROR);
} else {
setStatus(CheckStatus.OK);
}
}
@Override
public String getText() {
if (text == null) {
text = "Linear Ring (" + lr.getType().toString() + ") " + lr.getGmlId().getGmlString();
}
return text;
}
@Override
public void visit(Renderer renderer) {
renderer.highlight(lr);
}
}
package de.hft.stuttgart.citydoctor2.gui.tree;
import de.hft.stuttgart.citydoctor2.datastructure.Opening;
import de.hft.stuttgart.citydoctor2.gui.CheckStatus;
import de.hft.stuttgart.citydoctor2.gui.Renderer;
public class OpeningNode extends Renderable {
private final Opening opening;
public OpeningNode(Opening o) {
opening = o;
}
@Override
public void refreshTextColor() {
if (!opening.isValidated()) {
setStatus(CheckStatus.NOT_CHECKED);
} else if (opening.containsAnyError()) {
setStatus(CheckStatus.ERROR);
} else {
setStatus(CheckStatus.OK);
}
}
@Override
public String getText() {
return "Opening [" + opening.getGmlId() + ", " + opening.getType() + "]";
}
@Override
public void visit(Renderer renderer) {
renderer.render(opening);
}
}
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