#pragma once #include #include #include #include #include #include #include #include #include #include #include #include namespace mbgl { class PlacedSymbol { public: PlacedSymbol(Point anchorPoint_, uint16_t segment_, float lowerSize_, float upperSize_, std::array lineOffset_, WritingModeType writingModes_, GeometryCoordinates line_, std::vector tileDistances_) : anchorPoint(anchorPoint_), segment(segment_), lowerSize(lowerSize_), upperSize(upperSize_), lineOffset(lineOffset_), writingModes(writingModes_), line(std::move(line_)), tileDistances(std::move(tileDistances_)), hidden(false), vertexStartIndex(0) { } Point anchorPoint; uint16_t segment; float lowerSize; float upperSize; std::array lineOffset; WritingModeType writingModes; GeometryCoordinates line; std::vector tileDistances; std::vector glyphOffsets; bool hidden; size_t vertexStartIndex; // The crossTileID is only filled/used on the foreground for variable text anchors uint32_t crossTileID = 0u; }; class SymbolBucket final : public Bucket { public: SymbolBucket(style::SymbolLayoutProperties::PossiblyEvaluated, const std::map>&, const style::PropertyValue& textSize, const style::PropertyValue& iconSize, float zoom, bool sdfIcons, bool iconsNeedLinear, bool sortFeaturesByY, const std::string bucketLeaderID, const std::vector&&, const float tilePixelRatio); ~SymbolBucket() override; void upload(gfx::Context&) override; bool hasData() const override; bool supportsLayer(const style::Layer::Impl&) const override; bool hasTextData() const; bool hasIconData() const; bool hasCollisionBoxData() const; bool hasCollisionCircleData() const; bool hasFormatSectionOverrides() const; void updateOpacity(); void sortFeatures(const float angle); // The result contains references to the `symbolInstances` items, sorted by viewport Y. std::vector> getSortedSymbols(const float angle); const style::SymbolLayoutProperties::PossiblyEvaluated layout; const bool sdfIcons; const bool iconsNeedLinear; const bool sortFeaturesByY; const std::string bucketLeaderID; optional sortedAngle; bool staticUploaded = false; bool placementChangesUploaded = false; bool dynamicUploaded = false; bool sortUploaded = false; std::vector symbolInstances; struct PaintProperties { SymbolIconProgram::Binders iconBinders; SymbolSDFTextProgram::Binders textBinders; }; std::map paintProperties; std::unique_ptr textSizeBinder; struct Buffer { gfx::VertexVector vertices; gfx::VertexVector> dynamicVertices; gfx::VertexVector> opacityVertices; gfx::IndexVector triangles; SegmentVector segments; std::vector placedSymbols; optional> vertexBuffer; optional>> dynamicVertexBuffer; optional>> opacityVertexBuffer; optional indexBuffer; } text; std::unique_ptr iconSizeBinder; struct IconBuffer : public Buffer { PremultipliedImage atlasImage; } icon; struct CollisionBuffer { gfx::VertexVector> vertices; gfx::VertexVector> dynamicVertices; SegmentVector segments; optional>> vertexBuffer; optional>> dynamicVertexBuffer; }; struct CollisionBoxBuffer : public CollisionBuffer { gfx::IndexVector lines; optional indexBuffer; } collisionBox; struct CollisionCircleBuffer : public CollisionBuffer { gfx::IndexVector triangles; optional indexBuffer; } collisionCircle; const float tilePixelRatio; uint32_t bucketInstanceId = 0; bool justReloaded = false; mutable optional hasFormatSectionOverrides_; std::shared_ptr> featureSortOrder; }; } // namespace mbgl