Commit Graph

134 Commits

Author SHA1 Message Date
Mikhail Pozdnyakov
dea1063319 [core] Encapsulate placement code handling symbols sort ranges 2020-03-03 16:13:48 +02:00
zmiao
759dfe8bf6 [core] Support [within expression] with layout property 2020-02-12 17:35:18 +02:00
zmiao
1bd2ccf239 Enable within expression with Filter
add canonical as pointer

fix review findings
2020-02-12 12:24:05 +02:00
zmiao
3e99c08ea6 Enable parse within expression
Add geometry type checker
2020-02-12 12:24:05 +02:00
Ansis Brammanis
4f18d5fa92 [core] sort symbols using symbol-sort-key before placement (#16023)
fix #15964
partially port mapbox/mapbox-gl-js#9054
2020-02-11 11:24:14 -05:00
galinelle
4678b3d70c [core] remove std::vector copy step in SymbolLayout::anchorIsTooClose (#16131)
A const reference is enough here.
2020-01-22 16:04:31 +02:00
Konstantin Käfer
5a1e4c6b81 [core] implement stretchable icons for icon-text-fit 2020-01-15 15:02:11 +02:00
Konstantin Käfer
027e803b72 [core] move icon rotation from shaping to quad generation to mirror JS 2020-01-15 15:02:11 +02:00
Konstantin Käfer
4b171cccf1 [core] getGlyphQuad -> getGlyphQuads 2020-01-15 15:02:11 +02:00
Konstantin Käfer
d8d336160c [core] add pixelOffset and minFontScale to SymbolQuads 2020-01-15 15:02:11 +02:00
Konstantin Käfer
f82d4e6857 [core] Upgrade shaders and add new vertices to SymbolLayout 2020-01-15 15:02:11 +02:00
Mikhail Pozdnyakov
cc684df736 [core] Handle zero text size
The style specification stipulates that `text-size` values must be positive
(https://docs.mapbox.com/mapbox-gl-js/style-spec/#layout-symbol-text-size).

However, a zero value could be passed to the engine (e.g. as a result of
an expression) this patch handles it and avoids assertion hit in `shaping.cpp`.
2019-12-19 18:09:33 +02:00
Alexander Shalamov
89665326c2 [core] Add unit test for calculateTileDistances 2019-12-09 17:26:13 +02:00
Alexander Shalamov
b6b077d73a [core] Don't use signed int type for anchor segment 2019-12-09 17:26:13 +02:00
Alexander Shalamov
614000256b [core] Shape images in labels at bucket zoom level 2019-12-02 17:11:49 +02:00
Alexander Shalamov
26bf566f53 [core] Use new 'SymbolTextAndIcon' program to draw icons in text 2019-12-02 17:11:49 +02:00
Alexander Shalamov
2c49c4374c [core] Store 'sdf' flag in vertex attribute 2019-12-02 17:11:49 +02:00
Alexander Shalamov
2bb2a40b6d [core] Shape images in labels and create image quads 2019-12-02 17:11:49 +02:00
Alexander Shalamov
f4f652063d [core] Calculate line width and line breaks for images 2019-12-02 17:11:49 +02:00
Alexander Shalamov
34a9bc08ce [core] Pass images and evaluated layout text size to shaping 2019-12-02 17:11:49 +02:00
Alexander Shalamov
a9c3b5a389 [core] Add evaluated images to styled text sections 2019-12-02 17:11:49 +02:00
Alexander Shalamov
c6f3cc8b60 [core] Implement image expression (#15877)
* [core] Bump gl-js version
* [core] Implement image expression
* [core] Use new image expression
* [core] Coerce image expression to / from string
* [core] Serialize evaluated image
* [core] Pass available images to layout
* [core] Pass images to evaluation context
* [core] Set available flag value based on image availability
* [core] Allow image coercion to boolean to indicate image availability
* [core] Coalesce image expression
* [core] Add image expression to next build system
* [core] Align serialization format and evaluated type with gl-js
* [core] Add images to expression evaluation method
* [core] Add support for Image expression to expression test runner
* [core] Unskip image expression tests
* [core] Update unit tests
* [core] Use image expression in annotation manager
* [core] Add string to ImageExpression conversion
* [core] Add image expression to expression dsl
* [core] Convert tokens for implicitly created Image literal
* [core] Fix clang format
* [core] Split generated style code lines that are over 120 characters
* [core] Add unit test for image expression equality
* [core] Add image property expression evaluation unit test
* [core] Unskip image expression render test
* [core] Skip 'in' expression tests
* [core] Ignore fill-pattern/update-feature-state render test
* [core] Rename Image::serialize to Image::toValue
2019-11-11 18:20:01 +02:00
Konstantin Käfer
2187980a87 [core] fix icon-text-fit
This fixes rendering by account for the 1px texture padding around icons that were stretched with icon-text-fit. We've added the 1px padding before, but didn't scale it accordingly when we are resizing the icon when it is stretched to fit the text. Adjusts the code to match the logic in GL JS.
2019-10-14 18:46:12 +02:00
Juha Alanen
6b13c42314 [build] Fix clang format and tidy checks 2019-09-18 14:29:15 +03:00
Juha Alanen
413278ca20 [core] Add feature state support to bucket classes 2019-09-18 14:29:15 +03:00
Mikhail Pozdnyakov
3b5a43c722 [core] Enable text-offset with variable label placement
Port of https://github.com/mapbox/mapbox-gl-js/pull/8642
2019-09-03 11:45:17 +03:00
zmiao
6ef2710e5c [core] fix collisionBox alignment when Icon/text translation is enabled (#15467)
* add initial fix

* fix bug for collision circle

* refind code structure

* fix indentation

* update test

* refind code structure

* Add changelog

* Add comment for boolean
2019-08-30 08:24:03 +03:00
zmiao
c770c23262 [core] fix mixed sdf + non-sdf icon rendering in one layer (#15456)
* [core] fix icon symbol rendring when sdf and non-sdf icon in the same symbol layer

* fix build error

* fix typo

* revert renderableSegment change

* simplify codes

* fix build error

* refine sdf icon flag

* [core] fix mixed sdf + non-sdf icon rendering in one layer

* remove iconstatus getter in stymbol bucket

* fix review findings

* provide bitwise operator for SymbolContent enum

* use MBGL_MBGL_CONSTEXPR

* add one missing update for sdfIcon

* make renderer symbol type as enum
2019-08-26 21:54:59 +03:00
Alexander Shalamov
9ba700fd47 [core] Fix combination of icon-text-fit with text-variable-anchors and text-writing-mode 2019-08-20 12:31:02 +03:00
Thiago Marcos P. Santos
6dfe0e60ca [core] Fix use after std::move detected by clang-tidy
Detected by the bot being setup at
https://github.com/mapbox/mapbox-gl-native/pull/15385.
2019-08-19 13:37:23 +03:00
Alexander Shalamov
1b9d4d792c [core] Render half-width glyphs in upright orientation
This change forces glyphs whose natural orientation in vertical writing
mode is 'sideways' to be rendered in upright orientation (only for non complex
text layouts). This is different compared to W3C / browser behavior that is by
default, renders glyphs in their respective natural orientation.

In the future, there  might need to add a new layout property that would control
glyph orientation separately (e.g., text-glyph-orientation: natural | upright).
2019-08-13 13:32:56 +03:00
Alexander Shalamov
9aa529576f [core] Implement support for "text-writing-mode" layout property 2019-08-13 13:32:56 +03:00
Alexander Shalamov
ac74fc6d00 [core] Release quad data after vertex buffers are created 2019-07-23 15:43:27 +03:00
Mikhail Pozdnyakov
e582a329ef [core] SymbolBacket creates collision buffers optionally
sizeof(SymbolBucket) : 1024 -> 704
2019-07-22 12:23:39 +03:00
Mikhail Pozdnyakov
11bfe23981 [core] Symbol bucket uses shared layout
sizeof(SymbolBucket): 2296 -> 1024
2019-07-22 12:23:39 +03:00
Mikhail Pozdnyakov
7a7192516f [core] Introduce LayerRenderData. Source::update() accepts layer properties. 2019-04-17 17:21:41 +03:00
Mikhail Pozdnyakov
4b21560cf5 [core] Use style::LayerProperties in render layers, buckets and layouts. 2019-04-17 17:21:41 +03:00
Alexander Shalamov
2a169b07e8 [core] Set sortKey for symbol segments during layout phase 2019-04-17 15:04:08 +03:00
Konstantin Käfer
3ceabcd3ec [core] clang-tidy fixes 2019-04-05 11:49:17 +02:00
Mikhail Pozdnyakov
94d8cb4f7f [core] Single line optimization for variable label placement 2019-03-29 16:18:41 +02:00
Mikhail Pozdnyakov
2292623bc6 [core] Introduce variable text placement for point labels - Placement part 2019-03-29 16:18:41 +02:00
Mikhail Pozdnyakov
b39c71eea8 [core] Introduce variable text placement for point labels - Layout part 2019-03-29 16:18:41 +02:00
Alexander Shalamov
8be135231d [core] Add possibility of overriding paint properties inside format expression #14062
* [core] Add format override expression and formatted section to evaluation context

* [core] Add textColor to TaggedString's formatted section

* [core] Add FormatSectionOverrides and introduce overridable properties

* [core] Populate symbol layer paint properties for text sections

* [core] Add benchmark for style that uses text-color override

* [core] Add unit test for FormatOverrideExpression

* [core] Add unit test for FormatSectionOverrides
2019-03-13 17:14:53 +02:00
Konstantin Käfer
f13c2b86e4 [core] unify *Buffer/Vector naming 2019-03-06 16:12:51 +01:00
Konstantin Käfer
cd06b550dd [core] disallow subtyping of gl::Attributes<> and use type aliases instead 2019-03-01 09:33:37 +01:00
Mikhail Pozdnyakov
12295ef335 [core] SymbolBucket: use single map for paint properties data
Obviates unnecessary lookups, improves readability.
2019-01-14 12:53:44 +02:00
Mikhail Pozdnyakov
2bdab82ded [core] shader program must always match bucket in render symbol layer
Before this change, `RenderSymbolLayer` with updated style was trying to render
symbols using the previous bucket (with paint property binders that matched a previous program).

Now, symbol bucket caches the latest corresponding paint properties (caching is happening on
complete tiles only). As a result, `RenderSymbolLayer` always picks the shader program and
its parameters in sync with the obtained bucket.
2019-01-11 11:30:04 +02:00
Alexander Shalamov
05d5edfa74 [core] Remove casts where expected type is part of the contract 2018-11-19 14:06:21 +02:00
Konstantin Käfer
282c71e8e9 [core] unify UTF-8/16 conversion to <boost/locale/encoding_utf.hpp> 2018-10-23 12:23:40 +02:00
Ryan Hamley
0c6b1629ef [Core] Ensure queryRenderedFeatures accounts for icon-rotate (#13105) 2018-10-18 12:14:52 -07:00