summaryrefslogtreecommitdiff
path: root/src/mbgl/layout/symbol_instance.cpp
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2016-09-13 13:50:27 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-09-16 09:00:54 -0700
commita8dd1bbbb8f9053923179fd45b2dfcbb86e3f474 (patch)
treefac3c39d91b7060ff1659e55df64cd7f8a8143df /src/mbgl/layout/symbol_instance.cpp
parent1f375581c3a31adea9281a7494a73e5c8f1c9a17 (diff)
downloadqtlocation-mapboxgl-a8dd1bbbb8f9053923179fd45b2dfcbb86e3f474.tar.gz
[core] Move SymbolInstance and SymbolFeature into their own files
Diffstat (limited to 'src/mbgl/layout/symbol_instance.cpp')
-rw-r--r--src/mbgl/layout/symbol_instance.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/mbgl/layout/symbol_instance.cpp b/src/mbgl/layout/symbol_instance.cpp
new file mode 100644
index 0000000000..64b913200e
--- /dev/null
+++ b/src/mbgl/layout/symbol_instance.cpp
@@ -0,0 +1,34 @@
+#include <mbgl/layout/symbol_instance.hpp>
+#include <mbgl/style/layers/symbol_layer_properties.hpp>
+
+namespace mbgl {
+
+using namespace style;
+
+SymbolInstance::SymbolInstance(Anchor& anchor, const GeometryCoordinates& line,
+ const Shaping& shapedText, const PositionedIcon& shapedIcon,
+ const SymbolLayoutProperties& layout, const bool addToBuffers, const uint32_t index_,
+ const float textBoxScale, const float textPadding, const SymbolPlacementType textPlacement,
+ const float iconBoxScale, const float iconPadding, const SymbolPlacementType iconPlacement,
+ const GlyphPositions& face, const IndexedSubfeature& indexedFeature) :
+ point(anchor.point),
+ index(index_),
+ hasText(shapedText),
+ hasIcon(shapedIcon),
+
+ // Create the quads used for rendering the glyphs.
+ glyphQuads(addToBuffers && shapedText ?
+ getGlyphQuads(anchor, shapedText, textBoxScale, line, layout, textPlacement, face) :
+ SymbolQuads()),
+
+ // Create the quad used for rendering the icon.
+ iconQuads(addToBuffers && shapedIcon ?
+ getIconQuads(anchor, shapedIcon, line, layout, iconPlacement, shapedText) :
+ SymbolQuads()),
+
+ // Create the collision features that will be used to check whether this symbol instance can be placed
+ textCollisionFeature(line, anchor, shapedText, textBoxScale, textPadding, textPlacement, indexedFeature),
+ iconCollisionFeature(line, anchor, shapedIcon, iconBoxScale, iconPadding, iconPlacement, indexedFeature)
+ {}
+
+} // namespace mbgl