libosmscout
0.1
|
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... | |
CoordBuffer & | operator= (const CoordBuffer &other)=delete |
size_t | PushCoord (const Vertex2D &coord) |
Push coordinate to the buffer. More... | |
void | Reset () |
~CoordBuffer () | |
Public Attributes | |
Vertex2D * | buffer {new Vertex2D[bufferSize]()} |
Static Public Attributes | |
static CoordBuffer | emptyCoordBuffer |
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.
|
default |
osmscout::CoordBuffer::~CoordBuffer | ( | ) |
References buffer.
|
delete |
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)
org | original range of data in the CoordBuffer |
offset | offset of parallel way - positive offset is left, negative right |
References buffer, osmscout::Det(), osmscout::CoordBufferRange::GetEnd(), osmscout::CoordBufferRange::GetStart(), osmscout::Vertex2D::GetX(), osmscout::Vertex2D::GetY(), osmscout::Normalize(), and PushCoord().
|
delete |
size_t osmscout::CoordBuffer::PushCoord | ( | const Vertex2D & | coord | ) |
Push coordinate to the buffer.
coord |
References buffer, osmscout::Vertex2D::GetX(), osmscout::Vertex2D::GetY(), osmscout::log, and osmscout::Log::Warn().
Referenced by osmscout::CopyPolygonToCoordBuffer(), and GenerateParallelWay().
void osmscout::CoordBuffer::Reset | ( | ) |
Referenced by osmscout::MapPainterAgg::DrawArea(), osmscout::MapPainterSVG::DrawArea(), osmscout::MapPainterAgg::DrawPath(), osmscout::MapPainterSVG::DrawPath(), GenerateParallelWay(), osmscout::CoordBufferRange::Get(), osmscout::CoordBufferRange::GetFirst(), osmscout::CoordBufferRange::GetLast(), PushCoord(), and ~CoordBuffer().
|
static |