-
Notifications
You must be signed in to change notification settings - Fork 7
Optimieze Siteplan transform #2073
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,6 +16,7 @@ | |
| import java.util.function.Function; | ||
|
|
||
| import org.eclipse.set.model.planpro.Basisobjekte.Bereich_Objekt; | ||
| import org.eclipse.set.model.planpro.Geodaten.ENUMGEOKoordinatensystem; | ||
| import org.eclipse.set.model.planpro.Geodaten.GEO_Kante; | ||
| import org.eclipse.set.model.planpro.Geodaten.GEO_Knoten; | ||
| import org.eclipse.set.model.planpro.Geodaten.TOP_Kante; | ||
|
|
@@ -57,6 +58,18 @@ public class GEOKanteMetadata { | |
| */ | ||
| final BigDecimal length; | ||
|
|
||
| /** | ||
| * The coordinate system | ||
| */ | ||
| final ENUMGEOKoordinatensystem geoCRS; | ||
|
|
||
| /** | ||
| * @return the geometry coordinate system | ||
| */ | ||
| public ENUMGEOKoordinatensystem getGeoCRS() { | ||
| return geoCRS; | ||
| } | ||
|
|
||
| /** | ||
| * @return the GEO_Kante | ||
| */ | ||
|
|
@@ -121,17 +134,20 @@ public BigDecimal getLength() { | |
| * the start {@link GEO_Knoten} of this GEO_Kante | ||
| * @param geometry | ||
| * the geometry of this GEO_Kante | ||
| * @param geoCRS | ||
| * the geometry coordinate system | ||
| * | ||
| */ | ||
| public GEOKanteMetadata(final GEO_Kante geoKante, final BigDecimal start, | ||
| final BigDecimal length, final List<Bereich_Objekt> bereichObjekt, | ||
| final TOP_Kante topKante, final GEO_Knoten geoKnoten, | ||
| final LineString geometry) { | ||
| final LineString geometry, final ENUMGEOKoordinatensystem geoCRS) { | ||
| this.geoKante = geoKante; | ||
| this.start = start; | ||
| this.length = length; | ||
| this.geometry = geometry; | ||
| this.geoKnoten = geoKnoten; | ||
| this.geoCRS = geoCRS; | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. storage CRS direct in GEOKanteMetaData instead of find by each call |
||
| determineSegments(topKante, bereichObjekt); | ||
| } | ||
|
|
||
|
|
@@ -144,14 +160,18 @@ public GEOKanteMetadata(final GEO_Kante geoKante, final BigDecimal start, | |
| * the start {@link GEO_Knoten} of this GEO_Kante | ||
| * @param geometry | ||
| * the geometry of this GEO_Kante | ||
| * @param geoCRS | ||
| * the geometry coordinate system | ||
| */ | ||
| public GEOKanteMetadata(final GEO_Kante geoKante, final BigDecimal start, | ||
| final GEO_Knoten geoKnoten, final LineString geometry) { | ||
| final GEO_Knoten geoKnoten, final LineString geometry, | ||
| final ENUMGEOKoordinatensystem geoCRS) { | ||
| this.geoKante = geoKante; | ||
| this.start = start; | ||
| this.length = dermineLength().apply(geoKante); | ||
| this.geometry = geometry; | ||
| this.geoKnoten = geoKnoten; | ||
| this.geoCRS = geoCRS; | ||
| // As there is final no segmenting information, only use one segment | ||
| segments.add(new GEOKanteSegment(start, length)); | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,6 +13,7 @@ import java.math.BigDecimal | |
| import java.math.RoundingMode | ||
| import java.util.List | ||
| import java.util.Set | ||
| import java.util.function.Supplier | ||
| import org.eclipse.e4.core.services.events.IEventBroker | ||
| import org.eclipse.set.basis.IModelSession | ||
| import org.eclipse.set.basis.constants.ContainerType | ||
|
|
@@ -21,6 +22,7 @@ import org.eclipse.set.basis.constants.ToolboxConstants | |
| import org.eclipse.set.basis.geometry.GEOKanteCoordinate | ||
| import org.eclipse.set.basis.geometry.GEOKanteMetadata | ||
| import org.eclipse.set.basis.geometry.GEOKanteSegment | ||
| import org.eclipse.set.basis.geometry.GeoPosition | ||
| import org.eclipse.set.core.services.geometry.GeoKanteGeometryService | ||
| import org.eclipse.set.feature.siteplan.SiteplanConstants | ||
| import org.eclipse.set.feature.siteplan.positionservice.PositionService | ||
|
|
@@ -265,19 +267,23 @@ class TrackTransformator extends BaseTransformator<TOP_Kante> implements EventHa | |
| ]) | ||
| result.type.addAll(segment.getTrackType(md)) | ||
| val geoKnotenA = geoKante.geoKnotenA | ||
| // Record an error if there is not exactly one track type defined for the segment | ||
| val center = geoKante.getCoordinate(geoKnotenA, | ||
| geoKante.GEOKanteAllg.GEOLaenge.wert.divide(BigDecimal.valueOf(2), | ||
| ToolboxConstants.ROUNDING_TO_PLACE, RoundingMode.HALF_UP), | ||
| BigDecimal.ZERO, ENUMWirkrichtung.ENUM_WIRKRICHTUNG_IN) | ||
| // Record an error if there is not exactly one track type defined for the segment | ||
| // Calculate center coordinate only by necessary | ||
| val Supplier<GeoPosition> getCenterSupplier = [ | ||
| geoKante.getCoordinate(geoKnotenA, | ||
| geoKante.GEOKanteAllg?.GEOLaenge?.wert?.divide( | ||
| BigDecimal.valueOf(2), ToolboxConstants.ROUNDING_TO_PLACE, | ||
| RoundingMode.HALF_UP) ?: BigDecimal.ZERO, BigDecimal.ZERO, | ||
| ENUMWirkrichtung.ENUM_WIRKRICHTUNG_IN) | ||
| ] | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. calculate Center coordinate only by exist error |
||
| val guid = geoKante.identitaet.wert | ||
| if (result.type.length > 1 && existsTrackType) { | ||
| recordError(guid, String.format(ERROR_MULTIPLE_GLEIS_ART, guid), | ||
| positionService.transformCoordinate(center.getCoordinate, | ||
| 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(center.getCoordinate, | ||
| positionService.transformCoordinate(getCenterSupplier.get.getCoordinate, | ||
| geoKnotenA.CRS)) | ||
| } | ||
|
|
||
|
|
@@ -410,13 +416,9 @@ class TrackTransformator extends BaseTransformator<TOP_Kante> implements EventHa | |
| return result; | ||
| } else { | ||
| if (result.empty) { | ||
| result.add( | ||
| new GEOKanteCoordinate(lastCoordinate, geoKante, | ||
| geoKante.geoKnoten.CRS)) | ||
| result.add(new GEOKanteCoordinate(lastCoordinate, geoKante)) | ||
| } | ||
| result.add( | ||
| new GEOKanteCoordinate(coordinate, geoKante, | ||
| geoKante.geoKnoten.CRS)) | ||
| result.add(new GEOKanteCoordinate(coordinate, geoKante)) | ||
| distance += | ||
| BigDecimal.valueOf(lastCoordinate.distance(coordinate)) | ||
| lastCoordinate = coordinate | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -49,12 +49,12 @@ class GeoKnotenExtensions extends BasisObjektExtensions { | |
| * | ||
| * @returns the GEO-Punkte for this GEO-Knoten | ||
| */ | ||
| def static List<GEO_Punkt> getGeoPunkte( | ||
| def static Iterable<GEO_Punkt> getGeoPunkte( | ||
| GEO_Knoten knoten | ||
| ) { | ||
| return knoten.container.GEOPunkt.filter [ | ||
| IDGEOKnoten !== null && IDGEOKnoten?.wert == knoten.identitaet.wert | ||
| ].toList | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no need transform to list each call |
||
| ] | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -93,7 +93,7 @@ class GeoKnotenExtensions extends BasisObjektExtensions { | |
| * @returns the coordinate of this GEO Knoten | ||
| */ | ||
| def static Coordinate getCoordinate(GEO_Knoten geoKnoten) { | ||
| val List<GEO_Punkt> geoPunkte = geoKnoten.geoPunkte | ||
| val geoPunkte = geoKnoten.geoPunkte | ||
| val GEO_Punkt geoPunkt = geoPunkte.getGeoPunkt(geoKnoten) | ||
| return geoPunkt.coordinate | ||
| } | ||
|
|
@@ -102,14 +102,15 @@ class GeoKnotenExtensions extends BasisObjektExtensions { | |
| val crs = geoKnoten.geoPunkte.map [ | ||
| GEOPunktAllg?.GEOKoordinatensystem?.wert | ||
| ].toSet.uniqueOrNull | ||
| return crs !== null ? crs : ENUMGEOKoordinatensystem. | ||
| ENUMGEO_KOORDINATENSYSTEM_SONSTIGE | ||
| return crs !== null | ||
| ? crs | ||
| : ENUMGEOKoordinatensystem.ENUMGEO_KOORDINATENSYSTEM_SONSTIGE | ||
| } | ||
|
|
||
| def static GEO_Punkt getGeoPunkt(List<GEO_Punkt> geoPunkte, | ||
| def static GEO_Punkt getGeoPunkt(Iterable<GEO_Punkt> geoPunkte, | ||
| GEO_Knoten geoKnoten) { | ||
| if (geoPunkte.size === 1) { | ||
| return geoPunkte.first | ||
| return geoPunkte.get(0) | ||
| } | ||
| val crs = geoPunkte.map[GEOPunktAllg?.GEOKoordinatensystem?.wert].toSet | ||
| // A Geo_Knoten reference to two Geo_Punkt only when the Geo_Knoten have 2 Coordinatensystem | ||
|
|
@@ -119,7 +120,7 @@ class GeoKnotenExtensions extends BasisObjektExtensions { | |
| Integer.valueOf(geoPunkte.size()), | ||
| geoKnoten.getIdentitaet().getWert())) | ||
| } | ||
|
|
||
| return geoPunkte.firstOrNull | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
store coordinate of GEO_Knoten instead of find the coordinate each call