PointGenerator Module

Module Contents

template<typename Point_T>
class PointGenerator

Point Generator for terrestrial points The is a basic point generator used as a base for all others. It will just keep incrementing points for a stationary object forever. Each call to next will increment the timestamp of the returned point by the set interval

Public Types

using PointT = Point_T
using DurationT = tracktable::Duration

Public Functions

inline PointGenerator()

Instantiate an empty point generator

inline PointGenerator(const PointT &_position)

Sets the initial point to _position

Parameters:

_position[in] Initial point to use, including all metadata

inline PointGenerator(const PointT &_position, const DurationT &_interval)

Sets the initial point to _position, and the time interval to _interval

Parameters:
  • _position[in] Initial point to use

  • _interval[in] Interval to increase timestamp by

inline virtual ~PointGenerator()
inline virtual PointT next()

Updates position and returns a point

Returns:

new point

inline DurationT getInterval() const

Retrieve the interval of the points in the generator

Returns:

Interval of the points

inline void setInterval(const DurationT &_interval)

Set the interval of the points

inline std::string getObjectId() const

Retrieve the object ID at the given position

Returns:

ID of the object

inline void setObjectId(const std::string &_id)

Set the object at a given position

Protected Attributes

DurationT interval

Update Interval.

size_t count = 0

Count of points generated.

PointT position

Last point generated.

class ConstantSpeedPointGenerator : public tracktable::PointGenerator<tracktable::domain::terrestrial::trajectory_type::point_type>

Generates points based on a heading and speed each point is calculated based on the last point

Subclassed by tracktable::CircularPointGenerator, tracktable::GridPointGenerator

Public Types

using DurationT = BaseType::DurationT
using PointT = BaseType::PointT

Public Functions

inline ConstantSpeedPointGenerator()

Instantiate an empty constant speed point generator

inline ConstantSpeedPointGenerator(const PointT &_position)

Sets the initial point to _position

Parameters:

_position[in] Initial point to use, including all metadata

inline ConstantSpeedPointGenerator(const PointT &_position, const DurationT &_interval)

Sets the initial point to _position, and the time interval to _interval

Parameters:
  • _position[in] Initial point to use

  • _interval[in] Interval to increase timestamp by

inline ConstantSpeedPointGenerator(const PointT &_position, const DurationT &_interval, const double &_speed, const double &_heading)

Sets the initial speed to _speed, and the heading to _heading

Parameters:
  • _position[in] Initial point to use

  • _interval[in] Interval to increase timestamp by

  • _speed[in] Initial speed to use

  • _heading[in] Initial heading to use

inline virtual PointT next() override

Updates position and returns a point

Returns:

new point

inline double getSpeed() const

Retrieve the spped of the points in the generator

Returns:

Speed of the points

inline void setSpeed(const double &_speed)

Set the speed of the points

inline double getHeading() const

Retrieve the heading of the points in the generator

Returns:

Heading of the points

inline void setHeading(const double &_heading)

Set the heading of the points

Public Static Functions

static inline PointT reckon(PointT _origin, double _distance, double _heading)

Calculates a new lat/lon based on a point, distance, and direction method is trig based, centered around transforms back and forth to cartesian.

Parameters:
  • _origin[in] The (lon, lat) starting point

  • _distance[in] The distance, in meters, traveled

  • _heading[in] The compass heading to travel in degrees

Returns:

PointT The final destination

static inline PointT reckon2(const PointT &_origin, const double &_speed, const double &_heading, const DurationT &_dt)

Calculates a new lat/lon based on an initial point, speed, heading, and duration. uses spherical coordinates and angular velocities.

Parameters:
  • _origin[in] Start location (lon, lat)

  • _speed[in] Speed traveled (meters/second)

  • _heading[in] Compass heading to travel (degrees)

  • _dt[in] Duration of travel

Returns:

PointT resulting point

Protected Types

using ThisType = ConstantSpeedPointGenerator
using BaseType = PointGenerator<tracktable::domain::terrestrial::trajectory_type::point_type>

Private Members

double speed = 44.704

~100Mi/h in m/s

double heading = 0.0

North.

class CircularPointGenerator : public tracktable::ConstantSpeedPointGenerator

Generates points based on a turn rate each point is calculated based on the last point

Public Types

using DurationT = BaseType::DurationT
using PointT = BaseType::PointT

Public Functions

inline CircularPointGenerator()

Instantiate an empty circular point generator

inline CircularPointGenerator(const PointT &_position)

Sets the initial point to _position

Parameters:

_position[in] Initial point to use, including all metadata

