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 @@ -121,7 +121,12 @@ class TrackTransformator extends BaseTransformator<TOP_Kante> 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)
Expand Down Expand Up @@ -279,12 +284,12 @@ class TrackTransformator extends BaseTransformator<TOP_Kante> 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@
eType="#//TrackSection" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="designations" upperBound="-1"
eType="#//TrackDesignation" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="startCoordinate" eType="#//Coordinate"
containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="TrackSection" eSuperTypes="#//SiteplanObject">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="shape" eType="#//TrackShape"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@
<genClasses ecoreClass="siteplan.ecore#//Track">
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference siteplan.ecore#//Track/sections"/>
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference siteplan.ecore#//Track/designations"/>
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference siteplan.ecore#//Track/startCoordinate"/>
</genClasses>
<genClasses ecoreClass="siteplan.ecore#//TrackSection">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute siteplan.ecore#//TrackSection/shape"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1189,14 +1189,23 @@ public interface SiteplanPackage extends EPackage {
*/
int TRACK__DESIGNATIONS = SITEPLAN_OBJECT_FEATURE_COUNT + 1;

/**
* The feature id for the '<em><b>Start Coordinate</b></em>' containment
* reference. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
* @ordered
*/
int TRACK__START_COORDINATE = SITEPLAN_OBJECT_FEATURE_COUNT + 2;

/**
* The number of structural features of the '<em>Track</em>' class. <!--
* begin-user-doc --> <!-- end-user-doc -->
*
* @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 '<em>Track</em>' class. <!--
Expand Down Expand Up @@ -3966,6 +3975,19 @@ public interface SiteplanPackage extends EPackage {
*/
EReference getTrack_Designations();

/**
* Returns the meta object for the containment reference
* '{@link org.eclipse.set.model.siteplan.Track#getStartCoordinate <em>Start
* Coordinate</em>}'. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @return the meta object for the containment reference '<em>Start
* Coordinate</em>'.
* @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 <em>Track
Expand Down Expand Up @@ -6025,6 +6047,16 @@ interface Literals {
*/
EReference TRACK__DESIGNATIONS = eINSTANCE.getTrack_Designations();

/**
* The meta object literal for the '<em><b>Start Coordinate</b></em>'
* containment reference feature. <!-- begin-user-doc --> <!--
* end-user-doc -->
*
* @generated
*/
EReference TRACK__START_COORDINATE = eINSTANCE
.getTrack_StartCoordinate();

/**
* The meta object literal for the
* '{@link org.eclipse.set.model.siteplan.impl.TrackSectionImpl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
* <em>Sections</em>}</li>
* <li>{@link org.eclipse.set.model.siteplan.Track#getDesignations
* <em>Designations</em>}</li>
* <li>{@link org.eclipse.set.model.siteplan.Track#getStartCoordinate <em>Start
* Coordinate</em>}</li>
* </ul>
*
* @see org.eclipse.set.model.siteplan.SiteplanPackage#getTrack()
Expand Down Expand Up @@ -56,4 +58,31 @@ public interface Track extends SiteplanObject {
*/
EList<TrackDesignation> getDesignations();

/**
* Returns the value of the '<em><b>Start Coordinate</b></em>' containment
* reference. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @return the value of the '<em>Start Coordinate</em>' 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 <em>Start
* Coordinate</em>}' containment reference. <!-- begin-user-doc --> <!--
* end-user-doc -->
*
* @param value
* the new value of the '<em>Start Coordinate</em>' containment
* reference.
* @see #getStartCoordinate()
* @generated
*/
void setStartCoordinate(Coordinate value);

} // Track
Original file line number Diff line number Diff line change
Expand Up @@ -1374,6 +1374,16 @@ public EReference getTrack_Designations() {
return (EReference) trackEClass.getEStructuralFeatures().get(1);
}

/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public EReference getTrack_StartCoordinate() {
return (EReference) trackEClass.getEStructuralFeatures().get(2);
}

/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,19 @@

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;

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;
Expand All @@ -36,6 +39,8 @@
* <em>Sections</em>}</li>
* <li>{@link org.eclipse.set.model.siteplan.impl.TrackImpl#getDesignations
* <em>Designations</em>}</li>
* <li>{@link org.eclipse.set.model.siteplan.impl.TrackImpl#getStartCoordinate
* <em>Start Coordinate</em>}</li>
* </ul>
*
* @generated
Expand All @@ -62,6 +67,17 @@ public class TrackImpl extends SiteplanObjectImpl implements Track {
*/
protected EList<TrackDesignation> designations;

/**
* The cached value of the '{@link #getStartCoordinate() <em>Start
* Coordinate</em>}' containment reference. <!-- begin-user-doc --> <!--
* end-user-doc -->
*
* @see #getStartCoordinate()
* @generated
* @ordered
*/
protected Coordinate startCoordinate;

/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
Expand Down Expand Up @@ -110,6 +126,65 @@ public EList<TrackDesignation> getDesignations() {
return designations;
}

/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public Coordinate getStartCoordinate() {
return startCoordinate;
}

/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @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;
}

/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @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));
}

/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
Expand All @@ -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);
}
Expand All @@ -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);
}
Expand All @@ -164,6 +243,9 @@ public void eSet(int featureID, Object newValue) {
getDesignations().addAll(
(Collection<? extends TrackDesignation>) newValue);
return;
case SiteplanPackage.TRACK__START_COORDINATE:
setStartCoordinate((Coordinate) newValue);
return;
}
super.eSet(featureID, newValue);
}
Expand All @@ -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);
}
Expand All @@ -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);
}
Expand Down
29 changes: 18 additions & 11 deletions web/siteplan/src/feature/TrackSectionMarkerFeature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,32 @@ export default class TrackSectionMarkerFeature extends LageplanFeature<Track> {
}

getFeatures (model: SiteplanState): Feature<Geometry>[] {
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<Geometry> {
private createTrackMarkerFeature (
position: OlCoordinate,
track: Track | TrackSection,
visiblePredicate: () => boolean
): Feature<Geometry> {
const feature = createFeature(
FeatureType.TrackSectionMarker,
trackSection,
track,
new OlPoint(position)
)

feature.setStyle((_, resolution) => {
if (!store.state.trackSectionColorVisible) {
if (!visiblePredicate()) {
return new Style()
}

Expand All @@ -66,11 +78,6 @@ export default class TrackSectionMarkerFeature extends LageplanFeature<Track> {

return style
})

return feature
}

setFeatureColor (feature: Feature<Geometry>): Feature<Geometry> {
return feature
}
}
Loading
Loading