Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
05c6a6a
filter empty sheetcuts
linusbbb Sep 23, 2026
004f112
wrap export in try catch, account for missing direction line in sheetcut
linusbbb Sep 23, 2026
fc24af4
add validator for sheetcuts
linusbbb Sep 23, 2026
f707bd1
Merge remote-tracking branch 'origin/set/main' into siteplan-export-a…
linusbbb Oct 6, 2026
e84203a
fix siteplan export when attachment provider is missing
linusbbb Oct 6, 2026
5ac5db1
Merge branch 'eclipse-set:main' into siteplan-export-and-sheetcut-val…
linusbbb Oct 8, 2026
5a440da
Fix java/xtend formatting
linusbbb Oct 8, 2026
b11420f
Merge branch 'siteplan-export-and-sheetcut-validator' of https://gith…
linusbbb Oct 8, 2026
287c857
don't use polygon anchor if real direction line exists
linusbbb Oct 8, 2026
c0427b3
Update java/bundles/org.eclipse.set.ppmodel.extensions/src/org/eclips…
linusbbb Oct 8, 2026
2dac9c1
update validation view reference
linusbbb Oct 8, 2026
27a3221
Merge branch 'siteplan-export-and-sheetcut-validator' of https://gith…
linusbbb Oct 8, 2026
9d6d4bb
Update java/bundles/org.eclipse.set.ppmodel.extensions/src/org/eclips…
linusbbb Oct 13, 2026
32f851c
Merge branch 'eclipse-set:main' into siteplan-export-and-sheetcut-val…
linusbbb Oct 14, 2026
953c766
extract validation of direction line into seperate metjod
linusbbb Oct 14, 2026
f8306fb
check if coordinates are numeric in sheet cut validation
linusbbb Oct 14, 2026
7cbe186
extract validation of polygon into separate method
linusbbb Oct 14, 2026
88e8871
use getNullableObject for null checks
linusbbb Oct 14, 2026
74b1cfc
check if polygon coordinates are numeric, share one regex for both nu…
linusbbb Oct 14, 2026
9c65f11
Merge branch 'eclipse-set:main' into siteplan-export-and-sheetcut-val…
linusbbb Oct 15, 2026
f5954e1
Update java/bundles/org.eclipse.set.feature.validation/src/org/eclips…
linusbbb Oct 15, 2026
d9b7411
fix formatting
linusbbb Oct 15, 2026
3a1fb8e
add object scope and state to the sheet cut problems
linusbbb Oct 15, 2026
d08430b
remove duplicate node finding logic
linusbbb Oct 15, 2026
bcfb571
rename booleam methods
linusbbb Oct 15, 2026
efb330a
add line number again for "Blattschnitt ohne Ausrichtung"
linusbbb Oct 15, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class LayoutTransformator {
val layoutInfo = SiteplanFactory.eINSTANCE.createLayoutinfo
layoutInfo.guid = identitaet?.wert
layoutInfo.label = bezeichnung?.bezeichnungLageplan?.wert
IDLageplanBlattschnitt.forEach [
IDLageplanBlattschnitt.filter[value !== null].forEach [
layoutInfo.sheetsCut.add(value.transformSheetCut)
]
siteplan.layoutInfo.add(layoutInfo)
Expand Down Expand Up @@ -86,14 +86,13 @@ class LayoutTransformator {
}
]
return result.filter[x !== 0 && y !== 0].map [
positionService.transformCoordinate(x, y,
LayoutTransformator.
selectedCRS)
positionService.transformCoordinate(x, y, LayoutTransformator.
selectedCRS)
]
}

