Skip to content

Commit 71fb377

Browse files
committed
Address most review comments
1 parent 70c812b commit 71fb377

5 files changed

Lines changed: 30 additions & 16 deletions

File tree

CesiumUtility/include/CesiumUtility/Color.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ struct Color {
3232
*/
3333
uint32_t toRgba32() const;
3434

35+
/** @brief Checks if two Color objects are equal. */
3536
bool operator==(const Color& rhs) const;
3637
};
3738
} // namespace CesiumUtility

CesiumVectorData/include/CesiumVectorData/VectorRasterizer.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,12 @@ class VectorRasterizer {
129129
* @brief Draws a set of points to the canvas.
130130
*
131131
* @param points The set of points to draw.
132-
* @param style The @ref PointStyle to use when drawing the points.
132+
* @param styles The @ref PointStyle to use when drawing the points.
133+
* @note This method is intended for use with per-point styling, where each
134+
* point may have a different style. The `styles` vector should be the same
135+
* size as the `points` vector, and each point will be drawn using the
136+
* corresponding style in the `styles` vector. If a style is `nullptr`, that
137+
* point will not be drawn.
133138
*/
134139
void drawPoints(
135140
const std::vector<CesiumGeospatial::Cartographic>& points,

CesiumVectorData/include/CesiumVectorData/VectorStyle.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,39 +168,39 @@ struct VectorStyle {
168168
};
169169
} // namespace CesiumVectorData
170170

171-
/** @brief Hash implementation for \ref CesiumVectorData::ColorStyle. */
171+
/** @brief Hash implementation for @ref CesiumVectorData::ColorStyle. */
172172
template <> struct std::hash<CesiumVectorData::ColorStyle> {
173173
/** @brief Returns a `size_t` hash of the provided \ref
174174
* CesiumVectorData::ColorStyle instance. */
175175
std::size_t
176176
operator()(const CesiumVectorData::ColorStyle& style) const noexcept;
177177
};
178178

179-
/** @brief Hash implementation for \ref CesiumVectorData::LineStyle. */
179+
/** @brief Hash implementation for @ref CesiumVectorData::LineStyle. */
180180
template <> struct std::hash<CesiumVectorData::LineStyle> {
181181
/** @brief Returns a `size_t` hash of the provided \ref
182182
* CesiumVectorData::LineStyle instance. */
183183
std::size_t
184184
operator()(const CesiumVectorData::LineStyle& style) const noexcept;
185185
};
186186

187-
/** @brief Hash implementation for \ref CesiumVectorData::PolygonStyle. */
187+
/** @brief Hash implementation for @ref CesiumVectorData::PolygonStyle. */
188188
template <> struct std::hash<CesiumVectorData::PolygonStyle> {
189189
/** @brief Returns a `size_t` hash of the provided \ref
190190
* CesiumVectorData::PolygonStyle instance. */
191191
std::size_t
192192
operator()(const CesiumVectorData::PolygonStyle& style) const noexcept;
193193
};
194194

195-
/** @brief Hash implementation for \ref CesiumVectorData::PointStyle. */
195+
/** @brief Hash implementation for @ref CesiumVectorData::PointStyle. */
196196
template <> struct std::hash<CesiumVectorData::PointStyle> {
197197
/** @brief Returns a `size_t` hash of the provided \ref
198198
* CesiumVectorData::PointStyle instance. */
199199
std::size_t
200200
operator()(const CesiumVectorData::PointStyle& style) const noexcept;
201201
};
202202

203-
/** @brief Hash implementation for \ref CesiumVectorData::VectorStyle. */
203+
/** @brief Hash implementation for @ref CesiumVectorData::VectorStyle. */
204204
template <> struct std::hash<CesiumVectorData::VectorStyle> {
205205
/** @brief Returns a `size_t` hash of the provided \ref
206206
* CesiumVectorData::VectorStyle instance. */

CesiumVectorData/src/VectorRasterizer.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,15 @@ void VectorRasterizer::drawPoints(
402402
return;
403403
}
404404

405-
for (size_t i = 0; i < points.size(); i++) {
405+
// styles.size() should equal points.size(), but we will only draw as many
406+
// points as we have styles for.
407+
const size_t numPoints = std::min(points.size(), styles.size());
408+
409+
for (size_t i = 0; i < numPoints; i++) {
410+
if (styles[i] == nullptr) {
411+
continue;
412+
}
413+
406414
BLPoint point = radiansToPoint(
407415
points[i].longitude,
408416
points[i].latitude,

CesiumVectorOverlays/src/VectorTilesRasterOverlay.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ CesiumUtility::Result<int64_t> getFeatureId(
101101
featureIdAccessor)};
102102
} else if (pFeatureIdSet->texture) {
103103
return CesiumUtility::Result<int64_t>(ErrorList::warning(
104-
"Feature ID textures for vector primitives is not yet supported."));
104+
"Feature ID textures for vector primitives are not yet supported."));
105105
}
106106

107107
return {index};
@@ -325,9 +325,8 @@ CesiumAsync::Future<CesiumUtility::Result<VectorRenderContent*>> vectorizeModel(
325325
}
326326
});
327327

328-
// Apply per-element styling if the user specified a styling provider.
328+
// Apply default styling if the user did not specify a styling provider.
329329
if (pStylingProvider == nullptr) {
330-
331330
pContent->pointStyles.resize(
332331
pContent->points.size(),
333332
&pContent->defaultStyle);
@@ -342,6 +341,7 @@ CesiumAsync::Future<CesiumUtility::Result<VectorRenderContent*>> vectorizeModel(
342341
{pContent, errors});
343342
}
344343

344+
// Apply per-element styling if the user specified a styling provider.
345345
return std::
346346
move(asyncSystem.all(
347347
pStylingProvider
@@ -364,8 +364,8 @@ CesiumAsync::Future<CesiumUtility::Result<VectorRenderContent*>> vectorizeModel(
364364

365365
for (const auto& style : result) {
366366
if (style.has_value()) {
367-
pContent->pointStyles.emplace_back(
368-
&*pContent->uniqueStyles.insert(*style).first);
367+
pContent->pointStyles.emplace_back(&(
368+
*pContent->uniqueStyles.insert(*style).first));
369369
} else {
370370
pContent->pointStyles.emplace_back(
371371
&pContent->defaultStyle);
@@ -393,8 +393,8 @@ CesiumAsync::Future<CesiumUtility::Result<VectorRenderContent*>> vectorizeModel(
393393
}
394394
for (const auto& style : result) {
395395
if (style.has_value()) {
396-
pContent->polylineStyles.emplace_back(
397-
&*pContent->uniqueStyles.insert(*style).first);
396+
pContent->polylineStyles.emplace_back(&(
397+
*pContent->uniqueStyles.insert(*style).first));
398398
} else {
399399
pContent->polylineStyles.emplace_back(
400400
&pContent->defaultStyle);
@@ -421,8 +421,8 @@ CesiumAsync::Future<CesiumUtility::Result<VectorRenderContent*>> vectorizeModel(
421421
}
422422
for (const auto& style : result) {
423423
if (style.has_value()) {
424-
pContent->polygonStyles.emplace_back(
425-
&*pContent->uniqueStyles.insert(*style).first);
424+
pContent->polygonStyles.emplace_back(&(
425+
*pContent->uniqueStyles.insert(*style).first));
426426
} else {
427427
pContent->polygonStyles.emplace_back(
428428
&pContent->defaultStyle);

0 commit comments

Comments
 (0)