forked from maplibre/maplibre-native
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for
text-variable-anchor-offset
property (maplibre#2921)
Co-authored-by: Yingfang Wang <[email protected]> Co-authored-by: Alexey Kon <[email protected]>
- Loading branch information
1 parent
90a798b
commit 1a63194
Showing
192 changed files
with
5,932 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#pragma once | ||
|
||
#include <mbgl/style/types.hpp> | ||
#include <mbgl/util/feature.hpp> | ||
#include <mbgl/util/geometry.hpp> | ||
|
||
#include <array> | ||
#include <string> | ||
#include <vector> | ||
|
||
namespace mbgl { | ||
|
||
struct AnchorOffsetPair { | ||
style::SymbolAnchorType anchorType; | ||
std::array<float, 2> offset; | ||
|
||
AnchorOffsetPair(style::SymbolAnchorType anchorType_, std::array<float, 2> offset_) | ||
: anchorType(anchorType_), | ||
offset(offset_) {} | ||
|
||
bool operator==(const AnchorOffsetPair& other) const = default; | ||
}; | ||
|
||
class VariableAnchorOffsetCollection { | ||
private: | ||
using CollectionType = std::vector<AnchorOffsetPair>; | ||
CollectionType anchorOffsets; | ||
|
||
public: | ||
VariableAnchorOffsetCollection() = default; | ||
|
||
VariableAnchorOffsetCollection(const VariableAnchorOffsetCollection& other) = default; | ||
|
||
VariableAnchorOffsetCollection(VariableAnchorOffsetCollection&& other) noexcept = default; | ||
|
||
VariableAnchorOffsetCollection(std::vector<AnchorOffsetPair>&& values) { anchorOffsets = std::move(values); } | ||
|
||
std::array<float, 2> getOffsetByAnchor(const style::SymbolAnchorType& anchorType) const; | ||
|
||
std::string toString() const; | ||
|
||
mbgl::Value serialize() const; | ||
|
||
bool empty() const { return anchorOffsets.size() == 0; } | ||
|
||
CollectionType::size_type size() const { return anchorOffsets.size(); } | ||
|
||
CollectionType::const_iterator begin() const { return anchorOffsets.begin(); } | ||
|
||
CollectionType::const_iterator end() const { return anchorOffsets.end(); } | ||
|
||
const AnchorOffsetPair& operator[](size_t index) const { return anchorOffsets[index]; } | ||
|
||
VariableAnchorOffsetCollection& operator=(const VariableAnchorOffsetCollection& other) = default; | ||
|
||
VariableAnchorOffsetCollection& operator=(VariableAnchorOffsetCollection&& other) noexcept = default; | ||
|
||
bool operator==(const VariableAnchorOffsetCollection& other) const = default; | ||
}; | ||
|
||
} // namespace mbgl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
...st-runner/render-tests/text-variable-anchor-offset/all-anchors-icon-text-fit/metrics.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"network": [ | ||
[ | ||
"probeNetwork - default - end", | ||
7, | ||
1778473 | ||
], | ||
[ | ||
"probeNetwork - default - start", | ||
0, | ||
0 | ||
] | ||
], | ||
"gfx": [ | ||
[ | ||
"probeGFX - default - end", | ||
8, | ||
13, | ||
37, | ||
1, | ||
[ | ||
90448, | ||
90448 | ||
], | ||
[ | ||
100366, | ||
100366 | ||
], | ||
[ | ||
1337984, | ||
1337984 | ||
] | ||
] | ||
] | ||
} |
35 changes: 35 additions & 0 deletions
35
...nner/render-tests/text-variable-anchor-offset/all-anchors-text-allow-overlap/metrics.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"network": [ | ||
[ | ||
"probeNetwork - default - end", | ||
4, | ||
686859 | ||
], | ||
[ | ||
"probeNetwork - default - start", | ||
0, | ||
0 | ||
] | ||
], | ||
"gfx": [ | ||
[ | ||
"probeGFX - default - end", | ||
1, | ||
5, | ||
9, | ||
1, | ||
[ | ||
52212, | ||
52212 | ||
], | ||
[ | ||
5494, | ||
5494 | ||
], | ||
[ | ||
73024, | ||
73024 | ||
] | ||
] | ||
] | ||
} |
35 changes: 35 additions & 0 deletions
35
...roid-render-test-runner/render-tests/text-variable-anchor-offset/all-anchors/metrics.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"network": [ | ||
[ | ||
"probeNetwork - default - end", | ||
7, | ||
1778473 | ||
], | ||
[ | ||
"probeNetwork - default - start", | ||
0, | ||
0 | ||
] | ||
], | ||
"gfx": [ | ||
[ | ||
"probeGFX - default - end", | ||
4, | ||
13, | ||
21, | ||
1, | ||
[ | ||
143312, | ||
143312 | ||
], | ||
[ | ||
97654, | ||
97654 | ||
], | ||
[ | ||
1301824, | ||
1301824 | ||
] | ||
] | ||
] | ||
} |
Oops, something went wrong.