A CurveData that contains the elevation profile of a curve. More...
#include <ElevationCurveData.h>
Public Member Functions | |
ElevationCurveData (CurveId id, CurvePtr flattenCurve, ptr< TileProducer > elevations, bool monotonic) | |
Creates a new ElevationCurveData. | |
virtual | ~ElevationCurveData () |
Deletes this ElevationCurveData. | |
virtual float | getStartHeight () |
Returns the height of the starting point of the curve. | |
virtual float | getEndHeight () |
Returns the height of the ending point of the curve. | |
virtual float | getAltitude (float s) |
Returns the height corresponding to the given s coordinate. | |
virtual float | getSampleLength (CurvePtr c) |
Returns the distance to be used between samples for the elevation profile of the given curve. | |
virtual int | getSmoothFactor (CurvePtr c) |
Returns the smoothing factor to get the smoothed elevation profile for the given curve. | |
virtual void | getUsedTiles (set< TileCache::Tile::Id > &tiles, float rootSampleLength) |
Returns the list of tiles intersected by the curve with which this ElevationCurveData is associated. | |
Protected Member Functions | |
float | getSample (const vec2d &p) |
Computes a raw elevation sample of the curve. | |
float | getSample (int i) |
Computes a raw elevation sample of the curve. | |
float | getMonotonicSample (int i) |
Computes a monotonic elevation sample of the curve. | |
float | getSymetricSample (int i) |
Computes a symetric elevation sample of the curve. | |
float | getSmoothedSample (int i) |
Computes a smoothed elevation sample of the curve. | |
Protected Attributes | |
ptr< TileProducer > | elevations |
The producer used to compute raw terrain elevations, themselves used to compute the elevation profile. | |
bool | monotonic |
true for an only increasing or only decreasing profile, false for a profile with both increasing and decreasing sections. | |
float | sampleLength |
The distance to be used between samples for this elevation profile. | |
int | sampleCount |
Number of samples in this elevation profile. | |
float * | samples |
The raw elevation samples of this elevation profile (before making them monotonic and smoothing them). | |
float * | monotonicSamples |
The elevation samples after they have been made monotonic. | |
int | smoothFactor |
The smoothing factor to get the smoothed elevation profile. | |
float * | smoothedSamples |
The elevation samples after they have been made monotonic and smoothed. |
A CurveData that contains the elevation profile of a curve.
It can produce monotonic (i.e. only increasing or only decreasing) profiles, or unconstrained profiles (both increasing and decreasing). Monotonic profiles are useful for rivers, which can never flow uphill. An elevation profile is created by taking terrain height samples regularly spaced along the curve, by making them monotonic if desired, and by smoothing the resulting samples. For large curve widths the distance between samples is larger, the quadtree level used to get their altitude is lower, and the smoothing is more aggressive, than for narrower curves. This gives smoother elevation profiles for wider curves (a highway has less "bumps" than a small road).
proland::ElevationCurveData::ElevationCurveData | ( | CurveId | id, | |
CurvePtr | flattenCurve, | |||
ptr< TileProducer > | elevations, | |||
bool | monotonic | |||
) |
Creates a new ElevationCurveData.
id | the id of the curve for which we need to store the data. | |
flattenCurve | the flattened version of the curve for which we need to store the data. | |
elevations | the producer used to compute raw terrain elevations, themselves used to compute the elevation profile. | |
monotonic | true for only increasing or only decreasing profiles, false for profiles with both increasing and decreasing sections. |
virtual proland::ElevationCurveData::~ElevationCurveData | ( | ) | [virtual] |
Deletes this ElevationCurveData.
virtual float proland::ElevationCurveData::getAltitude | ( | float | s | ) | [virtual] |
Returns the height corresponding to the given s coordinate.
s | a pseudo curvilinear coordinate (see Curve::Vertex::s). |
Reimplemented in proland::RoadElevationLayer::RoadElevationCurveData, and proland::WaterElevationLayer::WaterElevationCurveData.
virtual float proland::ElevationCurveData::getEndHeight | ( | ) | [virtual] |
Returns the height of the ending point of the curve.
Reimplemented in proland::RoadElevationLayer::RoadElevationCurveData.
float proland::ElevationCurveData::getMonotonicSample | ( | int | i | ) | [protected] |
Computes a monotonic elevation sample of the curve.
i | index of the sample to compute. |
float proland::ElevationCurveData::getSample | ( | int | i | ) | [protected] |
Computes a raw elevation sample of the curve.
i | index of the point to compute. |
float proland::ElevationCurveData::getSample | ( | const vec2d & | p | ) | [protected] |
Computes a raw elevation sample of the curve.
p | the coordinates of the sample to compute. |
virtual float proland::ElevationCurveData::getSampleLength | ( | CurvePtr | c | ) | [virtual] |
Returns the distance to be used between samples for the elevation profile of the given curve.
This distance depends on the curve's width (so that wider curves have a smoother profile).
c | a curve. |
Reimplemented in proland::WaterElevationLayer::WaterElevationCurveData.
float proland::ElevationCurveData::getSmoothedSample | ( | int | i | ) | [protected] |
Computes a smoothed elevation sample of the curve.
i | index of the sample to compute. |
virtual int proland::ElevationCurveData::getSmoothFactor | ( | CurvePtr | c | ) | [virtual] |
Returns the smoothing factor to get the smoothed elevation profile for the given curve.
This factor depends on the curve's width (so that wider curves have a smoother profile). A smoothing factor of n indicates that (2n+1) consecutive samples must be averaged together to get a smooth sample.
c | a curve. |
virtual float proland::ElevationCurveData::getStartHeight | ( | ) | [virtual] |
Returns the height of the starting point of the curve.
Reimplemented in proland::RoadElevationLayer::RoadElevationCurveData.
float proland::ElevationCurveData::getSymetricSample | ( | int | i | ) | [protected] |
Computes a symetric elevation sample of the curve.
This function computes additional samples before 0 or after sampleCount - 1, by symmetry around the two endpoint samples. These extra samples are needed to computed smoothed endpoint samples (since smoothFactor samples are needed on both sides of a monotonic sample to get a smoothed sample).
i | index of the sample to compute. |
virtual void proland::ElevationCurveData::getUsedTiles | ( | set< TileCache::Tile::Id > & | tiles, | |
float | rootSampleLength | |||
) | [virtual] |
Returns the list of tiles intersected by the curve with which this ElevationCurveData is associated.
[out] | tiles | the list of usedTiles. |
rootSampleLength | Curve sample length at level 0. |
Reimplemented from proland::CurveData.
Reimplemented in proland::RoadElevationLayer::RoadElevationCurveData.
ptr<TileProducer> proland::ElevationCurveData::elevations [protected] |
The producer used to compute raw terrain elevations, themselves used to compute the elevation profile.
bool proland::ElevationCurveData::monotonic [protected] |
true for an only increasing or only decreasing profile, false for a profile with both increasing and decreasing sections.
float* proland::ElevationCurveData::monotonicSamples [protected] |
The elevation samples after they have been made monotonic.
int proland::ElevationCurveData::sampleCount [protected] |
Number of samples in this elevation profile.
float proland::ElevationCurveData::sampleLength [protected] |
The distance to be used between samples for this elevation profile.
float* proland::ElevationCurveData::samples [protected] |
The raw elevation samples of this elevation profile (before making them monotonic and smoothing them).
float* proland::ElevationCurveData::smoothedSamples [protected] |
The elevation samples after they have been made monotonic and smoothed.
int proland::ElevationCurveData::smoothFactor [protected] |
The smoothing factor to get the smoothed elevation profile.
A smoothing factor of n indicates that (2n+1) consecutive monotonic samples must be averaged together to get a smooth sample.