diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2015-10-26 15:12:43 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2015-11-10 11:33:17 -0800 |
commit | 54e08b1f83504e12cbc19b08295d9f9ed5177ab5 (patch) | |
tree | 40513395d4d0ed2d9003ef30a708f21b2e83e5ab /src/mbgl/annotation | |
parent | a5625675890213f94de7632d4ef152ade627c9a5 (diff) | |
download | qtlocation-mapboxgl-54e08b1f83504e12cbc19b08295d9f9ed5177ab5.tar.gz |
[core] Eliminate use of ClassProperties for paint
Diffstat (limited to 'src/mbgl/annotation')
-rw-r--r-- | src/mbgl/annotation/shape_annotation_impl.cpp | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/src/mbgl/annotation/shape_annotation_impl.cpp b/src/mbgl/annotation/shape_annotation_impl.cpp index bb6642c600..6941c59c38 100644 --- a/src/mbgl/annotation/shape_annotation_impl.cpp +++ b/src/mbgl/annotation/shape_annotation_impl.cpp @@ -26,19 +26,17 @@ void ShapeAnnotationImpl::updateStyle(Style& style) { if (style.getLayer(layerID)) return; - if (shape.properties.is<LinePaintProperties>()) { + if (shape.properties.is<LineAnnotationProperties>()) { type = ProjectedFeatureType::LineString; std::unique_ptr<LineLayer> layer = std::make_unique<LineLayer>(); layer->type = StyleLayerType::Line; layer->layout.join = JoinType::Round; - const LinePaintProperties& properties = shape.properties.get<LinePaintProperties>(); - ClassProperties paintProperties; - paintProperties.set(PropertyKey::LineOpacity, Function<float>(properties.opacity)); - paintProperties.set(PropertyKey::LineWidth, Function<float>(properties.width)); - paintProperties.set(PropertyKey::LineColor, Function<Color>(properties.color)); - layer->paints.paints.emplace(ClassID::Default, std::move(paintProperties)); + const LineAnnotationProperties& properties = shape.properties.get<LineAnnotationProperties>(); + layer->paint.opacity = properties.opacity; + layer->paint.width = properties.width; + layer->paint.color = properties.color; layer->id = layerID; layer->source = AnnotationManager::SourceID; @@ -46,18 +44,16 @@ void ShapeAnnotationImpl::updateStyle(Style& style) { style.addLayer(std::move(layer), AnnotationManager::PointLayerID); - } else if (shape.properties.is<FillPaintProperties>()) { + } else if (shape.properties.is<FillAnnotationProperties>()) { type = ProjectedFeatureType::Polygon; std::unique_ptr<FillLayer> layer = std::make_unique<FillLayer>(); layer->type = StyleLayerType::Fill; - const FillPaintProperties& properties = shape.properties.get<FillPaintProperties>(); - ClassProperties paintProperties; - paintProperties.set(PropertyKey::FillOpacity, Function<float>(properties.opacity)); - paintProperties.set(PropertyKey::FillColor, Function<Color>(properties.fill_color)); - paintProperties.set(PropertyKey::FillOutlineColor, Function<Color>(properties.stroke_color)); - layer->paints.paints.emplace(ClassID::Default, std::move(paintProperties)); + const FillAnnotationProperties& properties = shape.properties.get<FillAnnotationProperties>(); + layer->paint.opacity = properties.opacity; + layer->paint.color = properties.color; + layer->paint.outlineColor = properties.outlineColor; layer->id = layerID; layer->source = AnnotationManager::SourceID; |