static def ENUMGEOKoordinatensystem setCRS(String newCRS) {
//By default fallback to CR0 System
// By default fallback to CR0 System
selectedCRS = crsMap.getOrDefault(newCRS,
ENUMGEOKoordinatensystem.ENUMGEO_KOORDINATENSYSTEM_CR0)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ Export-Package: org.eclipse.set.feature.validation,
org.eclipse.set.feature.validation.session,
org.eclipse.set.feature.validation.utils
Service-Component: OSGI-INF/org.eclipse.set.feature.validation.LayoutInfoRequired.xml,
OSGI-INF/org.eclipse.set.feature.validation.SheetCutValidator.xml,
OSGI-INF/org.eclipse.set.feature.validation.descriptions.ValidationTableDescriptionService.xml,
OSGI-INF/org.eclipse.set.feature.validation.descriptions.ValidationViewDescriptionService.xml,
OSGI-INF/org.eclipse.set.feature.validation.modelloader.ModelLoaderContextFunction.xml,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
/**
* Copyright (c) 2026 DB InfraGO AG and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v2.0 which is available at
* https://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*
*/
package org.eclipse.set.feature.validation;

import java.util.Arrays;
import java.util.List;

import org.eclipse.set.basis.PlanProXMLNode;
import org.eclipse.set.basis.constants.ValidationResult;
import org.eclipse.set.basis.files.ToolboxFile;
import org.eclipse.set.core.services.validation.CustomValidator;
import org.eclipse.set.model.planpro.Layoutinformationen.Lageplan_Blattschnitt;
import org.eclipse.set.model.planpro.Layoutinformationen.PlanPro_Layoutinfo;
import org.eclipse.set.model.planpro.Layoutinformationen.Polygonzug_Ausrichtung_TypeClass;
import org.eclipse.set.model.planpro.Layoutinformationen.Polygonzug_Blattschnitt_TypeClass;
import org.eclipse.set.model.validationreport.ObjectScope;
import org.eclipse.set.model.validationreport.ObjectState;
import org.eclipse.set.model.validationreport.ValidationSeverity;
import org.eclipse.set.ppmodel.extensions.EObjectExtensions;
import org.eclipse.set.utils.xml.EObjectXMLFinder;
import org.osgi.service.component.annotations.Component;

/**
*
* @author brombacher
*/
@Component(immediate = true, service = CustomValidator.class)
public class SheetCutValidator extends AbstractCustomValidator {
public static final String SHEET_CUT_VALIDATION_TYPE = "Blattschnitte"; //$NON-NLS-1$

private static final String NUMBER_REGEX = "-?\\d+(\\.\\d+)?"; //$NON-NLS-1$

@Override
public void validate(final ToolboxFile toolboxFile,
final ValidationResult result, final FileType type) {
try {

if (type != FileType.Layout) {
return;
}

final PlanPro_Layoutinfo layoutInfo = EObjectExtensions
.getNullableObject(toolboxFile,
t -> t.getLayoutDocumentRoot()
.getPlanProLayoutinfo())
.orElse(null);

if (layoutInfo == null) {
return;
}

final List<Lageplan_Blattschnitt> sheetCuts = layoutInfo
.getLageplanBlattschnitt();

if (sheetCuts.isEmpty()) {
result.addCustomProblem(new CustomValidationProblemImpl(
"Keine Blattschnitte vorhanden", //$NON-NLS-1$
ValidationSeverity.WARNING, this.validationType(), null,
ObjectScope.LAYOUT, ObjectState.NONE));
} else {
final EObjectXMLFinder nodeFinder = new EObjectXMLFinder(
toolboxFile, toolboxFile.getLayoutPath());
boolean anyProblems = false;
for (final Lageplan_Blattschnitt sheetCut : sheetCuts) {

final PlanProXMLNode node = nodeFinder.find(sheetCut);
final int line = node == null ? 0
: nodeFinder.getLineNumber(node);
final String objektArt = nodeFinder.getObjectType(node);

anyProblems |= isInvalidDirectionLine(result, nodeFinder,
sheetCut, line, objektArt);
anyProblems |= isInvalidPolygon(result, nodeFinder,
sheetCut, line, objektArt);
}

if (!anyProblems) {
Comment thread
TruongQuangSB marked this conversation as resolved.
result.addCustomProblem(getSuccessValidationReport(
String.format("%d Blattschnitte sind vorhanden", //$NON-NLS-1$
Integer.valueOf(sheetCuts.size()))));
}
}
} catch (final Exception ex) {
result.addCustomProblem(new CustomValidationProblemImpl(
"Blattschnitte konnten nicht geprüft werden", //$NON-NLS-1$
ValidationSeverity.WARNING, this.validationType(), null,
ObjectScope.LAYOUT, ObjectState.NONE));
}
}

private boolean isInvalidDirectionLine(final ValidationResult result,
final EObjectXMLFinder finder, final Lageplan_Blattschnitt sheetCut,
final int line, final String objektArt)
throws EObjectXMLFinder.LineNotFoundException {

final Polygonzug_Ausrichtung_TypeClass ausrichtung = sheetCut
.getPolygonzugAusrichtung();
final PlanProXMLNode ausrichtungsNode = finder.find(ausrichtung);
final int ausrichtungsLine = ausrichtungsNode == null ? line
: finder.getLineNumber(ausrichtungsNode);

final String wert = EObjectExtensions
.getNullableObject(sheetCut,
s -> s.getPolygonzugAusrichtung().getWert())
.orElse(null);

if (wert == null || wert.isBlank()) {
final CustomValidationProblemImpl problem = new CustomValidationProblemImpl(
"Blattschnitt ohne Ausrichtung", //$NON-NLS-1$
ValidationSeverity.WARNING, this.validationType(),
objektArt, ObjectScope.LAYOUT, ObjectState.NONE);
problem.setLineNumber(ausrichtungsLine);
result.addCustomProblem(problem);
Comment thread
linusbbb marked this conversation as resolved.
return true;
}
final String[] tokens = wert.trim().split("\\s+"); //$NON-NLS-1$
if (tokens.length != 4) {
final CustomValidationProblemImpl problem = new CustomValidationProblemImpl(
String.format("Ausrichtung hat %d Koordinaten (erwartet 4)", //$NON-NLS-1$
Integer.valueOf(tokens.length)),
ValidationSeverity.WARNING, this.validationType(),
objektArt, ObjectScope.LAYOUT, ObjectState.NONE);
problem.setLineNumber(ausrichtungsLine);
result.addCustomProblem(problem);
return true;
}
if (Arrays.stream(tokens).anyMatch(t -> !t.matches(NUMBER_REGEX))) {
final CustomValidationProblemImpl problem = new CustomValidationProblemImpl(
"Ausrichtung hat nicht numerische Koordinaten", //$NON-NLS-1$
ValidationSeverity.WARNING, this.validationType(),
objektArt, ObjectScope.LAYOUT, ObjectState.NONE);
problem.setLineNumber(ausrichtungsLine);
result.addCustomProblem(problem);
return true;
}
return false;
}

private boolean isInvalidPolygon(final ValidationResult result,
final EObjectXMLFinder finder, final Lageplan_Blattschnitt sheetCut,
final int line, final String objektArt)
throws EObjectXMLFinder.LineNotFoundException {
final Polygonzug_Blattschnitt_TypeClass polygon = sheetCut
.getPolygonzugBlattschnitt();
final PlanProXMLNode polygonNode = finder.find(polygon);
final int polygonLine = polygonNode == null ? line
: finder.getLineNumber(polygonNode);

final String polygonWert = EObjectExtensions
.getNullableObject(sheetCut,
s -> s.getPolygonzugBlattschnitt().getWert())
.orElse(null);
if (polygonWert == null || polygonWert.isBlank()) {
final CustomValidationProblemImpl problem = new CustomValidationProblemImpl(
"Blattschnitt ohne Polygon", //$NON-NLS-1$
ValidationSeverity.WARNING, this.validationType(),
objektArt, ObjectScope.LAYOUT, ObjectState.NONE);
problem.setLineNumber(polygonLine);
result.addCustomProblem(problem);
return true;
}

final String[] polygonTokens = polygonWert.trim().split("\\s+"); //$NON-NLS-1$
if (polygonTokens.length % 2 != 0) {
final CustomValidationProblemImpl problem = new CustomValidationProblemImpl(
String.format(
"Polygon hat %d Koordinaten (ungerade Anzahl)", //$NON-NLS-1$
Integer.valueOf(polygonTokens.length)),
ValidationSeverity.WARNING, this.validationType(),
objektArt, ObjectScope.LAYOUT, ObjectState.NONE);
problem.setLineNumber(polygonLine);
result.addCustomProblem(problem);
return true;
} else if (polygonTokens.length / 2 < 3) {
final CustomValidationProblemImpl problem = new CustomValidationProblemImpl(
String.format(
"Polygon hat %d Punkte, mindestens 3 erforderlich", //$NON-NLS-1$
Integer.valueOf(polygonTokens.length / 2)),
ValidationSeverity.WARNING, this.validationType(),
objektArt, ObjectScope.LAYOUT, ObjectState.NONE);
problem.setLineNumber(polygonLine);
result.addCustomProblem(problem);
return true;
}
if (Arrays.stream(polygonTokens)
.anyMatch(t -> !t.matches(NUMBER_REGEX))) {
final CustomValidationProblemImpl problem = new CustomValidationProblemImpl(
"Polygon hat nicht numerische Koordinaten", //$NON-NLS-1$
ValidationSeverity.WARNING, this.validationType(),
objektArt, ObjectScope.LAYOUT, ObjectState.NONE);
problem.setLineNumber(polygonLine);
result.addCustomProblem(problem);
return true;
}
return false;
}

@Override
public String validationType() {
return SHEET_CUT_VALIDATION_TYPE;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ class PlanProToTitleboxTransformation {
it.variant = "no-logo"
if (schriftfeld?.planungsbueroLogo?.anhangAllg?.dateiname?.wert !==
null) {
val logo = attachmentPathProvider.apply(
val logo = attachmentPathProvider?.apply(
schriftfeld?.planungsbueroLogo?.identitaet?.wert)?.
toAbsolutePath?.normalize?.toString ?: ''
val dimension = getImageDimension(logo,
Expand Down
Loading
Loading