diff --git a/java/bundles/org.eclipse.set.feature.siteplan/src/org/eclipse/set/feature/siteplan/transform/SignalTransformator.xtend b/java/bundles/org.eclipse.set.feature.siteplan/src/org/eclipse/set/feature/siteplan/transform/SignalTransformator.xtend index d3c61f85e2..879bb3cfb8 100644 --- a/java/bundles/org.eclipse.set.feature.siteplan/src/org/eclipse/set/feature/siteplan/transform/SignalTransformator.xtend +++ b/java/bundles/org.eclipse.set.feature.siteplan/src/org/eclipse/set/feature/siteplan/transform/SignalTransformator.xtend @@ -31,6 +31,7 @@ import static extension org.eclipse.set.feature.siteplan.transform.TransformUtil import static extension org.eclipse.set.ppmodel.extensions.SignalBefestigungExtensions.* import static extension org.eclipse.set.ppmodel.extensions.SignalExtensions.* import static extension org.eclipse.set.ppmodel.extensions.SignalRahmenExtensions.* +import java.util.Set /** * Transforms PlanPro Signals to Siteplan Signals/SignalMounts @@ -69,7 +70,7 @@ class SignalTransformator extends BaseTransformator { val mountsWithParents = si.mounts.map [ mount | mount?.signalBefestigungen].flatten si.mounts = newHashSet(mountsWithParents); - + signalinfo.add(si) } @@ -81,7 +82,7 @@ class SignalTransformator extends BaseTransformator { signalinfo.forEach [ si | try { val baseMount = si.getBaseMount() - + val mergeWith = mergedSignalInfo.findFirst [ msi | msi.mounts.contains(baseMount) ] @@ -139,11 +140,14 @@ class SignalTransformator extends BaseTransformator { // Signals are rotated according to their effective rotation signalMount.position.rotation = effectiveRotation + // transform MountType signalMount.mountType = signalInfo.mountType + // Transform each attached signal signalMount.attachedSignals.addAll(signalInfo.signals.map [ transformAttachedSignal(it, signalInfo, signalMount) ].filter[!screen.empty]) + // Discard empty signals if (signalMount.attachedSignals.empty) @@ -190,7 +194,36 @@ class SignalTransformator extends BaseTransformator { } } - def SignalMountType getMountType(SignalInfo info) { + + + private static val Set MAST_BEFESTIGUNGSARTEN = newHashSet( + ENUMBefestigungArt.ENUM_BEFESTIGUNG_ART_REGELANORDNUNG_MAST_HOCH, + ENUMBefestigungArt.ENUM_BEFESTIGUNG_ART_REGELANORDNUNG_MAST_NIEDRIG, + ENUMBefestigungArt. ENUM_BEFESTIGUNG_ART_REGELANORDNUNG_SONSTIGE_HOCH, + ENUMBefestigungArt.ENUM_BEFESTIGUNG_ART_REGELANORDNUNG_SONSTIGE_NIEDRIG, + ENUMBefestigungArt.ENUM_BEFESTIGUNG_ART_SONDERANORDNUNG_MAST_HOCH, + ENUMBefestigungArt.ENUM_BEFESTIGUNG_ART_SONDERANORDNUNG_MAST_NIEDRIG + ); + + def private int countMasts(Iterable mounts) { + return mounts.filter[ MAST_BEFESTIGUNGSARTEN.contains(it) ].size; + } + + /** + * Original Definition: + * - if there are only Sonderkonstruktionen as mounts, return SONDERKONSTRUKTION + * - if there is one mount != Sonderkonstruktion, return that mounts BefestigungsArt. + * - if there is more then one mount != Sonderkonstruktion, take the mount with the lowest GUID: + * - then: if mount is mast and there are more then 1 signals attached to this assembly, return MehrereMasten + * - if there are no mounts: + * - take the signal with the lowest guid, and take the befestigungsArt from the signalReal + * - if signal/signalReal/signalReal.signalBefestigungsart null: return null + * + * New Definition: + * (ASSUMPTION: no Arbeitsbuehne without a Bridge / Ausleger (see changes in mapToSiteplanMountType)) + * - if any specific mount is an SignalAuslegerLinks, return SignalAuslegerLinks. + */ + def SignalMountType getMountType(SignalInfo info) { var mounts = info.mounts.sortBy[identitaet.wert].map [ signalBefestigungAllg.befestigungArt.wert ] @@ -201,11 +234,37 @@ class SignalTransformator extends BaseTransformator { it != SignalMountType.SONDERKONSTRUKTION ] - if (specificMounts.length != 0) { + if (specificMounts.length == 1) { + return specificMounts.head; + } + + if (specificMounts.length > 1) { + // there might be many different combinations, obviously. + // I attempt to keep behaviour as before (even if not correct) and only change behaviour for SignalAusleger + // SignalAusleger -> ... anything => should be SignalAusleger + // Fundament -> SignalAusleger => should be SignalAusleger + // Fundament -> Mast + // new logic for any assembly containing a SignalAusleger. Same for all other cases + if (specificMounts.exists [ + it === SignalMountType.SIGNALAUSLEGER + ]) { + return SignalMountType.SIGNALAUSLEGER; + } + if (specificMounts. + exists[it === SignalMountType.SIGNALBRUECKE]) { + return SignalMountType.SIGNALBRUECKE; + } + + + val mastCount = this.countMasts(mounts); + if (mastCount > 1) { + return SignalMountType.MEHRERE_MASTEN; + } + var mount = specificMounts.head // If multiple signals are attached to a MAST, convert into MEHRERE_MASTEN if (mount === SignalMountType.MAST && info.signals.length > 1) { - mount = SignalMountType.MEHRERE_MASTEN + return SignalMountType.MEHRERE_MASTEN; } return mount @@ -226,6 +285,7 @@ class SignalTransformator extends BaseTransformator { case ENUM_BEFESTIGUNG_ART_ANDERE_SONDERKONSTRUKTION, case ENUM_BEFESTIGUNG_ART_BAHNSTEIG, case ENUM_BEFESTIGUNG_ART_FUNDAMENT, + case ENUM_BEFESTIGUNG_ART_ARBEITSBUEHNE, case ENUM_BEFESTIGUNG_ART_KONSTRUKTIONSTEIL: return SignalMountType.SONDERKONSTRUKTION case ENUM_BEFESTIGUNG_ART_PRELLBOCK: @@ -240,7 +300,6 @@ class SignalTransformator extends BaseTransformator { case ENUM_BEFESTIGUNG_ART_PFOSTEN_NIEDRIG: return SignalMountType.PFOSTEN case ENUM_BEFESTIGUNG_ART_SONSTIGE, - case ENUM_BEFESTIGUNG_ART_ARBEITSBUEHNE, case ENUM_BEFESTIGUNG_ART_PFAHL, case ENUM_BEFESTIGUNG_ART_OL_KETTENWERK, case ENUM_BEFESTIGUNG_ART_OL_MAST, @@ -253,7 +312,7 @@ class SignalTransformator extends BaseTransformator { case ENUM_BEFESTIGUNG_ART_SONDERANORDNUNG_MAST_NIEDRIG: return SignalMountType.MAST case ENUM_BEFESTIGUNG_ART_SIGNALAUSLEGER: - return SignalMountType.SIGNALAUSLEGER_LINKS + return SignalMountType.SIGNALAUSLEGER case ENUM_BEFESTIGUNG_ART_SIGNALBRUECKE: return SignalMountType.SIGNALBRUECKE } @@ -269,7 +328,7 @@ class SignalTransformator extends BaseTransformator { case ENUM_SIGNAL_BEFESTIGUNGSART_MAST: return SignalMountType.MAST case ENUM_SIGNAL_BEFESTIGUNGSART_SIGNALAUSLEGER: - return SignalMountType.SIGNALAUSLEGER_LINKS + return SignalMountType.SIGNALAUSLEGER case ENUM_SIGNAL_BEFESTIGUNGSART_SIGNALBRUECKE: return SignalMountType.SIGNALBRUECKE } diff --git a/java/bundles/org.eclipse.set.model.siteplan/src/org/eclipse/set/model/siteplan/SignalMountType.java b/java/bundles/org.eclipse.set.model.siteplan/src/org/eclipse/set/model/siteplan/SignalMountType.java index 711aba5220..d545754ced 100644 --- a/java/bundles/org.eclipse.set.model.siteplan/src/org/eclipse/set/model/siteplan/SignalMountType.java +++ b/java/bundles/org.eclipse.set.model.siteplan/src/org/eclipse/set/model/siteplan/SignalMountType.java @@ -122,17 +122,7 @@ public enum SignalMountType implements Enumerator { * @generated * @ordered */ - SIGNALAUSLEGER_LINKS(9, "SignalauslegerLinks", "SignalauslegerLinks"), - - /** - * The 'Signalausleger Mitte' literal object. - * - * @see #SIGNALAUSLEGER_MITTE_VALUE - * @generated - * @ordered - */ - SIGNALAUSLEGER_MITTE(10, "SignalauslegerMitte", "SignalauslegerMitte"), + SIGNALAUSLEGER(9, "Signalausleger", "Signalausleger"), /** * The 'Signalbruecke' literal object. - * - * @see #SIGNALAUSLEGER_MITTE - * @model name="SignalauslegerMitte" - * @generated - * @ordered - */ - public static final int SIGNALAUSLEGER_MITTE_VALUE = 10; + public static final int SIGNALAUSLEGER_VALUE = 9; /** * The 'Signalbruecke' literal value.