libosmscout  0.1
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules
osmscout::CoordBuffer Class Referencefinal

Buffer structure for Vertex2D data. More...

#include <Transformation.h>

Public Member Functions

 CoordBuffer ()=default
 
 CoordBuffer (const CoordBuffer &other)=delete
 
CoordBufferRange GenerateParallelWay (const CoordBufferRange &org, double offset)
 Generate parallel way to way stored in this buffer on range orgStart, orgEnd (inclusive) Result is stored after the last valid point. More...
 
CoordBufferoperator= (const CoordBuffer &other)=delete
 
size_t PushCoord (const Vertex2D &coord)
 Push coordinate to the buffer. More...
 
void Reset ()
 
 ~CoordBuffer ()
 

Public Attributes

Vertex2Dbuffer {new Vertex2D[bufferSize]()}
 

Static Public Attributes

static CoordBuffer emptyCoordBuffer
 

Detailed Description

Buffer structure for Vertex2D data.

You can add coordinates to the buffer and get the position of the coordinate in the buffer in return.

The CoordBuffer automatically resizes by a factor of 2 if its is too small to hold the additional data. The initial size of the buffer should be able to hold "enough" data. If you thus get reallocation log warnings this is not an error, but if it happens too often you are either not reusing CoordBuffer instances as much as possible or are pushing more geometric data than we expect to be sensible for mobile or desktop rendering. Check your allocation strategy for MapPainter instances or style sheet in this case,

CoordBuffer also allows also higher level operations on the buffer to generate copies of stored objects.

Constructor & Destructor Documentation

◆ CoordBuffer() [1/2]

osmscout::CoordBuffer::CoordBuffer ( )
default

◆ ~CoordBuffer()

osmscout::CoordBuffer::~CoordBuffer ( )

References buffer.

◆ CoordBuffer() [2/2]

osmscout::CoordBuffer::CoordBuffer ( const CoordBuffer other)
delete

Member Function Documentation

◆ GenerateParallelWay()

CoordBufferRange osmscout::CoordBuffer::GenerateParallelWay ( const CoordBufferRange org,
double  offset 
)

Generate parallel way to way stored in this buffer on range orgStart, orgEnd (inclusive) Result is stored after the last valid point.

Generated way offsets are returned in start and end.

Way have to have at least two nodes (orgEnd > orgStart)

Parameters
orgoriginal range of data in the CoordBuffer
offsetoffset of parallel way - positive offset is left, negative right
Returns
range of data in the CoordBuffer

References buffer, osmscout::Det(), osmscout::CoordBufferRange::GetEnd(), osmscout::CoordBufferRange::GetStart(), osmscout::Vertex2D::GetX(), osmscout::Vertex2D::GetY(), osmscout::Normalize(), and PushCoord().

◆ operator=()

CoordBuffer& osmscout::CoordBuffer::operator= ( const CoordBuffer other)
delete

◆ PushCoord()

size_t osmscout::CoordBuffer::PushCoord ( const Vertex2D coord)

Push coordinate to the buffer.

Parameters
coord
Returns
position (index) of the new coordinate coordinate in the buffer
Note
x and y have to be valid, NaN is not allowed

References buffer, osmscout::Vertex2D::GetX(), osmscout::Vertex2D::GetY(), osmscout::log, and osmscout::Log::Warn().

Referenced by osmscout::CopyPolygonToCoordBuffer(), and GenerateParallelWay().

◆ Reset()

void osmscout::CoordBuffer::Reset ( )

Member Data Documentation

◆ buffer

◆ emptyCoordBuffer

CoordBuffer osmscout::CoordBuffer::emptyCoordBuffer
static

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