ICAROUS
All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros Modules Pages
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
larcfm::GeneralPlanWriter Class Reference

#include <GeneralPlanWriter.h>

Inheritance diagram for larcfm::GeneralPlanWriter:
larcfm::ErrorReporter

Public Member Functions

 GeneralPlanWriter ()
 
void open (const std::string &filename)
 
void open (std::ostream *writer)
 
void close ()
 
bool isTrkGsVs () const
 
void setTrkGsVs (bool trkgsvs)
 
bool hasPolygons () const
 
void setPolygons (bool p)
 
int getPrecision () const
 
void setPrecision (int precision)
 
int getLatLonExtraPrecision () const
 
void setLatLonExtraPrecision (int precision)
 
bool isOutputTime () const
 
void setOutputTime (bool display_time)
 
bool isOutputUnits () const
 
void setOutputUnits (bool display_units)
 
void setColumnDelimiterTab ()
 
void setColumnDelimiterComma ()
 
void setColumnDelimiterSpace ()
 
void addComment (const std::string &comment)
 
void setParameters (const ParameterData &pr)
 
void setPolyPathMode (PolyPath::PathMode m)
 
void clearPolyPathMode ()
 
void setPolyPathParameters (const std::vector< GeneralPlan > &list)
 
void setContainmentParameter (const std::string &s)
 
void writePlan (const GeneralPlan &gp, double activation_time)
 
void writePlan (const GeneralPlan &gp)
 
void writePlan (const Plan &p, double t)
 
void writePlan (const PolyPath &p, double t)
 
void writePlan (const Plan &p)
 
void writePlan (const PolyPath &p)
 
int size () const
 
int lines () const
 
bool isLatLon () const
 
bool hasError () const
 
bool hasMessage () const
 
std::string getMessage ()
 
std::string getMessageNoClear () const
 
std::string toString () const
 

Static Public Member Functions

static void write (const std::string &filename, const std::vector< GeneralPlan > plist, const std::vector< double > activeTimes)
 
static void write (const std::string &filename, const std::vector< GeneralPlan > plist)
 

Private Attributes

ErrorLog error
 
SeparatedOutput output
 
bool latlon
 
bool trkgsvs
 
bool display_time
 
bool first_line
 
bool display_units
 
bool polygons
 
bool source
 
bool time2
 
int precision
 
int latLonExtraPrecision
 
int lines_i
 
int num
 
std::string fname
 
PolyPath::PathMode mode
 
bool modedefined
 
std::ostream * fw
 

Additional Inherited Members

Detailed Description

This object writes a set of aircraft states, possibly over time, (and parameters) from a file The Aircraft states are stored in an ArrayList<AircraftState>.

State files consist of comma or space-separated values, with one point per line. Required columns include aircraft name, 3 position columns (either x[NM]/y[NM]/z[ft] or latitude[deg]/longitude[deg]/altitude[ft]) and 3 velocity columns (either vx[knot]/vy[knot]/vz[fpm] or track[deg]/gs[knot]/vs[fpm]).

An optional column is time [s]. If it is included, a "history" will be build if an aircraft has more than one entry. If it is not included, only the last entry for an aircraft will be stored.

It is necessary to include a header line that defines the column ordering. The column definitions are not case sensitive. There is also an optional header line, immediately following the column definition, that defines the unit type for each column (the defaults are listed above).

