blob: 5f21f6cdb64f7024e08e5e423e43a84c69d69ace [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="ApogyCommonGeometryData3DLAS",
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="ApogyCommonGeometryData3DLAS",
suppressGenModelAnnotations="false")
@GenModel(dynamicTemplates="true", templateDirectory="platform:/plugin/org.eclipse.apogy.common.emf.codegen/templates")
@GenModel(modelDirectory="/org.eclipse.apogy.common.geometry.data3d.las/src-gen")
@GenModel(editDirectory="/org.eclipse.apogy.common.geometry.data3d.las.edit/src-gen")
package org.eclipse.apogy.common.geometry.data3d.las
import org.eclipse.emf.ecore.EByteArray
import org.eclipse.apogy.common.Apogy
// Types
type IProgressMonitor wraps org.eclipse.core.runtime.IProgressMonitor
type CharArray wraps char[]
type LongArray wraps long[]
type InputStream wraps java.io.InputStream
type IOException wraps java.io.IOException
type OutputStream wraps java.io.OutputStream
type Exception wraps Exception
/**
* Represents a LAS (Laser File Format) header.
*/
class LASHeader
{
/**
* The file signature.
*/
String fileSignature
/**
* File source ID.
*/
int fileSourceID
/**
* File gloabal encoding.
*/
int globalEncoding
long projectID_GUID_data_1
int projectID_GUID_data_2
int projectID_GUID_data_3
EByteArray projectID_GUID_data_4
int versionMajor
int versionMinor
String systemIdentifier
String generatingSoftware
int fileCreationDayOfYear
int fileCreationYear
int headerSize
long offsetToPointData
long nVariableLengthRecords
int pointDataFormatID
int pointDataRecordLength
/**
* Number of point in the file.
*/
long numberOfPointRecords
/**
* Number of point per return.
*/
LongArray numberOfPointsByReturn
/**
* Scaling factor along the X Axis.
*/
@Apogy(units="m")
double xScaleFactor
/**
* Scaling factor along the Y Axis.
*/
@Apogy(units="m")
double yScaleFactor
/**
* Scaling factor along the Z Axis.
*/
@Apogy(units="m")
double zScaleFactor
/**
* Offset distance along X.
*/
@Apogy(units="m")
double xOffset
/**
* Offset distance along Y.
*/
@Apogy(units="m")
double yOffset
/**
* Offset distance along Z.
*/
@Apogy(units="m")
double zOffset
/**
* Maximum coordinates along X found in the data set.
*/
@Apogy(units="m")
double maxX
/**
* Minimum coordinates along X found in the data set.
*/
@Apogy(units="m")
double minX
/**
* Maximum coordinates along Y found in the data set.
*/
@Apogy(units="m")
double maxY
/**
* Minimum coordinates along Y found in the data set.
*/
@Apogy(units="m")
double minY
/**
* Maximum coordinates along Z found in the data set.
*/
@Apogy(units="m")
double maxZ
/**
* Minimum coordinates along Z found in the data set.
*/
@Apogy(units="m")
double minZ
long startOfWaveformDataPacketRecord
}
class VariableLengthRecord
{
int reserved
String userID
int recordID
int recordLengthAfterHeader
String description
}
/**
* LAS Reader used to read LAS Point from a file.
*/
@Apogy(hasCustomClass="true")
class LASReader
{
/**
* Path to the file to read the data from.
*/
String file
/**
* Input stream used to read to file.
*/
transient InputStream inputStream
refers transient VariableLengthRecord[] vlrs
/**
* Progress monitor used to monitor the progress of the read.
*/
transient IProgressMonitor progressMonitor
/**
* Header read from the file.
*/
refers transient LASHeader header
/**
* LAS points read from the file.
*/
refers transient LASPoint[] points
/**
* Reads the data from the file. Attributes will be populated with the data read.
* @throws An exception if the read fails.
*/
op void read() throws IOException
}
/**
* Defines a point (laser return) in LAS format.
*/
class LASPoint
{
/**
* Distance along X, in counts.
*/
long x
/**
* Distance along Y, in counts.
*/
long y
/**
* Distance along Z, in counts.
*/
long z
int intensity
/**
* The return number of this point.
*/
byte returnNumber
/**
* Total number of returns acquired.
*/
byte numberOfReturns
/**
* Direction of the scanning.
*/
ScanDirection scanDirection
/**
* Edge Of Flight Line.
*/
EdgeOfFlightLine edgeOfFlightLine
/**
* Classification
*/
short classification
/**
* Scan Angle Rank.
*/
byte scanAngleRank
/**
* User defined data.
*/
short userData
/**
* Point source ID.
*/
int pointSourceId
/**
* GPS time.
*/
double gpsTime
/**
* Return color red component.
*/
int red
/**
* Return color green component.
*/
int green
/**
* Return color blue component.
*/
int blue
}
/**
* Scan direction.
*/
enum ScanDirection
{
NEGATIVE = 0
POSITIVE = 1
}
/**
* Edge of Flight Line.
*/
enum EdgeOfFlightLine
{
END = 1
NOT_END = 0
}
/**
* LAS Facade.
*/
@Apogy(isSingleton="true", hasCustomClass="true")
class ApogyCommonGeometryData3DLASFacade
{
/**
* Creates a LASPoint using a format ID and a bytes array containing the actual data.
* @param formatID The format ID.
* @param data The bytes array containing the actual data.
* @return The LASPoint.
*/
op LASPoint createPoint(int formatID , EByteArray data) throws IOException
}
/**
* LAS Writer used to write LAS Point to file.
*/
@Apogy(hasCustomClass="true")
class LASWriter
{
/**
* Path to the file to write the data to.
*/
String fileName
/**
* Progress monitor used to monitor the progress of the write.
*/
transient IProgressMonitor progressMonitor
/**
* The LAS points. The scale 'scaleX', 'scaleY', 'scaleZ' are
* applied to the x, y, z values to obtain the actual values.
*/
refers unordered transient LASPoint[] points
/**
* Scaling factor along the X Axis.
*/
@Apogy(units="m")
double scaleX = "0.01"
/**
* Scaling factor along the Y Axis.
*/
@Apogy(units="m")
double scaleY = "0.01"
/**
* Scaling factor along the Z Axis.
*/
@Apogy(units="m")
double scaleZ = "0.01"
/**
* The LAS Header to write to file.
*/
refers readonly transient LASHeader header
/**
* Offset distance along X.
*/
@Apogy(units="m")
double xOffset = "0.0"
/**
* Offset distance along Y.
*/
@Apogy(units="m")
double yOffset = "0.0"
/**
* Offset distance along Z.
*/
@Apogy(units="m")
double zOffset = "0.0"
/**
* Output stream used to write to file.
*/
OutputStream outputStream
/**
* Write the data to the file.
* @throws An exception if the write fails.
*/
op void write() throws IOException
}