| // ***************************************************************************** |
| // 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="ApogyCommonTopologyAddonsPrimitives", |
| 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 |
| Sebastien Gemme |
| |
| SPDX-License-Identifier: EPL-1.0 |
| *******************************************************************************", |
| modelName="ApogyCommonTopologyAddonsPrimitives", |
| suppressGenModelAnnotations="false", |
| dynamicTemplates="true", |
| templateDirectory="platform:/plugin/org.eclipse.apogy.common.emf.codegen/templates") |
| @GenModel(modelDirectory="/org.eclipse.apogy.common.topology.addons.primitives/src-gen") |
| @GenModel(editDirectory="/org.eclipse.apogy.common.topology.addons.primitives.edit/src-gen") |
| |
| package org.eclipse.apogy.common.topology.addons.primitives |
| |
| import org.eclipse.emf.ecore.EClass |
| import org.eclipse.apogy.common.topology.Node |
| import org.eclipse.apogy.common.topology.Leaf |
| import org.eclipse.apogy.common.topology.AggregateGroupNode |
| import org.eclipse.apogy.common.math.Tuple3d |
| import org.eclipse.apogy.common.Apogy |
| |
| type Point3d wraps javax.vecmath.Point3d |
| type Vector3d wraps javax.vecmath.Vector3d |
| |
| /** |
| * Node that defines a vector by its length and rotation angles. When all rotation are zero, the vector points along the X-Axis. |
| */ |
| @Apogy(hasCustomClass="true", hasCustomItemProvider="true") |
| class Vector extends Node |
| { |
| contains Tuple3d coordinates |
| |
| @Apogy(units="m") |
| derived transient readonly volatile double currentLength |
| |
| /** |
| * Changes the length of the vector. |
| */ |
| op void setLength(@Apogy(units="m") double length) |
| } |
| |
| /** |
| * A Vector than support intersections. |
| */ |
| @Apogy(hasCustomClass="true") |
| class PickVector extends Vector |
| { |
| /* |
| * The current shortest intersection distance between |
| * the ray and a node of one of the included type. |
| */ |
| @Apogy(units="m") |
| double intersectionDistance = "-1.0" |
| |
| /** |
| * The node to which the intersected geometry belongs. |
| */ |
| refers Node intersectedNode |
| |
| Point3d relativeIntersectionPosition |
| |
| Point3d absoluteIntersectionPosition |
| |
| refers EClass [0..*] nodeTypesInIntersection |
| |
| refers EClass [0..*] nodeTypesToExcludeFromIntersection |
| |
| /* |
| * Returns whether or not the specified node should be considered when processing intersection. |
| */ |
| op boolean isNodeIncludedInIntersection(Node node) |
| } |
| |
| /** |
| * A plane. |
| */ |
| class Plane extends Node |
| { |
| contains Tuple3d v0 |
| |
| contains Tuple3d v1 |
| |
| double width |
| |
| double height |
| } |
| |
| class WayPoint extends AggregateGroupNode |
| { |
| } |
| |
| class Label extends Node |
| { |
| |
| } |
| |
| /** |
| * A sphere. |
| */ |
| class SpherePrimitive extends AggregateGroupNode |
| { |
| /** |
| * The radius of the sphere. |
| */ |
| @Apogy(units="m") |
| double radius |
| } |
| |
| /** |
| * Base class of all lights. |
| */ |
| @Apogy(hasCustomItemProvider="true") |
| abstract class Light extends Leaf |
| { |
| /** |
| * Whether or not the light in enabled. |
| */ |
| boolean enabled = "false" |
| |
| /** |
| * The color of the light. |
| */ |
| contains Tuple3d color |
| } |
| |
| /** |
| * A light that illuminates all object uniformly. |
| */ |
| class AmbientLight extends Light |
| { |
| } |
| |
| /** |
| * The DirectionalLight object specifies a light source that shines in along a given direction. |
| */ |
| class DirectionalLight extends Light |
| { |
| /** |
| * The direction vector of the light. |
| */ |
| contains Tuple3d direction |
| } |
| |
| /** |
| * The PointLight object specifies an attenuated light source at a fixed point in space that radiates light equally in all directions away from the light source. |
| */ |
| class PointLight extends Light |
| { |
| /** |
| * The radius beyond which the light is attenuated. |
| */ |
| @Apogy(units="m") |
| float radius = "10.0" |
| } |
| |
| |
| /** |
| * Represents a spot light. A spot light emits a cone of light from a position and along the +Z axis direction. It can be used to fake torch lights or car's lights. |
| */ |
| @Apogy(hasCustomItemProvider="true") |
| class SpotLight extends Light |
| { |
| /** |
| * The range beyond which the light is attenuated. |
| */ |
| @Apogy(units="m") |
| float spotRange = "10.0" |
| |
| /** |
| * The light cone spread angle. |
| */ |
| @Apogy(units="rad") |
| float spreadAngle = "0.52" |
| } |
| |
| @Apogy(isSingleton="true", hasCustomClass="true") |
| class ApogyCommonTopologyAddonsPrimitivesFacade |
| { |
| op Vector createVector(Vector vector) |
| |
| op Vector createVector(Point3d p0, Point3d p1) |
| |
| op Vector createVector(double x, double y, double z) |
| |
| op Plane createPlane(Vector3d v0, Vector3d v1, double width, double height) |
| |
| op AmbientLight createAmbientLight(Tuple3d color) |
| |
| op AmbientLight createAmbientLight(boolean lightOn, Tuple3d color) |
| |
| op DirectionalLight createDirectionalLight(Tuple3d color, Tuple3d direction) |
| |
| op DirectionalLight createDirectionalLight(boolean lightOn, Tuple3d color, Tuple3d direction) |
| |
| op PointLight createPointLight(Tuple3d color) |
| |
| op PointLight createPointLight(Tuple3d color, float radius) |
| |
| op SpotLight createSpotLight(Tuple3d color, float spreadAngle, float spotRange) |
| } |