If points are consecutive for the same aircraft, subsequent name fields may be replaced with a double quotation mark ("). The aircraft name is case sensitive, so US54A != Us54a != us54a.

Any empty line or any line starting with a hash sign (#) is ignored.

Files may also include parameter definitions prior to other data. Parameter definitions are of the form <key> = <value>, one per line, where <key> is a case-insensitive alphanumeric word and <value> is either a numeral or string. The <value> may include a unit, such as "dist = 50 [m]". Note that parameters require a space on either side of the equals sign. Note that it is possible to also update the stored parameter values (or store additional ones) through API calls.

Parameters can be interpreted as double values, strings, or Boolean values, and the user is required to know which parameter is interpreted as which type.

If the optional parameter "filetype" is specified, its value must be "state" or "history" (no quotes) for this reader to accept the file without error.

Constructor & Destructor Documentation

◆ GeneralPlanWriter()

larcfm::GeneralPlanWriter::GeneralPlanWriter ( )

Member Function Documentation

◆ addComment()

void larcfm::GeneralPlanWriter::addComment ( const std::string &  comment)

Adds a comment line to the file.

Parameters
commentcomment string

◆ clearPolyPathMode()

void larcfm::GeneralPlanWriter::clearPolyPathMode ( )

Clear any set polygon PathMode. The PathMode will default to the first written item's path mode if it is a PolyPath or MORPHING if it is not. Whatever the stored PathMode, all polygons written will be converted to that type.

Clear any set polygon PathMode. The PathMode will default to the first written item's path mode if it is a PolyPath or MORPHING if it is not. Whatever the stored PathMode, all polygons written will be converted to that type.

Parameters
m

◆ getMessage()

std::string larcfm::GeneralPlanWriter::getMessage ( )
virtual

Return a string representation of any errors or warnings. Calling this method will clear any messages and reset both the error and warning status to none.

Returns
error and warning messages. If there are no messages, an empty string is returned.

Implements larcfm::ErrorReporter.

◆ getMessageNoClear()

std::string larcfm::GeneralPlanWriter::getMessageNoClear ( ) const
virtual

Return a string representation of any errors or warnings. Calling this method will not clear the error or warning status (i.e., hasError() will return the same value before and after this call.)

Returns
error and warning messages. If there are no messages, an empty string is returned.

Implements larcfm::ErrorReporter.

◆ hasError()

bool larcfm::GeneralPlanWriter::hasError ( ) const
virtual

Does this object have an error?

Returns
true if there is an error.

Implements larcfm::ErrorReporter.

◆ hasMessage()

bool larcfm::GeneralPlanWriter::hasMessage ( ) const
virtual

Does this object have an error or a warning?

Returns
true if there is an error or warning.

Implements larcfm::ErrorReporter.

◆ isOutputTime()

bool larcfm::GeneralPlanWriter::isOutputTime ( ) const

Will the time be added to the file

Returns
true, if the time is to be output to the file

◆ isOutputUnits()

bool larcfm::GeneralPlanWriter::isOutputUnits ( ) const

Will the units be displayed?

Returns
true, if the units are to be displayed in output

◆ lines()

int larcfm::GeneralPlanWriter::lines ( ) const

Return number of lines added

Returns
number of lines

◆ open()

void larcfm::GeneralPlanWriter::open ( const std::string &  filename)

A new GeneralStateWriter based on the given file.

Parameters
filenamename of file

◆ setColumnDelimiterComma()

void larcfm::GeneralPlanWriter::setColumnDelimiterComma ( )

Sets the column delimiter to a comma. This method can only be used before the first "writeState" method.

◆ setColumnDelimiterSpace()

void larcfm::GeneralPlanWriter::setColumnDelimiterSpace ( )

Sets the column delimiter to a space. This method can only be used before the first "writeState" method.

◆ setColumnDelimiterTab()

void larcfm::GeneralPlanWriter::setColumnDelimiterTab ( )

Sets the column delimiter to a tab. This method can only be used before the first "writeState" method.

◆ setOutputTime()

void larcfm::GeneralPlanWriter::setOutputTime ( bool  display_time_)

Should the time be added to the file

Parameters
display_timetrue, if the time is to be output to the file

◆ setOutputUnits()

void larcfm::GeneralPlanWriter::setOutputUnits ( bool  display_units_)

Should the units be displayed?

Parameters
display_unitstrue, if the units are to be displayed in output

◆ setParameters()

void larcfm::GeneralPlanWriter::setParameters ( const ParameterData pr)

Set parameters. Use all the parameters in the reader.

Parameters
prparameters

◆ setPolygons()

void larcfm::GeneralPlanWriter::setPolygons ( bool  p)

Toggle extra polygon headers, true=include (default true)

Parameters
p

◆ setPolyPathMode()

void larcfm::GeneralPlanWriter::setPolyPathMode ( PolyPath::PathMode  m)

Specify a polygon PathMode. If this is not set ahead of time, this will default to the first written item's path mode if it is a PolyPath or MORPHING if it is not. Whatever the stored PathMode, all polygons written will be converted to that type.

Parameters
mpath mode

Specify a polygon PathMode. If this is not set ahead of time, this will default to the first written item's path mode if it is a PolyPath or MORPHING if it is not. Whatever the stored PathMode, all polygons written will be converted to that type.

Parameters
m

◆ setPolyPathParameters()

void larcfm::GeneralPlanWriter::setPolyPathParameters ( const std::vector< GeneralPlan > &  list)

If necessary, this must be called before the first write call

◆ size()

int larcfm::GeneralPlanWriter::size ( ) const

Return the number of states added to the file

Returns
number of states

The documentation for this class was generated from the following files: