Skip to content

Siteplan export and sheetcut validator - #2747

Open
linusbbb wants to merge 13 commits into
eclipse-set:mainfrom
linusbbb:siteplan-export-and-sheetcut-validator
Open

linusbbb wants to merge 13 commits into
eclipse-set:mainfrom
linusbbb:siteplan-export-and-sheetcut-validator

Conversation

@linusbbb

@linusbbb linusbbb commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

No description provided.

Comment thread web/siteplan/src/util/Controls/ExportControl.ts Outdated
linusbbb and others added 3 commits October 8, 2026 15:16
…e/set/ppmodel/extensions/utils/PlanProToTitleboxTransformation.xtend

Co-authored-by: TruongQuangSB <131350493+TruongQuangSB@users.noreply.github.com>
Comment on lines +71 to +107
final PlanProXMLNode node = nodeFinder.find(sheetCut);
final int line = node == null ? 0
: nodeFinder.getLineNumber(node);
final String objektArt = nodeFinder.getObjectType(node);

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

final String wert = ausrichtung == null ? null
: ausrichtung.getWert();
if (wert == null || wert.isBlank()) {
anyProblems = true;
final CustomValidationProblemImpl problem = new CustomValidationProblemImpl(
"Blattschnitt ohne Ausrichtung", //$NON-NLS-1$
ValidationSeverity.WARNING,
this.validationType(), objektArt, null, null);
problem.setLineNumber(ausrichtungsLine);
result.addCustomProblem(problem);
} else {
final String[] tokens = wert.trim().split("\\s+"); //$NON-NLS-1$
if (tokens.length != 4) {
anyProblems = true;
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, null,
null);
problem.setLineNumber(ausrichtungsLine);
result.addCustomProblem(problem);
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@linusbbb For better readability and easier debugging, consider extracting this validation into a separate method, such as validateDirectionLine.

problem.setLineNumber(ausrichtungsLine);
result.addCustomProblem(problem);
} else {
final String[] tokens = wert.trim().split("\\s+"); //$NON-NLS-1$

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@linusbbb the coordinaten string should also check, if this a number

}
}

if (!anyProblems) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (!anyProblems) {
if (result.isEmpty()) {

@linusbbb you can simple check if the list empty or not, when empty, then that mean no error

Comment on lines +109 to +153
final Polygonzug_Blattschnitt_TypeClass polygon = sheetCut
.getPolygonzugBlattschnitt();
final PlanProXMLNode polygonNode = nodeFinder.find(polygon);
final int polygonLine = polygonNode == null ? line
: nodeFinder.getLineNumber(polygonNode);

final String polygonWert = polygon == null ? null
: polygon.getWert();
if (polygonWert == null || polygonWert.isBlank()) {
anyProblems = true;
final CustomValidationProblemImpl problem = new CustomValidationProblemImpl(
"Blattschnitt ohne Polygon", //$NON-NLS-1$
ValidationSeverity.WARNING,
this.validationType(), objektArt, null, null);
problem.setLineNumber(polygonLine);
result.addCustomProblem(problem);
} else {
final String[] polygonTokens = polygonWert.trim()
.split("\\s+"); //$NON-NLS-1$
if (polygonTokens.length % 2 != 0) {
anyProblems = true;
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, null,
null);
problem.setLineNumber(polygonLine);
result.addCustomProblem(problem);
} else if (polygonTokens.length / 2 < 3) {
anyProblems = true;
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, null,
null);
problem.setLineNumber(polygonLine);
result.addCustomProblem(problem);
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@linusbbb same here, better separate methode

Comment on lines +71 to +84
final PlanProXMLNode node = nodeFinder.find(sheetCut);
final int line = node == null ? 0
: nodeFinder.getLineNumber(node);
final String objektArt = nodeFinder.getObjectType(node);

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

final String wert = ausrichtung == null ? null
: ausrichtung.getWert();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@linusbbb u can use org.eclipse.set.ppmodel.extensions.EObjectExtensions.getNullableObject(sheetcut, s -> s.getPolygonzugAusrichtung().getWert()) to avoid more times null check

"Blattschnitt ohne Ausrichtung", //$NON-NLS-1$
ValidationSeverity.WARNING,
this.validationType(), objektArt, null, null);
problem.setLineNumber(ausrichtungsLine);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@linusbbb when it is missing the information, then don't need define the linenumber

Comment on lines +126 to +127
final String[] polygonTokens = polygonWert.trim()
.split("\\s+"); //$NON-NLS-1$

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@linusbbb like oben, the polygon coordinate should be also validate

…e/set/ppmodel/extensions/utils/PlanProToTitleboxTransformation.xtend

Co-authored-by: TruongQuangSB <131350493+TruongQuangSB@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants