blob: 20a0431e2bea24b1f432f5162d7d42107b70144a [file] [log] [blame]
// *****************************************************************************
// Copyright (c) 2018 Agence spatiale canadienne / Canadian Space Agency
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// which accompanies this distribution, and is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// Contributors:
// Pierre Allard - initial API and implementation
// Regent L'Archeveque
//
// SPDX-License-Identifier: EPL-1.0
// *****************************************************************************
@GenModel(prefix="ApogySurfaceEnvironmentUI",
childCreationExtenders="true",
extensibleProviderFactory="true",
multipleEditorPages="false",
copyrightText="*******************************************************************************
Copyright (c) 2018 Agence spatiale canadienne / Canadian Space Agency
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
which accompanies this distribution, and is available at
http://www.eclipse.org/legal/epl-v10.html
Contributors:
Pierre Allard - initial API and implementation
Regent L'Archeveque
SPDX-License-Identifier: EPL-1.0
*******************************************************************************",
modelName="ApogyCoreSurfaceEnvironmentUI",
complianceLevel="8.0",
suppressGenModelAnnotations="false",
dynamicTemplates="true",
templateDirectory="platform:/plugin/org.eclipse.apogy.common.emf.codegen/templates")
@GenModel(modelDirectory="/org.eclipse.apogy.core.environment.surface.ui/src-gen")
@GenModel(editDirectory="/org.eclipse.apogy.core.environment.surface.ui.edit/src-gen")
package org.eclipse.apogy.core.environment.surface.ui
import org.eclipse.apogy.common.emf.Described
import org.eclipse.apogy.common.emf.Named
import org.eclipse.apogy.common.emf.ui.EClassSettings
import org.eclipse.apogy.common.emf.ui.NamedDescribedWizardPagesProvider
import org.eclipse.apogy.common.images.AbstractEImage
import org.eclipse.apogy.common.math.Matrix4x4
import org.eclipse.apogy.common.topology.ui.NodePresentation
import org.eclipse.apogy.common.geometry.data3d.ui.CartesianTriangularMeshPresentation
import org.eclipse.apogy.core.ApogySystemApiAdapter
import org.eclipse.apogy.core.FeatureOfInterestList
import org.eclipse.apogy.core.PoseProvider
import org.eclipse.apogy.core.environment.Star
import org.eclipse.apogy.core.environment.surface.Map
import org.eclipse.apogy.core.environment.surface.CartesianTriangularMeshMapLayer
import org.eclipse.apogy.core.environment.surface.FeaturesOfInterestMapLayer
import org.eclipse.apogy.core.environment.surface.ImageMapLayerPresentation
import org.eclipse.apogy.core.environment.surface.RectangularRegion
import org.eclipse.apogy.core.environment.surface.RectangularRegionProvider
import org.eclipse.apogy.core.environment.surface.ImageMapLayer
import org.eclipse.apogy.core.invocator.AbstractToolsListContainer
import org.eclipse.apogy.core.invocator.InvocatorSession
import org.eclipse.apogy.core.invocator.Variable
import org.eclipse.emf.ecore.EObject
import org.eclipse.apogy.common.Apogy
// Types
type List<T> wraps java.util.List
type HashMap<key, value> wraps java.util.HashMap
type Point2d wraps javax.vecmath.Point2d
type Color3f wraps javax.vecmath.Color3f
type Point3f wraps javax.vecmath.Point3f
type XYSeries wraps org.jfree.data.xy.XYSeries
type XYPlot wraps org.jfree.chart.plot.XYPlot
type XYDataItem wraps org.jfree.data.xy.XYDataItem
type AbstractXYAnnotation wraps org.jfree.chart.annotations.AbstractXYAnnotation
type ChartComposite wraps org.jfree.experimental.chart.swt.ChartComposite
type JFreeChart wraps org.jfree.chart.JFreeChart
@Apogy(hasCustomClass="true")
class AbstractSurfaceWorksitePresentation extends NodePresentation
{
@GenModel(propertyCategory="AXIS")
boolean axisVisible = "true"
@GenModel(propertyCategory="AXIS")
@Apogy(units="m")
double axisLength = "10.0"
@GenModel(propertyCategory="SKY")
boolean azimuthVisible = "true"
@GenModel(propertyCategory="SKY")
boolean elevationLinesVisible = "true"
@GenModel(propertyCategory="SKY")
boolean azimuthLinesVisible = "true"
@GenModel(propertyCategory="PLANE")
boolean planeVisible = "true"
@GenModel(propertyCategory="PLANE")
@Apogy(units="m")
double planeGridSize = "1.0"
@GenModel(propertyCategory="PLANE")
@Apogy(units="m")
double planeSize = "10.0"
}
class AbstractSurfaceWorksiteSkyPresentation extends NodePresentation
{
@GenModel(propertyCategory="Horizon")
boolean horizonVisible = "true"
}
class MoonPresentation extends NodePresentation
{
}
@Apogy(hasCustomClass="true")
class FeatureOfInterestNodePresentation extends NodePresentation
{
@GenModel(propertyCategory="FLAG")
@Apogy(units="m")
double poleHeight = "1.0"
@GenModel(propertyCategory="FLAG")
boolean flagVisible = "true"
@GenModel(propertyCategory="FLAG")
int fontSize = "16"
}
@Apogy(isSingleton="true", hasCustomClass="true")
class ApogySurfaceEnvironmentUIFacade
{
//op void getImageMapLayerPresentationExtent(ImageMapLayerPresentation imageMapLayerPresentation, Tuple3d lowerLeftCorner, Tuple3d upperRightCorner)
//op void getImageMapLayerPresentationExtent(List<ImageMapLayerPresentation> imageMapLayerPresentations, Tuple3d lowerLeftCorner, Tuple3d upperRightCorner)
/*
* Returns an image representing the assembly of the specified list of ImageMapLayerPresentation.
* @param imageMapLayerPresentations The specified list of ImageMapLayerPresentation.
* @return The image representing the specified list of ImageMapLayerPresentation.
*/
//op AbstractEImage getImageMapLayerPresentationImage(List<ImageMapLayerPresentation> imageMapLayerPresentations)
/*
* Returns the ImageMapLayerPresentation with the highest resolution (minimum meters/pixel).
* @return The ImageMapLayerPresentation with the highest resolution (minimum meters/pixel)
*/
//op ImageMapLayerPresentation getBestResolutionMapLayer(List<ImageMapLayerPresentation> imageMapLayerPresentations)
/*
* Returns the list of visible ImageMapLayerPresentation from"" a specified imageMapLayerPresentations.
* @param imageMapLayerPresentations The specified list of ImageMapLayerPresentation.
* @return The list of visible ImageMapLayerPresentation.
*/
//op List<ImageMapLayerPresentation> getVisibleImageMapLayerPresentation(List<ImageMapLayerPresentation> imageMapLayerPresentations)
op List<RectangularRegionProvider> getVisibleRectangularRegionProvider(MapViewConfiguration mapViewConfiguration)
/*
* Returns an image representing the specified MapViewExtent using a specified MapViewConfiguration.
* If the MapViewExtent is larger than the area covered by the MapViewConfiguration, transparent pixels will be added.
* @param mapViewConfiguration The specified MapViewConfiguration.
* @param mapViewExtent The specified ground area to be covered.
* @param maximumImageSizePixels The maximum size, in pixel, of the generated image.
* @return The image representing the specified MapViewExtent.
*/
op AbstractEImage getImageMapLayerPresentationImage(MapViewConfiguration mapViewConfiguration, RectangularRegion mapViewExtent, int maximumImageSizePixels)
/*
* Computes the length of a 2D trajectory.
* @param The XYSeries.
* @return The length of the trajectory represented in the XYSerie.
*/
op double getTrajectoryLength(XYSeries xySeries)
/*
* Return the identifier associated with a given MapViewConfiguration.
* @param mapViewConfiguration The given MapViewConfiguration.
* @return The identifier, null if none is found.
*/
op String getMapViewConfigurationIdentifier(MapViewConfiguration mapViewConfiguration)
/*
* Return the MapViewConfiguration (in the Active Session) with the specified identifier.
* @param identifier The MapViewConfiguration identifier.
* @return The MapViewConfiguration with the specified identifier, null if non is found.
*/
op MapViewConfiguration getActiveMapViewConfiguration(String identifier)
/*
* Return the MapViewConfigurationList in the Active Session.
* @return The MapViewConfigurationList in the Active Session, null if none is found.
*/
op MapViewConfigurationList getActiveMapViewConfigurationList()
op List<FeatureOfInterestList> getFeatureOfInterestLists(InvocatorSession session)
}
// Utilities
@Apogy(isSingleton="true", hasCustomClass="true")
class EnvironmentSurfaceUIUtilities
{
op Point3f toPoint3f(Star star)
op float getPointSizeForMagnitude(float magnitude, float magnitudeRangeMinimum, float magnitudeRangeMaximum, float minimumPointSize, float maximumPointSize)
}
// MapView Definitions
class MapViewConfigurationList extends AbstractToolsListContainer
{
contains MapViewConfiguration[0..*] mapViewConfigurations
}
/*
* Configuration used for the Map View.
*/
class MapViewConfiguration extends Named, Described
{
/*
* List of Maps being displayed.
*/
@GenModel(children="true", notify="true", property="None")
contains ImageMapLayerPresentation[0..*] mapLayers
/*
* Color of the map background.
*/
Color3f backgroundColor = "1.0,1.0,1.0"
/*
* List of Apogy System instances being tracked.
*/
@GenModel(children="true", notify="true", property="None")
contains MapAnnotation[0..*] mapAnnotations
/*
* Default region to use when none is covered by the map Layers
*/
refers transient RectangularRegion[1] defaultRectangularRegion
/*
* The image representing the active ImageMapLayers.
*/
@GenModel(children="false", notify="true")
refers derived transient readonly AbstractEImage mapImage
/*
* The rectangular region covered by the image layers defined in the map.
*/
@GenModel(children="false", notify="true", property="Readonly")
refers derived transient readonly RectangularRegion[1] mapImageRectangularRegion
/*
* The rectangular region covered by the map (typically larger than
* mapImageRectangularRegion and contains mapImageRectangularRegion).
*/
@GenModel(children="false", notify="true", property="Readonly")
refers derived transient RectangularRegion[1] extent
/*
* Forces the updates of all derived values.
*/
op void forceUpdate()
}
/*
* Presentation properties for an item displayed
* on the MapView.
*/
abstract class MapViewItemPresentation
{
/*
* Visibility
*/
boolean visible = "true"
}
/*
* Presentation properties for an ImageMapLayer displayed on the MapView.
*/
//class ImageMapLayerPresentation extends MapViewItemPresentation, RectangularRegionImage
//{
/** Image Map Layer being displayed.*/
// refers ImageMapLayer imageMapLayer
/**
* The alpha to use to display this layer, from fully opaque (1.0f) to fully transparent (0.0f).
*/
// float alpha = "1.0"
//}
/*
* Presentation properties for an object shown on top of the maps.
*/
abstract class MapAnnotation extends MapViewItemPresentation
{
/*
* TheXYPlot being used by MapView.
*/
op List<AbstractXYAnnotation> getXYShapeAnnotation()
}
/*
* Base class of all map tools.
*/
abstract class MapTool extends MapAnnotation
{
/*
* Whether or not the tool is active.
*/
boolean active = "true"
/*
* Method that is called to give access to the underlying ChartComposite and JFreeChart used to display the map.
* @param composite The ChartComposite used to display the map.
* @param chart The JFreeChart used to display the map.
*/
op void initialize(ChartComposite composite, JFreeChart chart)
/*
* Method that is called to dispose of the tool.
*/
op void dispose()
/*
* Method called when the user clicks on the map with the mouse.
* @param mouseButton The mouse button clicked
* @param x The absolute position x coordinates of the point selected.
* @param y The absolute position y coordinates of the point selected.
*/
op void positionSelected(int mouseButton, double x, double y)
}
/*
* Tool that shows the distance between two point on the map. The use needs to
* selects two positions on the map by clicking using the left button on the mouse.
*/
class MapRuler extends MapTool
{
/*
* The color of the ruler.
*/
Color3f rulerColor = "0.0,1.0,0.0"
}
/**
* Presentation properties associated with a CartesianTriangularMeshMapLayerNode.
*/
@Apogy(hasCustomClass="true")
class CartesianTriangularMeshMapLayerNodePresentation extends CartesianTriangularMeshPresentation
{
}
/*
* Presentation properties for a FeaturesOfInterestMapLayer.
*/
class FeaturesOfInterestMapLayerPresentation extends MapAnnotation, RectangularRegionProvider
{
@GenModel(notify="true", propertyCategory="FOI_PROPERTIES")
refers FeaturesOfInterestMapLayer featuresOfInterestMapLayer
@GenModel(notify="true", propertyCategory="FOI_PROPERTIES")
@Apogy(units="m")
double featureOfInterestRadius = "0.25"
/** The color of the vector. */
@GenModel(propertyCategory="FOI_PROPERTIES")
Color3f featureOfInterestColor = "0.0,0.0,1.0"
}
// Trajectory Annotation and Tools.
/*
* Base class for classes providing a trajectory.
*/
abstract class TrajectoryProvider
{
/*
* Re-initialize the TrajectoryProvider.
*/
op void initialize()
/*
* Clears the list of points and associated trajectory.
*/
op void clear()
/*
* Returns the current trajectory as a list of Point2d.
*/
op List<Point2d> asListOfPoint2d()
/*
* The XYSeries containing the trajectory data to be displayed.
*/
op XYSeries getXYSeries()
/*
* Latest x coordinates.
*/
transient XYDataItem latestPosition
/*
* The azimuth of the latest position, in radians, as measured relative to the x axis, positive clockwise.
*/
@Apogy(units="rad")
transient double azimuthAngle = "0.0"
/*
* The current length of the trajectory.
*/
@Apogy(units="m")
transient double trajectoryLength = "0.0"
/*
* The color of the ruler.
*/
Color3f trajectoryColor = "0.0,1.0,0.0"
}
/*
* Base class for user map tools that display trajectory on a map.
*/
@Apogy(hasCustomClass="true")
abstract class AbstractTrajectoryTool extends TrajectoryProvider, MapTool
{
}
/*
* Tool that allows a user to define a trajectory by clicking on a map.
* Clicking on the left mouse button add a point to the trajectory, cliking on
* the right mouse button removes the last point of the trajectory.
*/
class TrajectoryPickingTool extends AbstractTrajectoryTool
{
}
/*
* Base class for TrajectoryProvider that are providing trajectory based on a VariableTrajectoryAnnotation.
*/
abstract class VariableTrajectoryProvider extends TrajectoryProvider
{
@GenModel(property="None")
container VariableTrajectoryAnnotation variableAnnotation opposite trajectoryProvider
/*
* The Apogy System being displayed. This is automatically updated.
*/
refers transient PoseProvider[1] poseProvider
}
/*
* Default implementation of VariableTrajectoryProvider. This implementation makes use of thresholds
* to limits the number of position update of the trajectory to improve performance.
*/
@Apogy(hasCustomClass="true")
class DefaultVariableTrajectoryProvider extends VariableTrajectoryProvider
{
/*
* Minimum distance to keep between points added to the XYSeries.
*/
@GenModel(propertyCategory="THRESHOLDS")
@Apogy(units="m")
double distanceThreshold = "0.5"
/*
* Minimum azimuth change that will trigger an azimuthAngle change.
*/
@GenModel(propertyCategory="THRESHOLDS")
@Apogy(units="rad")
double azimuthThreshold = "0.017"
}
// Variable Annotations.
/*
* Base class used for MapAnnotation representing a variable on a Map.
*/
@Apogy(hasCustomClass="true")
abstract class AbstractVariableAnnotation extends MapAnnotation
{
/*
* The Apogy System being displayed.
*/
refers Variable[1] variable
/*
* The instance of the object adapted by the Apogy System.
*/
refers transient EObject[0..1] variableInstance
/*
* The current instance of ApogySystemApiAdapter handling the variable.
*/
refers transient ApogySystemApiAdapter[0..1] apogySystemApiAdapter
/*
* Method called when the pose of the variable changes.
* @param newPose The new pose matrix.
*/
op void updatePose(Matrix4x4 newPose)
}
/*
* AbstractVariableAnnotation that shows the position and orientation of a variable on a Map.
*/
class PoseVariableAnnotation extends AbstractVariableAnnotation
{
/*
* The length of the vector.NamedWizardPagesProvider
*/
@GenModel(propertyCategory="VECTOR_PROPERTIES")
@Apogy(units="m")
double vectorlength = "10.0"
/*
* The color of the vector.
*/
@GenModel(propertyCategory="VECTOR_PROPERTIES")
Color3f vectorColor = "0.0,0.0,1.0"
/*
* Whether to show the pose as text.
*/
boolean showPose = "true"
/*
* Method called when the position or orientation of the variable changes.
* @param x The x coordinates, in meters.
* @param y The y coordinates, in meters.
* @param zRotation The azimuth, in radians.
*/
op void updatePose(@Apogy(units="m") double x, @Apogy(units="m") double y, @Apogy(units="rad") double zRotation)
}
/*
* AbstractVariableAnnotation that draws the trajectory of a variable on a map.
*/
class VariableTrajectoryAnnotation extends AbstractVariableAnnotation, TrajectoryProvider
{
/*
* The trajectory provider.
*/
contains VariableTrajectoryProvider[1] trajectoryProvider opposite variableAnnotation
}
/*
* Specialization of PoseVariableAnnotation that also draws the shape of the vehicle on the map.
*/
class VehicleVariableAnnotation extends PoseVariableAnnotation
{
/*
* The length of the vehicle.
*/
@GenModel(propertyCategory="VEHICLE_DIMENSIONS")
@Apogy(units="m")
double vehicleLength = "1.0"
/*
* The width of the vehicle.
*/
@GenModel(propertyCategory="VEHICLE_DIMENSIONS")
@Apogy(units="m")
double vehicleWidth = "0.5"
}
// Wizard Support for Map
class MapUISettings extends EClassSettings
{
/*
* Name to give the MapUISettings.
*/
String name
}
@Apogy(hasCustomClass="true")
class MapWizardPagesProvider extends NamedDescribedWizardPagesProvider
{
}
// Wizard Support for CartesianTriangularMeshMapLayer
class CartesianTriangularMeshMapLayerUISettings extends EClassSettings
{
/*
* Name to give the MapUISettings.
*/
String name
}
// Wizard Provider to create CartesianTriangularMeshURLMapLayer
@Apogy(hasCustomClass="true")
class CartesianTriangularMeshURLMapLayerWizardPagesProvider extends NamedDescribedWizardPagesProvider
{
}
// Wizard Support for ImageMapLayer
@Apogy(hasCustomClass="true")
class ImageMapLayerUISettings extends EClassSettings
{
/*
* Name to give the ImageMapLayer.
*/
String name
/*
* Map where the ImageMapLayer is to be contained.
*/
refers Map map
/*
* Map that stores user data.
*/
HashMap<String, Object> userDataMap
}
// Wizard Provider to create ImageMapLayer
@Apogy(hasCustomClass="true")
class URLImageMapLayerWizardPagesProvider extends NamedDescribedWizardPagesProvider
{
}
// Wizard Support for MapLayerPresentation
class MapLayerPresentationUISettings extends EClassSettings
{
String name
refers CartesianTriangularMeshMapLayer cartesianTriangularMeshMapLayer
refers ImageMapLayer imageMapLayer
refers ImageMapLayerPresentation imageMapLayerPresentation
}
// Wizard Provider to create ImageMapLayerPresentation
@Apogy(hasCustomClass="true")
class ImageMapLayerPresentationWizardPagesProvider extends NamedDescribedWizardPagesProvider
{
}
// Wizard Provider to create CartesianTriangularMeshDerivedImageMapLayer
@Apogy(hasCustomClass="true")
class CartesianTriangularMeshDerivedImageMapLayerWizardPagesProvider extends NamedDescribedWizardPagesProvider
{
}
// Wizard Provider to create CartesianTriangularMeshSlopeImageMapLayer
@Apogy(hasCustomClass="true")
class CartesianTriangularMeshSlopeImageMapLayerWizardPagesProvider extends CartesianTriangularMeshDerivedImageMapLayerWizardPagesProvider
{
}
// Wizard Provider to create CartesianTriangularMeshDiscreteSlopeImageMapLayer
@Apogy(hasCustomClass="true")
class CartesianTriangularMeshDiscreteSlopeImageMapLayerWizardPagesProvider extends CartesianTriangularMeshDerivedImageMapLayerWizardPagesProvider
{
}
// Wizard Provider to create CartesianTriangularMeshHeightImageMapLayer
@Apogy(hasCustomClass="true")
class CartesianTriangularMeshHeightImageMapLayerWizardPagesProvider extends CartesianTriangularMeshDerivedImageMapLayerWizardPagesProvider
{
}
// Wizard Provider to create LineOfSightImageMapLayer
@Apogy(hasCustomClass="true")
class FixedPositionLineOfSightImageMapLayerWizardPagesProvider extends CartesianTriangularMeshDerivedImageMapLayerWizardPagesProvider
{
}
// Wizard support to create EllipseShapeImageLayer
@Apogy(hasCustomClass="true")
class EllipseShapeImageLayerWizardPagesProvider extends NamedDescribedWizardPagesProvider
{
}
// Wizard support to create RectangleShapeImageLayer
@Apogy(hasCustomClass="true")
class RectangleShapeImageLayerWizardPagesProvider extends NamedDescribedWizardPagesProvider
{
}
// Wizard support to create CartesianCoordinatesPolygonShapeImageMapLayer
@Apogy(hasCustomClass="true")
class CartesianCoordinatesPolygonShapeImageMapLayerWizardPagesProvider extends NamedDescribedWizardPagesProvider
{
}
// Wizard support to create FeaturesOfInterestMapLayer.
@Apogy(hasCustomClass="true")
class FeaturesOfInterestMapLayerWizardPagesProvider extends NamedDescribedWizardPagesProvider
{
}
// Wizard Support for TopologyTreeMapLayer
@Apogy(hasCustomClass="true")
class TopologyTreeMapLayerWizardPagesProvider extends NamedDescribedWizardPagesProvider
{
}