diff --git a/java/bundles/org.eclipse.set.feature.siteplan/src/org/eclipse/set/feature/siteplan/transform/TrackTransformator.xtend b/java/bundles/org.eclipse.set.feature.siteplan/src/org/eclipse/set/feature/siteplan/transform/TrackTransformator.xtend index 1e1bc7741a..3c2f6393ae 100644 --- a/java/bundles/org.eclipse.set.feature.siteplan/src/org/eclipse/set/feature/siteplan/transform/TrackTransformator.xtend +++ b/java/bundles/org.eclipse.set.feature.siteplan/src/org/eclipse/set/feature/siteplan/transform/TrackTransformator.xtend @@ -121,7 +121,12 @@ class TrackTransformator extends BaseTransformator implements EventHa sectionColor = '''hsl(«(SiteplanConstants.TOP_KANTEN_COLOR.size + 1) * 137.5», 100%, 65%)''' SiteplanConstants.TOP_KANTEN_COLOR.put(track.guid, sectionColor) } - + val geoKnotenA = topKante.TOPKnotenA.GEOKnoten + val geoCoordinate = geoKnotenA.coordinate + val siteplanCoordinate = positionService.transformCoordinate(geoCoordinate.x.doubleValue, geoCoordinate.y.doubleValue, geoKnotenA.CRS) + track.startCoordinate = SiteplanFactory.eINSTANCE.createCoordinate + track.startCoordinate.x = siteplanCoordinate.x + track.startCoordinate.y = siteplanCoordinate.y geoKantes.createTransformatorThread(this.class.name + "_" + track.guid, Runtime.runtime.availableProcessors, [ val section = transformTrackSection(it) @@ -279,12 +284,12 @@ class TrackTransformator extends BaseTransformator implements EventHa val guid = geoKante.identitaet.wert if (result.type.length > 1 && existsTrackType) { recordError(guid, String.format(ERROR_MULTIPLE_GLEIS_ART, guid), - positionService.transformCoordinate(getCenterSupplier.get.getCoordinate, - geoKnotenA.CRS)) + positionService.transformCoordinate( + getCenterSupplier.get.getCoordinate, geoKnotenA.CRS)) } else if (result.type.length == 0 && existsTrackType) { recordError(guid, String.format(ERROR_NO_GLEIS_ART, guid), - positionService.transformCoordinate(getCenterSupplier.get.getCoordinate, - geoKnotenA.CRS)) + positionService.transformCoordinate( + getCenterSupplier.get.getCoordinate, geoKnotenA.CRS)) } return result diff --git a/java/bundles/org.eclipse.set.model.siteplan/model/siteplan.ecore b/java/bundles/org.eclipse.set.model.siteplan/model/siteplan.ecore index e049617c29..1c63c650ef 100644 --- a/java/bundles/org.eclipse.set.model.siteplan/model/siteplan.ecore +++ b/java/bundles/org.eclipse.set.model.siteplan/model/siteplan.ecore @@ -188,6 +188,8 @@ eType="#//TrackSection" containment="true"/> + diff --git a/java/bundles/org.eclipse.set.model.siteplan/model/siteplan.genmodel b/java/bundles/org.eclipse.set.model.siteplan/model/siteplan.genmodel index f67ca40af6..cfeb76539d 100644 --- a/java/bundles/org.eclipse.set.model.siteplan/model/siteplan.genmodel +++ b/java/bundles/org.eclipse.set.model.siteplan/model/siteplan.genmodel @@ -253,6 +253,7 @@ + diff --git a/java/bundles/org.eclipse.set.model.siteplan/src/org/eclipse/set/model/siteplan/SiteplanPackage.java b/java/bundles/org.eclipse.set.model.siteplan/src/org/eclipse/set/model/siteplan/SiteplanPackage.java index 57b7e730dd..08fb08f3e7 100644 --- a/java/bundles/org.eclipse.set.model.siteplan/src/org/eclipse/set/model/siteplan/SiteplanPackage.java +++ b/java/bundles/org.eclipse.set.model.siteplan/src/org/eclipse/set/model/siteplan/SiteplanPackage.java @@ -1189,6 +1189,15 @@ public interface SiteplanPackage extends EPackage { */ int TRACK__DESIGNATIONS = SITEPLAN_OBJECT_FEATURE_COUNT + 1; + /** + * The feature id for the 'Start Coordinate' containment + * reference. + * + * @generated + * @ordered + */ + int TRACK__START_COORDINATE = SITEPLAN_OBJECT_FEATURE_COUNT + 2; + /** * The number of structural features of the 'Track' class. @@ -1196,7 +1205,7 @@ public interface SiteplanPackage extends EPackage { * @generated * @ordered */ - int TRACK_FEATURE_COUNT = SITEPLAN_OBJECT_FEATURE_COUNT + 2; + int TRACK_FEATURE_COUNT = SITEPLAN_OBJECT_FEATURE_COUNT + 3; /** * The number of operations of the 'Track' class. + * + * @return the meta object for the containment reference 'Start + * Coordinate'. + * @see org.eclipse.set.model.siteplan.Track#getStartCoordinate() + * @see #getTrack() + * @generated + */ + EReference getTrack_StartCoordinate(); + /** * Returns the meta object for class * '{@link org.eclipse.set.model.siteplan.TrackSection Track @@ -6025,6 +6047,16 @@ interface Literals { */ EReference TRACK__DESIGNATIONS = eINSTANCE.getTrack_Designations(); + /** + * The meta object literal for the 'Start Coordinate' + * containment reference feature. + * + * @generated + */ + EReference TRACK__START_COORDINATE = eINSTANCE + .getTrack_StartCoordinate(); + /** * The meta object literal for the * '{@link org.eclipse.set.model.siteplan.impl.TrackSectionImpl diff --git a/java/bundles/org.eclipse.set.model.siteplan/src/org/eclipse/set/model/siteplan/Track.java b/java/bundles/org.eclipse.set.model.siteplan/src/org/eclipse/set/model/siteplan/Track.java index 9fc5c66168..764b1056a5 100644 --- a/java/bundles/org.eclipse.set.model.siteplan/src/org/eclipse/set/model/siteplan/Track.java +++ b/java/bundles/org.eclipse.set.model.siteplan/src/org/eclipse/set/model/siteplan/Track.java @@ -22,6 +22,8 @@ * Sections} *
  • {@link org.eclipse.set.model.siteplan.Track#getDesignations * Designations}
  • + *
  • {@link org.eclipse.set.model.siteplan.Track#getStartCoordinate Start + * Coordinate}
  • * * * @see org.eclipse.set.model.siteplan.SiteplanPackage#getTrack() @@ -56,4 +58,31 @@ public interface Track extends SiteplanObject { */ EList getDesignations(); + /** + * Returns the value of the 'Start Coordinate' containment + * reference. + * + * @return the value of the 'Start Coordinate' containment + * reference. + * @see #setStartCoordinate(Coordinate) + * @see org.eclipse.set.model.siteplan.SiteplanPackage#getTrack_StartCoordinate() + * @model containment="true" + * @generated + */ + Coordinate getStartCoordinate(); + + /** + * Sets the value of the + * '{@link org.eclipse.set.model.siteplan.Track#getStartCoordinate Start + * Coordinate}' containment reference. + * + * @param value + * the new value of the 'Start Coordinate' containment + * reference. + * @see #getStartCoordinate() + * @generated + */ + void setStartCoordinate(Coordinate value); + } // Track diff --git a/java/bundles/org.eclipse.set.model.siteplan/src/org/eclipse/set/model/siteplan/impl/SiteplanPackageImpl.java b/java/bundles/org.eclipse.set.model.siteplan/src/org/eclipse/set/model/siteplan/impl/SiteplanPackageImpl.java index 0104cddc45..6d0effcc18 100644 --- a/java/bundles/org.eclipse.set.model.siteplan/src/org/eclipse/set/model/siteplan/impl/SiteplanPackageImpl.java +++ b/java/bundles/org.eclipse.set.model.siteplan/src/org/eclipse/set/model/siteplan/impl/SiteplanPackageImpl.java @@ -1374,6 +1374,16 @@ public EReference getTrack_Designations() { return (EReference) trackEClass.getEStructuralFeatures().get(1); } + /** + * + * + * @generated + */ + @Override + public EReference getTrack_StartCoordinate() { + return (EReference) trackEClass.getEStructuralFeatures().get(2); + } + /** * * @@ -2609,6 +2619,7 @@ public void createPackageContents() { trackEClass = createEClass(TRACK); createEReference(trackEClass, TRACK__SECTIONS); createEReference(trackEClass, TRACK__DESIGNATIONS); + createEReference(trackEClass, TRACK__START_COORDINATE); trackSectionEClass = createEClass(TRACK_SECTION); createEAttribute(trackSectionEClass, TRACK_SECTION__SHAPE); @@ -3142,6 +3153,10 @@ public void initializePackageContents() { null, "designations", null, 0, -1, Track.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getTrack_StartCoordinate(), this.getCoordinate(), null, + "startCoordinate", null, 0, 1, Track.class, !IS_TRANSIENT, + !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, + !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(trackSectionEClass, TrackSection.class, "TrackSection", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); diff --git a/java/bundles/org.eclipse.set.model.siteplan/src/org/eclipse/set/model/siteplan/impl/TrackImpl.java b/java/bundles/org.eclipse.set.model.siteplan/src/org/eclipse/set/model/siteplan/impl/TrackImpl.java index 6cc54d4a7f..12fc067c18 100644 --- a/java/bundles/org.eclipse.set.model.siteplan/src/org/eclipse/set/model/siteplan/impl/TrackImpl.java +++ b/java/bundles/org.eclipse.set.model.siteplan/src/org/eclipse/set/model/siteplan/impl/TrackImpl.java @@ -10,6 +10,7 @@ import java.util.Collection; +import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.notify.NotificationChain; import org.eclipse.emf.common.util.EList; @@ -17,9 +18,11 @@ import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.emf.ecore.util.EObjectContainmentEList; import org.eclipse.emf.ecore.util.InternalEList; +import org.eclipse.set.model.siteplan.Coordinate; import org.eclipse.set.model.siteplan.SiteplanPackage; import org.eclipse.set.model.siteplan.Track; import org.eclipse.set.model.siteplan.TrackDesignation; @@ -36,6 +39,8 @@ * Sections} *
  • {@link org.eclipse.set.model.siteplan.impl.TrackImpl#getDesignations * Designations}
  • + *
  • {@link org.eclipse.set.model.siteplan.impl.TrackImpl#getStartCoordinate + * Start Coordinate}
  • * * * @generated @@ -62,6 +67,17 @@ public class TrackImpl extends SiteplanObjectImpl implements Track { */ protected EList designations; + /** + * The cached value of the '{@link #getStartCoordinate() Start + * Coordinate}' containment reference. + * + * @see #getStartCoordinate() + * @generated + * @ordered + */ + protected Coordinate startCoordinate; + /** * * @@ -110,6 +126,65 @@ public EList getDesignations() { return designations; } + /** + * + * + * @generated + */ + @Override + public Coordinate getStartCoordinate() { + return startCoordinate; + } + + /** + * + * + * @generated + */ + public NotificationChain basicSetStartCoordinate( + Coordinate newStartCoordinate, NotificationChain msgs) { + Coordinate oldStartCoordinate = startCoordinate; + startCoordinate = newStartCoordinate; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, + Notification.SET, SiteplanPackage.TRACK__START_COORDINATE, + oldStartCoordinate, newStartCoordinate); + if (msgs == null) + msgs = notification; + else + msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + @Override + public void setStartCoordinate(Coordinate newStartCoordinate) { + if (newStartCoordinate != startCoordinate) { + NotificationChain msgs = null; + if (startCoordinate != null) + msgs = ((InternalEObject) startCoordinate).eInverseRemove(this, + EOPPOSITE_FEATURE_BASE + - SiteplanPackage.TRACK__START_COORDINATE, + null, msgs); + if (newStartCoordinate != null) + msgs = ((InternalEObject) newStartCoordinate).eInverseAdd(this, + EOPPOSITE_FEATURE_BASE + - SiteplanPackage.TRACK__START_COORDINATE, + null, msgs); + msgs = basicSetStartCoordinate(newStartCoordinate, msgs); + if (msgs != null) + msgs.dispatch(); + } else if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, + SiteplanPackage.TRACK__START_COORDINATE, newStartCoordinate, + newStartCoordinate)); + } + /** * * @@ -125,6 +200,8 @@ public NotificationChain eInverseRemove(InternalEObject otherEnd, case SiteplanPackage.TRACK__DESIGNATIONS: return ((InternalEList) getDesignations()) .basicRemove(otherEnd, msgs); + case SiteplanPackage.TRACK__START_COORDINATE: + return basicSetStartCoordinate(null, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } @@ -141,6 +218,8 @@ public Object eGet(int featureID, boolean resolve, boolean coreType) { return getSections(); case SiteplanPackage.TRACK__DESIGNATIONS: return getDesignations(); + case SiteplanPackage.TRACK__START_COORDINATE: + return getStartCoordinate(); } return super.eGet(featureID, resolve, coreType); } @@ -164,6 +243,9 @@ public void eSet(int featureID, Object newValue) { getDesignations().addAll( (Collection) newValue); return; + case SiteplanPackage.TRACK__START_COORDINATE: + setStartCoordinate((Coordinate) newValue); + return; } super.eSet(featureID, newValue); } @@ -182,6 +264,9 @@ public void eUnset(int featureID) { case SiteplanPackage.TRACK__DESIGNATIONS: getDesignations().clear(); return; + case SiteplanPackage.TRACK__START_COORDINATE: + setStartCoordinate((Coordinate) null); + return; } super.eUnset(featureID); } @@ -198,6 +283,8 @@ public boolean eIsSet(int featureID) { return sections != null && !sections.isEmpty(); case SiteplanPackage.TRACK__DESIGNATIONS: return designations != null && !designations.isEmpty(); + case SiteplanPackage.TRACK__START_COORDINATE: + return startCoordinate != null; } return super.eIsSet(featureID); } diff --git a/web/siteplan/src/feature/TrackSectionMarkerFeature.ts b/web/siteplan/src/feature/TrackSectionMarkerFeature.ts index f94c43d4b1..6836ef74f8 100644 --- a/web/siteplan/src/feature/TrackSectionMarkerFeature.ts +++ b/web/siteplan/src/feature/TrackSectionMarkerFeature.ts @@ -34,20 +34,32 @@ export default class TrackSectionMarkerFeature extends LageplanFeature { } getFeatures (model: SiteplanState): Feature[] { - return this.getObjectsModel(model).flatMap(track => - track?.sections.flatMap(section => - this.createTrackSectionMarkerFeature([section.startCoordinate.x, section.startCoordinate.y], section))) + return this.getObjectsModel(model).flatMap(track => { + const trackStartPos: OlCoordinate = [track.startCoordinate.x, track.startCoordinate.y] + return [this.createTrackMarkerFeature(trackStartPos, track, () => store.state.trackColorVisible)].concat( + track?.sections.flatMap(section => + this.createTrackMarkerFeature( + [section.startCoordinate.x, section.startCoordinate.y], + section, + () => store.state.trackSectionColorVisible + )) || [] + ) + }) } - private createTrackSectionMarkerFeature (position: OlCoordinate, trackSection: TrackSection): Feature { + private createTrackMarkerFeature ( + position: OlCoordinate, + track: Track | TrackSection, + visiblePredicate: () => boolean + ): Feature { const feature = createFeature( FeatureType.TrackSectionMarker, - trackSection, + track, new OlPoint(position) ) feature.setStyle((_, resolution) => { - if (!store.state.trackSectionColorVisible) { + if (!visiblePredicate()) { return new Style() } @@ -66,11 +78,6 @@ export default class TrackSectionMarkerFeature extends LageplanFeature { return style }) - - return feature - } - - setFeatureColor (feature: Feature): Feature { return feature } } diff --git a/web/siteplan/src/model/Track.ts b/web/siteplan/src/model/Track.ts index 75443fe330..d4c9fdd07c 100644 --- a/web/siteplan/src/model/Track.ts +++ b/web/siteplan/src/model/Track.ts @@ -7,7 +7,7 @@ * http://www.eclipse.org/legal/epl-v20.html */ import { checkInstance } from '@/util/ObjectExtension' -import { defaultPositionObj, Position } from './Position' +import { Coordinate, defaultCoordinateObj, defaultPositionObj, Position } from './Position' import SiteplanObject, { defaultObjectColorObj } from './SiteplanObject' import TrackSection, { defaultTrackSectionObj } from './TrackSection' @@ -33,6 +33,7 @@ export default interface Track extends SiteplanObject guid: string sections: TrackSection[] designations: TrackDesignation[] + startCoordinate: Coordinate } export function defaultTrackObj (): Track { @@ -40,7 +41,8 @@ export function defaultTrackObj (): Track { guid: 'abc', designations: [defaultTrackDesignationObj()], sections: [defaultTrackSectionObj()], - objectColors: [defaultObjectColorObj()] + objectColors: [defaultObjectColorObj()], + startCoordinate: defaultCoordinateObj() } } diff --git a/web/siteplan/src/util/FeatureExtensions.ts b/web/siteplan/src/util/FeatureExtensions.ts index 02ac351502..a300d81386 100644 --- a/web/siteplan/src/util/FeatureExtensions.ts +++ b/web/siteplan/src/util/FeatureExtensions.ts @@ -15,6 +15,7 @@ import { Coordinate, Position } from '@/model/Position' import { Signal } from '@/model/Signal' import { SignalMount } from '@/model/SignalMount' import TrackClose from '@/model/TrackClose' +import { store } from '@/store' import { FeatureCollection, Feature as GeoJSONFeature, GeometryCollection as GeoJSONGeometryCollection } from 'geojson' import { Feature } from 'ol' import GeoJSON from 'ol/format/GeoJSON' @@ -34,8 +35,13 @@ export function getFeatureGUIDs (feature: Feature): string[] { const fma = getFeatureData(feature) return fma ? [fma.guid] : [] case FeatureType.Track: - const trackSection = getFeatureData(feature) - return trackSection ? [trackSection.section.guid] : [] + const isTrackColorVisible = store.state.trackColorVisible + const trackData = getFeatureData(feature) + if (!trackData) { + return [] + } + + return isTrackColorVisible ? [trackData.guid] : [trackData.section.guid] case FeatureType.TrackOutline: const trackOutline = getFeatureData(feature) return trackOutline ? [trackOutline.guid] : [] diff --git a/web/siteplan/src/util/PlanProToolbox.ts b/web/siteplan/src/util/PlanProToolbox.ts index 5783b56b24..be0609076a 100644 --- a/web/siteplan/src/util/PlanProToolbox.ts +++ b/web/siteplan/src/util/PlanProToolbox.ts @@ -67,6 +67,7 @@ export default abstract class PlanProToolbox { } static jumpToTextView (guid: string): void { + console.log('Jump to text view called for guid:', guid) if (!this.inPPT()) { console.warn('PlanProToolbox.jumpToTextView called outside PPT') return