cesium-native 0.50.0
|
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::ImageAsset > | finalize () |
Finalizes the rasterization operations, flushing all draw calls to the canvas, ensuring proper pixel ordering, and releasing the draw context. | |
Rasterizes vector primitives into a CesiumGltf::ImageAsset.
Definition at line 26 of file VectorRasterizer.h.
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.
bounds | The bounds on the globe that this rasterizer's canvas will cover. |
imageAsset | The destination image asset. This CesiumGltf::ImageAsset must be four channels, with only one byte per channel (RGBA32). |
mipLevel | The mip level that the rasterizer should rasterize for the image. |
ellipsoid | The ellipsoid to use. |
void CesiumVectorData::VectorRasterizer::clear | ( | const CesiumUtility::Color & | clearColor | ) |
Fills the entire canvas with the given color.
clearColor | The color to use to clear the canvas. |
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.
geoJsonObject | The GeoJSON object to draw. |
style | The VectorStyle to use when drawing the object. |
void CesiumVectorData::VectorRasterizer::drawPolygon | ( | const CesiumGeospatial::CartographicPolygon & | polygon, |
const PolygonStyle & | style ) |
Draws a CesiumGeospatial::CartographicPolygon to the canvas.
polygon | The polygon to draw. |
style | The PolygonStyle to use when drawing the polygon. |
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.
polygon | The 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. |
style | The PolygonStyle to use when drawing the polygon. |
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.
points | The set of points making up the polyline. The coordinates should be specified in degrees. |
style | The LineStyle to use when drawing the polyline. |
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.