blob: 512872504f180fcd3633e52c5032c790b4490c9d [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
// Sebastien Gemme
//
// SPDX-License-Identifier: EPL-1.0
// *****************************************************************************
@GenModel(prefix="ApogyCommonTopologyUI",
childCreationExtenders="true",
extensibleProviderFactory="true",
multipleEditorPages="false",
suppressGenModelAnnotations="false",
dynamicTemplates="true",
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,
Sebastien Gemme
SPDX-License-Identifier: EPL-1.0
*******************************************************************************",
modelName="ApogyCommonTopologyUI",
complianceLevel="8.0")
@GenModel(dynamicTemplates="true", templateDirectory="platform:/plugin/org.eclipse.apogy.common.emf.codegen/templates")
@GenModel(modelDirectory="/org.eclipse.apogy.common.topology.ui/src-gen")
@GenModel(editDirectory="/org.eclipse.apogy.common.topology.ui.edit/src-gen")
package org.eclipse.apogy.common.topology.ui
import org.eclipse.apogy.common.emf.ui.WizardPagesProvider
import org.eclipse.apogy.common.math.Tuple3d
import org.eclipse.apogy.common.topology.Node
import org.eclipse.apogy.common.Apogy
// Types
type List<T> wraps java.util.List
type RGB wraps org.eclipse.swt.graphics.RGB
type Point3d wraps javax.vecmath.Point3d
type Vector3f wraps javax.vecmath.Vector3f
type SceneObject wraps org.eclipse.apogy.common.topology.ui.SceneObject
type Notification wraps org.eclipse.emf.common.notify.Notification
// Enums
/**
* Cast shadows modes.
*/
enum ShadowMode
{
INHERIT as "INHERIT" = 0,
OFF as "OFF" = 1,
CAST as "CAST" = 2,
RECEIVE as "RECEIVE" = 3,
CAST_AND_RECEIVE as "CAST_AND_RECEIVE" = 4
}
/**
* Mesh presentation modes.
*/
enum MeshPresentationMode
{
POINTS as "POINTS" = 0,
SURFACE as "SURFACE" = 1,
WIREFRAME as "WIREFRAME" = 2
}
/**
* The registry of all NodePresentation. This class is intended to be a singleton.
* It associates at most one NodePresentation to each Node. It registers to
*/
@Apogy(hasCustomClass="true")
class TopologyPresentationRegistry
{
/**
* The list of TopologyPresentationSet managed by the TopologyPresentationRegistry.
*/
contains TopologyPresentationSet[0..*] topologyPresentationSetList opposite topologyPresentationRegistry
/**
* The list of NodePresentation managed by this PresentationTopology.
*/
contains NodePresentation[0..*] nodePresentationList
/**
* Creates a TopologyPresentationSet from a specified topologyRoot.
* @param topologyRoot The node at the root of the topology.
* @return The TopologyPresentationSet.
*/
op TopologyPresentationSet createTopologyPresentationSet(Node topologyRoot)
/**
* Release a TopologyPresentationSet no longer needed.
* @param topologyPresentationSet The TopologyPresentationSet to release.
*/
op void release(TopologyPresentationSet topologyPresentationSet)
/**
* Returns the NodePresentation associated with a specified Node.
* @param node The specified Node.
* @return The NodePresentation associated with specified Node, null if none is found.
*/
op NodePresentation getPresentationNode(Node node)
}
/**
* A class used to keep a the relationship between a given topology and its associated TopologyPresentationSet.
*/
@Apogy(hasCustomClass="true")
class GraphicsContext
{
/**
* The root of the topology.
*/
refers Node topology
/**
* The TopologyPresentationSet associated with the root of the topology.
*/
refers TopologyPresentationSet topologyPresentationSet opposite graphicsContext
/**
* Dispose of this GraphicsContext.
*/
op void dispose()
}
/**
* Class that represent the result of a selection in a topology.
*/
@Apogy(hasCustomClass="true")
class NodeSelection
{
/**
* The TopologyPresentationSet associated with the selected Node.
*/
refers transient TopologyPresentationSet topologyPresentationSet
/**
* The Node selected.
*/
refers transient Node selectedNode
/**
* The NodePresentation associated with the selected Node.
*/
refers transient NodePresentation nodePresentation
/**
* The position of the selected point relative to the selected Node frame of reference.
*/
Point3d relativeIntersectionPoint
/**
* The absolute position of the selected point.
*/
Point3d absoluteIntersectionPoint
/**
* The normal at the selected point in the selected Node frame of reference.
*/
Vector3f relativeIntersectionNormal
/**
* The absolute normal at the selected point.
*/
Vector3f absoluteIntersectionNormal
}
/**
* Container of all the NodePresentation associated with the Nodes in a topology tree.
*/
@Apogy(hasCustomClass="true")
class TopologyPresentationSet
{
/**
* The TopologyPresentationRegistry containing this TopologyPresentationSet.
*/
refers TopologyPresentationRegistry topologyPresentationRegistry opposite topologyPresentationSetList
/**
* The GraphicsContext containing this PresentationTopology.
*/
refers GraphicsContext graphicsContext opposite topologyPresentationSet
/**
* The list of NodePresentation managed by this PresentationTopology.
*/
refers NodePresentation[0..*] nodePresentationList opposite topologyPresentationSet
/**
* Returns the NodePresentation associated with a specified Node.
* @param node The specified Node.
* @return The NodePresentation associated with specified Node, null if none is found.
*/
op NodePresentation getPresentationNode(Node node)
/**
* Returns the list of Nodes managed by this PresentationTopology.
* @return The list of Nodes. Never null.
*/
op List<Node> getNodes()
}
/**
* Represents a Node 3D representation attributes.
*/
@Apogy(hasCustomClass="true")
class NodePresentation
{
/**
* The list of TopologyPresentationSet referring to this NodePresentation.
*/
@GenModel(notify="false", property="None", children="false")
refers TopologyPresentationSet[0..*] topologyPresentationSet opposite nodePresentationList
/**
* The Node for which the presentation is defined.
*/
@GenModel(notify="true", property="None", propertyCategory="PRESENTATION_INTERNAL_INFORMATION")
refers Node node
/**
* The color to use for the Node 3D representation.
*/
@GenModel(notify="true", property="Editable", propertyCategory="VISUAL_INFORMATION")
RGB color
/**
* Whether or not the Node 3D representation should be shown. Note that all children of the node will also be affected.
*/
@GenModel(notify="true", property="Editable", propertyCategory="VISUAL_INFORMATION")
boolean visible = "true"
/**
* Whether or not the Node 3D representation should be shown as selected in the 3D viewer.
*/
@GenModel(notify="true", property="Editable", propertyCategory="VISUAL_INFORMATION")
boolean selected = "false"
/**
* The shadow mode applicable for the Node 3D representation.
*/
@GenModel(notify="true", property="Editable", propertyCategory="VISUAL_INFORMATION", children="false")
ShadowMode shadowMode
/**
* Whether or not the Node 3D representation bounds should be used when computing the bound of the 3D scene.
*/
@GenModel(notify="true", property="Readonly", propertyCategory="BOUNDING_VOLUME_INFORMATION", children="false")
boolean useInBoundingCalculation = "true"
/**
* Whether or not to display the Node ID.
*/
@GenModel(notify="true", property="Editable", propertyCategory="VISUAL_INFORMATION")
boolean IdVisible = "false"
/**
* Whether or not texture can be projected onto this object.
*/
@GenModel(notify="true", property="Readonly", propertyCategory="BOUNDING_VOLUME_INFORMATION", children="false")
boolean enableTextureProjection = "false"
/**
* The coordinates of the centroid of the Node 3D representation.
*/
@GenModel(notify="true", property="Readonly", propertyCategory="BOUNDING_VOLUME_INFORMATION")
refers derived volatile transient readonly Tuple3d centroid
/**
* The minimum coordinates of the bounding box of the Node 3D representation.
*/
@GenModel(notify="true", property="Readonly", propertyCategory="BOUNDING_VOLUME_INFORMATION")
refers derived volatile transient readonly Tuple3d min
/**
* The maximum coordinates of the bounding box of the Node 3D representation.
*/
@GenModel(notify="true", property="Readonly", propertyCategory="BOUNDING_VOLUME_INFORMATION")
refers derived volatile transient readonly Tuple3d max
/**
* The extends of the bounding box along the X axis of the Node, in meters.
*/
@GenModel(notify="true", property="Readonly")
@Apogy(units="m")
derived volatile transient readonly double xRange
/**
* The extends of the bounding box along the Y axis of the Node, in meters.
*/
@GenModel(notify="true", property="Readonly")
@Apogy(units="m")
derived volatile transient readonly double yRange
/**
* The extends of the bounding box along the Z axis of the Node, in meters.
*/
@GenModel(notify="true", property="Readonly")
@Apogy(units="m")
derived volatile transient readonly double zRange
/**
* The Scene Object representing the Node in the 3D scene.
*/
@GenModel(notify="true", property="None", children="false")
transient SceneObject sceneObject
}
/**
* NodePresentation for TransformNode.
*/
@Apogy(hasCustomClass="true")
class TransformNodePresentation extends NodePresentation
{
/**
* Whether or not to show the axes of the reference frame.
*/
@GenModel(notify="true", property="Editable", propertyCategory="VISUAL_INFORMATION")
boolean axisVisible = "false"
/**
* The length of the axis.
*/
@GenModel(notify="true", property="Editable")
@Apogy(units="m")
double axisLength = "1.0"
}
/**
* NodePresentation for RotationNode.
*/
@Apogy(hasCustomClass="true")
class RotationNodePresentation extends NodePresentation
{
/**
* Whether or not to show the axes of the reference frame.
*/
@GenModel(notify="true", property="Editable", propertyCategory="VISUAL_INFORMATION")
boolean axisVisible = "false"
/**
* The length of the axis.
*/
@GenModel(notify="true", property="Editable", propertyCategory="VISUAL_INFORMATION")
@Apogy(units="m")
double axisLength = "1.0"
}
/**
* NodePresentation for PositionNode.
*/
@Apogy(hasCustomClass="true")
class PositionNodePresentation extends NodePresentation
{
/**
* Whether or not to show the axes of the reference frame.
*/
@GenModel(notify="true", property="Editable", propertyCategory="VISUAL_INFORMATION")
boolean axisVisible = "false"
/**
* The length of the axis.
*/
@GenModel(notify="true", property="Editable", propertyCategory="VISUAL_INFORMATION")
@Apogy(units="m")
double axisLength = "1.0"
}
/**
* NodePresentation for URLNode.
*/
@Apogy(hasCustomClass="true")
class URLNodePresentation extends NodePresentation
{
/**
* Whether or not to show the axes of the reference frame.
*/
@GenModel(notify="true", property="Editable", propertyCategory="VISUAL_INFORMATION")
boolean axisVisible = "false"
/**
* The length of the axis.
*/
@GenModel(notify="true", property="Editable", propertyCategory="VISUAL_INFORMATION")
@Apogy(units="m")
double axisLength = "1.0"
/**
* The mesh presentation mode.
*/
@GenModel(notify="true", property="Editable", propertyCategory="VISUAL_INFORMATION")
MeshPresentationMode presentationMode = "SURFACE"
}
/**
* Facade for Topology UI.
*/
@Apogy(isSingleton="true", hasCustomClass="true")
class ApogyCommonTopologyUIFacade
{
/**
* Creates a GraphicsContext for a given topology tree.
* @param topologyRoot The root node of the topology.
* @return The GraphicsContext.
*/
op GraphicsContext createGraphicsContext(Node topologyRoot)
/**
* Finds the bounding box for a given topology tree.
* @param root The root node of the topology.
* @param topologyPresentationSet The presentation set containing all the nodes presentations for the topology tree.
* @param min The coordinates where the minimum values of the bounding box will be written to.
* @param max The coordinates where the maximum values of the bounding box will be written to.
*/
op void findExtent(Node root, TopologyPresentationSet topologyPresentationSet, Tuple3d min, Tuple3d max)
/**
* Creates a NodeSelection from the selected point relative position.
* @param topologyPresentationSet The TopologyPresentationSet containing the node presentation for the selected node.
* @param nodePresentation The NodePresentation for the selected Node.
* @param relativePosition The relative position of the selected point.
* @return The NodeSelection.
*/
op NodeSelection createNodeSelection(TopologyPresentationSet topologyPresentationSet, NodePresentation nodePresentation, Point3d relativePosition)
/**
* Creates a NodeSelection from the selected point relative position and normal.
* @param topologyPresentationSet The TopologyPresentationSet containing the node presentation for the selected node.
* @param node The selected Node.
* @param relativePosition The relative position of the selected point.
* @param relativeNormal The relative normal at the selected point.
* @return The NodeSelection.
*/
op NodeSelection createNodeSelection(TopologyPresentationSet topologyPresentationSet, Node node, Point3d relativePosition, Vector3f relativeNormal)
}
/**
* Wizard support for Node.
*/
@Apogy(hasCustomClass="true")
class NodeWizardPagesProvider extends WizardPagesProvider
{
}
/*
* Wizard support for PositionNode.
*/
@Apogy(hasCustomClass="true")
class PositionNodeWizardPagesProvider extends NodeWizardPagesProvider
{
}
/*
* Wizard support for RotationNode.
*/
@Apogy(hasCustomClass="true")
class RotationNodeWizardPagesProvider extends NodeWizardPagesProvider
{
}
/**
* Wizard support for TransformNode
*/
@Apogy(hasCustomClass="true")
class TransformNodeWizardPagesProvider extends NodeWizardPagesProvider
{
}
/*
* Wizard support for URLNode.
*/
@Apogy(hasCustomClass="true")
class URLNodeWizardPagesProvider extends NodeWizardPagesProvider
{
}
/*
* Base Wizard support for AbstractViewPoint.
*/
@Apogy(hasCustomClass="true")
class AbstractViewPointPagesProvider extends WizardPagesProvider
{
}
/*
* Wizard support for ArbitraryViewPoint.
*/
@Apogy(hasCustomClass="true")
class ArbitraryViewPointPagesProvider extends AbstractViewPointPagesProvider
{
}