inline CircularPointGenerator(const PointT &_position, const DurationT &_interval)

Sets the initial point to _position, and the time interval to _interval

Parameters:
  • _position[in] Initial point to use

  • _interval[in] Interval to increase timestamp by

inline CircularPointGenerator(const PointT &_position, const DurationT &_interval, const double &_speed, const double &_heading)

Sets the initial speed to _speed, and the heading to _heading

Parameters:
  • _position[in] Initial point to use

  • _interval[in] Interval to increase timestamp by

  • _speed[in] Initial speed to use

  • _heading[in] Initial heading to use

inline CircularPointGenerator(const PointT &_position, const DurationT &_interval, const double &_speed, const double &_heading, const double &_turnRate)

Sets the initial turn rate to _turnRate

Parameters:
  • _position[in] Initial point to use

  • _interval[in] Interval to increase timestamp by

  • _speed[in] Initial speed to use

  • _heading[in] Initial heading to use

  • _turnRate[in] Initial turn rate to use

inline virtual PointT next() override

Updates position and returns a point

Returns:

new point

inline double getTurnRate() const

Retrieve the turn rate of the points in the generator

Returns:

Turn rate of the points

inline void setTurnRate(const double &_rate)

Set the heading of the points

Protected Types

using ThisType = CircularPointGenerator
using BaseType = ConstantSpeedPointGenerator

Private Members

double turnRate = .6

deg/s == circle per 10 min

class GridPointGenerator : public tracktable::ConstantSpeedPointGenerator

Generator for generating boxes, snakes, or anything else on a grid

Take a length vector that tell how long each side is. if the length is negative, then it will turn left afterwards, otherwise it will turn right

Use a length vector of {10} to create a box with 10 points on each side. Use a length vector of {10,2,-10,-2} to create a mapping flight

Public Types

using DurationT = BaseType::DurationT
using PointT = BaseType::PointT

Public Functions

inline GridPointGenerator()

Instantiate an empty grid point generator

inline GridPointGenerator(const PointT &_position)

Sets the initial point to _position

Parameters:

_position[in] Initial point to use, including all metadata

inline GridPointGenerator(const PointT &_position, const DurationT &_interval)

Sets the initial point to _position, and the time interval to _interval

Parameters:
  • _position[in] Initial point to use

  • _interval[in] Interval to increase timestamp by

inline GridPointGenerator(const PointT &_position, const DurationT &_interval, const double &_speed, const double &_heading)

Sets the initial speed to _speed, and the heading to _heading

Parameters:
  • _position[in] Initial point to use

  • _interval[in] Interval to increase timestamp by

  • _speed[in] Initial speed to use

  • _heading[in] Initial heading to use

inline GridPointGenerator(const PointT &_position, const DurationT &_interval, const double &_speed, const double &_heading, std::vector<int> _lengths)

Sets the initial lengths rate to _lengths

Parameters:
  • _position[in] Initial point to use

  • _interval[in] Interval to increase timestamp by

  • _speed[in] Initial speed to use

  • _heading[in] Initial heading to use

  • _lengths[in] Initial length to use

inline virtual PointT next() override

Updates position and returns the new position

Returns:

new position

inline double getTurnRate() const

Retrieve the turn rate of the points in the generator

Returns:

Turn rate of the points

inline void setTurnRate(const double &_rate)

Set the heading of the points

Protected Types

using ThisType = GridPointGenerator
using BaseType = ConstantSpeedPointGenerator

Private Members

size_t current = 0
size_t gridCount = 0
double turnRate = .6
std::vector<int> lengths = {10}

deg/s == circle per 10 min

template<typename Point_T>
class MultipleGeneratorCollator

The collator lets you put together multiple generators and create a stream of points that is in chronological order.

  • Use addGenerator() to add generators.

  • Use generate(COUNT) to generate COUNT points for each generator and sort them.

  • Use next() to access each point as they come out.

Subsequent calls to generate will have the new points sorted into the list, but there are no rule that the next point is after any points retrieved prior to the call

Public Functions

inline void addGenerator(std::shared_ptr<PointGenerator<PointT>> _generator)

Add a generator to the list of generators

inline size_t getGeneratorCount() const

Retrieve the number of created generators

Returns:

The numbers of generators

inline PointT next()

Updates position and returns a point

Returns:

new point

inline void generate()

Generate a generator with 10 points

inline void generate(const size_t _count)

Generate a generator with n points

Parameters:

_count[in] Number of points to create generator with

Private Types

using PointT = Point_T

Private Members

std::vector<std::shared_ptr<PointGenerator<PointT>>> generators
std::vector<PointT> points