Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,18 @@

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Predicate;
import java.util.stream.Collectors;

import org.eclipse.e4.core.services.events.IEventBroker;
import org.eclipse.set.basis.constants.ContainerType;
Expand All @@ -32,14 +35,18 @@
import org.eclipse.set.core.services.graph.BankService;
import org.eclipse.set.core.services.graph.TopologicalGraphService;
import org.eclipse.set.core.services.session.SessionService;
import org.eclipse.set.model.planpro.Basisobjekte.Punkt_Objekt_TOP_Kante_AttributeGroup;
import org.eclipse.set.model.planpro.Basisobjekte.Ur_Objekt;
import org.eclipse.set.model.planpro.Geodaten.TOP_Kante;
import org.eclipse.set.model.planpro.Geodaten.TOP_Knoten;
import org.eclipse.set.model.planpro.Geodaten.Ueberhoehung;
import org.eclipse.set.model.planpro.Geodaten.Ueberhoehungslinie;
import org.eclipse.set.model.planpro.PlanPro.PlanPro_Schnittstelle;
import org.eclipse.set.ppmodel.extensions.BasisAttributExtensions;
import org.eclipse.set.ppmodel.extensions.MultiContainer_AttributeGroupExtensions;
import org.eclipse.set.ppmodel.extensions.PlanProSchnittstelleExtensions;
import org.eclipse.set.ppmodel.extensions.PunktObjektExtensions;
import org.eclipse.set.ppmodel.extensions.TopKanteExtensions;
import org.eclipse.set.ppmodel.extensions.container.MultiContainer_AttributeGroup;
import org.eclipse.set.ppmodel.extensions.graph.TopObjectIterator;
import org.eclipse.set.utils.ToolboxConfiguration;
Expand Down Expand Up @@ -247,6 +254,7 @@ public BankingInformation findTOPBanking(
if (begin == null || end == null) {
return null;
}

final BigDecimal bankingLineLength = bankingLine
.getUeberhoehungslinieAllg()
.getUeberhoehungslinieLaenge()
Expand Down Expand Up @@ -286,6 +294,17 @@ public BankingInformation findTOPBanking(
}
}

if (!bankingLine.getIDTOPKantePfad().isEmpty()) {
try {
return getBankingInformation(bankingLine);
} catch (final IllegalArgumentException e) {
logger.error(
"IDTOPKantePfad der Überhöhungslinien {} ist nicht plausible", //$NON-NLS-1$
bankingLine.getIdentitaet().getWert());
return null;
}

}
// Otherwise find all possible paths and find the path with the smallest
// deviation from the banking line length
// Add 1 to the limit to account for rounding errors
Expand All @@ -308,6 +327,91 @@ public BankingInformation findTOPBanking(
return new BankingInformation(bankingLine, path);
}

/**
* The Banking path is already defined. This function transform the
* information to {@link BankingInformation}
*
* @param bankingLine
* the {@link Ueberhoehungslinie}
* @return the {@link BankingInformation}
* @throws IllegalArgumentException
* when the path isn't plausible
*/
private static BankingInformation getBankingInformation(
final Ueberhoehungslinie bankingLine)
throws IllegalArgumentException {
final Set<TOP_Kante> relevantEdges = bankingLine.getIDTOPKantePfad()
.stream()
.map(ele -> ele.getValue())
.collect(Collectors.toSet());
final Punkt_Objekt_TOP_Kante_AttributeGroup start = PunktObjektExtensions
.getSinglePoint(bankingLine.getIDUeberhoehungA().getValue());
final Punkt_Objekt_TOP_Kante_AttributeGroup end = PunktObjektExtensions
.getSinglePoint(bankingLine.getIDUeberhoehungB().getValue());
// When the defined path not contains start/end point
if (relevantEdges.stream()
.noneMatch(edge -> edge == start.getIDTOPKante().getValue())
|| relevantEdges.stream()
.noneMatch(edge -> edge == end.getIDTOPKante()
.getValue())) {
throw new IllegalArgumentException();
}
final List<TOP_Kante> sortedEdges = new LinkedList<>();
TOP_Kante currentEdge = start.getIDTOPKante().getValue();
BigDecimal pathLength = BigDecimal.ZERO;

while (!relevantEdges.isEmpty()) {
sortedEdges.add(currentEdge);
relevantEdges.remove(currentEdge);
if (currentEdge == end.getIDTOPKante().getValue()) {
// when the path isn't end at end point
if (!relevantEdges.isEmpty()) {
throw new IllegalArgumentException();
}
// Edge before last edge
final TOP_Kante beforeLastEdge = sortedEdges
.get(sortedEdges.size() - 2);
final TOP_Knoten connectionNode = TopKanteExtensions
.connectionTo(currentEdge, beforeLastEdge);
final BigDecimal lastEdgeLength = connectionNode == currentEdge
.getIDTOPKnotenA()
.getValue() ? end.getAbstand().getWert()
: TopKanteExtensions.getLaenge(currentEdge)
.subtract(end.getAbstand().getWert());
pathLength = pathLength.add(lastEdgeLength);
break;
}
final List<TOP_Kante> nextEdges = new ArrayList<>();
for (final TOP_Kante edge : relevantEdges) {
if (TopKanteExtensions.isConnectedTo(edge, currentEdge)) {
nextEdges.add(edge);
}
}

// The current edge should only connected to one edge in the path
if (nextEdges.size() != 1) {
throw new IllegalArgumentException();
}
if (currentEdge == start.getIDTOPKante().getValue()) {
final TOP_Knoten connectionNode = TopKanteExtensions
.connectionTo(currentEdge, nextEdges.getFirst());
final BigDecimal firstEdgeLength = connectionNode == currentEdge
.getIDTOPKnotenB()
.getValue()
? TopKanteExtensions.getLaenge(currentEdge)
.subtract(start.getAbstand().getWert())
: start.getAbstand().getWert();
pathLength = pathLength.add(firstEdgeLength);
} else {
pathLength = pathLength
.add(TopKanteExtensions.getLaenge(currentEdge));
}
currentEdge = nextEdges.getFirst();
}
return new BankingInformation(bankingLine,
new TopPath(sortedEdges, pathLength, new TopPoint(start)));
}

@Override
public List<BankingInformation> findRelevantLineBankings(
final TopPoint point) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import org.osgi.service.event.EventAdmin

import static org.eclipse.set.feature.table.pt1.sskg.SskgColumns.*

import static extension org.eclipse.set.ppmodel.extensions.BueKanteExtensions.*
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.PunktObjektExtensions.*
Expand Down Expand Up @@ -345,7 +346,7 @@ class SskgTransformator extends AbstractPlanPro2TableModelTransformator {
def dispatch String getBezugspunktBezeichnung(FMA_Komponente fma) {
return fma.IDBezugspunkt?.value?.bezugspunktBezeichnung
}

def dispatch String getBezugspunktBezeichnung(Zugeinwirkung ein) {
return ein.IDBezugspunkt?.value?.bezugspunktBezeichnung
}
Expand All @@ -359,7 +360,7 @@ class SskgTransformator extends AbstractPlanPro2TableModelTransformator {
}

def dispatch String getBezugspunktBezeichnung(BUE_Kante bueKante) {
return bueKante?.IDBUEAnlage?.value?.bezugspunktBezeichnung
return bueKante?.bezeichnung ?: ""
}

def dispatch String getBezugspunktBezeichnung(Markanter_Punkt markanter) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,14 @@ class SsksTransformator extends AbstractPlanPro2TableModelTransformator {
ENUM_BEFESTIGUNG_ART_REGELANORDNUNG_SONSTIGE_NIEDRIG,
ENUM_BEFESTIGUNG_ART_SONDERANORDNUNG_MAST_HOCH,
ENUM_BEFESTIGUNG_ART_SONDERANORDNUNG_MAST_NIEDRIG]
static val inRelevantFiktivFunktion = #[
ENUM_FIKTIVES_SIGNAL_FUNKTION_ZUG_START_ZIEL_BK_MIT_ZS_1,
ENUM_FIKTIVES_SIGNAL_FUNKTION_ZUG_START_ZIEL_BK_MIT_ZS_7,
ENUM_FIKTIVES_SIGNAL_FUNKTION_ZUG_START_ZIEL_NE_14_MIT_ZS_1,
ENUM_FIKTIVES_SIGNAL_FUNKTION_ZUG_START_ZIEL_NE_14_MIT_ZS_7,
ENUM_FIKTIVES_SIGNAL_FUNKTION_ZUG_START_ZIEL_NE_14_MIT_ZS_8,
ENUM_FIKTIVES_SIGNAL_FUNKTION_RANGIER_START_ZIEL_NE_14
]
val BankService bankingService
val String tableShortCut

Expand Down Expand Up @@ -949,7 +957,10 @@ class .simpleName»: «e.message» - failed to transform table contents''', e)
}

private static def boolean isSsksSignal(Signal signal) {
if (signal?.signalFiktiv !== null) {
if (signal?.signalFiktiv !== null &&
!signal?.signalFiktiv?.fiktivesSignalFunktion.exists [
inRelevantFiktivFunktion.contains(it)
]) {
return true
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class SsldTransformator extends AbstractPlanPro2TableModelTransformator {
}

val distance = relevantFmas.map[value.length].max
return distance > maxLength
return distance > maxLength.add(BigDecimal.ONE)
? '''> «maxLength.toTableIntegerAgateDown»''' : distance.
toTableIntegerAgateDown
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import org.eclipse.set.core.services.enumtranslation.EnumTranslationService
import org.eclipse.set.feature.table.pt1.AbstractPlanPro2TableModelTransformator
import org.eclipse.set.model.planpro.Ansteuerung_Element.Stell_Bereich
import org.eclipse.set.model.planpro.Basisobjekte.Basis_Objekt
import org.eclipse.set.model.planpro.Basisobjekte.Punkt_Objekt
import org.eclipse.set.model.planpro.Nahbedienung.ENUMNBGrenzeArt
import org.eclipse.set.model.planpro.Nahbedienung.NB_Zone
import org.eclipse.set.model.planpro.Nahbedienung.NB_Zone_Element
Expand Down Expand Up @@ -313,28 +312,28 @@ class SslnTransformator extends AbstractPlanPro2TableModelTransformator {
}

private static dispatch def String toBezeichnungGrenze(
Punkt_Objekt markanteStelle,
Basis_Objekt markanteStelle,
NB_Zone_Grenze grenze
) {
return null
}

private static dispatch def String toBezeichnungGrenze(
Void markanteStelle,
Signal markanteStelle,
NB_Zone_Grenze grenze
) {
return null
return grenze.toBezeichnungGrenze
}

private static dispatch def String toBezeichnungGrenze(
Signal markanteStelle,
FMA_Komponente markanteStelle,
NB_Zone_Grenze grenze
) {
return grenze.toBezeichnungGrenze
}

private static dispatch def String toBezeichnungGrenze(
FMA_Komponente markanteStelle,
W_Kr_Gsp_Komponente markanteStelle,
NB_Zone_Grenze grenze
) {
return grenze.toBezeichnungGrenze
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import static org.eclipse.set.feature.table.pt1.ssza.SszaColumns.*

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.BueKanteExtensions.*
import static extension org.eclipse.set.ppmodel.extensions.DatenpunktExtensions.*
import static extension org.eclipse.set.ppmodel.extensions.FmaAnlageExtensions.*
import static extension org.eclipse.set.ppmodel.extensions.PunktObjektExtensions.*
Expand Down Expand Up @@ -167,16 +168,7 @@ class SszaTransformator extends AbstractPlanPro2TableModelTransformator {
),
bezugspunktCase(
BUE_Kante,
[
val relevantBereichs = container.gleisBezeichnung.filter [ bo |
bo.contains(it)
].toList
val tracksDesignation = relevantBereichs.filterNull.map [
bezeichnung?.bezGleisBezeichnung?.wert
]
'''BÜ-K «IDBUEAnlage?.value?.bezeichnung?.bezeichnungTabelle?.wert»«
»«IF !tracksDesignation.nullOrEmpty», Gl. «tracksDesignation.join(", ")»«ENDIF»'''
]
[bezeichnung]
),
bezugspunktCase(
PZB_Element,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,8 @@ class BueAnlageExtensions extends PunktObjektExtensions {
static def Stellelement getStellelement(BUE_Anlage anlage) {
return anlage?.IDBUESchnittstelle?.value?.IDStellelement?.value
}

static def String getBezeichnung(BUE_Anlage anlage) {
return anlage?.bezeichnung?.bezeichnungTabelle?.wert
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/**
* Copyright (c) 2026 DB InfraGO AG and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v2.0 which is available at
* https://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*
*/
package org.eclipse.set.ppmodel.extensions;

import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.stream.Collectors;

import org.eclipse.set.model.planpro.Bahnuebergang.BUE_Kante;
import org.eclipse.set.model.planpro.Gleis.Gleis_Bezeichnung;
import org.eclipse.set.ppmodel.extensions.container.MultiContainer_AttributeGroup;

import com.google.common.collect.Streams;

/**
* Extensions for {@link BUE_Kante}
*/
public class BueKanteExtensions extends BasisObjektExtensions {

/**
* Get table designation of {@link BUE_Kante}
*
* @param bueKante
* the {@link BUE_Kante}
* @return the designation
*/
@SuppressWarnings("nls")
public static String getBezeichnung(final BUE_Kante bueKante) {
final MultiContainer_AttributeGroup container = getContainer(bueKante);
final List<Gleis_Bezeichnung> relevantGleisBezeichnung = Streams
.stream(container.getGleisBezeichnung())
.filter(bo -> BereichObjektExtensions.contains(bo, bueKante))
.filter(Objects::nonNull)
.toList();
final List<String> gleisBezeichnung = relevantGleisBezeichnung.stream()
.map(ele -> EObjectExtensions
.getNullableObject(ele,
e -> e.getBezeichnung()
.getBezGleisBezeichnung()
.getWert())
.orElse(null))
.filter(Objects::nonNull)
.toList();

final String bueAnlageBezeichnung = Optional
.ofNullable(BueAnlageExtensions
.getBezeichnung(bueKante.getIDBUEAnlage().getValue()))
.orElse("");
final StringBuilder builder = new StringBuilder();
builder.append("BÜ-K ");
builder.append(bueAnlageBezeichnung);
if (!gleisBezeichnung.isEmpty()) {
builder.append(", Gl. ");
builder.append(gleisBezeichnung.stream()
.collect(Collectors.joining(", ")));
}
return builder.toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ package org.eclipse.set.ppmodel.extensions

import java.util.List
import org.eclipse.set.model.planpro.Ansteuerung_Element.Stell_Bereich
import org.eclipse.set.model.planpro.Bahnuebergang.BUE_Anlage
import org.eclipse.set.model.planpro.Bahnuebergang.BUE_Kante
import org.eclipse.set.model.planpro.Basisobjekte.Basis_Objekt
import org.eclipse.set.model.planpro.Basisobjekte.Punkt_Objekt
import org.eclipse.set.model.planpro.Fahrstrasse.Markanter_Punkt
Expand Down Expand Up @@ -59,12 +57,9 @@ class FmaKomponenteExtensions extends BasisObjektExtensions {
def static dispatch Punkt_Objekt getBezugsPunkt(Basis_Objekt object) {
return null
}
def static dispatch Punkt_Objekt getBezugsPunkt(BUE_Anlage bueAnlage) {
return bueAnlage.bezugsPunkt
}

def static dispatch Punkt_Objekt getBezugsPunkt(BUE_Kante bueKante) {
return bueKante.bezugsPunkt
def static dispatch Punkt_Objekt getBezugsPunkt(Punkt_Objekt po) {
return po
}

def static dispatch Punkt_Objekt getBezugsPunkt(Markanter_Punkt markanter) {
Expand Down
Loading
Loading