cesium-native 0.50.0
Loading...
Searching...
No Matches
CesiumVectorData::VectorRasterizer Class Reference

Rasterizes vector primitives into a CesiumGltf::ImageAsset. More...

#include <CesiumVectorData/VectorRasterizer.h>

Public Member Functions

 VectorRasterizer (const CesiumGeospatial::GlobeRectangle &bounds, CesiumUtility::IntrusivePointer< CesiumGltf::ImageAsset > &imageAsset, uint32_t mipLevel=0, const CesiumGeospatial::Ellipsoid &ellipsoid=CesiumGeospatial::Ellipsoid::WGS84)
 Creates a new VectorRasterizer representing the given rectangle on the globe.
 
void drawPolygon (const CesiumGeospatial::CartographicPolygon &polygon, const PolygonStyle &style)
 Draws a CesiumGeospatial::CartographicPolygon to the canvas.
 
void drawPolygon (const std::vector< std::vector< glm::dvec3 > > &polygon, const PolygonStyle &style)
 Draws a set of linear rings representing a polygon and its holes to the canvas.
 
void drawPolyline (const std::span< const glm::dvec3 > &points, const LineStyle &style)
 Draws a polyline (a set of multiple line segments) to the canvas.
 
void drawGeoJsonObject (const GeoJsonObject &geoJsonObject, const VectorStyle &style)
 Rasterizes a GeoJsonObject to the canvas.
 
void clear (const CesiumUtility::Color &clearColor)
 Fills the entire canvas with the given color.
 
CesiumUtility::IntrusivePointer< CesiumGltf::ImageAssetfinalize ()
 Finalizes the rasterization operations, flushing all draw calls to the canvas, ensuring proper pixel ordering, and releasing the draw context.
 

Detailed Description

Rasterizes vector primitives into a CesiumGltf::ImageAsset.

Definition at line 26 of file VectorRasterizer.h.

Constructor & Destructor Documentation

◆ VectorRasterizer()

CesiumVectorData::VectorRasterizer::VectorRasterizer ( const CesiumGeospatial::GlobeRectangle & bounds,
CesiumUtility::IntrusivePointer< CesiumGltf::ImageAsset > & imageAsset,
uint32_t mipLevel = 0,
const CesiumGeospatial::Ellipsoid & ellipsoid = CesiumGeospatial::Ellipsoid::WGS84 )

Creates a new VectorRasterizer representing the given rectangle on the globe.

Parameters
boundsThe bounds on the globe that this rasterizer's canvas will cover.
imageAssetThe destination image asset. This CesiumGltf::ImageAsset must be four channels, with only one byte per channel (RGBA32).
mipLevelThe mip level that the rasterizer should rasterize for the image.
ellipsoidThe ellipsoid to use.

Member Function Documentation

◆ clear()

void CesiumVectorData::VectorRasterizer::clear ( const CesiumUtility::Color & clearColor)

Fills the entire canvas with the given color.

Parameters
clearColorThe color to use to clear the canvas.

◆ drawGeoJsonObject()

void CesiumVectorData::VectorRasterizer::drawGeoJsonObject ( const GeoJsonObject & geoJsonObject,
const VectorStyle & style )

Rasterizes a GeoJsonObject to the canvas.

This will recurse through any children of the GeoJsonObject as well. All GeoJSON objects will be considered (that is, no object's children will be ignored), but only LineString types (LineString and MultiLineString) and Polygon types (Polygon and MultiPolygon) will actually be rendered.

This method can potentially be very slow if a large tree is passed in. If better performance is needed, selecting a subset of leaf objects (those without any children) and calling drawGeoJsonObject on each one will have better results.

Parameters
geoJsonObjectThe GeoJSON object to draw.
styleThe VectorStyle to use when drawing the object.

◆ drawPolygon() [1/2]

void CesiumVectorData::VectorRasterizer::drawPolygon ( const CesiumGeospatial::CartographicPolygon & polygon,
const PolygonStyle & style )

Draws a CesiumGeospatial::CartographicPolygon to the canvas.

Parameters
polygonThe polygon to draw.
styleThe PolygonStyle to use when drawing the polygon.

◆ drawPolygon() [2/2]

void CesiumVectorData::VectorRasterizer::drawPolygon ( const std::vector< std::vector< glm::dvec3 > > & polygon,
const PolygonStyle & style )

Draws a set of linear rings representing a polygon and its holes to the canvas.

Parameters
polygonThe polygon to draw. It is assumed to have right-hand winding order (exterior rings are counterclockwise, holes are clockwise) as is the case in GeoJSON. The coordinates should be specified in degrees.
styleThe PolygonStyle to use when drawing the polygon.

◆ drawPolyline()

void CesiumVectorData::VectorRasterizer::drawPolyline ( const std::span< const glm::dvec3 > & points,
const LineStyle & style )

Draws a polyline (a set of multiple line segments) to the canvas.

Parameters
pointsThe set of points making up the polyline. The coordinates should be specified in degrees.
styleThe LineStyle to use when drawing the polyline.

◆ finalize()

CesiumUtility::IntrusivePointer< CesiumGltf::ImageAsset > CesiumVectorData::VectorRasterizer::finalize ( )

Finalizes the rasterization operations, flushing all draw calls to the canvas, ensuring proper pixel ordering, and releasing the draw context.

Once a VectorRasterizer is finalized, it can no longer be used for drawing. Subsequent calls to its methods will do nothing.


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