blob: 4f35fdf98069e56dc1038757a1a58b384b55a4e2 [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="ApogyEarthEnvironment",
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="ApogyCoreEnvironment",
complianceLevel="8.0",
suppressGenModelAnnotations="false",
dynamicTemplates="true",
templateDirectory="platform:/plugin/org.eclipse.apogy.common.emf.codegen/templates")
@GenModel(modelDirectory="/org.eclipse.apogy.core.environment.earth/src-gen")
@GenModel(editDirectory="/org.eclipse.apogy.core.environment.earth.edit/src-gen")
package org.eclipse.apogy.core.environment.earth
import org.eclipse.apogy.common.math.Tuple3d
import org.eclipse.apogy.common.topology.Node
import org.eclipse.apogy.core.ApogySystem
import org.eclipse.apogy.core.environment.AbstractSurfaceLocation
import org.eclipse.apogy.core.environment.Worksite
import org.eclipse.apogy.common.Apogy
// Types
type List<T> wraps java.util.List
type Exception wraps java.lang.Exception
/*
* A location on Earth.
*/
@Apogy(hasCustomItemProvider="true")
class GeographicCoordinates
{
/**
* The longitude, in radians. Longitude east of Greenwich, UK are positive
* while those west of Greenwich are negative.
*/
@GenModel(propertyCategory="GEOGRAPHIC_COORDINATES")
@Apogy(units="rad")
double longitude
/**
* The latitude, in radians. Latitude north of the equator are positive while those
* south of the equator are negative.
*/
@GenModel(propertyCategory="GEOGRAPHIC_COORDINATES")
@Apogy(units="rad")
double latitude
/**
* Height above the Earth's sea level, in meters.
*/
@GenModel(propertyCategory="GEOGRAPHIC_COORDINATES")
@Apogy(units="m")
double elevation
}
/**
* Defines a location on the surface of the Earth.
*/
@Apogy(hasCustomItemProvider="true")
class EarthSurfaceLocation extends GeographicCoordinates, AbstractSurfaceLocation
{
}
/**
* The horizontal coordinate system is a celestial coordinate system that uses the
* observer's local horizon as the fundamental plane. This conveniently divides the
* sky into the upper hemisphere that you can see, and the lower hemisphere that you
* cannot (because the Earth is in the way). The pole of the upper hemisphere is called
* the zenith. The pole of the lower hemisphere is called the nadir.
*
*/
@Apogy(hasCustomItemProvider="true")
class HorizontalCoordinates
{
/**
* Sometimes referred to as elevation, that is the angle between the
* object and the observer's local horizon. Negative altitude means the
* object is below the local horizon.
*/
@Apogy(units="rad")
double altitude
/**
* The angle of the object around the horizon, measured from the
* north point towards the east.
*/
@Apogy(units="rad")
double azimuth
/**
* The distance from the observer.
*/
@Apogy(units="m")
double radius
}
/**
* The ecliptic coordinate system is a celestial coordinate system that uses the ecliptic
* for its fundamental plane. The ecliptic is the path that the sun appears to follow across
* the sky over the course of a year. It is also the projection of the Earth's orbital plane
* onto the celestial sphere. The latitudinal angle is called the ecliptic latitude or celestial
* latitude (denoted β), measured positive towards the north. The longitudinal angle is called
* the ecliptic longitude or celestial longitude (denoted λ), measured eastwards from 0° to 360°.
* Like right ascension in the equatorial coordinate system, 0° ecliptic longitude is pointing
* towards the Sun from the Earth at the Northern hemisphere vernal equinox. This choice makes
* the coordinates of the fixed stars subject to shifts due to the precession, so that always a
* reference epoch should be specified. Usually epoch J2000.0 is taken, but the instantaneous
* equinox of the day (called the epoch of date) is possible too. This coordinate system can be
* particularly useful for charting solar system objects. Most planets (except Mercury), and many
* small solar system bodies have orbits with small inclinations to the ecliptic plane, and therefore
* their ecliptic latitude β is always small. Because of the planets' small deviation from the plane
* of the ecliptic, ecliptic coordinates were used historically to compute their positions. (Aaboe 2001, 17-19)
*/
class EclipticCoordinates
{
/**
* The ecliptic longitude or celestial longitude (denoted λ), measured eastwards from 0° to 360°.
*/
@Apogy(units="rad")
double longitude
/**
* The ecliptic latitude or celestial latitude (denoted β), measured positive towards the north.
*/
@Apogy(units="rad")
double latitude
/**
* The distance from the center of the Sun.
*/
@Apogy(units="m")
double radius
}
/**
* Worksite defined for Earth
*/
abstract class EarthWorksite extends Worksite
{
/*
* The geographical coordinates of the origin of the worksite, in the WS84 datum.
*/
contains GeographicCoordinates[1] geographicalCoordinates
/**
* The current sun intensity at the surface of the worksite.
*/
@GenModel(property="Readonly")
@Apogy(units="W/m^2")
transient double sunIntensity = "0"
}
/**
* Facade for Earth Environment.
*/
@Apogy(isSingleton="true", hasCustomClass="true")
class ApogyEarthFacade
{
/**
* Refers to the active EarthWorksite. May be null.
*/
refers transient EarthWorksite activeEarthWorksite
/**
* Return a unit vector pointing toward the Moon. The vector is defined for a specified topology node within a specified ApogySystem.
* @param apogySystem The ApogySystem containing the specified Node.
* @param nodeID The ID of the specified Node.
* @return The unit vector pointing toward the Moon, defined in the specified node coordinates, null if none is found.
*/
op Tuple3d getMoonVector(ApogySystem apogySystem, String nodeID, org.eclipse.apogy.core.invocator.Environment environment)
/**
* Return a unit vector pointing toward the Moon. The vector is defined for a specified topology node.
* @param nodeID The ID of the specified Node.
* @return The unit vector pointing toward the Moon, defined in the specified node coordinates, null if none is found.
*/
op Tuple3d getMoonVector(Node node, org.eclipse.apogy.core.invocator.Environment environment)
/**
* Create a GeographicCoordinates.
* @param longitude The longitude, in radians.
* @param latitude The latitude, in radians.
* @param altitude The altitude, in meters.
*/
op GeographicCoordinates createGeographicCoordinates(double longitude, double latitude, double altitude)
/*
* Creates an EarthSurfaceLocation from parameters.
* @param name The name of the location.
* @param description The description of the location.
* @param longitude The longitude of the location, in radians.
* @param latitude The latitude of the location, in radians.
* @param elevation The elevation of the location, in meters.
* @return The EarthSurfaceLocation.
*/
op EarthSurfaceLocation createEarthSurfaceLocation(String name, String description, @Apogy(units = "rad") double longitude, @Apogy(units = "rad") double latitude, @Apogy(units = "m") double elevation)
/**
* Loads a list of GeographicCoordinates from a CSV formated file (Longitude, Latitude, Altitude). Longitude, Latitude are expected in degrees, Altitude in meters.
* @param url File URL.
* @return The list of GeographicCoordinates. Never null, but can be empty.
* @throws An exception if a probelm occures during load.
*/
op List<GeographicCoordinates> loadGeographicCoordinatesFromURL(String url) throws Exception
}