cesium-native 0.65.0
Loading...
Searching...
No Matches
VectorStyle.h
1#pragma once
2
3#include <CesiumUtility/Color.h>
4
5#include <functional>
6#include <optional>
7
8namespace CesiumVectorData {
9
13enum class ColorMode : uint8_t {
15 Normal = 0,
27};
28
32struct ColorStyle {
37
49 CesiumUtility::Color getColor(size_t randomColorSeed = 0) const;
50
52 bool operator==(const ColorStyle& rhs) const;
53};
54
56enum class LineWidthMode : uint8_t {
61 Pixels = 0,
71};
72
74struct LineStyle : public ColorStyle {
80 double width = 1.0;
85
87 bool operator==(const LineStyle& rhs) const;
88};
89
96 std::optional<ColorStyle> fill;
101 std::optional<LineStyle> outline;
102
104 bool operator==(const PolygonStyle& rhs) const;
105};
106
110 double radius = 1.0;
115 std::optional<ColorStyle> fill;
120 std::optional<LineStyle> outline;
121
123 bool operator==(const PointStyle& rhs) const;
124};
125
142
146 VectorStyle() = default;
147
151 VectorStyle(const LineStyle& lineStyle, const PolygonStyle& polygonStyle);
152
157 const LineStyle& lineStyle,
158 const PolygonStyle& polygonStyle,
159 const PointStyle& pointStyle);
160
165
167 bool operator==(const VectorStyle& rhs) const;
168};
169} // namespace CesiumVectorData
170
172template <> struct std::hash<CesiumVectorData::ColorStyle> {
175 std::size_t
176 operator()(const CesiumVectorData::ColorStyle& style) const noexcept;
177};
178
180template <> struct std::hash<CesiumVectorData::LineStyle> {
183 std::size_t
184 operator()(const CesiumVectorData::LineStyle& style) const noexcept;
185};
186
188template <> struct std::hash<CesiumVectorData::PolygonStyle> {
191 std::size_t
192 operator()(const CesiumVectorData::PolygonStyle& style) const noexcept;
193};
194
196template <> struct std::hash<CesiumVectorData::PointStyle> {
199 std::size_t
200 operator()(const CesiumVectorData::PointStyle& style) const noexcept;
201};
202
204template <> struct std::hash<CesiumVectorData::VectorStyle> {
207 std::size_t
208 operator()(const CesiumVectorData::VectorStyle& style) const noexcept;
209};
Classes for loading vector data such as GeoJSON.
LineWidthMode
The mode to use when interpreting a given line width.
Definition VectorStyle.h:56
@ Meters
The line width will cover this number of meters of the ellipsoid it's rendered on....
Definition VectorStyle.h:70
@ Pixels
The line will always be this number of pixels in width, no matter how close the user gets to the line...
Definition VectorStyle.h:61
ColorMode
The mode used for coloring.
Definition VectorStyle.h:13
@ Random
The color will be chosen randomly.
Definition VectorStyle.h:26
@ Normal
The normal color mode. The color will be used directly.
Definition VectorStyle.h:15
Represents an RGBA color value.
Definition Color.h:9
Specifies the color of a style type.
Definition VectorStyle.h:32
ColorMode colorMode
The color mode to be used.
Definition VectorStyle.h:36
bool operator==(const ColorStyle &rhs) const
Checks if two ColorStyle instances are equal.
CesiumUtility::Color color
The color to be used.
Definition VectorStyle.h:34
CesiumUtility::Color getColor(size_t randomColorSeed=0) const
Obtains the color specified on this ColorStyle.
The style used to draw polylines and strokes.
Definition VectorStyle.h:74
bool operator==(const LineStyle &rhs) const
Checks if two LineStyle instances are equal.
double width
The width of this line. If widthMode is set to LineWidthMode::Pixels, this is in pixels....
Definition VectorStyle.h:80
LineWidthMode widthMode
The mode to use when interpreting width.
Definition VectorStyle.h:84
The style used to draw a point.
double radius
The radius of the point in pixels.
std::optional< ColorStyle > fill
The color used to fill this point. If std::nullopt, the point will not be filled.
bool operator==(const PointStyle &rhs) const
Checks if two PointStyle instances are equal.
std::optional< LineStyle > outline
The style used to outline this point. If std::nullopt, the point will not be outlined.
The style used to draw a Polygon.
Definition VectorStyle.h:91
bool operator==(const PolygonStyle &rhs) const
Checks if two PolygonStyle instances are equal.
std::optional< ColorStyle > fill
The color used to fill this polygon. If std::nullopt, the polygon will not be filled.
Definition VectorStyle.h:96
std::optional< LineStyle > outline
The style used to outline this polygon. If std::nullopt, the polygon will not be outlined.
Style information to use when drawing vector data.
LineStyle line
The style to use when drawing polylines.
VectorStyle()=default
Default constructor for VectorStyle.
PointStyle point
The style to use when drawing points.
VectorStyle(const LineStyle &lineStyle, const PolygonStyle &polygonStyle)
Initializes style information for line and polygon types.
PolygonStyle polygon
The style to use when drawing polygons.
VectorStyle(const LineStyle &lineStyle, const PolygonStyle &polygonStyle, const PointStyle &pointStyle)
Initializes style information for all types.
VectorStyle(const CesiumUtility::Color &color)
Initializes all styles to the given color.
bool operator==(const VectorStyle &rhs) const
Checks if two VectorStyle instances are equal.
std::size_t operator()(const CesiumVectorData::ColorStyle &style) const noexcept
Returns a size_t hash of the provided CesiumVectorData::ColorStyle instance.
std::size_t operator()(const CesiumVectorData::LineStyle &style) const noexcept
Returns a size_t hash of the provided CesiumVectorData::LineStyle instance.
std::size_t operator()(const CesiumVectorData::PointStyle &style) const noexcept
Returns a size_t hash of the provided CesiumVectorData::PointStyle instance.
std::size_t operator()(const CesiumVectorData::PolygonStyle &style) const noexcept
Returns a size_t hash of the provided CesiumVectorData::PolygonStyle instance.
std::size_t operator()(const CesiumVectorData::VectorStyle &style) const noexcept
Returns a size_t hash of the provided CesiumVectorData::VectorStyle instance.