From 82c14d460e3cf906d8058bb0fa04139530cba82a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pascal=20St=C3=BCcker?= <stuecker.pascal@scheidt-bachmann-st.de> Date: Fri, 24 Feb 2023 13:56:36 +0100 Subject: [PATCH 1/9] Fix Sslr.Abhaengigkeiten.FwWeichen_mit_Fla only showing first level crossing --- ....table.pt1.sslr.SslrDescriptionService.xml | 8 + ...ble.pt1.sslr.SslrTransformationService.xml | 10 + .../table/pt1/sskf/SskfTransformator.xtend | 2 +- .../feature/table/pt1/sslr/SslrColumns.java | 105 ++++++ .../pt1/sslr/SslrDescriptionService.java | 37 +++ .../pt1/sslr/SslrTransformationService.java | 67 ++++ .../table/pt1/sslr/SslrTransformator.xtend | 311 ++++++++++++++++++ .../extensions/FmaAnlageExtensions.xtend | 18 +- .../extensions/FstrZugRangierExtensions.xtend | 14 +- 9 files changed, 547 insertions(+), 25 deletions(-) create mode 100644 java/bundles/org.eclipse.set.feature.table.pt1/OSGI-INF/org.eclipse.set.feature.table.pt1.sslr.SslrDescriptionService.xml create mode 100644 java/bundles/org.eclipse.set.feature.table.pt1/OSGI-INF/org.eclipse.set.feature.table.pt1.sslr.SslrTransformationService.xml create mode 100644 java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sslr/SslrColumns.java create mode 100644 java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sslr/SslrDescriptionService.java create mode 100644 java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sslr/SslrTransformationService.java create mode 100644 java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sslr/SslrTransformator.xtend diff --git a/java/bundles/org.eclipse.set.feature.table.pt1/OSGI-INF/org.eclipse.set.feature.table.pt1.sslr.SslrDescriptionService.xml b/java/bundles/org.eclipse.set.feature.table.pt1/OSGI-INF/org.eclipse.set.feature.table.pt1.sslr.SslrDescriptionService.xml new file mode 100644 index 000000000..9ef68b20d --- /dev/null +++ b/java/bundles/org.eclipse.set.feature.table.pt1/OSGI-INF/org.eclipse.set.feature.table.pt1.sslr.SslrDescriptionService.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.3.0" name="org.eclipse.set.feature.table.pt1.sslr.SslrDescriptionService"> + <service> + <provide interface="org.eclipse.set.core.services.part.PartDescriptionService"/> + </service> + <reference cardinality="1..1" field="messages" interface="org.eclipse.set.feature.table.pt1.messages.Messages" name="messages"/> + <implementation class="org.eclipse.set.feature.table.pt1.sslr.SslrDescriptionService"/> +</scr:component> \ No newline at end of file diff --git a/java/bundles/org.eclipse.set.feature.table.pt1/OSGI-INF/org.eclipse.set.feature.table.pt1.sslr.SslrTransformationService.xml b/java/bundles/org.eclipse.set.feature.table.pt1/OSGI-INF/org.eclipse.set.feature.table.pt1.sslr.SslrTransformationService.xml new file mode 100644 index 000000000..53dc1f94b --- /dev/null +++ b/java/bundles/org.eclipse.set.feature.table.pt1/OSGI-INF/org.eclipse.set.feature.table.pt1.sslr.SslrTransformationService.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.3.0" immediate="true" name="org.eclipse.set.feature.table.pt1.sslr.SslrTransformationService"> + <property name="table.shortcut" value="sslr"/> + <service> + <provide interface="org.eclipse.set.feature.table.PlanPro2TableTransformationService"/> + </service> + <reference cardinality="1..1" field="enumTranslationService" interface="org.eclipse.set.core.services.enumtranslation.EnumTranslationService" name="enumTranslationService"/> + <reference cardinality="1..1" field="messages" interface="org.eclipse.set.feature.table.pt1.messages.Messages" name="messages"/> + <implementation class="org.eclipse.set.feature.table.pt1.sslr.SslrTransformationService"/> +</scr:component> \ No newline at end of file diff --git a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sskf/SskfTransformator.xtend b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sskf/SskfTransformator.xtend index 226c74c14..7eb4f8e44 100644 --- a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sskf/SskfTransformator.xtend +++ b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sskf/SskfTransformator.xtend @@ -221,7 +221,7 @@ class SskfTransformator extends AbstractPlanPro2TableModelTransformator { cols.getColumn(Sonstiges_Weiche), fmaAnlage, [ - weichen.value = gleisabschnitt.filterContained( + weichen.value = IDGleisAbschnitt.filterContained( container.WKrGspKomponente ).map[WKrGspElement] diff --git a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sslr/SslrColumns.java b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sslr/SslrColumns.java new file mode 100644 index 000000000..1999bbaa8 --- /dev/null +++ b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sslr/SslrColumns.java @@ -0,0 +1,105 @@ +/** + * Copyright (c) 2023 DB Netz AG and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + */ + +package org.eclipse.set.feature.table.pt1.sslr; + +/** + * Symbolic addressing for Sslr columns. + * + * @author truong + * + */ +@SuppressWarnings("nls") +public class SslrColumns { + + /** + * Sslr.Grundsatzangaben.Bezeichnung + */ + public static final String Bezeichnung = "A"; + + /** + * Sslr.Grundsatzangaben.Fahrweg.Start + */ + public static final String Fahrweg_Start = "B"; + + /** + * Sslr.Grundsatzangaben.Fahrweg.Ziel + */ + public static final String Fahrweg_Ziel = "C"; + + /** + * Sslr.Grundsatzangaben.Fahrweg.Nummer + */ + public static final String Fahrweg_Nummer = "D"; + + /** + * Sslr.Grundsatzangaben.Fahrweg.Entscheidungsweiche + */ + public static final String Fahrweg_Entscheidungsweiche = "E"; + + /** + * Sslr.Grundsatzangaben.Art + */ + public static final String Art = "F"; + + /** + * Sslr.Einstellung.Autom_Einstellung + */ + public static final String Autom_Einstellung = "G"; + + /** + * Sslr.Einstellung.F_Bedienung + */ + public static final String F_Bedienung = "H"; + + /** + * Sslr.Abhaengigkeiten.Inselgleis.Bezeichnung + */ + public static final String Inselgleis_Bezeichnung = "I"; + + /** + * Sslr.Abhaengigkeiten.Inselgleis.Gegenfahrtausschluss + */ + public static final String Inselgleis_Gegenfahrtausschluss = "J"; + + /** + * Sslr.Abhaengigkeiten.Gleisfreimeldung + */ + public static final String Gleisfreimeldung = "K"; + + /** + * Sslr.Abhaengigkeiten.FwWeichen_mit_Fla + */ + public static final String FwWeichen_mit_Fla = "L"; + + /** + * Sslr.Abhaengigkeiten.Ueberwachte_Ssp + */ + public static final String Ueberwachte_Ssp = "M"; + + /** + * Sslr.Abhaengigkeiten.Abhaengiger_BUe + */ + public static final String Abhaengiger_BUe = "N"; + + /** + * Sslr.Abhaengigkeiten.Ziel_erlaubnisabh + */ + public static final String Ziel_erlaubnisabh = "O"; + + /** + * Sslr.Abhaengigkeiten.Aufloes_Fstr + */ + public static final String Aufloes_Fstr = "P"; + + /** + * Sslr.Bemerkung + */ + public static final String Bemerkung = "Q"; +} diff --git a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sslr/SslrDescriptionService.java b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sslr/SslrDescriptionService.java new file mode 100644 index 000000000..b1cc10660 --- /dev/null +++ b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sslr/SslrDescriptionService.java @@ -0,0 +1,37 @@ +/** + * Copyright (c) 2020 DB Netz AG and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + */ + +package org.eclipse.set.feature.table.pt1.sslr; + +import org.eclipse.set.core.services.part.PartDescriptionService; +import org.eclipse.set.feature.table.AbstractTableDescription; +import org.eclipse.set.feature.table.pt1.messages.Messages; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Reference; + +/** + * Part description for SSKS table view. + * + * @author Schaefer + */ +@Component(service = PartDescriptionService.class) +public class SslrDescriptionService extends AbstractTableDescription { + @Reference + Messages messages; + + @Override + protected String getToolboxViewName() { + return messages.SslrDescriptionService_ViewName; + } + + @Override + protected String getToolboxViewTooltip() { + return messages.SslrDescriptionService_ViewTooltip; + } +} diff --git a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sslr/SslrTransformationService.java b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sslr/SslrTransformationService.java new file mode 100644 index 000000000..482694646 --- /dev/null +++ b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sslr/SslrTransformationService.java @@ -0,0 +1,67 @@ +/** + * Copyright (c) 2016 DB Netz AG and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + */ +package org.eclipse.set.feature.table.pt1.sslr; + +import static org.eclipse.nebula.widgets.nattable.sort.SortDirectionEnum.ASC; +import static org.eclipse.set.utils.table.sorting.ComparatorBuilder.CellComparatorType.MIXED_STRING; + +import java.util.Comparator; + +import org.eclipse.set.core.services.enumtranslation.EnumTranslationService; +import org.eclipse.set.feature.table.PlanPro2TableTransformationService; +import org.eclipse.set.feature.table.pt1.AbstractPlanPro2TableModelTransformator; +import org.eclipse.set.feature.table.pt1.AbstractPlanPro2TableTransformationService; +import org.eclipse.set.feature.table.pt1.messages.Messages; +import org.eclipse.set.model.tablemodel.RowGroup; +import org.eclipse.set.ppmodel.extensions.utils.TableNameInfo; +import org.eclipse.set.utils.table.sorting.TableRowGroupComparator; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Reference; + +/** + * Service for creating the sslr table model. + * + * @author Schneider/Schaefer + * + * @usage production + */ +@Component(service = { + PlanPro2TableTransformationService.class }, immediate = true, property = { + "table.shortcut=sslr" }) +public class SslrTransformationService + extends AbstractPlanPro2TableTransformationService { + @Reference + private Messages messages; + @Reference + private EnumTranslationService enumTranslationService; + + @Override + public AbstractPlanPro2TableModelTransformator createTransformator() { + return new SslrTransformator(cols, enumTranslationService); + } + + @Override + public Comparator<RowGroup> getRowGroupComparator() { + return TableRowGroupComparator.builder().sort("B", MIXED_STRING, ASC) //$NON-NLS-1$ + .sort("C", MIXED_STRING, ASC) //$NON-NLS-1$ + .sort("D", MIXED_STRING, ASC).build(); //$NON-NLS-1$ + } + + @Override + public TableNameInfo getTableNameInfo() { + return new TableNameInfo(messages.ToolboxTableNameSslrLong, + messages.ToolboxTableNameSslrPlanningNumber, + messages.ToolboxTableNameSslrShort); + } + + @Override + protected String getTableHeading() { + return messages.Sslr_Heading; + } +} diff --git a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sslr/SslrTransformator.xtend b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sslr/SslrTransformator.xtend new file mode 100644 index 000000000..2fd939325 --- /dev/null +++ b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sslr/SslrTransformator.xtend @@ -0,0 +1,311 @@ +/** + * Copyright (c) 2016 DB Netz AG and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + */ +package org.eclipse.set.feature.table.pt1.sslr + +import java.math.BigInteger +import java.util.Collections +import org.eclipse.set.core.services.enumtranslation.EnumTranslationService +import org.eclipse.set.feature.table.pt1.AbstractPlanPro2TableModelTransformator +import org.eclipse.set.model.tablemodel.Table +import org.eclipse.set.model.tablemodel.TableRow +import org.eclipse.set.model.tablemodel.format.TextAlignment +import org.eclipse.set.ppmodel.extensions.container.MultiContainer_AttributeGroup +import org.eclipse.set.ppmodel.extensions.utils.Case +import org.eclipse.set.toolboxmodel.Fahrstrasse.Fstr_Zug_Rangier +import org.eclipse.set.toolboxmodel.Weichen_und_Gleissperren.W_Kr_Gsp_Element +import org.eclipse.set.utils.table.TMFactory + +import static org.eclipse.set.toolboxmodel.Fahrstrasse.ENUMRangierGegenfahrtausschluss.* + +import static extension org.eclipse.set.model.tablemodel.extensions.TableExtensions.* +import static extension org.eclipse.set.ppmodel.extensions.BasisAttributExtensions.* +import static extension org.eclipse.set.ppmodel.extensions.BedienAnzeigeElementExtensions.* +import static extension org.eclipse.set.ppmodel.extensions.BereichObjektExtensions.* +import static extension org.eclipse.set.ppmodel.extensions.FahrwegExtensions.* +import static extension org.eclipse.set.ppmodel.extensions.FlaSchutzExtensions.* +import static extension org.eclipse.set.ppmodel.extensions.FmaAnlageExtensions.* +import static extension org.eclipse.set.ppmodel.extensions.FstrAbhaengigkeitExtensions.* +import static extension org.eclipse.set.ppmodel.extensions.FstrRangierFlaZuordnungExtensions.* +import static extension org.eclipse.set.ppmodel.extensions.FstrZugRangierExtensions.* +import static extension org.eclipse.set.ppmodel.extensions.SignalExtensions.* +import static org.eclipse.set.feature.table.pt1.sslr.SslrColumns.* +import java.util.Set +import org.eclipse.set.model.tablemodel.ColumnDescriptor + +/** + * Table transformation for a Rangierstraßentabelle (Sslr). + * + * @author Schneider/Schaefer + */ +class SslrTransformator extends AbstractPlanPro2TableModelTransformator { + + var TMFactory factory = null + + new(Set<ColumnDescriptor> cols, + EnumTranslationService enumTranslationService) { + super(cols, enumTranslationService) + } + + override transformTableContent(MultiContainer_AttributeGroup container, + TMFactory factory) { + this.factory = factory + return container.transform + } + + private def Table create factory.table transform( + MultiContainer_AttributeGroup container) { + container.fstrZugRangier.filter[generalbedingung].forEach [ it | + if (Thread.currentThread.interrupted) { + return + } + it.transform + ] + return + } + + private def TableRow create factory.newTableRow(fstrZugRangier) transform( + Fstr_Zug_Rangier fstrZugRangier) { + val fstrFahrwegStartSignalBezeichnung = fstrZugRangier.fstrFahrweg?. + start?.bezeichnung?.bezeichnungTabelle?.wert ?: "" + val fstrFahrwegZielSignalBezeichnung = fstrZugRangier.fstrFahrweg?. + zielSignal?.bezeichnung?.bezeichnungTabelle?.wert ?: "" + val row = it + + // A: Sslr.Grundsatzangaben.Bezeichnung + fillSwitch( + cols.getColumn(Bezeichnung), + fstrZugRangier, + new Case<Fstr_Zug_Rangier>( + [ + fstrZugRangierAllg?.fstrReihenfolge?.wert.compareTo( + BigInteger.ZERO) == 0 + ], + [ + '''«fstrFahrwegStartSignalBezeichnung»/«fstrFahrwegZielSignalBezeichnung»''' + ] + ), + new Case<Fstr_Zug_Rangier>( + [ + fstrZugRangierAllg?.fstrReihenfolge?.wert.compareTo( + BigInteger.ZERO) > 0 + ], + [ + '''«fstrFahrwegStartSignalBezeichnung»/«fstrFahrwegZielSignalBezeichnung» [U«fstrZugRangierAllg.fstrReihenfolge.wert.toString»]''' + ] + ) + ) + + // B: Sslr.Grundsatzangaben.Fahrweg.Start + fill( + cols.getColumn(Fahrweg_Start), + fstrZugRangier, + [fstrFahrwegStartSignalBezeichnung] + ) + + // C: Sslr.Grundsatzangaben.Fahrweg.Ziel + fill( + cols.getColumn(Fahrweg_Ziel), + fstrZugRangier, + [fstrFahrwegZielSignalBezeichnung] + ) + + // D: Sslr.Grundsatzangaben.Fahrweg.Nummer + fillConditional( + cols.getColumn(Fahrweg_Nummer), + fstrZugRangier, + [ + fstrZugRangierAllg?.fstrReihenfolge?.wert.compareTo( + BigInteger.ZERO) > 0 + ], + [fstrZugRangierAllg.fstrReihenfolge.wert.toString] + ) + + // E: Sslr.Grundsatzangaben.Fahrweg.Entscheidungsweiche + fillIterable( + cols.getColumn(Fahrweg_Entscheidungsweiche), + fstrZugRangier, + [getEntscheidungsweichen(newLinkedList()).map[bezeichnung]], + MIXED_STRING_COMPARATOR, + [it] + ) + + // F: Sslr.Grundsatzangaben.Art + fill( + cols.getColumn(Art), + fstrZugRangier, + [ + fstrRangier?.fstrRangierArt?.wert?.translate?.substring(0,1) + ] + ) + + // G: Sslr.Einstellung.Autom_Einstellung + fill( + cols.getColumn(Autom_Einstellung), + fstrZugRangier, + [fstrZug?.automatischeEinstellung?.wert?.translate] + ) + + // H: Sslr.Einstellung.F_Bedienung + fill( + cols.getColumn(F_Bedienung), + fstrZugRangier, + [fstrZugRangierAllg?.FBedienung?.wert?.translate] + ) + + // I: Sslr.Abhaengigkeiten.Inselgleis.Bezeichnung + val raFahrtGleichzeitigVerbot = fstrZugRangier?.fstrFahrweg?. + zielSignal?.raFahrtGleichzeitigVerbot ?: Collections.emptySet + fillSwitch( + cols.getColumn(Inselgleis_Bezeichnung), + fstrZugRangier, + new Case<Fstr_Zug_Rangier>( + [!raFahrtGleichzeitigVerbot.empty], + [ + raFahrtGleichzeitigVerbot.map [ + bezeichnung?.bezGleisBezeichnung?.wert + ].getIterableFilling(MIXED_STRING_COMPARATOR) + ] + ), + new Case<Fstr_Zug_Rangier>( + [ + #{ + ENUM_RANGIER_GEGENFAHRTAUSSCHLUSS_JA, + ENUM_RANGIER_GEGENFAHRTAUSSCHLUSS_INSELGLEIS_FREI + }.contains(fstrRangier?.rangierGegenfahrtausschluss?.wert) + ], + [ + fstrZugRangier.container.gleisBezeichnung.filter [ + intersects(fstrZugRangier?.fstrFahrweg?.zielSignal) + ].map[bezeichnung?.bezGleisBezeichnung?.wert]. + getIterableFilling(MIXED_STRING_COMPARATOR) + ] + ) + ) + + // J: Sslr.Abhaengigkeiten.Inselgleis.Gegenfahrtausschluss + fill( + cols.getColumn(Inselgleis_Gegenfahrtausschluss), + fstrZugRangier, + [ + val gegenfahrtausschluss = fstrRangier?. + rangierGegenfahrtausschluss?.wert + if (gegenfahrtausschluss === null) + return null + switch (gegenfahrtausschluss) { + case ENUM_RANGIER_GEGENFAHRTAUSSCHLUSS_INSELGLEIS_FREI: return "Inselgleis frei" + case ENUM_RANGIER_GEGENFAHRTAUSSCHLUSS_JA: return "x" + case ENUM_RANGIER_GEGENFAHRTAUSSCHLUSS_NEIN: return "o" + } + ] + ) + + // K: Sslr.Abhaengigkeiten.Gleisfreimeldung + fillIterable( + cols.getColumn(Gleisfreimeldung), + fstrZugRangier, + [ + fmaAnlageRangierFrei?.map [ + gleisabschnitt?.bezeichnung?.bezeichnungTabelle?.wert + ].toSet + ], + MIXED_STRING_COMPARATOR + ) + + // L: Sslr.Abhaengigkeiten.FwWeichen_mit_Fla + fill( + cols.getColumn(FwWeichen_mit_Fla), + fstrZugRangier, + [ + (fstrRangierFlaZuordnung?.flaSchutz?. + anforderer as W_Kr_Gsp_Element)?.bezeichnung?. + bezeichnungTabelle?.wert + ] + ) + + // M: Sslr.Abhaengigkeiten.Ueberwachte_Ssp + fillIterable( + cols.getColumn(Ueberwachte_Ssp), + fstrZugRangier, + [ + fstrFahrweg?.abhaengigkeiten.map [ + val ssp = schluesselsperre?.bezeichnung?. + bezeichnungTabelle?.wert + val aufloesungZielgleis = fstrAbhaengigkeitSsp?. + aufloesungSspZielgleis?.wert?.translate + '''«ssp» («aufloesungZielgleis»)''' + ] + ], + MIXED_STRING_COMPARATOR + ) + + // N: Sslr.Abhaengigkeiten.Abhaengiger_BUe + fillIterable( + cols.getColumn(Abhaengiger_BUe), + fstrZugRangier, + [fstrFahrweg.BUes.map[bezeichnung.bezeichnungTabelle.wert]], + MIXED_STRING_COMPARATOR, + [it] + ) + + // O: Sslr.Abhaengigkeiten.Ziel_erlaubnisabh + fill( + cols.getColumn(Ziel_erlaubnisabh), + fstrZugRangier, + [ + (fstrFahrweg?.zielSignal?.signalFstr?. + IDRaZielErlaubnisabhaengig?.identitaet?.wert !== null). + translate + ] + ) + + // P: Sslr.Abhaengigkeiten.Aufloes_Fstr + fill( + cols.getColumn(Aufloes_Fstr), + fstrZugRangier, + [ + fstrFahrweg?.start?.signalFstr?.rangierstrasseRestaufloesung?. + wert?.translate + ] + ) + + // Q: Sslr.Bemerkung + fill( + cols.getColumn(Bemerkung), + fstrZugRangier, + [ + val bedAnzeigeElemente = fstrFahrweg?.abhaengigkeiten?.map [ + bedienAnzeigeElement + ]?.filterNull ?: Collections.emptyList + val footnotes = footnoteTransformation.transform(it, row) + '''«FOR bae : bedAnzeigeElemente.map[comment[translate]].filterNull SEPARATOR ", "»«bae»«ENDFOR» «footnotes»'''. + toString.trim + ] + ) + return + } + + private def boolean getGeneralbedingung(Fstr_Zug_Rangier fstrZugRangier) { + return fstrZugRangier?.fstrRangier.fstrRangierArt.wert?.literal?. + substring(0, 1) == "R" + } + + override void formatTableContent(Table table) { + // A: Sslr.Grundsatzangaben.Bezeichnung + table.setTextAlignment(0, TextAlignment.LEFT); + + // B: Sslr.Grundsatzangaben.Fahrweg.Start + table.setTextAlignment(1, TextAlignment.LEFT); + + // C: Sslr.Grundsatzangaben.Fahrweg.Ziel + table.setTextAlignment(2, TextAlignment.LEFT); + + // Q: Sslr.Bemerkung + table.setTextAlignment(15, TextAlignment.LEFT); + } +} diff --git a/java/bundles/org.eclipse.set.ppmodel.extensions/src/org/eclipse/set/ppmodel/extensions/FmaAnlageExtensions.xtend b/java/bundles/org.eclipse.set.ppmodel.extensions/src/org/eclipse/set/ppmodel/extensions/FmaAnlageExtensions.xtend index d87d25271..ee6742838 100644 --- a/java/bundles/org.eclipse.set.ppmodel.extensions/src/org/eclipse/set/ppmodel/extensions/FmaAnlageExtensions.xtend +++ b/java/bundles/org.eclipse.set.ppmodel.extensions/src/org/eclipse/set/ppmodel/extensions/FmaAnlageExtensions.xtend @@ -11,7 +11,6 @@ package org.eclipse.set.ppmodel.extensions import java.util.List import java.util.Set import org.eclipse.set.toolboxmodel.Basisobjekte.Punkt_Objekt -import org.eclipse.set.toolboxmodel.Gleis.Gleis_Abschnitt import org.eclipse.set.toolboxmodel.Gleis.Gleis_Schaltgruppe import org.eclipse.set.toolboxmodel.Ortung.FMA_Anlage import org.eclipse.set.toolboxmodel.Ortung.FMA_Komponente @@ -26,15 +25,6 @@ import static extension org.eclipse.set.ppmodel.extensions.FmaKomponenteExtensio */ class FmaAnlageExtensions extends BasisObjektExtensions { - /** - * @param anlage this FMA Anlage - * - * @returns the observed Gleisabschnitt of this FMA Anlage - */ - def static Gleis_Abschnitt getGleisabschnitt(FMA_Anlage anlage) { - return anlage.IDGleisAbschnitt - } - /** * @param anlage the fma anlage * @@ -62,7 +52,7 @@ class FmaAnlageExtensions extends BasisObjektExtensions { * @returns the Gleisabschlüsse of this FMA Anlage */ def static Set<Gleis_Abschluss> getGleisAbschluesse(FMA_Anlage anlage) { - return anlage.gleisabschnitt.filterContained( + return anlage.IDGleisAbschnitt.filterContained( anlage.container.gleisAbschluss).toSet } @@ -72,7 +62,7 @@ class FmaAnlageExtensions extends BasisObjektExtensions { * @returns the table name of this FMA Anlage */ def static String getTableName(FMA_Anlage anlage) { - val name = anlage.gleisabschnitt.bezeichnung.bezeichnungTabelle.wert + val name = anlage.IDGleisAbschnitt.bezeichnung.bezeichnungTabelle.wert var kaskadeBez = anlage?.FMAAnlageKaskade?.FMAKaskadeBezeichnung?.wert if (kaskadeBez === null) { kaskadeBez = "" @@ -87,7 +77,7 @@ class FmaAnlageExtensions extends BasisObjektExtensions { * @returns the BZ-Bezeichner of this FMA Anlage */ def static String getBzBezeichner(FMA_Anlage anlage) { - val gleisabschnitt = anlage.gleisabschnitt + val gleisabschnitt = anlage.IDGleisAbschnitt val kennzahl = gleisabschnitt?.bezeichnung?.kennzahl?.wert val kennbuchstabe = anlage?.bezeichnung?.bezeichnungKennbuchstabe?. wert?.toString @@ -116,7 +106,7 @@ class FmaAnlageExtensions extends BasisObjektExtensions { */ def static List<Gleis_Schaltgruppe> getGleisSchaltgruppen( FMA_Anlage anlage) { - val gleisabschnitt = anlage.gleisabschnitt + val gleisabschnitt = anlage.IDGleisAbschnitt return anlage.container.gleisSchaltgruppe.filter [ intersectsStrictly(gleisabschnitt) ].toList diff --git a/java/bundles/org.eclipse.set.ppmodel.extensions/src/org/eclipse/set/ppmodel/extensions/FstrZugRangierExtensions.xtend b/java/bundles/org.eclipse.set.ppmodel.extensions/src/org/eclipse/set/ppmodel/extensions/FstrZugRangierExtensions.xtend index b60a8ec47..9b0b6b604 100644 --- a/java/bundles/org.eclipse.set.ppmodel.extensions/src/org/eclipse/set/ppmodel/extensions/FstrZugRangierExtensions.xtend +++ b/java/bundles/org.eclipse.set.ppmodel.extensions/src/org/eclipse/set/ppmodel/extensions/FstrZugRangierExtensions.xtend @@ -94,17 +94,11 @@ class FstrZugRangierExtensions extends BasisObjektExtensions { * * @returns the Fstr_Rangier_Fla_Zuordnung */ - def static Fstr_Rangier_Fla_Zuordnung getFstrRangierFlaZuordnung( + def static Iterable<Fstr_Rangier_Fla_Zuordnung> getFstrRangierFlaZuordnung( Fstr_Zug_Rangier fstrZugRangier) { - - for (fstrRangierFla : fstrZugRangier.container. - fstrRangierFlaZuordnung) { - if (fstrRangierFla?.IDFstrRangier?.identitaet?.wert == - fstrZugRangier.identitaet.wert) { - return fstrRangierFla; - } - } - return null; + return fstrZugRangier.container.fstrRangierFlaZuordnung.filter [ + IDFstrRangier === fstrZugRangier + ] } /** -- GitLab From 7a71dc3d7ce8da97b439bac90c571dab5bde6564 Mon Sep 17 00:00:00 2001 From: Quang Truong <truong.quang@scheidt-bachmann-st.de> Date: Mon, 20 Mar 2023 16:39:34 +0100 Subject: [PATCH 2/9] set#48 adjust & enable table sslr --- .../META-INF/MANIFEST.MF | 2 + .../table/pt1/sslr/SslrTransformator.xtend | 79 ++++++++++++++++--- .../extensions/FstrZugRangierExtensions.xtend | 58 +++++++++++++- 3 files changed, 126 insertions(+), 13 deletions(-) diff --git a/java/bundles/org.eclipse.set.feature.table.pt1/META-INF/MANIFEST.MF b/java/bundles/org.eclipse.set.feature.table.pt1/META-INF/MANIFEST.MF index fe9e476a3..094f5d60f 100644 --- a/java/bundles/org.eclipse.set.feature.table.pt1/META-INF/MANIFEST.MF +++ b/java/bundles/org.eclipse.set.feature.table.pt1/META-INF/MANIFEST.MF @@ -104,5 +104,7 @@ Service-Component: OSGI-INF/org.eclipse.set.feature.table.pt1.messages.Messages. OSGI-INF/org.eclipse.set.feature.table.pt1.sslb.SslbTransformationService.xml, OSGI-INF/org.eclipse.set.feature.table.pt1.ssli.SsliDescriptionService.xml, OSGI-INF/org.eclipse.set.feature.table.pt1.ssli.SsliTransformationService.xml, + OSGI-INF/org.eclipse.set.feature.table.pt1.sslr.SslrDescriptionService.xml, + OSGI-INF/org.eclipse.set.feature.table.pt1.sslr.SslrTransformationService.xml, OSGI-INF/org.eclipse.set.feature.table.pt1.ssvu.SsvuDescriptionService.xml, OSGI-INF/org.eclipse.set.feature.table.pt1.ssvu.SsvuTransformationService.xml diff --git a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sslr/SslrTransformator.xtend b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sslr/SslrTransformator.xtend index 2fd939325..56562f8a8 100644 --- a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sslr/SslrTransformator.xtend +++ b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sslr/SslrTransformator.xtend @@ -10,8 +10,10 @@ package org.eclipse.set.feature.table.pt1.sslr import java.math.BigInteger import java.util.Collections +import java.util.Set import org.eclipse.set.core.services.enumtranslation.EnumTranslationService import org.eclipse.set.feature.table.pt1.AbstractPlanPro2TableModelTransformator +import org.eclipse.set.model.tablemodel.ColumnDescriptor import org.eclipse.set.model.tablemodel.Table import org.eclipse.set.model.tablemodel.TableRow import org.eclipse.set.model.tablemodel.format.TextAlignment @@ -21,6 +23,7 @@ import org.eclipse.set.toolboxmodel.Fahrstrasse.Fstr_Zug_Rangier import org.eclipse.set.toolboxmodel.Weichen_und_Gleissperren.W_Kr_Gsp_Element import org.eclipse.set.utils.table.TMFactory +import static org.eclipse.set.feature.table.pt1.sslr.SslrColumns.* import static org.eclipse.set.toolboxmodel.Fahrstrasse.ENUMRangierGegenfahrtausschluss.* import static extension org.eclipse.set.model.tablemodel.extensions.TableExtensions.* @@ -29,14 +32,10 @@ import static extension org.eclipse.set.ppmodel.extensions.BedienAnzeigeElementE import static extension org.eclipse.set.ppmodel.extensions.BereichObjektExtensions.* import static extension org.eclipse.set.ppmodel.extensions.FahrwegExtensions.* import static extension org.eclipse.set.ppmodel.extensions.FlaSchutzExtensions.* -import static extension org.eclipse.set.ppmodel.extensions.FmaAnlageExtensions.* import static extension org.eclipse.set.ppmodel.extensions.FstrAbhaengigkeitExtensions.* import static extension org.eclipse.set.ppmodel.extensions.FstrRangierFlaZuordnungExtensions.* import static extension org.eclipse.set.ppmodel.extensions.FstrZugRangierExtensions.* import static extension org.eclipse.set.ppmodel.extensions.SignalExtensions.* -import static org.eclipse.set.feature.table.pt1.sslr.SslrColumns.* -import java.util.Set -import org.eclipse.set.model.tablemodel.ColumnDescriptor /** * Table transformation for a Rangierstraßentabelle (Sslr). @@ -140,7 +139,7 @@ class SslrTransformator extends AbstractPlanPro2TableModelTransformator { cols.getColumn(Art), fstrZugRangier, [ - fstrRangier?.fstrRangierArt?.wert?.translate?.substring(0,1) + fstrRangier?.fstrRangierArt?.wert?.translate?.substring(0, 1) ] ) @@ -211,21 +210,24 @@ class SslrTransformator extends AbstractPlanPro2TableModelTransformator { fstrZugRangier, [ fmaAnlageRangierFrei?.map [ - gleisabschnitt?.bezeichnung?.bezeichnungTabelle?.wert + IDGleisAbschnitt?.bezeichnung?.bezeichnungTabelle?.wert ].toSet ], MIXED_STRING_COMPARATOR ) // L: Sslr.Abhaengigkeiten.FwWeichen_mit_Fla - fill( + fillIterable( cols.getColumn(FwWeichen_mit_Fla), fstrZugRangier, [ - (fstrRangierFlaZuordnung?.flaSchutz?. - anforderer as W_Kr_Gsp_Element)?.bezeichnung?. - bezeichnungTabelle?.wert - ] + fstrRangierFlaZuordnung?.map [ + (flaSchutz?.anforderer as W_Kr_Gsp_Element)?.bezeichnung?. + bezeichnungTabelle?.wert + ] + + ], + MIXED_STRING_COMPARATOR ) // M: Sslr.Abhaengigkeiten.Ueberwachte_Ssp @@ -287,11 +289,64 @@ class SslrTransformator extends AbstractPlanPro2TableModelTransformator { toString.trim ] ) + + val bedAnzeigeElemente = fstrZugRangier.fstrFahrweg?.abhaengigkeiten?. + map [ + bedienAnzeigeElement + ]?.filterNull ?: Collections.emptyList + + val besondersRangierFstrs = fstrZugRangier.IDFstrAusschlussBesonders?.filter[ + generalbedingung + ]?.filterNull ?: Collections.emptyList + + val zugFstrs = fstrZugRangier.IDFstrAusschlussBesonders?.filter[ + fstrZugRangier?.fstrRangier.fstrRangierArt.wert?. + literal?.substring(0, 1) == "Z" + ]?.filterNull ?: Collections.emptyList + fillSwitch( + cols.getColumn(Bemerkung), + fstrZugRangier, + new Case<Fstr_Zug_Rangier>( + [ + !bedAnzeigeElemente.empty && !bedAnzeigeElemente.map [ + comment[translate] + ].filterNull.empty + ], + [ + val footnotes = footnoteTransformation.transform(it, row) + '''«FOR bae : bedAnzeigeElemente.map[comment[translate]].filterNull SEPARATOR ", "»«bae»«ENDFOR» «footnotes»'''. + toString.trim + ] + ), + new Case<Fstr_Zug_Rangier>( + [ + !besondersRangierFstrs.empty + ], + [ + val fahrWegStartZiel = IDFstrAusschlussBesonders.map [ + fstrFahrweg.transformFarhwegStartZiel + ] + + val footnotes = footnoteTransformation.transform(it, row) + '''«FOR fwsz : fahrWegStartZiel.filterNull SEPARATOR ", "»«fwsz»«ENDFOR» «footnotes»'''. + toString.trim + ] + ), + new Case<Fstr_Zug_Rangier>( + [ + !zugFstrs.empty + ], + [ + val footnotes = footnoteTransformation.transform(it, row) + '''Siehe Sslz: «FOR fstr : zugFstrs SEPARATOR ", "»«fstr.zugFstrBezeichnung»«ENDFOR» «footnotes»''' + ] + ) + ) return } private def boolean getGeneralbedingung(Fstr_Zug_Rangier fstrZugRangier) { - return fstrZugRangier?.fstrRangier.fstrRangierArt.wert?.literal?. + return fstrZugRangier?.fstrRangier?.fstrRangierArt?.wert?.literal?. substring(0, 1) == "R" } diff --git a/java/bundles/org.eclipse.set.ppmodel.extensions/src/org/eclipse/set/ppmodel/extensions/FstrZugRangierExtensions.xtend b/java/bundles/org.eclipse.set.ppmodel.extensions/src/org/eclipse/set/ppmodel/extensions/FstrZugRangierExtensions.xtend index 9b0b6b604..fb7b7ae58 100644 --- a/java/bundles/org.eclipse.set.ppmodel.extensions/src/org/eclipse/set/ppmodel/extensions/FstrZugRangierExtensions.xtend +++ b/java/bundles/org.eclipse.set.ppmodel.extensions/src/org/eclipse/set/ppmodel/extensions/FstrZugRangierExtensions.xtend @@ -42,6 +42,7 @@ import static extension org.eclipse.set.ppmodel.extensions.SignalRahmenExtension import static extension org.eclipse.set.ppmodel.extensions.SignalbegriffExtensions.* import static extension org.eclipse.set.ppmodel.extensions.WKrGspKomponenteExtensions.* import static extension org.eclipse.set.ppmodel.extensions.utils.IterableExtensions.* +import static extension org.eclipse.set.utils.math.BigIntegerExtensions.* /** * This class extends {@link Fstr_Zug_Rangier}. @@ -188,7 +189,6 @@ class FstrZugRangierExtensions extends BasisObjektExtensions { ].toSet } - /** * @param fstrZugRangier this Fstr Zug Rangier * @param signal a Signal @@ -217,6 +217,62 @@ class FstrZugRangierExtensions extends BasisObjektExtensions { return fstrZugRangier?.fstrRangier?.IDFMAAnlageRangierFrei?.toSet } + def static String getZugFstrBezeichnung(Fstr_Zug_Rangier fstrZugRangier) { + if (!fstrZugRangier.isZOrGz) { + return null + } + + if (fstrZugRangier?.fstrZug?.fstrZugDWeg === null || + fstrZugRangier?.fstrDWeg?.fstrDWegSpezifisch === null) { + if (fstrZugRangier?.fstrZugRangierAllg?.fstrReihenfolge?.wert == + BigInteger.ZERO) { + return fstrZugRangier?.fstrFahrweg?.transformFarhwegStartZiel + } + + if (fstrZugRangier?.fstrZugRangierAllg?.fstrReihenfolge?.wert. + isNotNullAndGreater(BigInteger.ZERO)) { + return '''«fstrZugRangier?.fstrFahrweg?. + transformFarhwegStartZiel» [U«fstrZugRangier?. + fstrZugRangierAllg?.fstrReihenfolge?.wert»]''' + } + } + + if (fstrZugRangier?.fstrZug?.fstrZugDWeg !== null) { + if (fstrZugRangier?.fstrZugRangierAllg?.fstrReihenfolge?.wert == + BigInteger.ZERO) { + return '''«fstrZugRangier?.fstrFahrweg?. + transformFarhwegStartZiel» («fstrZugRangier?. + fstrDWeg?.bezeichnung?.bezeichnungFstrDWeg?.wert»)''' + + } + + if (fstrZugRangier?.fstrZugRangierAllg?.fstrReihenfolge?.wert. + isNotNullAndGreater(BigInteger.ZERO)) { + return '''«fstrZugRangier?.fstrFahrweg?. + transformFarhwegStartZiel» [U«fstrZugRangier?. + fstrZugRangierAllg?.fstrReihenfolge?.wert»] («fstrZugRangier?. + fstrDWeg?.bezeichnung?.bezeichnungFstrDWeg?.wert»)''' + + } + } + return null + } + + def static String transformFarhwegStartZiel(Fstr_Fahrweg fahrweg) { + return '''«fahrweg?.start?.bezeichnung?.bezeichnungTabelle?.wert»/«fahrweg?.zielSignal?.bezeichnung?.bezeichnungTabelle?.wert»''' + } + + def static boolean isZOrGz(Fstr_Zug_Rangier fstrZugRangier) { + val rangierArt = fstrZugRangier?.fstrRangier?.fstrRangierArt?.wert?. + literal + return rangierArt.matches( + "Z.*" + ) || rangierArt.matches( + "GZ.*" + ) + + } + private def static dispatch int getVmax(Object object, Fstr_Fahrweg fw) { return -1 } -- GitLab From a51218f5eb070e777bb5354a45972946f41137e7 Mon Sep 17 00:00:00 2001 From: Quang Truong <truong.quang@scheidt-bachmann-st.de> Date: Mon, 20 Mar 2023 17:29:47 +0100 Subject: [PATCH 3/9] set#48 adjust & enable ssln --- .../META-INF/MANIFEST.MF | 2 + ....table.pt1.ssln.SslnDescriptionService.xml | 8 + ...ble.pt1.ssln.SslnTransformationService.xml | 10 + .../feature/table/pt1/ssln/SslnColumns.java | 90 +++++ .../pt1/ssln/SslnDescriptionService.java | 37 ++ .../pt1/ssln/SslnTransformationService.java | 67 +++ .../table/pt1/ssln/SslnTransformator.xtend | 380 ++++++++++++++++++ .../ppmodel/extensions/NbZoneExtensions.xtend | 2 +- 8 files changed, 595 insertions(+), 1 deletion(-) create mode 100644 java/bundles/org.eclipse.set.feature.table.pt1/OSGI-INF/org.eclipse.set.feature.table.pt1.ssln.SslnDescriptionService.xml create mode 100644 java/bundles/org.eclipse.set.feature.table.pt1/OSGI-INF/org.eclipse.set.feature.table.pt1.ssln.SslnTransformationService.xml create mode 100644 java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssln/SslnColumns.java create mode 100644 java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssln/SslnDescriptionService.java create mode 100644 java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssln/SslnTransformationService.java create mode 100644 java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssln/SslnTransformator.xtend diff --git a/java/bundles/org.eclipse.set.feature.table.pt1/META-INF/MANIFEST.MF b/java/bundles/org.eclipse.set.feature.table.pt1/META-INF/MANIFEST.MF index 094f5d60f..b659659f7 100644 --- a/java/bundles/org.eclipse.set.feature.table.pt1/META-INF/MANIFEST.MF +++ b/java/bundles/org.eclipse.set.feature.table.pt1/META-INF/MANIFEST.MF @@ -104,6 +104,8 @@ Service-Component: OSGI-INF/org.eclipse.set.feature.table.pt1.messages.Messages. OSGI-INF/org.eclipse.set.feature.table.pt1.sslb.SslbTransformationService.xml, OSGI-INF/org.eclipse.set.feature.table.pt1.ssli.SsliDescriptionService.xml, OSGI-INF/org.eclipse.set.feature.table.pt1.ssli.SsliTransformationService.xml, + OSGI-INF/org.eclipse.set.feature.table.pt1.ssln.SslnDescriptionService.xml, + OSGI-INF/org.eclipse.set.feature.table.pt1.ssln.SslnTransformationService.xml, OSGI-INF/org.eclipse.set.feature.table.pt1.sslr.SslrDescriptionService.xml, OSGI-INF/org.eclipse.set.feature.table.pt1.sslr.SslrTransformationService.xml, OSGI-INF/org.eclipse.set.feature.table.pt1.ssvu.SsvuDescriptionService.xml, diff --git a/java/bundles/org.eclipse.set.feature.table.pt1/OSGI-INF/org.eclipse.set.feature.table.pt1.ssln.SslnDescriptionService.xml b/java/bundles/org.eclipse.set.feature.table.pt1/OSGI-INF/org.eclipse.set.feature.table.pt1.ssln.SslnDescriptionService.xml new file mode 100644 index 000000000..e9e55762d --- /dev/null +++ b/java/bundles/org.eclipse.set.feature.table.pt1/OSGI-INF/org.eclipse.set.feature.table.pt1.ssln.SslnDescriptionService.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.3.0" name="org.eclipse.set.feature.table.pt1.ssln.SslnDescriptionService"> + <service> + <provide interface="org.eclipse.set.core.services.part.PartDescriptionService"/> + </service> + <reference cardinality="1..1" field="messages" interface="org.eclipse.set.feature.table.pt1.messages.Messages" name="messages"/> + <implementation class="org.eclipse.set.feature.table.pt1.ssln.SslnDescriptionService"/> +</scr:component> \ No newline at end of file diff --git a/java/bundles/org.eclipse.set.feature.table.pt1/OSGI-INF/org.eclipse.set.feature.table.pt1.ssln.SslnTransformationService.xml b/java/bundles/org.eclipse.set.feature.table.pt1/OSGI-INF/org.eclipse.set.feature.table.pt1.ssln.SslnTransformationService.xml new file mode 100644 index 000000000..17a53257f --- /dev/null +++ b/java/bundles/org.eclipse.set.feature.table.pt1/OSGI-INF/org.eclipse.set.feature.table.pt1.ssln.SslnTransformationService.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.3.0" immediate="true" name="org.eclipse.set.feature.table.pt1.ssln.SslnTransformationService"> + <property name="table.shortcut" value="ssln"/> + <service> + <provide interface="org.eclipse.set.feature.table.PlanPro2TableTransformationService"/> + </service> + <reference cardinality="1..1" field="enumTranslationService" interface="org.eclipse.set.core.services.enumtranslation.EnumTranslationService" name="enumTranslationService"/> + <reference cardinality="1..1" field="messages" interface="org.eclipse.set.feature.table.pt1.messages.Messages" name="messages"/> + <implementation class="org.eclipse.set.feature.table.pt1.ssln.SslnTransformationService"/> +</scr:component> \ No newline at end of file diff --git a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssln/SslnColumns.java b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssln/SslnColumns.java new file mode 100644 index 000000000..d85f7fca6 --- /dev/null +++ b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssln/SslnColumns.java @@ -0,0 +1,90 @@ +/** + * Copyright (c) 2023 DB Netz AG and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + */ + +package org.eclipse.set.feature.table.pt1.ssln; + +/** + * Symbolic addressing for Ssln columns. + * + * @author truong + * + */ +@SuppressWarnings("nls") +public class SslnColumns { + + /** + * Ssln.Grundsatzangaben.Bereich_Zone + */ + public static final String Bereich_Zone = "A"; + + /** + * Ssln.Grundsatzangaben.Art + */ + public static final String Art = "B"; + + /** + * Ssln.Unterstellungsverhaeltnis.untergeordnet + */ + public static final String untergeordnet = "C"; + + /** + * Ssln.Unterstellungsverhaeltnis.Rang_Zuschaltung + */ + public static final String Rang_Zuschaltung = "D"; + + /** + * Ssln.Unterstellungsverhaeltnis.Aufloesung_Grenze + */ + public static final String Aufloesung_Grenze = "E"; + + /** + * Ssln.Grenze.Bez_Grenze + */ + public static final String Bez_Grenze = "F"; + + /** + * Ssln.Element.Weiche_Gs.frei_stellbar + */ + public static final String Weiche_Gs_frei_stellebar = "G"; + + /** + * Ssln.Element.Weiche_Gs.verschlossen + */ + public static final String Weiche_Gs_verschlossen = "H"; + + /** + * Ssln.Element.Signal.frei_stellbar + */ + public static final String Signal_frei_stellbar = "I"; + + /** + * Ssln.Erlaubnis.staendig + */ + public static final String Erlaubnis_staendig = "J"; + + /** + * Ssln.Element.Ssp + */ + public static final String Ssp = "K"; + + /** + * Ssln.Element.Bedien_Einr + */ + public static final String Bedien_Einr = "L"; + + /** + * Ssln.NB_R.Bedienungshandlung + */ + public static final String Bedienungshandlung = "M"; + + /** + * Ssln.Bemerkung + */ + public static final String Bemerkung = "N"; +} diff --git a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssln/SslnDescriptionService.java b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssln/SslnDescriptionService.java new file mode 100644 index 000000000..c65fbc7dc --- /dev/null +++ b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssln/SslnDescriptionService.java @@ -0,0 +1,37 @@ +/** + * Copyright (c) 2020 DB Netz AG and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + */ + +package org.eclipse.set.feature.table.pt1.ssln; + +import org.eclipse.set.core.services.part.PartDescriptionService; +import org.eclipse.set.feature.table.AbstractTableDescription; +import org.eclipse.set.feature.table.pt1.messages.Messages; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Reference; + +/** + * Part description for SSLN table view. + * + * @author Schaefer + */ +@Component(service = PartDescriptionService.class) +public class SslnDescriptionService extends AbstractTableDescription { + @Reference + Messages messages; + + @Override + protected String getToolboxViewName() { + return messages.SslnDescriptionService_ViewName; + } + + @Override + protected String getToolboxViewTooltip() { + return messages.SslnDescriptionService_ViewTooltip; + } +} diff --git a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssln/SslnTransformationService.java b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssln/SslnTransformationService.java new file mode 100644 index 000000000..74236696f --- /dev/null +++ b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssln/SslnTransformationService.java @@ -0,0 +1,67 @@ +/** + * Copyright (c) 2017 DB Netz AG and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + */ +package org.eclipse.set.feature.table.pt1.ssln; + +import static org.eclipse.nebula.widgets.nattable.sort.SortDirectionEnum.ASC; +import static org.eclipse.set.utils.table.sorting.ComparatorBuilder.CellComparatorType.MIXED_STRING; + +import java.util.Comparator; + +import org.eclipse.set.core.services.enumtranslation.EnumTranslationService; +import org.eclipse.set.feature.table.PlanPro2TableTransformationService; +import org.eclipse.set.feature.table.pt1.AbstractPlanPro2TableModelTransformator; +import org.eclipse.set.feature.table.pt1.AbstractPlanPro2TableTransformationService; +import org.eclipse.set.feature.table.pt1.messages.Messages; +import org.eclipse.set.model.tablemodel.RowGroup; +import org.eclipse.set.ppmodel.extensions.utils.TableNameInfo; +import org.eclipse.set.utils.table.sorting.TableRowGroupComparator; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Reference; + +/** + * Service for creating the Ssln table model. + * + * @author Schaefer + * + * @usage production + */ +@Component(service = { + PlanPro2TableTransformationService.class }, immediate = true, property = { + "table.shortcut=ssln" }) +public class SslnTransformationService + extends AbstractPlanPro2TableTransformationService { + + @Reference + private Messages messages; + @Reference + private EnumTranslationService enumTranslationService; + + @Override + public AbstractPlanPro2TableModelTransformator createTransformator() { + return new SslnTransformator(cols, enumTranslationService); + } + + @Override + public Comparator<RowGroup> getRowGroupComparator() { + return TableRowGroupComparator.builder().sort("A", MIXED_STRING, ASC) //$NON-NLS-1$ + .build(); + } + + @Override + public TableNameInfo getTableNameInfo() { + return new TableNameInfo(messages.ToolboxTableNameSslnLong, + messages.ToolboxTableNameSslnPlanningNumber, + messages.ToolboxTableNameSslnShort); + } + + @Override + protected String getTableHeading() { + return messages.SslnTableView_Heading; + } +} diff --git a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssln/SslnTransformator.xtend b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssln/SslnTransformator.xtend new file mode 100644 index 000000000..086027f28 --- /dev/null +++ b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssln/SslnTransformator.xtend @@ -0,0 +1,380 @@ +/** + * Copyright (c) 2017 DB Netz AG and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + */ +package org.eclipse.set.feature.table.pt1.ssln + +import com.google.common.collect.Lists +import java.util.List +import org.eclipse.set.basis.Pair +import org.eclipse.set.basis.constants.ToolboxConstants +import org.eclipse.set.core.services.enumtranslation.EnumTranslationService +import org.eclipse.set.feature.table.pt1.AbstractPlanPro2TableModelTransformator +import org.eclipse.set.model.tablemodel.Table +import org.eclipse.set.model.tablemodel.TableRow +import org.eclipse.set.model.tablemodel.format.TextAlignment +import org.eclipse.set.ppmodel.extensions.container.MultiContainer_AttributeGroup +import org.eclipse.set.toolboxmodel.Basisobjekte.Basis_Objekt +import org.eclipse.set.toolboxmodel.Basisobjekte.Punkt_Objekt +import org.eclipse.set.toolboxmodel.Nahbedienung.NB_Zone +import org.eclipse.set.toolboxmodel.Nahbedienung.NB_Zone_Element +import org.eclipse.set.toolboxmodel.Nahbedienung.NB_Zone_Grenze +import org.eclipse.set.toolboxmodel.Ortung.FMA_Komponente +import org.eclipse.set.toolboxmodel.Schluesselabhaengigkeiten.Schluesselsperre +import org.eclipse.set.toolboxmodel.Signale.Signal +import org.eclipse.set.toolboxmodel.Weichen_und_Gleissperren.W_Kr_Gsp_Element +import org.eclipse.set.toolboxmodel.Weichen_und_Gleissperren.W_Kr_Gsp_Komponente +import org.eclipse.set.utils.table.TMFactory + +import static org.eclipse.set.ppmodel.extensions.NbZoneExtensions.* + +import static extension org.eclipse.set.model.tablemodel.extensions.TableExtensions.* +import static extension org.eclipse.set.ppmodel.extensions.BedienAnzeigeElementExtensions.* +import static extension org.eclipse.set.ppmodel.extensions.FlaSchutzExtensions.* +import static extension org.eclipse.set.ppmodel.extensions.MarkanterPunktExtensions.* +import static extension org.eclipse.set.ppmodel.extensions.NbExtensions.* +import static extension org.eclipse.set.ppmodel.extensions.NbBedienAnzeigeElementExtensions.* +import static extension org.eclipse.set.ppmodel.extensions.NbZoneElementExtensions.* +import static extension org.eclipse.set.ppmodel.extensions.NbZoneGrenzeExtensions.* +import static extension org.eclipse.set.ppmodel.extensions.PunktObjektExtensions.* +import static extension org.eclipse.set.ppmodel.extensions.TopKanteExtensions.* +import static extension org.eclipse.set.ppmodel.extensions.NbZoneExtensions.* +import static extension org.eclipse.set.ppmodel.extensions.WKrGspKomponenteExtensions.* +import static extension org.eclipse.set.utils.StringExtensions.* +import static org.eclipse.set.feature.table.pt1.ssln.SslnColumns.* +import java.util.Set +import org.eclipse.set.model.tablemodel.ColumnDescriptor + +/** + * Table transformation for a Nahbedienungstabelle (SSLN). + * + * @author Schaefer + */ +class SslnTransformator extends AbstractPlanPro2TableModelTransformator { + + var TMFactory factory + + new(Set<ColumnDescriptor> cols, + EnumTranslationService enumTranslationService) { + super(cols, enumTranslationService) + } + + override transformTableContent(MultiContainer_AttributeGroup container, + TMFactory factory) { + this.factory = factory + return container.transform + } + + private def Table create factory.table transform( + MultiContainer_AttributeGroup container) { + container.NBZone.forEach [ it | + if (Thread.currentThread.interrupted) { + return + } + it.transform + ] + return + } + + private def TableRow create factory.newTableRow(nbZone) transform( + NB_Zone nbZone) { + val row = it + + // A: Ssln.Grundsatzangaben.Bereich_Zone + fill(cols.getColumn(Bereich_Zone), nbZone, [getBezeichnung(it)]) + + // B: Ssln.Grundsatzangaben.Art + fill( + cols.getColumn(Art), + nbZone, + [nb?.NBArt?.wert?.translate] + ) + + // C: Ssln.Unterstellungsverhaeltnis.untergeordnet + fillConditional( + cols.getColumn(untergeordnet), + nbZone, + [IDNBZone !== null], + [NBZone?.bezeichnung.bezeichnungNBZone?.wert?.toString] + ) + + // D: Ssln.Unterstellungsverhaeltnis.Rang_Zuschaltung + fillConditional( + cols.getColumn(Rang_Zuschaltung), + nbZone, + [IDNBZone !== null], + [NBZoneAllg?.rang?.wert?.toString] + ) + + // E: Ssln.Unterstellungsverhaeltnis.Aufloesung_Grenze + fill( + cols.getColumn(Aufloesung_Grenze), + nbZone, + [NBZoneAllg?.NBVerhaeltnisBesonders?.wert?.translate] + ) + + // F: Ssln.Grenze.Bez_Grenze + fillIterable( + cols.getColumn(Bez_Grenze), + nbZone, + [ + NBZoneGrenzen.map [ + markanterPunkt?.markanteStelle?.toBezeichnungGrenze(it) + ].filterNull + ], + null + ) + + // G: Ssln.Element.Weiche_Gs.frei_stellbar + fillIterable( + cols.getColumn(Weiche_Gs_frei_stellebar), + nbZone, + [ + val nBZoneElemente = NBZoneElemente.filter [ + NBZoneElementAllg?.freieStellbarkeit?.wert && + nbElement instanceof W_Kr_Gsp_Komponente + ] + + nBZoneElemente.filterMultipleNbElements.map [ + '''«(nbElement as W_Kr_Gsp_Komponente)?.WKrGspElement?.bezeichnung?.bezeichnungTabelle?.wert» («NBZoneElementAllg?.NBRueckgabevoraussetzung?.wert?.translate»)''' + ] + ], + MIXED_STRING_COMPARATOR, + [it] + ) + + // H: Ssln.Element.Weiche_Gs.verschlossen + fillIterable( + cols.getColumn(Weiche_Gs_verschlossen), + nbZone, + [ + NBZoneElemente.map[new Pair(it, nbElement)].filter [ + !first?.NBZoneElementAllg?.freieStellbarkeit?.wert && + second instanceof W_Kr_Gsp_Komponente + ].map [ + '''«(second as W_Kr_Gsp_Komponente).WKrGspElement?.bezeichnung?.bezeichnungTabelle?.wert» («first?.NBZoneElementAllg?.WGspLage?.wert?.translate ?: "-"»)''' + ] + ], + MIXED_STRING_COMPARATOR, + [it] + ) + + // I: Ssln.Element.Signal.frei_stellbar + fillIterable( + cols.getColumn(Signal_frei_stellbar), + nbZone, + [ + NBZoneElemente.map[new Pair(it, nbElement)].filter [ + first?.NBZoneElementAllg?.freieStellbarkeit?.wert && + second instanceof Signal + ].map [ + '''«(second as Signal)?.bezeichnung?.bezeichnungTabelle?.wert» («first?.NBZoneElementAllg?.NBRueckgabevoraussetzung?.wert?.translate»)''' + ] + ], + MIXED_STRING_COMPARATOR, + [it] + ) + + // J: Ssln.Erlaubnis.staendig + fillIterable( + cols.getColumn(Erlaubnis_staendig), + nbZone, + [ + NBZoneElemente.map[new Pair(it, nbElement)].filter [ + first?.NBZoneElementAllg?.freieStellbarkeit?.wert !== + null && + !first.NBZoneElementAllg.freieStellbarkeit.wert. + booleanValue && second instanceof Signal + ].map[second as Signal].filter [ + val signal = it + nbZone.NBZoneGrenzen.forall [ + markanterPunkt?.markanteStelle?.identitaet?.wert != + signal.identitaet.wert + ] + ].map[bezeichnung?.bezeichnungTabelle?.wert] + ], + MIXED_STRING_COMPARATOR, + [it] + ) + + // K: Ssln.Element.Ssp + fillIterable( + cols.getColumn(Ssp), + nbZone, + [ + NBZoneElemente.map[nbElement].filter [ + it instanceof Schluesselsperre + ].map[it as Schluesselsperre].map [ + bezeichnung?.bezeichnungTabelle?.wert + ] + ], + MIXED_STRING_COMPARATOR, + [it] + ) + + // L: Ssln.Element.Bedien_Einr + fillIterable( + cols.getColumn(Bedien_Einr), + nbZone, + [ + NBBedienAnzeigeElemente.map [ + bedienAnzeigeElement?.bedienEinrichtungOertlich + ].filterNull.map[bezeichnung?.bedienEinrichtOertlBez?.wert] + ], + null, + [it] + ) + + // M: Ssln.NB_R.Bedienungshandlung + fillIterable( + cols.getColumn(Bedienungshandlung), + nbZone, + [ + nb?.NBFunktionalitaetNBREnums.map[toString] + ], + null, + [it], + String.format("%n") + ) + + // N: Ssln.Bemerkung + fill( + cols.getColumn(Bemerkung), + nbZone, + [footnoteTransformation.transform(it, row)] + ) + + return + } + + private static def Iterable<NB_Zone_Element> filterMultipleNbElements( + Iterable<NB_Zone_Element> elements) { + if (elements.empty) { + return Lists.newArrayList + } + val head = elements.head + val tail = elements.tail + + if (head.hasOtherNbElementIn(tail)) { + // we skip the head and use the other nbElement with the tail + return tail.filterMultipleNbElements + } else { + // we use the head and filter the tail + return Lists.newArrayList(head) + tail.filterMultipleNbElements + } + } + + private static def boolean hasOtherNbElementIn(NB_Zone_Element element, + Iterable<NB_Zone_Element> elements) { + return elements.exists[hasDifferentNbElementInSameWeiche(element)] + } + + private static def boolean hasDifferentNbElementInSameWeiche( + NB_Zone_Element element, NB_Zone_Element otherElement) { + return element.nbElement. + isDifferentKomponenteInSameWeiche(otherElement.nbElement) + } + + private static def boolean isDifferentKomponenteInSameWeiche( + Basis_Objekt komponente, Basis_Objekt otherKomponente) { + if (komponente instanceof W_Kr_Gsp_Komponente) { + if (otherKomponente instanceof W_Kr_Gsp_Komponente) { + if (komponente.identitaet.wert == + otherKomponente.identitaet.wert) { + return false + } + val wKrGspElement = komponente.WKrGspElement + val otherWKrGspElement = otherKomponente.WKrGspElement + return wKrGspElement?.identitaet?.wert == + otherWKrGspElement?.identitaet?.wert + } + } + return false + } + + private static def List<String> getNbGrenzeBezeichnung( + List<W_Kr_Gsp_Element> wKrGspElemente) { + return wKrGspElemente.map [ + bezeichnung?.bezeichnungTabelle?.wert?.removeSuffix("A", "B", "AB", + "CD") ?: "" + ] + } + + override void formatTableContent(Table table) { + // A: Ssln.Grundsatzangaben.Bereich_Zone + table.setTextAlignment(0, TextAlignment.LEFT); + + // N: Ssln.Bemerkung + table.setTextAlignment(13, TextAlignment.LEFT); + } + + private static dispatch def String toBezeichnungGrenze( + Punkt_Objekt markanteStelle, + NB_Zone_Grenze grenze + ) { + return null + } + + private static dispatch def String toBezeichnungGrenze( + Void markanteStelle, + NB_Zone_Grenze grenze + ) { + return null + } + + private static dispatch def String toBezeichnungGrenze( + Signal markanteStelle, + NB_Zone_Grenze grenze + ) { + return grenze.toBezeichnungGrenze + } + + private static dispatch def String toBezeichnungGrenze( + W_Kr_Gsp_Komponente markanteStelle, + NB_Zone_Grenze grenze + ) { + val bezeichnung = getIterableFilling( + markanteStelle.topKanten.flatMap [ + WKrGspElemente.nbGrenzeBezeichnung + ], + ToolboxConstants.LST_OBJECT_NAME_COMPARATOR, + "/" + ) + val innen = markanteStelle.WKrGspElement.bezeichnung?. + bezeichnungTabelle?.wert ?: "" + val aussen = grenze.flaSchutzElemente + return '''«bezeichnung» («innen», «aussen»)''' + } + + private static dispatch def String toBezeichnungGrenze( + FMA_Komponente markanteStelle, + NB_Zone_Grenze grenze + ) { + return grenze.toBezeichnungGrenze + } + + private static def String toBezeichnungGrenze( + NB_Zone_Grenze grenze + ) { + val bezeichnung = grenze?.markanterPunkt?.bezeichnung?. + bezeichnungMarkanterPunkt?.wert + val innen = bezeichnung + val aussen = grenze.flaSchutzElemente + return '''«bezeichnung» («innen», «aussen»)''' + } + + private static def String flaSchutzElemente(NB_Zone_Grenze grenze) { + val elemente = grenze.flaSchutz.map [ + weicheGleissperreElement.bezeichnung?.bezeichnungTabelle?.wert ?: "" + ] + return if (elemente.empty) { + "-" + } else { + getIterableFilling(elemente, MIXED_STRING_COMPARATOR, " ") + } + } +} diff --git a/java/bundles/org.eclipse.set.ppmodel.extensions/src/org/eclipse/set/ppmodel/extensions/NbZoneExtensions.xtend b/java/bundles/org.eclipse.set.ppmodel.extensions/src/org/eclipse/set/ppmodel/extensions/NbZoneExtensions.xtend index e3372fea3..8c576e833 100644 --- a/java/bundles/org.eclipse.set.ppmodel.extensions/src/org/eclipse/set/ppmodel/extensions/NbZoneExtensions.xtend +++ b/java/bundles/org.eclipse.set.ppmodel.extensions/src/org/eclipse/set/ppmodel/extensions/NbZoneExtensions.xtend @@ -81,6 +81,6 @@ class NbZoneExtensions extends BasisObjektExtensions { */ def static String getBezeichnung(NB_Zone nbZone) { val nb = nbZone.nb - return '''«nb?.bezeichnung?.kennzahl?.wert ?: ""»NB«nb?.bezeichnung.bezeichnungNB?.wert ?: ""»«nbZone.bezeichnung?.bezeichnungNBZone?.wert ?: ""»''' + return '''«nb?.bezeichnung?.kennzahl?.wert ?: ""»NB«nb?.bezeichnung.bezeichnungNB.wert ?: ""»«nbZone.bezeichnung?.bezeichnungNBZone?.wert ?: ""»''' } } -- GitLab From 1182b7ae341116b09e6744c95df412423247122d Mon Sep 17 00:00:00 2001 From: Quang Truong <truong.quang@scheidt-bachmann-st.de> Date: Tue, 21 Mar 2023 14:08:20 +0100 Subject: [PATCH 4/9] issue#48 adjust & active sslf. Improve text cell algiment --- .../META-INF/MANIFEST.MF | 2 + ....table.pt1.sslf.SslfDescriptionService.xml | 8 + ...ble.pt1.sslf.SslfTransformationService.xml | 10 + .../table/pt1/ssbb/SsbbTransformator.xtend | 2 +- .../table/pt1/ssit/SsitTransformator.xtend | 17 +- .../table/pt1/sska/SskaTransformator.xtend | 15 +- .../table/pt1/sskf/SskfTransformator.xtend | 17 +- .../table/pt1/sskg/SskgTransformator.xtend | 11 - .../table/pt1/ssko/SskoTransformator.xtend | 10 +- .../table/pt1/sskt/SsktTransformator.xtend | 18 +- .../table/pt1/sslb/SslbTransformator.xtend | 17 +- .../feature/table/pt1/sslf/SslfColumns.java | 85 ++++++ .../pt1/sslf/SslfDescriptionService.java | 37 +++ .../pt1/sslf/SslfTransformationService.java | 75 +++++ .../table/pt1/sslf/SslfTransformator.xtend | 269 ++++++++++++++++++ .../table/pt1/ssli/SsliTransformator.xtend | 14 +- .../table/pt1/ssln/SslnTransformator.xtend | 30 ++ .../table/pt1/sslr/SslrTransformator.xtend | 26 ++ .../table/pt1/ssvu/SsvuTransformator.xtend | 2 +- .../data/export/excel/sslf_vorlage.xlt | Bin 29696 -> 29184 bytes .../ColumnDescriptorExtensions.xtend | 1 + .../extensions/TableExtensions.xtend | 23 +- .../AbstractTableModelTransformator.xtend | 6 +- .../table/ColumnDescriptorModelBuilder.java | 1 + 24 files changed, 600 insertions(+), 96 deletions(-) create mode 100644 java/bundles/org.eclipse.set.feature.table.pt1/OSGI-INF/org.eclipse.set.feature.table.pt1.sslf.SslfDescriptionService.xml create mode 100644 java/bundles/org.eclipse.set.feature.table.pt1/OSGI-INF/org.eclipse.set.feature.table.pt1.sslf.SslfTransformationService.xml create mode 100644 java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sslf/SslfColumns.java create mode 100644 java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sslf/SslfDescriptionService.java create mode 100644 java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sslf/SslfTransformationService.java create mode 100644 java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sslf/SslfTransformator.xtend diff --git a/java/bundles/org.eclipse.set.feature.table.pt1/META-INF/MANIFEST.MF b/java/bundles/org.eclipse.set.feature.table.pt1/META-INF/MANIFEST.MF index b659659f7..8b4aa1fca 100644 --- a/java/bundles/org.eclipse.set.feature.table.pt1/META-INF/MANIFEST.MF +++ b/java/bundles/org.eclipse.set.feature.table.pt1/META-INF/MANIFEST.MF @@ -102,6 +102,8 @@ Service-Component: OSGI-INF/org.eclipse.set.feature.table.pt1.messages.Messages. OSGI-INF/org.eclipse.set.feature.table.pt1.sskt.SsktTransformationService.xml, OSGI-INF/org.eclipse.set.feature.table.pt1.sslb.SslbDescriptionService.xml, OSGI-INF/org.eclipse.set.feature.table.pt1.sslb.SslbTransformationService.xml, + OSGI-INF/org.eclipse.set.feature.table.pt1.sslf.SslfDescriptionService.xml, + OSGI-INF/org.eclipse.set.feature.table.pt1.sslf.SslfTransformationService.xml, OSGI-INF/org.eclipse.set.feature.table.pt1.ssli.SsliDescriptionService.xml, OSGI-INF/org.eclipse.set.feature.table.pt1.ssli.SsliTransformationService.xml, OSGI-INF/org.eclipse.set.feature.table.pt1.ssln.SslnDescriptionService.xml, diff --git a/java/bundles/org.eclipse.set.feature.table.pt1/OSGI-INF/org.eclipse.set.feature.table.pt1.sslf.SslfDescriptionService.xml b/java/bundles/org.eclipse.set.feature.table.pt1/OSGI-INF/org.eclipse.set.feature.table.pt1.sslf.SslfDescriptionService.xml new file mode 100644 index 000000000..3aa496436 --- /dev/null +++ b/java/bundles/org.eclipse.set.feature.table.pt1/OSGI-INF/org.eclipse.set.feature.table.pt1.sslf.SslfDescriptionService.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.3.0" name="org.eclipse.set.feature.table.pt1.sslf.SslfDescriptionService"> + <service> + <provide interface="org.eclipse.set.core.services.part.PartDescriptionService"/> + </service> + <reference cardinality="1..1" field="messages" interface="org.eclipse.set.feature.table.pt1.messages.Messages" name="messages"/> + <implementation class="org.eclipse.set.feature.table.pt1.sslf.SslfDescriptionService"/> +</scr:component> \ No newline at end of file diff --git a/java/bundles/org.eclipse.set.feature.table.pt1/OSGI-INF/org.eclipse.set.feature.table.pt1.sslf.SslfTransformationService.xml b/java/bundles/org.eclipse.set.feature.table.pt1/OSGI-INF/org.eclipse.set.feature.table.pt1.sslf.SslfTransformationService.xml new file mode 100644 index 000000000..6aa83d2ae --- /dev/null +++ b/java/bundles/org.eclipse.set.feature.table.pt1/OSGI-INF/org.eclipse.set.feature.table.pt1.sslf.SslfTransformationService.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.3.0" immediate="true" name="org.eclipse.set.feature.table.pt1.sslf.SslfTransformationService"> + <property name="table.shortcut" value="sslf"/> + <service> + <provide interface="org.eclipse.set.feature.table.PlanPro2TableTransformationService"/> + </service> + <reference cardinality="1..1" field="enumTranslationService" interface="org.eclipse.set.core.services.enumtranslation.EnumTranslationService" name="enumTranslationService"/> + <reference cardinality="1..1" field="messages" interface="org.eclipse.set.feature.table.pt1.messages.Messages" name="messages"/> + <implementation class="org.eclipse.set.feature.table.pt1.sslf.SslfTransformationService"/> +</scr:component> \ No newline at end of file diff --git a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssbb/SsbbTransformator.xtend b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssbb/SsbbTransformator.xtend index ffb9e031a..292442af9 100644 --- a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssbb/SsbbTransformator.xtend +++ b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssbb/SsbbTransformator.xtend @@ -227,7 +227,7 @@ class SsbbTransformator extends AbstractPlanPro2TableModelTransformator { instance, cols.getColumn(Bemerkung), einrichtung, - [""] + [footnoteTransformation.transform(it, instance)] ) return diff --git a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssit/SsitTransformator.xtend b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssit/SsitTransformator.xtend index 6d67e26e4..0d6d32c72 100644 --- a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssit/SsitTransformator.xtend +++ b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssit/SsitTransformator.xtend @@ -9,11 +9,12 @@ package org.eclipse.set.feature.table.pt1.ssit import com.google.common.collect.Lists +import java.util.Set import org.eclipse.set.core.services.enumtranslation.EnumTranslationService import org.eclipse.set.feature.table.pt1.AbstractPlanPro2TableModelTransformator +import org.eclipse.set.model.tablemodel.ColumnDescriptor import org.eclipse.set.model.tablemodel.Table import org.eclipse.set.model.tablemodel.TableRow -import org.eclipse.set.model.tablemodel.format.TextAlignment import org.eclipse.set.ppmodel.extensions.container.MultiContainer_AttributeGroup import org.eclipse.set.toolboxmodel.Basisobjekte.Basis_Objekt import org.eclipse.set.toolboxmodel.Bedienung.Bedien_Einrichtung_Oertlich @@ -22,7 +23,8 @@ import org.eclipse.set.toolboxmodel.Signale.Signal import org.eclipse.set.toolboxmodel.Weichen_und_Gleissperren.W_Kr_Gsp_Komponente import org.eclipse.set.utils.table.TMFactory -import static extension org.eclipse.set.model.tablemodel.extensions.TableExtensions.* +import static org.eclipse.set.feature.table.pt1.ssit.SsitColumns.* + import static extension org.eclipse.set.ppmodel.extensions.BedienAnzeigeElementExtensions.* import static extension org.eclipse.set.ppmodel.extensions.BedienEinrichtungOertlichExtensions.* import static extension org.eclipse.set.ppmodel.extensions.NbBedienAnzeigeElementExtensions.* @@ -31,9 +33,6 @@ import static extension org.eclipse.set.ppmodel.extensions.NbZoneExtensions.* import static extension org.eclipse.set.ppmodel.extensions.PunktObjektStreckeExtensions.* import static extension org.eclipse.set.ppmodel.extensions.WKrGspKomponenteExtensions.* import static extension org.eclipse.set.utils.math.BigDecimalExtensions.* -import static org.eclipse.set.feature.table.pt1.ssit.SsitColumns.* -import java.util.Set -import org.eclipse.set.model.tablemodel.ColumnDescriptor /** * Table transformation for a Bedieneinrichtungstabelle ESTW (Ssit). @@ -304,14 +303,6 @@ class SsitTransformator extends AbstractPlanPro2TableModelTransformator { return } - override void formatTableContent(Table table) { - // A: Ssit.Grundsatzangaben.Bezeichnung - table.setTextAlignment(0, TextAlignment.LEFT); - - // R: Ssit.Bemerkung - table.setTextAlignment(17, TextAlignment.LEFT); - } - private static def boolean isWKrGspKomponenteWithZungenpaar( Basis_Objekt objekt) { if (objekt instanceof W_Kr_Gsp_Komponente) { diff --git a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sska/SskaTransformator.xtend b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sska/SskaTransformator.xtend index 00036c266..6e925d62b 100644 --- a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sska/SskaTransformator.xtend +++ b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sska/SskaTransformator.xtend @@ -262,14 +262,11 @@ class SskaTransformator extends AbstractPlanPro2TableModelTransformator { } override void formatTableContent(Table table) { - // A: Sska.Grundsatzangaben.Bezeichnung - table.setTextAlignment(0, TextAlignment.LEFT); - + super.formatTableContent(table) + // G: Sska.Grundsatzangaben.Unterbringung.km - table.setTextAlignment(6, TextAlignment.RIGHT); - - // O: Sska.Bemerkung - table.setTextAlignment(20, TextAlignment.LEFT); + table.setTextAlignment(cols.getColumn(Unterbringung_km), + TextAlignment.RIGHT); } private def dispatch String getElementBezeichnung(Basis_Objekt element) { @@ -415,8 +412,8 @@ class SskaTransformator extends AbstractPlanPro2TableModelTransformator { if (element?.ESTWZEEnergieversorgung?.IDEnergieSekundaer !== null) { return element.elementEnergieSekundaer.bezeichner } - return element?.ESTWZEEnergieversorgung?.energieversorgungArtErsatz?.wert?. - translate ?: "" + return element?.ESTWZEEnergieversorgung?.energieversorgungArtErsatz?. + wert?.translate ?: "" } private def dispatch String getElementVerknuepfungenBedienungLokal( diff --git a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sskf/SskfTransformator.xtend b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sskf/SskfTransformator.xtend index 7eb4f8e44..a6762bfb4 100644 --- a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sskf/SskfTransformator.xtend +++ b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sskf/SskfTransformator.xtend @@ -9,29 +9,26 @@ package org.eclipse.set.feature.table.pt1.sskf import java.util.List +import java.util.Set import org.eclipse.set.basis.Wrapper import org.eclipse.set.core.services.enumtranslation.EnumTranslationService import org.eclipse.set.feature.table.pt1.AbstractPlanPro2TableModelTransformator -import org.eclipse.set.model.tablemodel.Table -import org.eclipse.set.model.tablemodel.format.TextAlignment +import org.eclipse.set.model.tablemodel.ColumnDescriptor import org.eclipse.set.ppmodel.extensions.container.MultiContainer_AttributeGroup import org.eclipse.set.toolboxmodel.Gleis.Gleis_Schaltgruppe import org.eclipse.set.toolboxmodel.Ortung.FMA_Anlage import org.eclipse.set.toolboxmodel.Weichen_und_Gleissperren.W_Kr_Gsp_Element import org.eclipse.set.utils.table.TMFactory +import static org.eclipse.set.feature.table.pt1.sskf.SskfColumns.* import static org.eclipse.set.toolboxmodel.Ortung.ENUMFMAArt.* import static org.eclipse.set.toolboxmodel.Ortung.ENUMUebertragungFMinfoRichtung.* -import static extension org.eclipse.set.model.tablemodel.extensions.TableExtensions.* import static extension org.eclipse.set.ppmodel.extensions.AussenelementansteuerungExtensions.* import static extension org.eclipse.set.ppmodel.extensions.BereichObjektExtensions.* import static extension org.eclipse.set.ppmodel.extensions.FmaAnlageExtensions.* import static extension org.eclipse.set.ppmodel.extensions.WKrGspElementExtensions.* import static extension org.eclipse.set.ppmodel.extensions.WKrGspKomponenteExtensions.* -import static org.eclipse.set.feature.table.pt1.sskf.SskfColumns.* -import java.util.Set -import org.eclipse.set.model.tablemodel.ColumnDescriptor /** * Table transformation for a Zugstraßentabelle (SSLZ). @@ -310,12 +307,4 @@ class SskfTransformator extends AbstractPlanPro2TableModelTransformator { return factory.table } - - override void formatTableContent(Table table) { - // A: Grundsatzangaben.Bezeichnung - table.setTextAlignment(0, TextAlignment.LEFT); - - // V: Bemerkung - table.setTextAlignment(21, TextAlignment.LEFT); - } } diff --git a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sskg/SskgTransformator.xtend b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sskg/SskgTransformator.xtend index eb8838c18..07f5ff754 100644 --- a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sskg/SskgTransformator.xtend +++ b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sskg/SskgTransformator.xtend @@ -14,9 +14,7 @@ import java.util.Set import org.eclipse.set.core.services.enumtranslation.EnumTranslationService import org.eclipse.set.feature.table.pt1.AbstractPlanPro2TableModelTransformator import org.eclipse.set.model.tablemodel.ColumnDescriptor -import org.eclipse.set.model.tablemodel.Table import org.eclipse.set.model.tablemodel.TableRow -import org.eclipse.set.model.tablemodel.format.TextAlignment import org.eclipse.set.ppmodel.extensions.container.MultiContainer_AttributeGroup import org.eclipse.set.ppmodel.extensions.utils.TopGraph import org.eclipse.set.toolboxmodel.Ortung.FMA_Komponente @@ -25,7 +23,6 @@ import org.eclipse.set.utils.table.TMFactory import static org.eclipse.set.feature.table.pt1.sskg.SskgColumns.* -import static extension org.eclipse.set.model.tablemodel.extensions.TableExtensions.* import static extension org.eclipse.set.ppmodel.extensions.FmaKomponenteAchszaehlpunktExtensions.* import static extension org.eclipse.set.ppmodel.extensions.FmaKomponenteExtensions.* import static extension org.eclipse.set.ppmodel.extensions.MarkanterPunktExtensions.* @@ -341,12 +338,4 @@ class SskgTransformator extends AbstractPlanPro2TableModelTransformator { return factory.table; } - - override void formatTableContent(Table table) { - // A: Grundsatzangaben.Bezeichnung - table.setTextAlignment(0, TextAlignment.LEFT); - - // L: Bemerkung - table.setTextAlignment(11, TextAlignment.LEFT); - } } diff --git a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssko/SskoTransformator.xtend b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssko/SskoTransformator.xtend index 9082a2c5f..8ab1623f8 100644 --- a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssko/SskoTransformator.xtend +++ b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssko/SskoTransformator.xtend @@ -386,13 +386,9 @@ class SskoTransformator extends AbstractPlanPro2TableModelTransformator { } override void formatTableContent(Table table) { - // A: Grundsatzangaben.Bezeichnung_Schloss - table.setTextAlignment(0, TextAlignment.LEFT); - + super.formatTableContent(table) // P: Sk_Ssp.Unterbringung.km - table.setTextAlignment(15, TextAlignment.RIGHT); - - // S: Bemerkung - table.setTextAlignment(18, TextAlignment.LEFT); + table.setTextAlignment(cols.getColumn(Sk_Ssp_Unterbringung_km), + TextAlignment.RIGHT); } } diff --git a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sskt/SsktTransformator.xtend b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sskt/SsktTransformator.xtend index 2f57cc479..9a82c8ca4 100644 --- a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sskt/SsktTransformator.xtend +++ b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sskt/SsktTransformator.xtend @@ -8,8 +8,10 @@ */ package org.eclipse.set.feature.table.pt1.sskt +import java.util.Set import org.eclipse.set.core.services.enumtranslation.EnumTranslationService import org.eclipse.set.feature.table.pt1.AbstractPlanPro2TableModelTransformator +import org.eclipse.set.model.tablemodel.ColumnDescriptor import org.eclipse.set.model.tablemodel.Table import org.eclipse.set.model.tablemodel.TableRow import org.eclipse.set.model.tablemodel.format.TextAlignment @@ -23,13 +25,12 @@ import org.eclipse.set.toolboxmodel.Bedienung.Bedien_Standort import org.eclipse.set.utils.table.RowFactory import org.eclipse.set.utils.table.TMFactory +import static org.eclipse.set.feature.table.pt1.sskt.SsktColumns.* + import static extension org.eclipse.set.model.tablemodel.extensions.TableExtensions.* import static extension org.eclipse.set.ppmodel.extensions.BedienStandortExtensions.* import static extension org.eclipse.set.ppmodel.extensions.TechnikStandortExtensions.* import static extension org.eclipse.set.ppmodel.extensions.UnterbringungExtensions.* -import static org.eclipse.set.feature.table.pt1.sskt.SsktColumns.* -import java.util.Set -import org.eclipse.set.model.tablemodel.ColumnDescriptor /** * Table transformation for Sskt. @@ -329,14 +330,9 @@ class SsktTransformator extends AbstractPlanPro2TableModelTransformator { } override void formatTableContent(Table table) { - // IMPROVE: Use column descriptor instead of index - // A: Sskt.Grundsatzangaben.Bezeichnung - table.setTextAlignment(0, TextAlignment.LEFT); - + super.formatTableContent(table) // G: Sskt.Grundsatzangaben.Unterbringung.km - table.setTextAlignment(6, TextAlignment.RIGHT); - - // U: Sskt.Bemerkung - table.setTextAlignment(15, TextAlignment.LEFT); + table.setTextAlignment(cols.getColumn(Unterbringung_km), + TextAlignment.RIGHT); } } diff --git a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sslb/SslbTransformator.xtend b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sslb/SslbTransformator.xtend index 542e6acfb..902c42e68 100644 --- a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sslb/SslbTransformator.xtend +++ b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sslb/SslbTransformator.xtend @@ -8,9 +8,11 @@ */ package org.eclipse.set.feature.table.pt1.sslb +import java.util.Set import org.eclipse.set.basis.Pair import org.eclipse.set.core.services.enumtranslation.EnumTranslationService import org.eclipse.set.feature.table.pt1.AbstractPlanPro2TableModelTransformator +import org.eclipse.set.model.tablemodel.ColumnDescriptor import org.eclipse.set.model.tablemodel.Table import org.eclipse.set.model.tablemodel.TableRow import org.eclipse.set.model.tablemodel.format.TextAlignment @@ -20,6 +22,8 @@ import org.eclipse.set.toolboxmodel.Block.Block_Element import org.eclipse.set.toolboxmodel.Geodaten.ENUMOertlichkeitArt import org.eclipse.set.utils.table.TMFactory +import static org.eclipse.set.feature.table.pt1.sslb.SslbColumns.* + import static extension org.eclipse.set.model.tablemodel.extensions.TableExtensions.* import static extension org.eclipse.set.ppmodel.extensions.BasisAttributExtensions.* import static extension org.eclipse.set.ppmodel.extensions.BedienAnrueckabschnittExtensions.* @@ -28,9 +32,6 @@ import static extension org.eclipse.set.ppmodel.extensions.BereichObjektExtensio import static extension org.eclipse.set.ppmodel.extensions.BlockAnlageExtensions.* import static extension org.eclipse.set.ppmodel.extensions.BlockElementExtensions.* import static extension org.eclipse.set.ppmodel.extensions.BlockStreckeExtensions.* -import static org.eclipse.set.feature.table.pt1.sslb.SslbColumns.* -import java.util.Set -import org.eclipse.set.model.tablemodel.ColumnDescriptor /** * Table transformation for a Inselgleistabelle (Sslb). @@ -339,13 +340,9 @@ class SslbTransformator extends AbstractPlanPro2TableModelTransformator { } override void formatTableContent(Table table) { - // D: Sslb.Grundsatzangaben.von.Betriebsst_Start - table.setTextAlignment(3, TextAlignment.LEFT); - + super.formatTableContent(table) // F: Sslb.Grundsatzangaben.nach.Betriebsst_Ziel - table.setTextAlignment(5, TextAlignment.LEFT); - - // V: Sslb.Bemerkung - table.setTextAlignment(21, TextAlignment.LEFT); + table.setTextAlignment(cols.getColumn(Betriebsstelle_Ziel), + TextAlignment.LEFT); } } diff --git a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sslf/SslfColumns.java b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sslf/SslfColumns.java new file mode 100644 index 000000000..fd6df90d1 --- /dev/null +++ b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sslf/SslfColumns.java @@ -0,0 +1,85 @@ +/** + * Copyright (c) 2023 DB Netz AG and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + */ + +package org.eclipse.set.feature.table.pt1.sslf; + +/** + * Symbolic addressing for Sslf columns. + * + * @author truong + * + */ +@SuppressWarnings("nls") +public class SslfColumns { + + /** + * Sslf.Flankenschutzanforderer.Bezeichnung_W_Nb + */ + public static final String Bezeichnung_W_Nb = "A"; + + /** + * Sslf.Flankenschutzanforderer.WLage_NbGrenze + */ + public static final String WLage_NbGrenze = "B"; + + /** + * Sslf.Unmittelbarer_Flankenschutz.Weiche_Gleissperre.Bezeichnung_W + */ + public static final String Bezeichnung_W = "C"; + + /** + * Sslf.Unmittelbarer_Flankenschutz.Weiche_Gleissperre.Lage + */ + public static final String Weiche_Gleissperre_Lage = "D"; + + /** + * Sslf.Unmittelbarer_Flankenschutz.Weiche_Gleissperre.Zwieschutz + */ + public static final String Weiche_Gleissperre_Zwieschutz = "E"; + + /** + * Sslf.Unmittelbarer_Flankenschutz.Signal.Bezeichnung_Sig + */ + public static final String Bezeichung_Sig = "F"; + + /** + * Sslf.Unmittelbarer_Flankenschutz.Signal.Zielsperrung + */ + public static final String Signal_Zielsperrung = "G"; + + /** + * Sslf.Weitergabe.Weiche_Kreuzung.Bezeichnung_W_Kr + */ + public static final String Weiche_Kreuzung_Bezeichnung_W_Kr = "H"; + + /** + * Sslf.Weitergabe.Weiche_Kreuzung.wie_Fahrt_ueber + */ + public static final String Weiche_Kreuzung_wie_Fahrt_ueber = "I"; + + /** + * Sslf.Technischer_Verzicht + */ + public static final String Technischer_Verzicht = "J"; + + /** + * Sslf.Schutzraumueberwachung.freigemeldet + */ + public static final String freigemeldet = "K"; + + /** + * Sslf.Schutzraumueberwachung.nicht_freigemeldet + */ + public static final String nicht_freigemeldet = "L"; + + /** + * Sslf.Bemerkung + */ + public static final String Bemerkung = "M"; +} diff --git a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sslf/SslfDescriptionService.java b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sslf/SslfDescriptionService.java new file mode 100644 index 000000000..f521e8a51 --- /dev/null +++ b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sslf/SslfDescriptionService.java @@ -0,0 +1,37 @@ +/** + * Copyright (c) 2020 DB Netz AG and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + */ + +package org.eclipse.set.feature.table.pt1.sslf; + +import org.eclipse.set.core.services.part.PartDescriptionService; +import org.eclipse.set.feature.table.AbstractTableDescription; +import org.eclipse.set.feature.table.pt1.messages.Messages; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Reference; + +/** + * Part description for SSLF table view. + * + * @author Schaefer + */ +@Component(service = PartDescriptionService.class) +public class SslfDescriptionService extends AbstractTableDescription { + @Reference + Messages messages; + + @Override + protected String getToolboxViewName() { + return messages.SslfDescriptionService_ViewName; + } + + @Override + protected String getToolboxViewTooltip() { + return messages.SslfDescriptionService_ViewTooltip; + } +} diff --git a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sslf/SslfTransformationService.java b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sslf/SslfTransformationService.java new file mode 100644 index 000000000..aaf8749b5 --- /dev/null +++ b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sslf/SslfTransformationService.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) 2016 DB Netz AG and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + */ +package org.eclipse.set.feature.table.pt1.sslf; + +import static org.eclipse.nebula.widgets.nattable.sort.SortDirectionEnum.ASC; +import static org.eclipse.set.utils.table.sorting.ComparatorBuilder.CellComparatorType.MIXED_STRING; + +import java.util.Comparator; + +import org.eclipse.set.core.services.enumtranslation.EnumTranslationService; +import org.eclipse.set.feature.table.PlanPro2TableTransformationService; +import org.eclipse.set.feature.table.pt1.AbstractPlanPro2TableModelTransformator; +import org.eclipse.set.feature.table.pt1.AbstractPlanPro2TableTransformationService; +import org.eclipse.set.feature.table.pt1.messages.Messages; +import org.eclipse.set.model.tablemodel.RowGroup; +import org.eclipse.set.ppmodel.extensions.utils.TableNameInfo; +import org.eclipse.set.utils.table.sorting.TableRowGroupComparator; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Reference; + +/** + * Service for creating the ssld table model. + * + * @author rumpf + * + * @usage production + */ +@Component(service = { + PlanPro2TableTransformationService.class }, immediate = true, property = { + "table.shortcut=sslf" }) +public final class SslfTransformationService + extends AbstractPlanPro2TableTransformationService { + + @Reference + private Messages messages; + @Reference + private EnumTranslationService enumTranslationService; + + /** + * constructor. + */ + public SslfTransformationService() { + super(); + } + + @Override + public AbstractPlanPro2TableModelTransformator createTransformator() { + return new SslfTransformator(cols, enumTranslationService); + } + + @Override + public Comparator<RowGroup> getRowGroupComparator() { + return TableRowGroupComparator.builder().sort("A", MIXED_STRING, ASC) //$NON-NLS-1$ + .sort("B", MIXED_STRING, ASC).build(); //$NON-NLS-1$ + } + + @Override + public TableNameInfo getTableNameInfo() { + return new TableNameInfo(messages.ToolboxTableNameSslfLong, + messages.ToolboxTableNameSslfPlanningNumber, + messages.ToolboxTableNameSslfShort); + } + + @Override + protected String getTableHeading() { + return messages.SslfTableView_Heading; + } + +} \ No newline at end of file diff --git a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sslf/SslfTransformator.xtend b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sslf/SslfTransformator.xtend new file mode 100644 index 000000000..2475e5fcd --- /dev/null +++ b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sslf/SslfTransformator.xtend @@ -0,0 +1,269 @@ +/** + * Copyright (c) 2016 DB Netz AG and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + */ +package org.eclipse.set.feature.table.pt1.sslf + +import java.util.Set +import org.eclipse.set.core.services.enumtranslation.EnumTranslationService +import org.eclipse.set.feature.table.pt1.AbstractPlanPro2TableModelTransformator +import org.eclipse.set.model.tablemodel.ColumnDescriptor +import org.eclipse.set.ppmodel.extensions.container.MultiContainer_AttributeGroup +import org.eclipse.set.toolboxmodel.Basisobjekte.Basis_Objekt +import org.eclipse.set.toolboxmodel.Flankenschutz.Fla_Schutz +import org.eclipse.set.toolboxmodel.Nahbedienung.NB_Zone_Grenze +import org.eclipse.set.toolboxmodel.Weichen_und_Gleissperren.ENUMWKrArt +import org.eclipse.set.toolboxmodel.Weichen_und_Gleissperren.W_Kr_Gsp_Element +import org.eclipse.set.utils.table.TMFactory + +import static org.eclipse.set.feature.table.pt1.sslf.SslfColumns.* +import static org.eclipse.set.toolboxmodel.Flankenschutz.ENUMFahrtUeber.* + +import static extension org.eclipse.set.ppmodel.extensions.FlaFreimeldeZuordnungExtensions.* +import static extension org.eclipse.set.ppmodel.extensions.FlaSchutzExtensions.* + +/** + * Table transformation for a Flankenschutztabelle (SSLF). + * + * @author Schaefer + */ +class SslfTransformator extends AbstractPlanPro2TableModelTransformator { + + new(Set<ColumnDescriptor> cols, + EnumTranslationService enumTranslationService) { + super(cols, enumTranslationService) + } + + override transformTableContent( + MultiContainer_AttributeGroup container, + TMFactory factory + ) { + val flaSchutzList = container.flaSchutz.filter[generalbedingung].sortBy [ + wLageNbGrenze + ] + + for (flaSchutz : flaSchutzList) { + if (Thread.currentThread.interrupted) { + return null + } + val instance = factory.newTableRow(flaSchutz) + + // A: Sslf.Flankenschutzanforderer.Bezeichnung_W_Nb + fill( + instance, + cols.getColumn(Bezeichnung_W_Nb), + flaSchutz, + [getBezeichnungTabelle(anforderer)] + ) + + // B: Sslf.Flankenschutzanforderer.WLage_NbGrenze + fill(instance, cols.getColumn(WLage_NbGrenze), flaSchutz, [ + wLageNbGrenze + ]) + + // C: Sslf.Unmittelbarer_Flankenschutz.Weiche_Gleissperre.Bezeichnung_W + fillConditional( + instance, + cols.getColumn(Bezeichnung_W), + flaSchutz, + [flaSchutz.flaSchutzWGsp !== null], + [weicheGleissperreElement.bezeichnung.bezeichnungTabelle.wert] + ) + + // D: Sslf.Unmittelbarer_Flankenschutz.Weiche_Gleissperre.Lage + fill( + instance, + cols.getColumn(Weiche_Gleissperre_Lage), + flaSchutz, + [flaSchutzWGsp?.flaWLage?.wert?.translate ?: ""] + ) + + // E: Sslf.Unmittelbarer_Flankenschutz.Weiche_Gleissperre.Zwieschutz + fillConditional( + instance, + cols.getColumn(Weiche_Gleissperre_Zwieschutz), + flaSchutz, + [flaSchutzWGsp !== null], + [if (hasZwieschutz) "x" else "o"] + ) + + // F: Sslf.Unmittelbarer_Flankenschutz.Signal.Bezeichnung_Sig + fillConditional( + instance, + cols.getColumn(Bezeichung_Sig), + flaSchutz, + [flaSchutzSignal !== null], + [signal.bezeichnung.bezeichnungTabelle.wert] + ) + + // G: Sslf.Unmittelbarer_Flankenschutz.Signal.Zielsperrung + fillConditional( + instance, + cols.getColumn(Signal_Zielsperrung), + flaSchutz, + [flaSchutzSignal !== null], + [hasZielsperrung.translate] + ) + + // H: Sslf.Weitergabe.Weiche_Kreuzung.Bezeichnung_W_Kr + fill( + instance, + cols.getColumn(Weiche_Kreuzung_Bezeichnung_W_Kr), + flaSchutz, + [weitergabeWKrBezeichnung] + ) + + // I: Sslf.Weitergabe.Weiche_Kreuzung.wie_Fahrt_ueber + fill( + instance, + cols.getColumn(Weiche_Kreuzung_wie_Fahrt_ueber), + flaSchutz, + [weitergabeWKrWieFahrtUeber] + ) + + // J: Sslf.Technischer_Verzicht + fill( + instance, + cols.getColumn(Technischer_Verzicht), + flaSchutz, + [flaVerzicht?.wert?.translate ?: ""] + ) + + // K: Sslf.Schutzraumueberwachung.freigemeldet + fillIterable( + instance, + cols.getColumn(freigemeldet), + flaSchutz, + [ + freimeldeZuordnungen.filter[flaRaumFreimeldung.wert].map [ + fmaAnlage?.IDGleisAbschnitt + ].filterNull.map [ + bezeichnung?.bezeichnungTabelle?.wert + ] + ], + MIXED_STRING_COMPARATOR + ) + + // L: Sslf.Schutzraumueberwachung.nicht_freigemeldet + fillIterable( + instance, + cols.getColumn(nicht_freigemeldet), + flaSchutz, + [ + freimeldeZuordnungen.filter[!flaRaumFreimeldung.wert].map [ + fmaAnlage?.IDGleisAbschnitt + ].filterNull.map [ + bezeichnung?.bezeichnungTabelle?.wert + ] + ], + MIXED_STRING_COMPARATOR + ) + + // M: Sslf.Bemerkung + fill( + instance, + cols.getColumn(Bemerkung), + flaSchutz, + [footnoteTransformation.transform(it, instance)] + ) + + } + + return factory.table + } + + private def boolean isGeneralbedingung(Fla_Schutz flaSchutz) { + return newLinkedList(ENUM_FAHRT_UEBER_LINKS, ENUM_FAHRT_UEBER_RECHTS). + contains( + flaSchutz?.flaSchutzAnforderer?.fahrtUeber?.wert + ) || flaSchutz?.anforderer instanceof NB_Zone_Grenze + } + + private def String getWeitergabeWKrBezeichnung(Fla_Schutz flaSchutz) { + val hasFlaWeitergabeL = flaSchutz?.flaSchutzWeitergabe?. + IDFlaWeitergabeL !== null + val hasFlaWeitergabeR = flaSchutz?.flaSchutzWeitergabe?. + IDFlaWeitergabeR !== null + + if (hasFlaWeitergabeL) { + return (flaSchutz.weitergabeL.anforderer as W_Kr_Gsp_Element). + bezeichnung.bezeichnungTabelle.wert + } + + if (hasFlaWeitergabeR && !hasFlaWeitergabeL) { + return (flaSchutz.weitergabeR.anforderer as W_Kr_Gsp_Element). + bezeichnung.bezeichnungTabelle.wert + } + + return "" + } + + private def String getWeitergabeWKrWieFahrtUeber(Fla_Schutz flaSchutz) { + val hasFlaWeitergabeL = flaSchutz?.flaSchutzWeitergabe?. + IDFlaWeitergabeL !== null + val hasFlaWeitergabeR = flaSchutz?.flaSchutzWeitergabe?. + IDFlaWeitergabeR !== null + + if (hasFlaWeitergabeL && hasFlaWeitergabeR) { + return "L+R" + } + + if (hasFlaWeitergabeL && !hasFlaWeitergabeR) { + return "L" + } + + if (hasFlaWeitergabeR && !hasFlaWeitergabeL) { + return "R" + } + + return "" + } + + private def String wLageNbGrenze(Fla_Schutz flaSchutz) { + val fahrtUeber = flaSchutz?.flaSchutzAnforderer?.fahrtUeber?.wert + + if (fahrtUeber == ENUM_FAHRT_UEBER_LINKS) { + return "L" + } + + if (fahrtUeber == ENUM_FAHRT_UEBER_RECHTS) { + return "R" + } + + val anforderer = flaSchutz.anforderer + + if (anforderer instanceof NB_Zone_Grenze) { + return anforderer?.IDMarkanterPunkt?.bezeichnung?. + bezeichnungMarkanterPunkt?.wert ?: "" + } + + return "" + } + + private def dispatch String getBezeichnungTabelle(Fla_Schutz flaSchutz, + Basis_Objekt object) { + throw new IllegalArgumentException(object.class.simpleName) + } + + private def dispatch String getBezeichnungTabelle(Fla_Schutz flaSchutz, + W_Kr_Gsp_Element wKrGspElement) { + val wkrArt = wKrGspElement?.IDWKrAnlage?.WKrAnlageAllg?.WKrArt?.wert + if (wkrArt === ENUMWKrArt.ENUMW_KR_ART_EKW && + flaSchutz?.flaSchutzAnforderer.EKWKrAnteil.wert) { + return '''«wKrGspElement?.bezeichnung?.kennzahl»K«wKrGspElement.bezeichnung.oertlicherElementname»''' + } else { + return wKrGspElement?.bezeichnung?.bezeichnungTabelle?.wert + } + } + + private def dispatch String getBezeichnungTabelle(Fla_Schutz flaSchutz, + NB_Zone_Grenze nbZoneGrenze) { + val zone = nbZoneGrenze.IDNBZone + val nb = zone.IDNB + return '''«nb?.bezeichnung?.kennzahl?.wert» Nb«nb?.bezeichnung?.bezeichnungNB?.wert.intValue»/«zone?.bezeichnung?.bezeichnungNBZone?.wert.intValue»''' + } +} diff --git a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssli/SsliTransformator.xtend b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssli/SsliTransformator.xtend index 5efca4608..7ef354c18 100644 --- a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssli/SsliTransformator.xtend +++ b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssli/SsliTransformator.xtend @@ -16,9 +16,9 @@ import java.util.Map import java.util.Set import org.eclipse.set.core.services.enumtranslation.EnumTranslationService import org.eclipse.set.feature.table.pt1.AbstractPlanPro2TableModelTransformator +import org.eclipse.set.model.tablemodel.ColumnDescriptor import org.eclipse.set.model.tablemodel.Table import org.eclipse.set.model.tablemodel.TableRow -import org.eclipse.set.model.tablemodel.format.TextAlignment import org.eclipse.set.ppmodel.extensions.container.MultiContainer_AttributeGroup import org.eclipse.set.ppmodel.extensions.utils.Case import org.eclipse.set.ppmodel.extensions.utils.TopGraph @@ -28,16 +28,14 @@ import org.eclipse.set.toolboxmodel.Signale.ENUMSignalArt import org.eclipse.set.toolboxmodel.Signale.Signal import org.eclipse.set.utils.table.TMFactory +import static org.eclipse.set.feature.table.pt1.ssli.SsliColumns.* import static org.eclipse.set.toolboxmodel.Fahrstrasse.ENUMRangierGegenfahrtausschluss.* -import static extension org.eclipse.set.model.tablemodel.extensions.TableExtensions.* import static extension org.eclipse.set.ppmodel.extensions.BasisAttributExtensions.* import static extension org.eclipse.set.ppmodel.extensions.BereichObjektExtensions.* import static extension org.eclipse.set.ppmodel.extensions.PunktObjektExtensions.* import static extension org.eclipse.set.ppmodel.extensions.SignalExtensions.* import static extension org.eclipse.set.utils.graph.DigraphExtensions.* -import static org.eclipse.set.feature.table.pt1.ssli.SsliColumns.* -import org.eclipse.set.model.tablemodel.ColumnDescriptor /** * Table transformation for a Inselgleistabelle (Ssli). @@ -337,12 +335,4 @@ class SsliTransformator extends AbstractPlanPro2TableModelTransformator { } return false } - - override void formatTableContent(Table table) { - // A: Ssli.Grundsatzangaben.Bezeichnung_Inselgleis - table.setTextAlignment(0, TextAlignment.LEFT); - - // O: Ssli.Bemerkung - table.setTextAlignment(7, TextAlignment.LEFT); - } } diff --git a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssln/SslnTransformator.xtend b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssln/SslnTransformator.xtend index 086027f28..077c89ba0 100644 --- a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssln/SslnTransformator.xtend +++ b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssln/SslnTransformator.xtend @@ -10,13 +10,23 @@ package org.eclipse.set.feature.table.pt1.ssln import com.google.common.collect.Lists import java.util.List +<<<<<<< HEAD +import java.util.Set +======= +>>>>>>> dca65b763dc8c144cbfaf4cca2e8cee71e77addc import org.eclipse.set.basis.Pair import org.eclipse.set.basis.constants.ToolboxConstants import org.eclipse.set.core.services.enumtranslation.EnumTranslationService import org.eclipse.set.feature.table.pt1.AbstractPlanPro2TableModelTransformator +<<<<<<< HEAD +import org.eclipse.set.model.tablemodel.ColumnDescriptor +import org.eclipse.set.model.tablemodel.Table +import org.eclipse.set.model.tablemodel.TableRow +======= import org.eclipse.set.model.tablemodel.Table import org.eclipse.set.model.tablemodel.TableRow import org.eclipse.set.model.tablemodel.format.TextAlignment +>>>>>>> dca65b763dc8c144cbfaf4cca2e8cee71e77addc import org.eclipse.set.ppmodel.extensions.container.MultiContainer_AttributeGroup import org.eclipse.set.toolboxmodel.Basisobjekte.Basis_Objekt import org.eclipse.set.toolboxmodel.Basisobjekte.Punkt_Objekt @@ -30,6 +40,22 @@ import org.eclipse.set.toolboxmodel.Weichen_und_Gleissperren.W_Kr_Gsp_Element import org.eclipse.set.toolboxmodel.Weichen_und_Gleissperren.W_Kr_Gsp_Komponente import org.eclipse.set.utils.table.TMFactory +<<<<<<< HEAD +import static org.eclipse.set.feature.table.pt1.ssln.SslnColumns.* + +import static extension org.eclipse.set.ppmodel.extensions.BedienAnzeigeElementExtensions.* +import static extension org.eclipse.set.ppmodel.extensions.FlaSchutzExtensions.* +import static extension org.eclipse.set.ppmodel.extensions.MarkanterPunktExtensions.* +import static extension org.eclipse.set.ppmodel.extensions.NbBedienAnzeigeElementExtensions.* +import static extension org.eclipse.set.ppmodel.extensions.NbExtensions.* +import static extension org.eclipse.set.ppmodel.extensions.NbZoneElementExtensions.* +import static extension org.eclipse.set.ppmodel.extensions.NbZoneExtensions.* +import static extension org.eclipse.set.ppmodel.extensions.NbZoneGrenzeExtensions.* +import static extension org.eclipse.set.ppmodel.extensions.PunktObjektExtensions.* +import static extension org.eclipse.set.ppmodel.extensions.TopKanteExtensions.* +import static extension org.eclipse.set.ppmodel.extensions.WKrGspKomponenteExtensions.* +import static extension org.eclipse.set.utils.StringExtensions.* +======= import static org.eclipse.set.ppmodel.extensions.NbZoneExtensions.* import static extension org.eclipse.set.model.tablemodel.extensions.TableExtensions.* @@ -48,6 +74,7 @@ import static extension org.eclipse.set.utils.StringExtensions.* import static org.eclipse.set.feature.table.pt1.ssln.SslnColumns.* import java.util.Set import org.eclipse.set.model.tablemodel.ColumnDescriptor +>>>>>>> dca65b763dc8c144cbfaf4cca2e8cee71e77addc /** * Table transformation for a Nahbedienungstabelle (SSLN). @@ -304,6 +331,8 @@ class SslnTransformator extends AbstractPlanPro2TableModelTransformator { ] } +<<<<<<< HEAD +======= override void formatTableContent(Table table) { // A: Ssln.Grundsatzangaben.Bereich_Zone table.setTextAlignment(0, TextAlignment.LEFT); @@ -312,6 +341,7 @@ class SslnTransformator extends AbstractPlanPro2TableModelTransformator { table.setTextAlignment(13, TextAlignment.LEFT); } +>>>>>>> dca65b763dc8c144cbfaf4cca2e8cee71e77addc private static dispatch def String toBezeichnungGrenze( Punkt_Objekt markanteStelle, NB_Zone_Grenze grenze diff --git a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sslr/SslrTransformator.xtend b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sslr/SslrTransformator.xtend index 56562f8a8..7f3293003 100644 --- a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sslr/SslrTransformator.xtend +++ b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sslr/SslrTransformator.xtend @@ -289,12 +289,26 @@ class SslrTransformator extends AbstractPlanPro2TableModelTransformator { toString.trim ] ) +<<<<<<< HEAD + +======= +>>>>>>> dca65b763dc8c144cbfaf4cca2e8cee71e77addc val bedAnzeigeElemente = fstrZugRangier.fstrFahrweg?.abhaengigkeiten?. map [ bedienAnzeigeElement ]?.filterNull ?: Collections.emptyList +<<<<<<< HEAD + val besondersRangierFstrs = fstrZugRangier.IDFstrAusschlussBesonders?. + filter [ + generalbedingung + ]?.filterNull ?: Collections.emptyList + + val zugFstrs = fstrZugRangier.IDFstrAusschlussBesonders?.filter [ + fstrZugRangier?.fstrRangier.fstrRangierArt.wert?.literal?. + substring(0, 1) == "Z" +======= val besondersRangierFstrs = fstrZugRangier.IDFstrAusschlussBesonders?.filter[ generalbedingung ]?.filterNull ?: Collections.emptyList @@ -302,6 +316,7 @@ class SslrTransformator extends AbstractPlanPro2TableModelTransformator { val zugFstrs = fstrZugRangier.IDFstrAusschlussBesonders?.filter[ fstrZugRangier?.fstrRangier.fstrRangierArt.wert?. literal?.substring(0, 1) == "Z" +>>>>>>> dca65b763dc8c144cbfaf4cca2e8cee71e77addc ]?.filterNull ?: Collections.emptyList fillSwitch( cols.getColumn(Bemerkung), @@ -351,6 +366,16 @@ class SslrTransformator extends AbstractPlanPro2TableModelTransformator { } override void formatTableContent(Table table) { +<<<<<<< HEAD + super.formatTableContent(table) + // B: Sslr.Grundsatzangaben.Fahrweg.Start + table.setTextAlignment(cols.getColumn(Fahrweg_Start), + TextAlignment.LEFT); + + // C: Sslr.Grundsatzangaben.Fahrweg.Ziel + table.setTextAlignment(cols.getColumn(Fahrweg_Ziel), + TextAlignment.LEFT); +======= // A: Sslr.Grundsatzangaben.Bezeichnung table.setTextAlignment(0, TextAlignment.LEFT); @@ -362,5 +387,6 @@ class SslrTransformator extends AbstractPlanPro2TableModelTransformator { // Q: Sslr.Bemerkung table.setTextAlignment(15, TextAlignment.LEFT); +>>>>>>> dca65b763dc8c144cbfaf4cca2e8cee71e77addc } } diff --git a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssvu/SsvuTransformator.xtend b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssvu/SsvuTransformator.xtend index 82990b860..20846bb73 100644 --- a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssvu/SsvuTransformator.xtend +++ b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssvu/SsvuTransformator.xtend @@ -308,6 +308,6 @@ class SsvuTransformator extends AbstractPlanPro2TableModelTransformator { override void formatTableContent(Table table) { // H: Ssvu.Bemerkung - table.setTextAlignment(7, TextAlignment.LEFT); + table.setTextAlignment(cols.getColumn(Bemerkung), TextAlignment.LEFT); } } diff --git a/java/bundles/org.eclipse.set.feature/rootdir/data/export/excel/sslf_vorlage.xlt b/java/bundles/org.eclipse.set.feature/rootdir/data/export/excel/sslf_vorlage.xlt index 44206fbc3bc0a05ee28dafcf13f742d84692bd5d..547309a70a9ded34566691c170d7fb530f3b3d62 100644 GIT binary patch delta 4772 zcma)ATWl0n82-=frL(iU-QC$<R$8E?Sgs;BZ7HQxXjd*mTT!f_P_PInD1k_f0j5zO zh#JM77`%|Eukt|ZCd3DV_~3&f#u!5g!50%v^hNrp5~%+-XLh?RXLn~#=3Kt>o&Vha z|KERh>`yWFyEwB{bbPq1DflQ6O$=QSa!N$39Roks{6GeU&75r{gdjN?%*a!LNSWH{ zKr8or6<Flv&B<BxD~mJfjNrl`ceoWPG{?gk*&SqIsO&<;l|SY|mPwa*kT<X)W>8~c zD2P_7xQUqo))j+waziN29os{yyH37`HqU2u77Nc<D~pF^EUVBQ54W~ajaW~6=nx&G zy>yiGWi+3@;H6FPg?Bw8w<{dC<Xg$5@@jIiOr-vn^>#*nl<tzBryJ$n^fvjIosgY& zqdd#_fW1LpuqWkD>Gs88mL<p{>NM<L>TMyq(sIJAqZ1}~6rMwL;_NHia|i2QPlldk zRLE3QeeU+$y|(dNhuqz9OvL3c9ZPE77p>eoTbi9$gM9K^<YZ@7cC9+zI*0G#<|9Ng z?!L|CVlMadjepGLH7>*Q#;Seo)3;6(H8R|%o(?YBx`=-6BRan+H`=vO%p-vtPFx_v zVA%(fpGHS{BQ-Q^2rh?>0QWvdE97^BI}IV^(CP*`zxznK50^?Oc_9XBksdPS`R+xb z!zOAsyPLe)?Lw_-O&(jlrr8;0nkS%^61>bF!VyAXlGEX6KetpnMJd`?+h6Fn`P}mT zWYoGm?2L$e$TX5(y%svl+(Zj7G;Er3p(}!?1BfNqGS!oIY`W#ruL#u>bm>aOnCNpw zgo;FriH)uVEIKbXkJV@}s6i<&GL1QuAIvIrA2F)IpaG=<;~EU-Q_AD>F2NieI`OLx zD8HDL2E!qj^3octPJ`8Jum)gG$;6EsBJ{X);s-R?3=P(#!J3P(wfP;-ECTb`EDbjM zUQF)pop81h_IHQ908D2GVQ0b!bKRhw9v)yE*L0a`84uEPZhD>#PK`6^Wx@v3xCrg? zaEo@sOuSZ<y%@HnSTTA5xWfYDG)g!V2s60-BH`3j%b)}7fAg&X?RUM%WtSPGr#OW? zW|-^HIfyrSX$L*rq?ZU+t;R%{HNvBn^e8RZPB>E4jL|URER~2j?Q;hOcuD)|Y3Z!% z7qjH|>t;JRhX4!NL(kB&%!)IwozI1+hc?p_{BCj6RvO@PklR~1@8Oi7Q-;M$CW0rO zTzi>4dWhvePT7iS1G^K<0n5!gRp<$q3WLu2V#3V*F=6~!aw@M@O%IpgPbe<U9~16_ znGR>=lbRmt>Q5+qjXx$-8BC}A<XOI9+!OqgKcVne{+RG#F0<19)%4JJe?sB#{4wDs z6tlwq)%5To{)ED`{W0MZJZAa*tLfoO{0W8A%F+;R;=Ei^GU2%LGRy8?QQ=SW)XGBP zYy2_c%?r$O`&ZM$$rq?x)1?Gmr#?E)=6uMwNN>|Py-5qHi(fy<DJCHzY2hhLf8<&< z*c=VkrorZFum`8H>A0hP8Z5*j^EB9e4YojoE!1F(?!!3lKnPp9<A*fZ5)JmS23xAZ zmT9o%z)Ite6&m774aTAOeT(Ms`yLF=tA(*j8szG~Qa0RjB`TCpF>&|)n9zudOz6K7 z3Pq_%Eij=z{+Q6I%1qwBnjWfFnVM%p0sS$dmQ|RJH$Akq3e{smhy5|3*wvVh+CB8W z8dWi21^$?@jjBw?{fULiRHeF17?M9G%&R(+<G*%-(N(8{2~+gPgn{~CIxG}+Tb+8H zmeV*#o8O3HmtC#iW7u>NktX#b<KKoX=kJ<He$mFs^D|28Ia*F|B<y}12p5dUKjG;6 zaP$w3y5k(!1~`w)cLo-8;Pb-dzb*{MqMT61I047U2J!&M?Z_=oXh$g~zaH2sM^?9v z4+aDLc_44SS}&Ui&(%=+%MY&Yypj8Mus`8-G{~7FCq**%*~q^M^X}Bt6zo%;JCbo5 qP%U}sNG5`wJN(|A7-|#aNB=P<Hp~Bxz9HJ>YsZ`zbd^1#`}_}B<&`b~ delta 5367 zcmb7ITWl0n82-=9c6U45?re9rWq}s9faOw!7O^dtv=A*8p{;l+S1XrtQ`&%tAq1F> z5@XZ{-1C4@q9!JqU<@If5Fbe8RnZ6J0i(ufg3%X3eG*M@{r;Jq-I?97?d-|!ob#RU z|IhsAznq!P+!mQX#JM)n^-lZjKqnDh-h4^Oyr|X=EdMt2RYp)Sn2RgA5Sp9_q~sa3 z`hR+FsLhzUsJ5EFjj=iO6V!$2oWMmPQ(UVq4zt0OToZsY?hJFs)SoFpT9~dXMZty| zg=Q2*nW)t{hrBX_Nhg?;eO0xX7^<?Slk#mIV?C|QsXV2vaEhfgtvJjEo9AmG@hI)4 z!*q!D&`bDjr$zJ;Zmnbste%w{4%TX6ji^h|T9P|rYt?EJ@@IXf{4lmiUWx^UkXK@P zc}LfR=`^9q&+F3iczm9`6z`Mg<0<)9d_vx;Ym>hxT4a5EXX;cqNvFbCs`weB`!@!^ z$*oMDh*b>%74p|v^||W{_QaKrF1f7pn9$|Nol8TXi5ASxlizn<Z;BIbKYr}?%O?*X z+Iuj)XWyZ8@5U`~N<Y2>^3$&M0dxlCovv3FFM+=z9Yi${ZpHOMT+ieBF0K=}{)y{r zh?2AN?8<#Dr3fL4C@IWY9}c4vtBCfmC;EC*PG7Y|G&j_6H0b$^s$h+SvG*b)Bq&5% z6$MxP%H6BCWyb<Cu)0y+Tzw?bi<lugjayOBMnl~cltXJ;jUTyJm<ghn4VT6tDBR!} zhq07%z8XHu21|U6G}nBDBCh!wtj_ZGozzmTL3{%?5Tz(xag24+v8Rt0=VKJ3Y*lH& zI)XDIrE!81G#bG+6%0yJk~T!w7Y(e3hwXV%qF@<ByuC!2qOcMx^rLVgK0;43#)Epw zo6t4UZSwe*%Q4l&?wYbTFJNMpzKrNK^;MN*4a$g3rb2dtt<c6o9vH`OIj`CSL+VuU zA{CesGlR2SVQmF52G>+7gnKF$;XO<gcFQ)T&I5z%C}ETl6CT8*2gdFyU!=hUo8f_R zX4$faeTOq0ppDJ)z-D`3jUHH&2R5e?i_u&+D1Yd=Z1fP@av$kL*!CXOYI~$(#J4bR z&LyZDEom|Z!gLF<Z9)m6uh5PHt^#L=jzgEA0BtqfHY7K%AduACiEnotp&*dbTMZC) zAa||l8rsQeSQypP^Tc*oi$rNx0oPH}c^_DYOVD28-Lpmt?IYe_YoyYM8FOrcg4;QO zR#lh_q95U;Wc3Q}@L*vgjDvz>!@{dUvy^G*aV%KMBD9~LgK}%GmR>M-*BV7}<fMxl zbR0e`qvBRaAf=cxD#mN6PF`ErDVpWIb#o1tRq<U%9KzNpLXTn3t^HK7+AzIHqtK^A zV;c-2_+)?v@qN;4o9QX@I!I3g+f2`zUSrR(@6IS1%qJScccN#UmSQAm1NCt;tV`MN z6UFgHC>Y1F!o{P{7Anq~DheZ8CT{Y%uuO+<^r6D?0$g>bBVhBnBKhHSq<iq4_PZ_M zQsyB5%x-QzAHjb3oG^W46#P(BYAfffdjT$weiq=Anv!qXZ@GZ$>XZUt*e>9J^~2|S zT+WC8oy~1A=VQ5mlU=?;oHKs-$ZNKL`Yzz2>4(o{b#lJpwwSBy<N|I!7d=0GE}4Dw z4E5vJY|i+%Aol`%6!=+yE3_ZJ!RLY>0X`c1@cHzcgwOVuEWU-p`#LJcVdWQklP=N+ zv;yV2&3EHxx-=HH9|G+2zPSR!<I%hdFh=t|umv9210Gn52e!}yTf|uT<I!Rd;t~(6 z)dS;~k8+D2^1zllu;Sy<G6!gHSDOdc?tv}$z#jI%R#ajJJyHo$M;XQkR2tYMf#ixK z=CiM-=9~4;D!&{DQwwmCT6~TXKYWg#3cfr4OPRnHaBx)!04X&$p99YipMw(iPrv+f z#QNcLFi*j^?YFj+BYg@1%$HoiS>T7y8RF)boqx_^#4h0UaSN0--|D$tz^UbjzYI^p zz63ZW{Vc%gIvF4KyDi{co=l*e&w1{L&o#ioxBc(jR`(5YeQ*e%U*6n&t{v0m-y&l< zHR9R&3*qOG=~m)&g`dcAIPvFIEJ*ZLIEJqYm_H-55pP{Osr>Md7aKhGbMH6&Cl<x) z2>#*2n~<*H?E`<4V5kC)%A@^>CVpd!K!D#p_>E0qp5N?LXwzkT|6-Z#@6Qed)Syu0 z-O+m4IB+49$v2+f^~ufLmjk_eVWL4c4WAa#-220S>tU`A|K{^~d0{LS<~TJ6SI1JK hBX?u0Rb-FcQ@-n${~S3f7RuvCjT$}?@OO;)`48dp>y`ij diff --git a/java/bundles/org.eclipse.set.model.tablemodel.extensions/src/org/eclipse/set/model/tablemodel/extensions/ColumnDescriptorExtensions.xtend b/java/bundles/org.eclipse.set.model.tablemodel.extensions/src/org/eclipse/set/model/tablemodel/extensions/ColumnDescriptorExtensions.xtend index 0d8e39685..776084349 100644 --- a/java/bundles/org.eclipse.set.model.tablemodel.extensions/src/org/eclipse/set/model/tablemodel/extensions/ColumnDescriptorExtensions.xtend +++ b/java/bundles/org.eclipse.set.model.tablemodel.extensions/src/org/eclipse/set/model/tablemodel/extensions/ColumnDescriptorExtensions.xtend @@ -54,6 +54,7 @@ class ColumnDescriptorExtensions { String unit) { val unitDescriptor = TablemodelFactory.eINSTANCE.createColumnDescriptor unitDescriptor.label = unit + unitDescriptor.columnPosition = descriptor.columnPosition unitDescriptor.unit = true descriptor.table.columndescriptors.add(unitDescriptor) descriptor.children.add(unitDescriptor) diff --git a/java/bundles/org.eclipse.set.model.tablemodel.extensions/src/org/eclipse/set/model/tablemodel/extensions/TableExtensions.xtend b/java/bundles/org.eclipse.set.model.tablemodel.extensions/src/org/eclipse/set/model/tablemodel/extensions/TableExtensions.xtend index e34714a40..95a0c8fe6 100644 --- a/java/bundles/org.eclipse.set.model.tablemodel.extensions/src/org/eclipse/set/model/tablemodel/extensions/TableExtensions.xtend +++ b/java/bundles/org.eclipse.set.model.tablemodel.extensions/src/org/eclipse/set/model/tablemodel/extensions/TableExtensions.xtend @@ -249,8 +249,8 @@ class TableExtensions { static def TableRow getMatchingRow(Table table, TableRow row) { val group = row.group val rowIndex = group.rows.indexOf(row) - return table.getGroupByLeadingObject(group.leadingObject, group.leadingObjectIndex)?.rows?.get( - rowIndex) + return table.getGroupByLeadingObject(group.leadingObject, + group.leadingObjectIndex)?.rows?.get(rowIndex) } /** @@ -261,9 +261,11 @@ class TableExtensions { * @return the first group of this table with the given leading object (or * <code>null</code> if no such row exists) */ - static def RowGroup getGroupByLeadingObject(Table table, Ur_Objekt object, int index) { + static def RowGroup getGroupByLeadingObject(Table table, Ur_Objekt object, + int index) { return table.tablecontent.rowgroups.findFirst [ - leadingObject?.identitaet?.wert == object?.identitaet?.wert && leadingObjectIndex === index + leadingObject?.identitaet?.wert == object?.identitaet?.wert && + leadingObjectIndex === index ] } @@ -277,7 +279,8 @@ class TableExtensions { */ static def RowGroup getGroupById(Table table, String groupId, int index) { return table.tablecontent.rowgroups.findFirst [ - leadingObject?.identitaet?.wert == groupId && leadingObjectIndex === index + leadingObject?.identitaet?.wert == groupId && + leadingObjectIndex === index ] } @@ -287,8 +290,16 @@ class TableExtensions { * @param table this table * @param columnIdx the column index */ - static def void setTextAlignment(Table table, int columnIdx, + static def void setTextAlignment(Table table, ColumnDescriptor column, TextAlignment textAlignment) { + val columnIdx = table.columns.indexed.findFirst [ + value.equals(column) || (value.columnPosition !== null && + value.columnPosition.equals(column.columnPosition)) + ]?.key + + if (columnIdx === null) { + return + } table.tablecontent.rowgroups.forEach [ it.setTextAlignment(columnIdx, textAlignment) ] diff --git a/java/bundles/org.eclipse.set.utils.table/src/org/eclipse/set/utils/table/AbstractTableModelTransformator.xtend b/java/bundles/org.eclipse.set.utils.table/src/org/eclipse/set/utils/table/AbstractTableModelTransformator.xtend index 97c49265c..6baf68468 100644 --- a/java/bundles/org.eclipse.set.utils.table/src/org/eclipse/set/utils/table/AbstractTableModelTransformator.xtend +++ b/java/bundles/org.eclipse.set.utils.table/src/org/eclipse/set/utils/table/AbstractTableModelTransformator.xtend @@ -462,6 +462,10 @@ abstract class AbstractTableModelTransformator<T> implements TableModelTransform } override void formatTableContent(Table table) { - table.setTextAlignment(0, TextAlignment.LEFT); + val cols = table.columns + // Description column + table.setTextAlignment(cols.get(0), TextAlignment.LEFT); + // Notice column + table.setTextAlignment(cols.get(cols.size -1), TextAlignment.LEFT) } } diff --git a/java/bundles/org.eclipse.set.utils.table/src/org/eclipse/set/utils/table/ColumnDescriptorModelBuilder.java b/java/bundles/org.eclipse.set.utils.table/src/org/eclipse/set/utils/table/ColumnDescriptorModelBuilder.java index d018671f2..ad50a30c4 100644 --- a/java/bundles/org.eclipse.set.utils.table/src/org/eclipse/set/utils/table/ColumnDescriptorModelBuilder.java +++ b/java/bundles/org.eclipse.set.utils.table/src/org/eclipse/set/utils/table/ColumnDescriptorModelBuilder.java @@ -66,6 +66,7 @@ public final class ColumnDescriptorModelBuilder { .createColumnDescriptor(); unitDescriptor.setLabel(unit); unitDescriptor.setUnit(true); + unitDescriptor.setColumnPosition(childDescriptor.getColumnPosition()); table.getColumndescriptors().add(childDescriptor); table.getColumndescriptors().add(unitDescriptor); parentDescriptor.getChildren().add(childDescriptor); -- GitLab From 8ea371aa60b42973aa4b3a5875f89bc8cdcb3513 Mon Sep 17 00:00:00 2001 From: Quang Truong <truong.quang@scheidt-bachmann-st.de> Date: Tue, 21 Mar 2023 14:23:02 +0100 Subject: [PATCH 5/9] issue#48 adjust & active ssld --- .../META-INF/MANIFEST.MF | 2 + ....table.pt1.ssld.SsldDescriptionService.xml | 8 + ...ble.pt1.ssld.SsldTransformationService.xml | 10 + .../feature/table/pt1/ssld/SsldColumns.java | 120 ++++++ .../pt1/ssld/SsldDescriptionService.java | 37 ++ .../pt1/ssld/SsldTransformationService.java | 74 ++++ .../table/pt1/ssld/SsldTransformator.xtend | 380 ++++++++++++++++++ .../table/pt1/ssln/SslnTransformator.xtend | 41 -- .../table/pt1/sslr/SslrTransformator.xtend | 29 -- 9 files changed, 631 insertions(+), 70 deletions(-) create mode 100644 java/bundles/org.eclipse.set.feature.table.pt1/OSGI-INF/org.eclipse.set.feature.table.pt1.ssld.SsldDescriptionService.xml create mode 100644 java/bundles/org.eclipse.set.feature.table.pt1/OSGI-INF/org.eclipse.set.feature.table.pt1.ssld.SsldTransformationService.xml create mode 100644 java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssld/SsldColumns.java create mode 100644 java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssld/SsldDescriptionService.java create mode 100644 java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssld/SsldTransformationService.java create mode 100644 java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssld/SsldTransformator.xtend diff --git a/java/bundles/org.eclipse.set.feature.table.pt1/META-INF/MANIFEST.MF b/java/bundles/org.eclipse.set.feature.table.pt1/META-INF/MANIFEST.MF index 8b4aa1fca..053778647 100644 --- a/java/bundles/org.eclipse.set.feature.table.pt1/META-INF/MANIFEST.MF +++ b/java/bundles/org.eclipse.set.feature.table.pt1/META-INF/MANIFEST.MF @@ -102,6 +102,8 @@ Service-Component: OSGI-INF/org.eclipse.set.feature.table.pt1.messages.Messages. OSGI-INF/org.eclipse.set.feature.table.pt1.sskt.SsktTransformationService.xml, OSGI-INF/org.eclipse.set.feature.table.pt1.sslb.SslbDescriptionService.xml, OSGI-INF/org.eclipse.set.feature.table.pt1.sslb.SslbTransformationService.xml, + OSGI-INF/org.eclipse.set.feature.table.pt1.ssld.SsldDescriptionService.xml, + OSGI-INF/org.eclipse.set.feature.table.pt1.ssld.SsldTransformationService.xml, OSGI-INF/org.eclipse.set.feature.table.pt1.sslf.SslfDescriptionService.xml, OSGI-INF/org.eclipse.set.feature.table.pt1.sslf.SslfTransformationService.xml, OSGI-INF/org.eclipse.set.feature.table.pt1.ssli.SsliDescriptionService.xml, diff --git a/java/bundles/org.eclipse.set.feature.table.pt1/OSGI-INF/org.eclipse.set.feature.table.pt1.ssld.SsldDescriptionService.xml b/java/bundles/org.eclipse.set.feature.table.pt1/OSGI-INF/org.eclipse.set.feature.table.pt1.ssld.SsldDescriptionService.xml new file mode 100644 index 000000000..d0a2998af --- /dev/null +++ b/java/bundles/org.eclipse.set.feature.table.pt1/OSGI-INF/org.eclipse.set.feature.table.pt1.ssld.SsldDescriptionService.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.3.0" name="org.eclipse.set.feature.table.pt1.ssld.SsldDescriptionService"> + <service> + <provide interface="org.eclipse.set.core.services.part.PartDescriptionService"/> + </service> + <reference cardinality="1..1" field="messages" interface="org.eclipse.set.feature.table.pt1.messages.Messages" name="messages"/> + <implementation class="org.eclipse.set.feature.table.pt1.ssld.SsldDescriptionService"/> +</scr:component> \ No newline at end of file diff --git a/java/bundles/org.eclipse.set.feature.table.pt1/OSGI-INF/org.eclipse.set.feature.table.pt1.ssld.SsldTransformationService.xml b/java/bundles/org.eclipse.set.feature.table.pt1/OSGI-INF/org.eclipse.set.feature.table.pt1.ssld.SsldTransformationService.xml new file mode 100644 index 000000000..09d3ff2b7 --- /dev/null +++ b/java/bundles/org.eclipse.set.feature.table.pt1/OSGI-INF/org.eclipse.set.feature.table.pt1.ssld.SsldTransformationService.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.3.0" immediate="true" name="org.eclipse.set.feature.table.pt1.ssld.SsldTransformationService"> + <property name="table.shortcut" value="ssld"/> + <service> + <provide interface="org.eclipse.set.feature.table.PlanPro2TableTransformationService"/> + </service> + <reference cardinality="1..1" field="enumTranslationService" interface="org.eclipse.set.core.services.enumtranslation.EnumTranslationService" name="enumTranslationService"/> + <reference cardinality="1..1" field="messages" interface="org.eclipse.set.feature.table.pt1.messages.Messages" name="messages"/> + <implementation class="org.eclipse.set.feature.table.pt1.ssld.SsldTransformationService"/> +</scr:component> \ No newline at end of file diff --git a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssld/SsldColumns.java b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssld/SsldColumns.java new file mode 100644 index 000000000..cb70a3b71 --- /dev/null +++ b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssld/SsldColumns.java @@ -0,0 +1,120 @@ +/** + * Copyright (c) 2023 DB Netz AG and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + */ + +package org.eclipse.set.feature.table.pt1.ssld; + +/** + * Symbolic addressing for Ssld columns. + * + * @author truong + * + */ +@SuppressWarnings("nls") +public class SsldColumns { + + /** + * Ssld.Grundsatzangaben.von + */ + public static final String von = "A"; + + /** + * Ssld.Grundsatzangaben.bis + */ + public static final String bis = "B"; + + /** + * Ssld.Grundsatzangaben.Gefahrpunkt + */ + public static final String Gefahrpunkt = "C"; + + /** + * Ssld.Grundsatzangaben.PZB_Gefahrpunkt + */ + public static final String PZB_Gefahrpunkt = "D"; + + /** + * Ssld.Grundsatzangaben.Bezeichnung + */ + public static final String Bezeichnung = "E"; + + /** + * Ssld.Eigenschaften.Zielgeschwindigkeit_moeglich + */ + public static final String Zielgeschwindigkeit_moeglich = "F"; + + /** + * Ssld.Eigenschaften.Laenge.Soll + */ + public static final String Laenge_Soll = "G"; + + /** + * Ssld.Eigenschaften.Laenge.Ist + */ + public static final String Laenge_Ist = "H"; + + /** + * Ssld.Eigenschaften.Laenge.Freigemeldet + */ + public static final String Freigemeldet = "I"; + + /** + * Ssld.Eigenschaften.massgebende_Neigung + */ + public static final String massgebende_Neigung = "J"; + + /** + * Ssld.Abhaengigkeiten.Weichen_Kreuzungen.mit_Verschluss + */ + public static final String Weichen_Kreuzungen_mit_Verschluss = "K"; + + /** + * Ssld.Abhaengigkeiten.Weichen_Kreuzungen.ohne_Verschluss + */ + public static final String Weichen_Kreuzungen_ohne_Verschluss = "L"; + + /** + * Ssld.Abhaengigkeiten.relevante_FmA + */ + public static final String relevante_FmA = "M"; + + /** + * Ssld.Abhaengigkeiten.v_Aufwertung_Verzicht + */ + public static final String v_Aufwertung_Verzicht = "N"; + + /** + * Ssld.Abhaengigkeiten.Erlaubnisabhaengig + */ + public static final String Erlaubnisabhaengig = "O"; + + /** + * Ssld.Aufloesung.Manuell + */ + public static final String Manuell = "P"; + + /** + * Ssld.Aufloesung.Zielgleisabschnitt.Bezeichnung + */ + public static final String Zielgleisabschnitt_Bezeichnung = "Q"; + + /** + * Ssld.Aufloesung.Zielgleisabschnitt.Laenge + */ + public static final String Zielgleisabschnitt_Laenge = "R"; + + /** + * Ssld.Aufloesung.Verzoegerung + */ + public static final String Verzoegerung = "S"; + + /** + * Ssld.Bemerkung + */ + public static final String Bemerkung = "T"; +} diff --git a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssld/SsldDescriptionService.java b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssld/SsldDescriptionService.java new file mode 100644 index 000000000..1f3a88a18 --- /dev/null +++ b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssld/SsldDescriptionService.java @@ -0,0 +1,37 @@ +/** + * Copyright (c) 2020 DB Netz AG and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + */ + +package org.eclipse.set.feature.table.pt1.ssld; + +import org.eclipse.set.core.services.part.PartDescriptionService; +import org.eclipse.set.feature.table.AbstractTableDescription; +import org.eclipse.set.feature.table.pt1.messages.Messages; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Reference; + +/** + * Part description for SSLD table view. + * + * @author Schaefer + */ +@Component(service = PartDescriptionService.class) +public class SsldDescriptionService extends AbstractTableDescription { + @Reference + Messages messages; + + @Override + protected String getToolboxViewName() { + return messages.SsldDescriptionService_ViewName; + } + + @Override + protected String getToolboxViewTooltip() { + return messages.SsldDescriptionService_ViewTooltip; + } +} diff --git a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssld/SsldTransformationService.java b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssld/SsldTransformationService.java new file mode 100644 index 000000000..d5a1c4437 --- /dev/null +++ b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssld/SsldTransformationService.java @@ -0,0 +1,74 @@ +/** + * Copyright (c) 2016 DB Netz AG and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + */ +package org.eclipse.set.feature.table.pt1.ssld; + +import static org.eclipse.nebula.widgets.nattable.sort.SortDirectionEnum.ASC; +import static org.eclipse.set.utils.table.sorting.ComparatorBuilder.CellComparatorType.MIXED_STRING; + +import java.util.Comparator; + +import org.eclipse.set.core.services.enumtranslation.EnumTranslationService; +import org.eclipse.set.feature.table.PlanPro2TableTransformationService; +import org.eclipse.set.feature.table.pt1.AbstractPlanPro2TableModelTransformator; +import org.eclipse.set.feature.table.pt1.AbstractPlanPro2TableTransformationService; +import org.eclipse.set.feature.table.pt1.messages.Messages; +import org.eclipse.set.model.tablemodel.RowGroup; +import org.eclipse.set.ppmodel.extensions.utils.TableNameInfo; +import org.eclipse.set.utils.table.sorting.TableRowGroupComparator; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Reference; + +/** + * Service for creating the ssld table model. + * + * @author rumpf + * + * @usage production + */ +@Component(service = { + PlanPro2TableTransformationService.class }, immediate = true, property = { + "table.shortcut=ssld" }) +public final class SsldTransformationService + extends AbstractPlanPro2TableTransformationService { + @Reference + private Messages messages; + @Reference + private EnumTranslationService enumTranslationService; + + /** + * constructor. + */ + public SsldTransformationService() { + super(); + } + + @Override + public AbstractPlanPro2TableModelTransformator createTransformator() { + return new SsldTransformator(cols, enumTranslationService); + } + + @Override + public Comparator<RowGroup> getRowGroupComparator() { + return TableRowGroupComparator.builder().sort("A", MIXED_STRING, ASC) //$NON-NLS-1$ + .sort("E", MIXED_STRING, ASC).build(); //$NON-NLS-1$ + } + + @Override + public TableNameInfo getTableNameInfo() { + return new TableNameInfo(messages.ToolboxTableNameSsldLong, + messages.ToolboxTableNameSsldPlanningNumber, + messages.ToolboxTableNameSsldShort); + } + + @Override + protected String getTableHeading() { + return messages.SsldTableView_Heading; + } + +} \ No newline at end of file diff --git a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssld/SsldTransformator.xtend b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssld/SsldTransformator.xtend new file mode 100644 index 000000000..32bd2587b --- /dev/null +++ b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssld/SsldTransformator.xtend @@ -0,0 +1,380 @@ +/** + * Copyright (c) 2015 DB Netz AG and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + */ +package org.eclipse.set.feature.table.pt1.ssld + +import java.math.RoundingMode +import org.eclipse.set.core.services.enumtranslation.EnumTranslationService +import org.eclipse.set.feature.table.pt1.AbstractPlanPro2TableModelTransformator +import org.eclipse.set.model.tablemodel.Table +import org.eclipse.set.model.tablemodel.format.TextAlignment +import org.eclipse.set.ppmodel.extensions.container.MultiContainer_AttributeGroup +import org.eclipse.set.ppmodel.extensions.utils.Case +import org.eclipse.set.ppmodel.extensions.utils.TopGraph +import org.eclipse.set.toolboxmodel.Basisobjekte.Punkt_Objekt +import org.eclipse.set.toolboxmodel.Fahrstrasse.Fstr_DWeg +import org.eclipse.set.toolboxmodel.Signale.Signal +import org.eclipse.set.utils.math.AgateRounding +import org.eclipse.set.utils.table.TMFactory + +import static org.eclipse.set.toolboxmodel.Signale.ENUMSignalFunktion.* + +import static extension org.eclipse.set.model.tablemodel.extensions.TableExtensions.* +import static extension org.eclipse.set.ppmodel.extensions.BereichObjektExtensions.* +import static extension org.eclipse.set.ppmodel.extensions.DwegExtensions.* +import static extension org.eclipse.set.ppmodel.extensions.FahrwegExtensions.* +import static extension org.eclipse.set.ppmodel.extensions.FmaAnlageExtensions.* +import static extension org.eclipse.set.ppmodel.extensions.FstrDWegSpezifischExtensions.* +import static extension org.eclipse.set.ppmodel.extensions.FstrDWegWKrExtensions.* +import static extension org.eclipse.set.ppmodel.extensions.PunktObjektExtensions.* +import static extension org.eclipse.set.ppmodel.extensions.SignalExtensions.* +import static extension org.eclipse.set.utils.graph.DigraphExtensions.* +import static extension org.eclipse.set.utils.math.BigDecimalExtensions.* +import static org.eclipse.set.feature.table.pt1.ssld.SsldColumns.* +import java.util.Set +import org.eclipse.set.model.tablemodel.ColumnDescriptor + +/** + * Table transformation for a Durchrutschwegtabelle (SSLD). + * + * @author Dittmer + */ +class SsldTransformator extends AbstractPlanPro2TableModelTransformator { + + new(Set<ColumnDescriptor> cols, + EnumTranslationService enumTranslationService) { + super(cols, enumTranslationService) + } + + def static double getShortestPathLength(TopGraph topGraph, Signal signal, + Punkt_Objekt p) { + val paths = topGraph.getPaths(signal.singlePoints, p.singlePoints) + if (paths.isNullOrEmpty) { + return 0.0 + } else { + return paths.map[it.length].min + } + } + + def static String getFreigemeldetLaenge(TopGraph topGraph, Fstr_DWeg dweg) { + if (dweg.IDFMAAnlageFreimeldung === null) { + return "" + } + val fmaAnlagen = dweg?.fmaAnlageFreimeldung + if (fmaAnlagen.empty) { + return "" + } + if (fmaAnlagen.contains(null)) { + throw new IllegalArgumentException('''«dweg?.bezeichnung?.bezeichnungFstrDWeg?.wert» contains non-FMA-Anlagen within ID_FMA_Anlage''') + } + val topDWeg = dweg.IDFstrFahrweg.bereichObjektTeilbereich.map [ + IDTOPKante + ] + val distance = fmaAnlagen?.map[fmaGrenzen]?.flatten?.filter [ + // Only consider FMA borders which are located on the DWeg + punktObjektTOPKante.map[IDTOPKante].exists[topDWeg.contains(it)] + ].fold(Double.valueOf(0.0), [ Double current, Punkt_Objekt grenze | + Math.max(current, + getShortestPathLength(topGraph, dweg?.fstrFahrweg?.start, + grenze)) + ]) + val roundedDistance = AgateRounding.roundDown(distance) + if (roundedDistance == 0.0) + throw new IllegalArgumentException("no path found") + else + return roundedDistance.toString + } + + override transformTableContent( + MultiContainer_AttributeGroup container, + TMFactory factory + ) { + + val topGraph = new TopGraph(container.TOPKante) + + val fstDwegList = container.fstrDWeg + + // var footnoteNumber = 1; + for (dweg : fstDwegList) { + if (Thread.currentThread.interrupted) { + return null + } + val instance = factory.newTableRow(dweg) + // A: Ssld.Grundsatzangaben.von + fill( + instance, + cols.getColumn(von), + dweg, + [fstrFahrweg.start.bezeichnung?.bezeichnungTabelle?.wert] + ) + + // B: Ssld.Grundsatzangaben.bis + fillConditional( + instance, + cols.getColumn(bis), + dweg, + [fstrDWegSpezifisch !== null], + [ + fstrFahrweg.zielPunkt.bezeichnung.bezeichnungMarkanterPunkt. + wert + ] + ) + + // C: Ssld.Grundsatzangaben.Gefahrpunkt + fillSwitch( + instance, + cols.getColumn(Gefahrpunkt), + dweg, + new Case<Fstr_DWeg>( + [fstrDWegSpezifisch === null], + [ + fstrFahrweg.zielPunkt.bezeichnung. + bezeichnungMarkanterPunkt.wert + ] + ) + ) + + // D: Ssld.Grundsatzangaben.PZB_Gefahrpunkt + fill( + instance, + cols.getColumn(PZB_Gefahrpunkt), + dweg, + [PZBGefahrpunkt?.bezeichnung?.bezeichnungMarkanterPunkt?.wert] + ) + + // E: Ssld.Grundsatzangaben.Bezeichnung + fillConditional( + instance, + cols.getColumn(Bezeichnung), + dweg, + [fstrDWegSpezifisch !== null], + [bezeichnung.bezeichnungFstrDWeg.wert] + ) + + // F: Ssld.Eigenschaften.Zielgeschwindigkeit_moeglich + fillConditional( + instance, + cols.getColumn(Zielgeschwindigkeit_moeglich), + dweg, + [fstrDWegSpezifisch !== null], + [fstrDWegSpezifisch.DWegV.wert.toString] + ) + + // G: Ssld.Eigenschaften.Laenge.Soll + fill( + instance, + cols.getColumn(Laenge_Soll), + dweg, + [fstrDWegAllg.laengeSoll.wert.toString] + ) + + // H: Ssld.Eigenschaften.Laenge.Ist + fill( + instance, + cols.getColumn(Laenge_Ist), + dweg, + [fstrFahrweg.length.toTableIntegerAgateDown] + ) + + // I: Ssld.Eigenschaften.Laenge.Freigemeldet + fill( + instance, + cols.getColumn(Freigemeldet), + dweg, + [getFreigemeldetLaenge(topGraph, dweg)] + ) + + // J: Ssld.Eigenschaften.massgebende_Neigung + fill( + instance, + cols.getColumn(massgebende_Neigung), + dweg, + [ + fstrDWegAllg.massgebendeNeigung.wert.setScale(1, + RoundingMode.DOWN).toString + ] + ) + + // K: Ssld.Abhaengigkeiten.Weichen_Kreuzungen.mit_Verschluss + fillIterableWithSeparatorConditional( + instance, + cols.getColumn(Weichen_Kreuzungen_mit_Verschluss), + dweg, + [fstrDWegSpezifisch !== null], + [ + zuordnungen.filter[elementVerschluss?.wert].map [ + WKrGspElement.bezeichnung.bezeichnungTabelle.wert + ] + ], + MIXED_STRING_COMPARATOR, + [""], + "\r\n" + ) + + // L: Ssld.Abhaengigkeiten.Weichen_Kreuzungen.ohne_Verschluss + fillIterableWithSeparatorConditional( + instance, + cols.getColumn(Weichen_Kreuzungen_ohne_Verschluss), + dweg, + [fstrDWegSpezifisch !== null], + [ + zuordnungen.filter[!elementVerschluss?.wert].map [ + WKrGspElement.bezeichnung.bezeichnungTabelle.wert + ] + ], + MIXED_STRING_COMPARATOR, + [""], + "\r\n" + ) + + // M: Ssld.Abhaengigkeiten.relevante_FmA + fillIterableWithSeparatorConditional( + instance, + cols.getColumn(relevante_FmA), + dweg, + [fstrDWegSpezifisch !== null], + [ + val fmaAnlagen = dweg?.fmaAnlageFreimeldung + if (fmaAnlagen.contains(null)) { + throw new IllegalArgumentException('''«dweg?.bezeichnung?.bezeichnungFstrDWeg?.wert» contains non-FMA-Anlagen within ID_FMA_Anlage''') + } + fmaAnlagen.map[tableName] + ], + MIXED_STRING_COMPARATOR, + [""], + "\r\n" + ) + + // N: Ssld.Abhaengigkeiten.v_Aufwertung_Verzicht + fillConditional( + instance, + cols.getColumn(v_Aufwertung_Verzicht), + dweg, + [dweg?.fstrFahrweg?.start.isStartOfAnyTrainRoute], + [ + dweg?.fstrDWegSpezifisch?.DWegVAufwertungVerzicht?.wert?. + translate + ] + ) + + // O: Ssld.Abhaengigkeiten.Erlaubnisabhaengig + fillConditional( + instance, + cols.getColumn(Erlaubnisabhaengig), + dweg, + [fstrDWegSpezifisch !== null], + [ + if (fstrFahrweg.zielPunkt.IDDWegErlaubnisabhaengig !== null) + "x" + else if (#{ + ENUM_SIGNAL_FUNKTION_AUSFAHR_SIGNAL, + ENUM_SIGNAL_FUNKTION_AUSFAHR_ZWISCHEN_SIGNAL, + ENUM_SIGNAL_FUNKTION_EINFAHR_AUSFAHR_SIGNAL, + ENUM_SIGNAL_FUNKTION_GRUPPENAUSFAHR_GRUPPENZWISCHEN_SIGNAL, + ENUM_SIGNAL_FUNKTION_GRUPPENAUSFAHR_SIGNAL + }.contains( + fstrFahrweg?.start?.signalReal?.signalRealAktiv?. + signalFunktion?.wert + )) + "o" + ] + ) + + // P: Ssld.Aufloesung.Manuell + fillConditional( + instance, + cols.getColumn(Manuell), + dweg, + [fstrDWegSpezifisch !== null], + [ + fstrFahrweg?.start?.signalFstr?.DAManuell?.wert?.translate + ] + ) + + // Q: Ssld.Aufloesung.Zielgleisabschnitt.Bezeichnung + fillConditional( + instance, + cols.getColumn(Zielgleisabschnitt_Bezeichnung), + dweg, + [dweg.fstrDWegSpezifisch !== null], + [ + fstrDWegSpezifisch.fmaAnlageZielgleis.gleisabschnitt. + bezeichnung.bezeichnungTabelle.wert + ] + ) + + // R: Ssld.Aufloesung.Zielgleisabschnitt.Laenge + fillConditional( + instance, + cols.getColumn(Zielgleisabschnitt_Laenge), + dweg, + [dweg.fstrDWegSpezifisch !== null], + [ + fstrDWegSpezifisch.fmaAnlageZielgleis.gleisabschnitt.length. + toTableInteger + ] + ) + + // S: Ssld.Aufloesung.Verzoegerung + fillConditional( + instance, + cols.getColumn(Verzoegerung), + dweg, + [dweg.fstrDWegSpezifisch !== null], + [ + fstrDWegSpezifisch.aufloesungVerzoegerung.wert.toString + ] + ) + + // PLANPRO-2377 + // Verschieben nach BasisObjektExtensions.comment(Basis_Objekt) + // Bemerkung ==> Fussnoten erstellen + // fillIterable verwenden +// var str = "" +// var first = true +// val comments = dweg.comments +// for (Bearbeitungsvermerk vermerk : comments) { +// if (!first) { +// str = str + ", " +// } +// first = false +// str = str + "*" + footnoteNumber + " " +// instance.addFootnote(footnoteNumber, +// vermerk?.bearbeitungsvermerkAllg?. +// kommentar?.wert) +// footnoteNumber++ +// } +// +// val commentText = str.trim; + // T: Ssld.Bemerkung + fill( + instance, + cols.getColumn("T"), + dweg, + [footnoteTransformation.transform(it, instance)] + ) + + } + + return factory.table + } + + override void formatTableContent(Table table) { + // A: Ssld.Grundsatzangaben.von + table.setTextAlignment(0, TextAlignment.LEFT); + + // B: Ssld.Grundsatzangaben.bis + table.setTextAlignment(1, TextAlignment.LEFT); + + // C: Ssld.Grundsatzangaben.Gefahrpunkt + table.setTextAlignment(2, TextAlignment.LEFT); + + // G: Bemerkung + table.setTextAlignment(19, TextAlignment.LEFT); + } +} diff --git a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssln/SslnTransformator.xtend b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssln/SslnTransformator.xtend index 077c89ba0..d349bcadd 100644 --- a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssln/SslnTransformator.xtend +++ b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssln/SslnTransformator.xtend @@ -10,23 +10,14 @@ package org.eclipse.set.feature.table.pt1.ssln import com.google.common.collect.Lists import java.util.List -<<<<<<< HEAD import java.util.Set -======= ->>>>>>> dca65b763dc8c144cbfaf4cca2e8cee71e77addc import org.eclipse.set.basis.Pair import org.eclipse.set.basis.constants.ToolboxConstants import org.eclipse.set.core.services.enumtranslation.EnumTranslationService import org.eclipse.set.feature.table.pt1.AbstractPlanPro2TableModelTransformator -<<<<<<< HEAD import org.eclipse.set.model.tablemodel.ColumnDescriptor import org.eclipse.set.model.tablemodel.Table import org.eclipse.set.model.tablemodel.TableRow -======= -import org.eclipse.set.model.tablemodel.Table -import org.eclipse.set.model.tablemodel.TableRow -import org.eclipse.set.model.tablemodel.format.TextAlignment ->>>>>>> dca65b763dc8c144cbfaf4cca2e8cee71e77addc import org.eclipse.set.ppmodel.extensions.container.MultiContainer_AttributeGroup import org.eclipse.set.toolboxmodel.Basisobjekte.Basis_Objekt import org.eclipse.set.toolboxmodel.Basisobjekte.Punkt_Objekt @@ -40,7 +31,6 @@ import org.eclipse.set.toolboxmodel.Weichen_und_Gleissperren.W_Kr_Gsp_Element import org.eclipse.set.toolboxmodel.Weichen_und_Gleissperren.W_Kr_Gsp_Komponente import org.eclipse.set.utils.table.TMFactory -<<<<<<< HEAD import static org.eclipse.set.feature.table.pt1.ssln.SslnColumns.* import static extension org.eclipse.set.ppmodel.extensions.BedienAnzeigeElementExtensions.* @@ -55,26 +45,6 @@ import static extension org.eclipse.set.ppmodel.extensions.PunktObjektExtensions import static extension org.eclipse.set.ppmodel.extensions.TopKanteExtensions.* import static extension org.eclipse.set.ppmodel.extensions.WKrGspKomponenteExtensions.* import static extension org.eclipse.set.utils.StringExtensions.* -======= -import static org.eclipse.set.ppmodel.extensions.NbZoneExtensions.* - -import static extension org.eclipse.set.model.tablemodel.extensions.TableExtensions.* -import static extension org.eclipse.set.ppmodel.extensions.BedienAnzeigeElementExtensions.* -import static extension org.eclipse.set.ppmodel.extensions.FlaSchutzExtensions.* -import static extension org.eclipse.set.ppmodel.extensions.MarkanterPunktExtensions.* -import static extension org.eclipse.set.ppmodel.extensions.NbExtensions.* -import static extension org.eclipse.set.ppmodel.extensions.NbBedienAnzeigeElementExtensions.* -import static extension org.eclipse.set.ppmodel.extensions.NbZoneElementExtensions.* -import static extension org.eclipse.set.ppmodel.extensions.NbZoneGrenzeExtensions.* -import static extension org.eclipse.set.ppmodel.extensions.PunktObjektExtensions.* -import static extension org.eclipse.set.ppmodel.extensions.TopKanteExtensions.* -import static extension org.eclipse.set.ppmodel.extensions.NbZoneExtensions.* -import static extension org.eclipse.set.ppmodel.extensions.WKrGspKomponenteExtensions.* -import static extension org.eclipse.set.utils.StringExtensions.* -import static org.eclipse.set.feature.table.pt1.ssln.SslnColumns.* -import java.util.Set -import org.eclipse.set.model.tablemodel.ColumnDescriptor ->>>>>>> dca65b763dc8c144cbfaf4cca2e8cee71e77addc /** * Table transformation for a Nahbedienungstabelle (SSLN). @@ -331,17 +301,6 @@ class SslnTransformator extends AbstractPlanPro2TableModelTransformator { ] } -<<<<<<< HEAD -======= - override void formatTableContent(Table table) { - // A: Ssln.Grundsatzangaben.Bereich_Zone - table.setTextAlignment(0, TextAlignment.LEFT); - - // N: Ssln.Bemerkung - table.setTextAlignment(13, TextAlignment.LEFT); - } - ->>>>>>> dca65b763dc8c144cbfaf4cca2e8cee71e77addc private static dispatch def String toBezeichnungGrenze( Punkt_Objekt markanteStelle, NB_Zone_Grenze grenze diff --git a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sslr/SslrTransformator.xtend b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sslr/SslrTransformator.xtend index 7f3293003..88ecbe30e 100644 --- a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sslr/SslrTransformator.xtend +++ b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sslr/SslrTransformator.xtend @@ -289,17 +289,11 @@ class SslrTransformator extends AbstractPlanPro2TableModelTransformator { toString.trim ] ) -<<<<<<< HEAD - -======= - ->>>>>>> dca65b763dc8c144cbfaf4cca2e8cee71e77addc val bedAnzeigeElemente = fstrZugRangier.fstrFahrweg?.abhaengigkeiten?. map [ bedienAnzeigeElement ]?.filterNull ?: Collections.emptyList -<<<<<<< HEAD val besondersRangierFstrs = fstrZugRangier.IDFstrAusschlussBesonders?. filter [ generalbedingung @@ -308,15 +302,6 @@ class SslrTransformator extends AbstractPlanPro2TableModelTransformator { val zugFstrs = fstrZugRangier.IDFstrAusschlussBesonders?.filter [ fstrZugRangier?.fstrRangier.fstrRangierArt.wert?.literal?. substring(0, 1) == "Z" -======= - val besondersRangierFstrs = fstrZugRangier.IDFstrAusschlussBesonders?.filter[ - generalbedingung - ]?.filterNull ?: Collections.emptyList - - val zugFstrs = fstrZugRangier.IDFstrAusschlussBesonders?.filter[ - fstrZugRangier?.fstrRangier.fstrRangierArt.wert?. - literal?.substring(0, 1) == "Z" ->>>>>>> dca65b763dc8c144cbfaf4cca2e8cee71e77addc ]?.filterNull ?: Collections.emptyList fillSwitch( cols.getColumn(Bemerkung), @@ -366,7 +351,6 @@ class SslrTransformator extends AbstractPlanPro2TableModelTransformator { } override void formatTableContent(Table table) { -<<<<<<< HEAD super.formatTableContent(table) // B: Sslr.Grundsatzangaben.Fahrweg.Start table.setTextAlignment(cols.getColumn(Fahrweg_Start), @@ -375,18 +359,5 @@ class SslrTransformator extends AbstractPlanPro2TableModelTransformator { // C: Sslr.Grundsatzangaben.Fahrweg.Ziel table.setTextAlignment(cols.getColumn(Fahrweg_Ziel), TextAlignment.LEFT); -======= - // A: Sslr.Grundsatzangaben.Bezeichnung - table.setTextAlignment(0, TextAlignment.LEFT); - - // B: Sslr.Grundsatzangaben.Fahrweg.Start - table.setTextAlignment(1, TextAlignment.LEFT); - - // C: Sslr.Grundsatzangaben.Fahrweg.Ziel - table.setTextAlignment(2, TextAlignment.LEFT); - - // Q: Sslr.Bemerkung - table.setTextAlignment(15, TextAlignment.LEFT); ->>>>>>> dca65b763dc8c144cbfaf4cca2e8cee71e77addc } } -- GitLab From cfe1928d9e7360405be72b3ec4d137f2803e822f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pascal=20St=C3=BCcker?= <stuecker.pascal@scheidt-bachmann-st.de> Date: Fri, 24 Feb 2023 15:09:23 +0100 Subject: [PATCH 6/9] Adjust length of slip way target track length to only consider overlaps --- .../table/pt1/ssld/SsldTransformator.xtend | 8 ++- .../extensions/BereichObjektExtensions.xtend | 69 +++++++++++++++++-- 2 files changed, 68 insertions(+), 9 deletions(-) diff --git a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssld/SsldTransformator.xtend b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssld/SsldTransformator.xtend index 32bd2587b..318e53105 100644 --- a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssld/SsldTransformator.xtend +++ b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssld/SsldTransformator.xtend @@ -315,8 +315,12 @@ class SsldTransformator extends AbstractPlanPro2TableModelTransformator { dweg, [dweg.fstrDWegSpezifisch !== null], [ - fstrDWegSpezifisch.fmaAnlageZielgleis.gleisabschnitt.length. - toTableInteger + val fstr = container.fstrZugRangier.filter [ + fstrZug?.fstrZugDWeg?.IDFstrDWeg == dweg + ].get(0) + fstrDWegSpezifisch.IDFMAAnlageZielgleis.IDGleisAbschnitt. + getOverlappingLength(fstr.IDFstrFahrweg). + toTableIntegerAgateDown ] ) diff --git a/java/bundles/org.eclipse.set.ppmodel.extensions/src/org/eclipse/set/ppmodel/extensions/BereichObjektExtensions.xtend b/java/bundles/org.eclipse.set.ppmodel.extensions/src/org/eclipse/set/ppmodel/extensions/BereichObjektExtensions.xtend index d0865c862..f446229ee 100644 --- a/java/bundles/org.eclipse.set.ppmodel.extensions/src/org/eclipse/set/ppmodel/extensions/BereichObjektExtensions.xtend +++ b/java/bundles/org.eclipse.set.ppmodel.extensions/src/org/eclipse/set/ppmodel/extensions/BereichObjektExtensions.xtend @@ -267,7 +267,9 @@ class BereichObjektExtensions extends BasisObjektExtensions { Bereich_Objekt bereich, Bereich_Objekt other ) { - return bereich.bereichObjektTeilbereich.exists[other.intersectsStrictly(it)] + return bereich.bereichObjektTeilbereich.exists [ + other.intersectsStrictly(it) + ] } /** @@ -281,8 +283,11 @@ class BereichObjektExtensions extends BasisObjektExtensions { Bereich_Objekt bereich, Bereich_Objekt_Teilbereich_AttributeGroup teilbereich ) { - return bereich.bereichObjektTeilbereich.exists[intersectsStrictly(teilbereich)] + return bereich.bereichObjektTeilbereich.exists [ + intersectsStrictly(teilbereich) + ] } + /** * @param teilbereich a Teilbereich * @param other another Teilbereich @@ -323,17 +328,16 @@ class BereichObjektExtensions extends BasisObjektExtensions { if (bEndAStart < 0) { return false } - + // If the two TBs are equal, they intersect - if(aEndBStart === 0) - { + if (aEndBStart === 0) { return bEndAStart === 0 } - + // Intersection as either // - a starts before b ends // - b starts before a ends - return true + return true } /** @@ -577,4 +581,55 @@ class BereichObjektExtensions extends BasisObjektExtensions { Distance.compare(distance, B) <= 0 } + def static BigDecimal getOverlappingLength( + Bereich_Objekt_Teilbereich_AttributeGroup tba, + Bereich_Objekt_Teilbereich_AttributeGroup tbb) { + if (tba.IDTOPKante !== tbb.IDTOPKante) + return BigDecimal.ZERO + + val taA = tba.begrenzungA?.wert + val taB = tba.begrenzungB?.wert + val tbA = tbb.begrenzungA?.wert + val tbB = tbb.begrenzungB?.wert + + val minA = taA.min(taB) + val maxA = taA.max(taB) + + val minB = tbA.min(tbB) + val maxB = tbA.max(tbB) + + // Determine whether A or B starts first + if (minA < minB) { + // A starts first + // If A ends before B begins, the length is zero + if (maxA <= minB) { + return BigDecimal.ZERO + } + // Otherwise the length is the distance from minB to either maxB or maxA (whichever is less) + return maxA.min(maxB) - minB + } else // minB <= minA + { + // B starts first + // If B ends before A begins, the length is zero + if (maxB <= minA) { + return BigDecimal.ZERO + } + // Otherwise the length is the distance from minB to either maxB or maxA (whichever is less) + return maxB.min(maxA) - minA + } + } + + def static BigDecimal getOverlappingLength(Bereich_Objekt bo, + Bereich_Objekt_Teilbereich_AttributeGroup tbb) { + return bo.bereichObjektTeilbereich.map[getOverlappingLength(tbb)].reduce [ a, b | + a + b + ] + } + + def static BigDecimal getOverlappingLength(Bereich_Objekt bo, + Bereich_Objekt bo2) { + return bo.bereichObjektTeilbereich.map[bo2.getOverlappingLength(it)]. + reduce[a, b|a + b] + } + } -- GitLab From 6e633205db166579470e54f65048eae700bb3b68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pascal=20St=C3=BCcker?= <stuecker.pascal@scheidt-bachmann-st.de> Date: Fri, 3 Mar 2023 11:19:17 +0100 Subject: [PATCH 7/9] Fix NPE & ArrayIndexOutOfBoundsException in Ssld --- .../feature/table/pt1/ssld/SsldTransformator.xtend | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssld/SsldTransformator.xtend b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssld/SsldTransformator.xtend index 318e53105..8bc5abfe8 100644 --- a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssld/SsldTransformator.xtend +++ b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssld/SsldTransformator.xtend @@ -78,7 +78,7 @@ class SsldTransformator extends AbstractPlanPro2TableModelTransformator { val distance = fmaAnlagen?.map[fmaGrenzen]?.flatten?.filter [ // Only consider FMA borders which are located on the DWeg punktObjektTOPKante.map[IDTOPKante].exists[topDWeg.contains(it)] - ].fold(Double.valueOf(0.0), [ Double current, Punkt_Objekt grenze | + ]?.fold(Double.valueOf(0.0), [ Double current, Punkt_Objekt grenze | Math.max(current, getShortestPathLength(topGraph, dweg?.fstrFahrweg?.start, grenze)) @@ -315,11 +315,15 @@ class SsldTransformator extends AbstractPlanPro2TableModelTransformator { dweg, [dweg.fstrDWegSpezifisch !== null], [ - val fstr = container.fstrZugRangier.filter [ - fstrZug?.fstrZugDWeg?.IDFstrDWeg == dweg - ].get(0) + val fstrs = container.fstrZugRangier.filter [ + fstrZug?.fstrZugDWeg?.IDFstrDWeg === dweg + ] + if (fstrs.empty) { + return "" + } + fstrDWegSpezifisch.IDFMAAnlageZielgleis.IDGleisAbschnitt. - getOverlappingLength(fstr.IDFstrFahrweg). + getOverlappingLength(fstrs.get(0).IDFstrFahrweg). toTableIntegerAgateDown ] ) -- GitLab From 37975f624d5a1dd73309f455d57c1135ce7f4bcc Mon Sep 17 00:00:00 2001 From: Quang Truong <truong.quang@scheidt-bachmann-st.de> Date: Tue, 21 Mar 2023 14:33:14 +0100 Subject: [PATCH 8/9] set#48 adjust & active ssld --- .../table/pt1/ssld/SsldTransformator.xtend | 36 +++---------------- 1 file changed, 5 insertions(+), 31 deletions(-) diff --git a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssld/SsldTransformator.xtend b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssld/SsldTransformator.xtend index 8bc5abfe8..f027859e2 100644 --- a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssld/SsldTransformator.xtend +++ b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssld/SsldTransformator.xtend @@ -278,8 +278,7 @@ class SsldTransformator extends AbstractPlanPro2TableModelTransformator { ENUM_SIGNAL_FUNKTION_GRUPPENAUSFAHR_GRUPPENZWISCHEN_SIGNAL, ENUM_SIGNAL_FUNKTION_GRUPPENAUSFAHR_SIGNAL }.contains( - fstrFahrweg?.start?.signalReal?.signalRealAktiv?. - signalFunktion?.wert + fstrFahrweg?.start?.signalReal?.signalFunktion?.wert )) "o" ] @@ -303,7 +302,7 @@ class SsldTransformator extends AbstractPlanPro2TableModelTransformator { dweg, [dweg.fstrDWegSpezifisch !== null], [ - fstrDWegSpezifisch.fmaAnlageZielgleis.gleisabschnitt. + fstrDWegSpezifisch.fmaAnlageZielgleis.IDGleisAbschnitt. bezeichnung.bezeichnungTabelle.wert ] ) @@ -339,26 +338,6 @@ class SsldTransformator extends AbstractPlanPro2TableModelTransformator { ] ) - // PLANPRO-2377 - // Verschieben nach BasisObjektExtensions.comment(Basis_Objekt) - // Bemerkung ==> Fussnoten erstellen - // fillIterable verwenden -// var str = "" -// var first = true -// val comments = dweg.comments -// for (Bearbeitungsvermerk vermerk : comments) { -// if (!first) { -// str = str + ", " -// } -// first = false -// str = str + "*" + footnoteNumber + " " -// instance.addFootnote(footnoteNumber, -// vermerk?.bearbeitungsvermerkAllg?. -// kommentar?.wert) -// footnoteNumber++ -// } -// -// val commentText = str.trim; // T: Ssld.Bemerkung fill( instance, @@ -373,16 +352,11 @@ class SsldTransformator extends AbstractPlanPro2TableModelTransformator { } override void formatTableContent(Table table) { - // A: Ssld.Grundsatzangaben.von - table.setTextAlignment(0, TextAlignment.LEFT); - + super.formatTableContent(table) // B: Ssld.Grundsatzangaben.bis - table.setTextAlignment(1, TextAlignment.LEFT); + table.setTextAlignment(cols.getColumn(bis), TextAlignment.LEFT); // C: Ssld.Grundsatzangaben.Gefahrpunkt - table.setTextAlignment(2, TextAlignment.LEFT); - - // G: Bemerkung - table.setTextAlignment(19, TextAlignment.LEFT); + table.setTextAlignment(cols.getColumn(Gefahrpunkt), TextAlignment.LEFT); } } -- GitLab From a6a99c57ef158197fdc64b68b206ccbf26c64eb5 Mon Sep 17 00:00:00 2001 From: Quang Truong <truong.quang@scheidt-bachmann-st.de> Date: Tue, 21 Mar 2023 16:08:50 +0100 Subject: [PATCH 9/9] issue#48 adjust & enable ssla --- .../META-INF/MANIFEST.MF | 2 + ....table.pt1.ssla.SslaDescriptionService.xml | 8 + ...ble.pt1.ssla.SslaTransformationService.xml | 10 ++ .../feature/table/pt1/ssla/SslaColumns.java | 55 +++++++ .../pt1/ssla/SslaDescriptionService.java | 37 +++++ .../pt1/ssla/SslaTransformationService.java | 75 +++++++++ .../table/pt1/ssla/SslaTransformator.xtend | 143 ++++++++++++++++++ 7 files changed, 330 insertions(+) create mode 100644 java/bundles/org.eclipse.set.feature.table.pt1/OSGI-INF/org.eclipse.set.feature.table.pt1.ssla.SslaDescriptionService.xml create mode 100644 java/bundles/org.eclipse.set.feature.table.pt1/OSGI-INF/org.eclipse.set.feature.table.pt1.ssla.SslaTransformationService.xml create mode 100644 java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssla/SslaColumns.java create mode 100644 java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssla/SslaDescriptionService.java create mode 100644 java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssla/SslaTransformationService.java create mode 100644 java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssla/SslaTransformator.xtend diff --git a/java/bundles/org.eclipse.set.feature.table.pt1/META-INF/MANIFEST.MF b/java/bundles/org.eclipse.set.feature.table.pt1/META-INF/MANIFEST.MF index 053778647..b2c056d52 100644 --- a/java/bundles/org.eclipse.set.feature.table.pt1/META-INF/MANIFEST.MF +++ b/java/bundles/org.eclipse.set.feature.table.pt1/META-INF/MANIFEST.MF @@ -100,6 +100,8 @@ Service-Component: OSGI-INF/org.eclipse.set.feature.table.pt1.messages.Messages. OSGI-INF/org.eclipse.set.feature.table.pt1.ssko.SskoTransformationService.xml, OSGI-INF/org.eclipse.set.feature.table.pt1.sskt.SsktDescriptionService.xml, OSGI-INF/org.eclipse.set.feature.table.pt1.sskt.SsktTransformationService.xml, + OSGI-INF/org.eclipse.set.feature.table.pt1.ssla.SslaDescriptionService.xml, + OSGI-INF/org.eclipse.set.feature.table.pt1.ssla.SslaTransformationService.xml, OSGI-INF/org.eclipse.set.feature.table.pt1.sslb.SslbDescriptionService.xml, OSGI-INF/org.eclipse.set.feature.table.pt1.sslb.SslbTransformationService.xml, OSGI-INF/org.eclipse.set.feature.table.pt1.ssld.SsldDescriptionService.xml, diff --git a/java/bundles/org.eclipse.set.feature.table.pt1/OSGI-INF/org.eclipse.set.feature.table.pt1.ssla.SslaDescriptionService.xml b/java/bundles/org.eclipse.set.feature.table.pt1/OSGI-INF/org.eclipse.set.feature.table.pt1.ssla.SslaDescriptionService.xml new file mode 100644 index 000000000..ac95c2e42 --- /dev/null +++ b/java/bundles/org.eclipse.set.feature.table.pt1/OSGI-INF/org.eclipse.set.feature.table.pt1.ssla.SslaDescriptionService.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.3.0" name="org.eclipse.set.feature.table.pt1.ssla.SslaDescriptionService"> + <service> + <provide interface="org.eclipse.set.core.services.part.PartDescriptionService"/> + </service> + <reference cardinality="1..1" field="messages" interface="org.eclipse.set.feature.table.pt1.messages.Messages" name="messages"/> + <implementation class="org.eclipse.set.feature.table.pt1.ssla.SslaDescriptionService"/> +</scr:component> \ No newline at end of file diff --git a/java/bundles/org.eclipse.set.feature.table.pt1/OSGI-INF/org.eclipse.set.feature.table.pt1.ssla.SslaTransformationService.xml b/java/bundles/org.eclipse.set.feature.table.pt1/OSGI-INF/org.eclipse.set.feature.table.pt1.ssla.SslaTransformationService.xml new file mode 100644 index 000000000..76a5ea351 --- /dev/null +++ b/java/bundles/org.eclipse.set.feature.table.pt1/OSGI-INF/org.eclipse.set.feature.table.pt1.ssla.SslaTransformationService.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.3.0" immediate="true" name="org.eclipse.set.feature.table.pt1.ssla.SslaTransformationService"> + <property name="table.shortcut" value="ssla"/> + <service> + <provide interface="org.eclipse.set.feature.table.PlanPro2TableTransformationService"/> + </service> + <reference cardinality="1..1" field="enumTranslationService" interface="org.eclipse.set.core.services.enumtranslation.EnumTranslationService" name="enumTranslationService"/> + <reference cardinality="1..1" field="messages" interface="org.eclipse.set.feature.table.pt1.messages.Messages" name="messages"/> + <implementation class="org.eclipse.set.feature.table.pt1.ssla.SslaTransformationService"/> +</scr:component> \ No newline at end of file diff --git a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssla/SslaColumns.java b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssla/SslaColumns.java new file mode 100644 index 000000000..561650549 --- /dev/null +++ b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssla/SslaColumns.java @@ -0,0 +1,55 @@ +/** + * Copyright (c) 2023 DB Netz AG and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + */ + +package org.eclipse.set.feature.table.pt1.ssla; + +/** + * Symbolic addressing for Ssla columns. + * + * @author truong + * + */ +@SuppressWarnings("nls") +public class SslaColumns { + + /** + * Ssla.Grundsatzangaben.Bezeichnung + */ + public static final String Bezeichnung = "A"; + + /** + * Ssla.Grundsatzangaben.Fahrweg.Start + */ + public static final String Fahrweg_Start = "B"; + + /** + * Ssla.Grundsatzangaben.Fahrweg.Ziel + */ + public static final String Fahrweg_Ziel = "C"; + + /** + * Ssla.Grundsatzangaben.Durchrutschweg_Ziel + */ + public static final String Durchrutschweg_Ziel = "D"; + + /** + * Ssla.Grundsatzangaben.Art + */ + public static final String Art = "E"; + + /** + * Ssla.Unterwegssignal + */ + public static final String Unterwegssignal = "F"; + + /** + * Ssla.Bemerkung + */ + public static final String Bemerkung = "G"; +} diff --git a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssla/SslaDescriptionService.java b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssla/SslaDescriptionService.java new file mode 100644 index 000000000..6cc89d87e --- /dev/null +++ b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssla/SslaDescriptionService.java @@ -0,0 +1,37 @@ +/** + * Copyright (c) 2020 DB Netz AG and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + */ + +package org.eclipse.set.feature.table.pt1.ssla; + +import org.eclipse.set.core.services.part.PartDescriptionService; +import org.eclipse.set.feature.table.AbstractTableDescription; +import org.eclipse.set.feature.table.pt1.messages.Messages; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Reference; + +/** + * Part description for SSLA table view. + * + * @author Schaefer + */ +@Component(service = PartDescriptionService.class) +public class SslaDescriptionService extends AbstractTableDescription { + @Reference + Messages messages; + + @Override + protected String getToolboxViewName() { + return messages.SslaDescriptionService_ViewName; + } + + @Override + protected String getToolboxViewTooltip() { + return messages.SslaDescriptionService_ViewTooltip; + } +} diff --git a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssla/SslaTransformationService.java b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssla/SslaTransformationService.java new file mode 100644 index 000000000..8984c00da --- /dev/null +++ b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssla/SslaTransformationService.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) 2016 DB Netz AG and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + */ +package org.eclipse.set.feature.table.pt1.ssla; + +import static org.eclipse.nebula.widgets.nattable.sort.SortDirectionEnum.ASC; +import static org.eclipse.set.utils.table.sorting.ComparatorBuilder.CellComparatorType.LEXICOGRAPHICAL; + +import java.util.Comparator; + +import org.eclipse.set.core.services.enumtranslation.EnumTranslationService; +import org.eclipse.set.feature.table.PlanPro2TableTransformationService; +import org.eclipse.set.feature.table.pt1.AbstractPlanPro2TableModelTransformator; +import org.eclipse.set.feature.table.pt1.AbstractPlanPro2TableTransformationService; +import org.eclipse.set.feature.table.pt1.messages.Messages; +import org.eclipse.set.model.tablemodel.RowGroup; +import org.eclipse.set.ppmodel.extensions.utils.TableNameInfo; +import org.eclipse.set.utils.table.sorting.TableRowGroupComparator; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Reference; + +/** + * Service for creating the ssld table model. org.eclipse.set.feature.table + * + * @author rumpf + * + * @usage production + */ +@Component(service = { + PlanPro2TableTransformationService.class }, immediate = true, property = { + "table.shortcut=ssla" }) +public final class SslaTransformationService + extends AbstractPlanPro2TableTransformationService { + + @Reference + private Messages messages; + @Reference + private EnumTranslationService enumTranslationService; + + /** + * constructor. + */ + public SslaTransformationService() { + super(); + } + + @Override + public AbstractPlanPro2TableModelTransformator createTransformator() { + return new SslaTransformator(cols, enumTranslationService); + } + + @Override + public Comparator<RowGroup> getRowGroupComparator() { + return TableRowGroupComparator.builder().sort("A", LEXICOGRAPHICAL, ASC) //$NON-NLS-1$ + .build(); + } + + @Override + public TableNameInfo getTableNameInfo() { + return new TableNameInfo(messages.ToolboxTableNameSslaLong, + messages.ToolboxTableNameSslaPlanningNumber, + messages.ToolboxTableNameSslaShort); + } + + @Override + protected String getTableHeading() { + return messages.SslaTableView_Heading; + } + +} \ No newline at end of file diff --git a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssla/SslaTransformator.xtend b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssla/SslaTransformator.xtend new file mode 100644 index 000000000..045b92a10 --- /dev/null +++ b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssla/SslaTransformator.xtend @@ -0,0 +1,143 @@ +/** + * Copyright (c) 2016 DB Netz AG and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + */ +package org.eclipse.set.feature.table.pt1.ssla + +import java.util.LinkedList +import java.util.List +import java.util.Set +import org.eclipse.set.core.services.enumtranslation.EnumTranslationService +import org.eclipse.set.feature.table.pt1.AbstractPlanPro2TableModelTransformator +import org.eclipse.set.model.tablemodel.ColumnDescriptor +import org.eclipse.set.ppmodel.extensions.container.MultiContainer_AttributeGroup +import org.eclipse.set.toolboxmodel.Fahrstrasse.Fstr_Aneinander +import org.eclipse.set.toolboxmodel.Fahrstrasse.Fstr_Aneinander_Zuordnung +import org.eclipse.set.utils.table.TMFactory + +import static org.eclipse.set.feature.table.pt1.ssla.SslaColumns.* + +import static extension org.eclipse.set.ppmodel.extensions.FahrwegExtensions.* +import static extension org.eclipse.set.ppmodel.extensions.FstrAneinanderExtensions.* +import static extension org.eclipse.set.ppmodel.extensions.FstrZugRangierExtensions.* + +/** + * Table transformation for a aneinandergereihte Fahrstraßen (Ssla). + * + * @author Schneider + */ +class SslaTransformator extends AbstractPlanPro2TableModelTransformator { + + new(Set<ColumnDescriptor> cols, + EnumTranslationService enumTranslationService) { + super(cols, enumTranslationService) + } + + override transformTableContent(MultiContainer_AttributeGroup container, + TMFactory factory) { + val fstrAneinanderList = container.fstrAneinander + + // Basis_Objekt + for (fstrAneinander : fstrAneinanderList) { + if (Thread.currentThread.interrupted) { + return null + } + val instance = factory.newTableRow(fstrAneinander) + + // A: Ssla.Grundsatzangaben.Bezeichnung + fill( + instance, + cols.getColumn(Bezeichnung), + fstrAneinander, + [tableDescription] + ) + + // B: Ssla.Grundsatzangaben.Fahrweg.Start + fill( + instance, + cols.getColumn(Fahrweg_Start), + fstrAneinander, + [startSignal?.bezeichnung?.bezeichnungTabelle?.wert ?: ""] + ) + + // C: Ssla.Grundsatzangaben.Fahrweg.Ziel + fill( + instance, + cols.getColumn(Fahrweg_Ziel), + fstrAneinander, + [zielSignal?.bezeichnung?.bezeichnungTabelle?.wert ?: ""] + ) + + // D: Ssla.Grundsatzangaben.Durchrutschweg_Ziel + fill( + instance, + cols.getColumn(Durchrutschweg_Ziel), + fstrAneinander, + [zielDweg?.bezeichnung?.bezeichnungFstrDWeg?.wert ?: ""] + ) + + // E: Ssla.Grundsatzangaben.Art + fill( + instance, + cols.getColumn(Art), + fstrAneinander, + [ + if (zuordnungen.exists [ + fstrZugRangier?.fstrZug?.fstrZugArt?.wert?.literal?. + substring(0, 1) == "Z" + ]) { + return "Z" + } + return "R" + ] + ) + + // F: Ssla.Unterwegssignal + fill( + instance, + cols.getColumn(Unterwegssignal), + fstrAneinander, + [fstrUnterwegsSignalString] + ) + + // G: Ssla.Bemerkung + fill( + instance, + cols.getColumn(Bemerkung), + fstrAneinander, + [footnoteTransformation.transform(it, instance)] + ) + + } + + return factory.table + } + + private def String getFstrUnterwegsSignalString( + Fstr_Aneinander fstrAneinander) { + val List<Fstr_Aneinander_Zuordnung> zuordnungen = fstrAneinander. + zuordnungen + var zuordnungenUnterwegs = new LinkedList<Fstr_Aneinander_Zuordnung> + + zuordnungen.remove(fstrAneinander.fstrZielZuordnung) + + while (zuordnungen.size > 0) { + var zu = zuordnungen.fstrStartZuordnung + if (zu === null) { + throw new IllegalArgumentException( + "Unable to find fstrStartZuordnung"); + } + zuordnungenUnterwegs.add(zu) + zuordnungen.remove(zu) + } + + return '''«FOR zuordnung : zuordnungenUnterwegs SEPARATOR ' - '»« + »«zuordnung.fstrZugRangier?.fstrFahrweg?.zielSignal?.bezeichnung?.bezeichnungTabelle?.wert»« + »«IF zuordnung.fstrZugRangier?.fstrDWeg?.bezeichnung?.bezeichnungFstrDWeg?.wert !== null »« + »(«zuordnung.fstrZugRangier?.fstrDWeg?.bezeichnung?.bezeichnungFstrDWeg?.wert»)«ENDIF»«ENDFOR»'''; + } +} -- GitLab