--------------------------------------------------------------------------------
-- Road Model
--
-- 		(Defined by TNO - Road Model Kernel)
-- Mar, 1994   	(Modified by Teresa Goncalves - UNINOVA)
-- Jun, 1994	(Modified by Jorge Sobrinho - UNINOVA: upgrade for cross-section
--------------------------------------------------------------------------------

-------------------- Road ------------------------------------------------------
ENTITY Road;		-- temporary 'root'-entity
	section:	LIST [1:?] OF RoadSection;
END_ENTITY;
-------------------- RoadSection -----------------------------------------------

ENTITY RoadSection;
	code		: INTEGER;
	description	: OPTIONAL STRING(30);
	axis:	LIST [1:?] OF RoadAxis;
	origin:	RoadNode;	-- anchor node
	x		: REAL;		-- anchor co-ordinates
	y		: REAL;
	z		: REAL;
		-- restrictions of angle and inclination depends on the
		-- 'eenheid' definition
	angle		: REAL;		-- horizontal, hoek in 400
	inclination	: REAL;		-- vertical, tan(hellingshoek)
	lengthOffset	: OPTIONAL LIST [1:?] OF REAL;	-- for "non-roots"
--UNIQUE
--	code;
END_ENTITY;

-------------------- RoadAxis --------------------------------------------------
ENTITY RoadAxis;
	code		: INTEGER;
	description	: OPTIONAL STRING(30);
	startNode:	RoadNode;
	endNode:	RoadNode;
	geometry:	RoadGeometry;
--UNIQUE
--	code;
END_ENTITY;

-------------------- RoadGeometry ----------------------------------------------
ENTITY RoadGeometry;
	origin		: REAL;	  -- longitudinal co-ordinate of chainage
	longGradMax	: OPTIONAL REAL;   -- max. longitudinal gradient
	alig:		Alignment;
	cross:		CrossSection;
END_ENTITY;

-------------------- CrossSection ----------------------------------------------
ENTITY CrossSection;
	sections:	LIST OF TransversalSection;
	n_original:	INTEGER; -- Number of original topographical layers
	n_asphalt:	INTEGER; -- Number of asphalt layers
	mat_original:	LIST OF STRING; -- Material name of each layer
	mat_asphalt:	LIST OF STRING; -- Material name of each asphalt layer
END_ENTITY;

ENTITY TransversalSection;
	chainage: 	REAL;		-- longitudinal co-ordinate (station, Km)
	original:	LIST OF	Layer;
	final:		Layer;
	asphalt:	LIST OF	Layer;
END_ENTITY;

ENTITY Layer;
	line:	LIST OF TransversalPoint;
	layer_type: INTEGER;	-- type of the topographical layer:
				-- 	- Original, 0
				--	- Final, 1
				--	- Asphalt, 2
END_ENTITY;

ENTITY TransversalPoint;
	offset:		REAL;	-- from road alignment, meters
	elevation:	REAL;	-- high, meters
END_ENTITY;

-------------------- Alignment -------------------------------------------------
ENTITY Alignment;
	origin		: REAL;	-- longitudinal co-ordinate of chainage
	horizlArc:	LIST [1:?] OF HorizontalArc;
	vertlArc:	LIST [1:?] OF VerticalArc;
END_ENTITY;

-------------------- HorizontalArc ---------------------------------------------
ENTITY HorizontalArc
	ABSTRACT SUPERTYPE OF (ONEOF(ClothoidH, CurveH, StraightH));
	code		: INTEGER;
	description	: OPTIONAL STRING(30);
	startNode:	TangentNodeH;
	endNode:	TangentNodeH;
--UNIQUE
--	code;
END_ENTITY;

ENTITY ClothoidH
	SUBTYPE OF (HorizontalArc);
		-- curvature = 1 / radius, positive = right, negative = left
	startCurvature	: REAL;
	endCurvature	: REAL;
END_ENTITY;

ENTITY CurveH
	SUBTYPE OF (HorizontalArc);
		-- curvature = 1 / radius, positive = right, negative = left
	curvature	: REAL;
END_ENTITY;

ENTITY StraightH
	SUBTYPE OF (HorizontalArc);
END_ENTITY;

-------------------- VerticalArc -----------------------------------------------
ENTITY VerticalArc
	ABSTRACT SUPERTYPE OF (ONEOF(CurveV, StraightV));
	code		: INTEGER;
	description	: OPTIONAL STRING(30);
	startNode:	TangentNodeV;
	endNode:	TangentNodeV;
--UNIQUE
--	code;
END_ENTITY;

ENTITY CurveV
	SUBTYPE OF (VerticalArc);
		-- curvature = 1 / radius, positive = right, negative = left
	curvature	: REAL;
END_ENTITY;

ENTITY StraightV
	SUBTYPE OF (VerticalArc);
END_ENTITY;

-------------------- TangentNode -----------------------------------------------
ENTITY TangentNode
	ABSTRACT SUPERTYPE OF (ONEOF(TangentNodeH, TangentNodeV));
	chainage	: REAL;	-- longitudinal co-ordinate
END_ENTITY;

ENTITY TangentNodeH
       SUBTYPE OF (TangentNode);
       x_coord:        REAL;   -- Easting (meters)
       y_coord:        REAL;   -- Northing (meters)
       direction:      REAL;   -- Azimuths from North (degrees)
END_ENTITY;

ENTITY TangentNodeV
       SUBTYPE OF (TangentNode);
       z_coord:        REAL;   -- Elevation (meters)
       slope:          REAL;   -- (zf - zi)/(chf - chi)
END_ENTITY;

-------------------- RoadNode --------------------------------------------------
ENTITY RoadNode;
	description	: OPTIONAL STRING (30);
	geometry:	LIST [1:?] OF RoadGeometry;
	chainage	: LIST [1:?] OF REAL;
END_ENTITY;

--------------------------------------------------------------------------------
-- Road Model
--------------------------------------------------------------------------------