Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

[core] Variable label placement #14184

Merged
merged 12 commits into from Mar 29, 2019
Merged

[core] Variable label placement #14184

merged 12 commits into from Mar 29, 2019

Conversation

pozdnyakov
Copy link
Contributor

platform/node/test/ignores.json Outdated Show resolved Hide resolved
src/mbgl/layout/symbol_layout.cpp Show resolved Hide resolved
src/mbgl/renderer/layers/render_symbol_layer.cpp Outdated Show resolved Hide resolved
src/mbgl/renderer/layers/render_symbol_layer.cpp Outdated Show resolved Hide resolved
src/mbgl/renderer/layers/render_symbol_layer.cpp Outdated Show resolved Hide resolved
src/mbgl/text/placement.cpp Show resolved Hide resolved
src/mbgl/text/placement.cpp Outdated Show resolved Hide resolved
src/mbgl/text/placement.cpp Outdated Show resolved Hide resolved
src/mbgl/layout/symbol_layout.cpp Show resolved Hide resolved
src/mbgl/layout/symbol_layout.cpp Outdated Show resolved Hide resolved
@pozdnyakov pozdnyakov added the ⚠️ DO NOT MERGE Work in progress, proof of concept, or on hold label Mar 21, 2019
@pozdnyakov pozdnyakov removed the ⚠️ DO NOT MERGE Work in progress, proof of concept, or on hold label Mar 21, 2019
@pozdnyakov pozdnyakov requested a review from kkaefer March 21, 2019 14:28
namespace {

} // namespace

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove unused?

@@ -360,12 +363,10 @@ const Shaping getShaping(const TaggedString& formattedString,
const style::TextJustifyType textJustify,
const float spacing,
const Point<float>& translate,
const float verticalHeight,
//const float verticalHeight,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

@julianrex
Copy link
Contributor

/cc @fabian-guerra for related platform/darwin/scripts/generate-style-code.js changes.

@pozdnyakov
Copy link
Contributor Author

@alexshalamov @kkaefer Thanks for your comments! Fixed now in the latest patch set. Also, an optimization for single-line labels is added.

@chloekraw
Copy link
Contributor

@pozdnyakov - does the implementation in this PR still leave out runtime styling support?

@pozdnyakov
Copy link
Contributor Author

@pozdnyakov - does the implementation in this PR still leave out runtime styling support?

This patch contains auto-generated runtime API & tests for Android.

// but doesn't actually specify what happens if you use both. We go with the radial offset.
textOffset = evaluateRadialOffset(textAnchor, radialOffset * util::ONE_EM);
} else {
textOffset = { layout.evaluate<TextOffset>(zoom, feature)[0] * util::ONE_EM,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const auto evaluatedOffset = layout.evaluate<TextOffset>(zoom, feature);
textOffset = { evaluatedOffset[0] * util::ONE_EM, evaluatedOffset[1] * util::ONE_EM };

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pozdnyakov wdyt? simple fix, avoids extra evaluation of text offset.

@@ -197,7 +197,12 @@ global.defaultValueJava = function(property) {
case 'array':
switch (property.value) {
case 'string':
return '[' + property['default'] + "]";
case 'enum':
if (property['default'] !== undefined) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change has to be applied to darwin/scripts/generate-style-code.js and please run make darwin-style-code after. That's why the iOS and macOS tests fail in this branch.

Let me know if you have any questions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit more than this, pls see 9bc4994

@pozdnyakov pozdnyakov requested a review from 1ec5 as a code owner March 27, 2019 12:24
@pozdnyakov pozdnyakov requested review from a team and fabian-guerra March 27, 2019 12:24
auto str = mbgl::Enum<MBGLEnum>::toString(value);
MGLEnum mglType = *mbgl::Enum<MGLEnum>::toEnum(str);
return [NSValue value:&mglType withObjCType:@encode(MGLEnum)];
static NSString *toMGLRawStyleValue(const MBGLEnum &value) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we changing NSValue to an NSString? Is there any MGLTextAnchor conversion error?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previously existing method was never invoked - the currently removed

        template <typename MBGLEnum = MBGLType,
            class = typename std::enable_if<std::is_enum<MBGLEnum>::value>::type,
        typename MGLEnum = ObjCEnum,
            class = typename std::enable_if<std::is_enum<MGLEnum>::value>::type>
        NSExpression *operator()(const MBGLEnum &value) const {...}

was used instead. It worked fine for a single MGLTextAnchor instance, however std::vector< MGLTextAnchor> could not be handled.


You can set this property to an expression containing any of the following:

* Constant array values
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is accepts MGLTextAnchor values, the documentation should be similar to:

* Constant `MGLTextAnchor` values
* Any of the following constant string values:
* `center`: The center of the text is placed closest to the anchor.
* `left`: The left side of the text is placed closest to the anchor.
* `right`: The right side of the text is placed closest to the anchor.
* `top`: The top of the text is placed closest to the anchor.
* `bottom`: The bottom of the text is placed closest to the anchor.
* `top-left`: The top left corner of the text is placed closest to the
anchor.
* `top-right`: The top right corner of the text is placed closest to the
anchor.
* `bottom-left`: The bottom left corner of the text is placed closest to the
anchor.
* `bottom-right`: The bottom right corner of the text is placed closest to
the anchor.

Copy link
Member

@tobrun tobrun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Core The cross-platform C++ core, aka mbgl feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants