You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
buckets should be allowed to specify more than one format #244
Currently, buckets specify one output format: a line, fill, point, text.
I think buckets should specify multiple formats, for example:
{
"line": { "linecap": "round" },
"fill": true
}
Buckets are instructions for selecting features and converting them to a renderable format. You may want multiple formats for the same group of features. These formats can impact each other. If both fills and lines will be drawn for a feature it would be good to avoid duplicating data in the vertex buffers. If text and points need to be placed together, they need to be processed together. Adding multiple formats to one bucket, instead of making separate buckets for each format lets us handle these things.
Since buckets would have more than one possible rendering, the style would need specify a type. Either
{
"type": "line",
"color": "#000"
}
To draw an outline, you'd have two layers, one for the outline and one for the fill.
Or you could prefix everything, which is a bit more ambiguous (what order are they drawn in?) and it adds two ways of doing things, but is less verbose.
Since you're going to have two separate classes anyway, why not create two separate buckets with the same filters? Specifically, what does "If text and points need to be placed together, they need to be processed together." mean?
To handle placement for text and points/shields together
not yet implemented
For example, you want to place a label together with an icon/shield, and only show either of them when both of them can be shown. This means placement and collision detection needs to happen together for both features. How would we process them together if they were in separate buckets?
To avoid duplicating data
Ideally:
If we want just fills: a line vertex buffer (for gl.LINE_STRIP) and an element buffer for fills
If we want just lines: a triangulated vertex buffer (for gl.TIRANGLE_STRIP)
If we want lines and fills: a triangulated vertex buffer (for gl.TRIANGLE_STRIP) and an element buffer for fills
If we have two separate buckets (one for lines, one for fills), how can we avoid adding the vertices to the buffer twice in two different formats? Or does it not matter that much if we do duplicate the data?
I can follow 1), but 2) seems a little weird to me: We have a clear distinction between fills and lines, and drawing either one as another type doesn't make much sense? If we're drawing fills, we're drawing a 1px outline too that feeds off the same buffer, so there is no vertex duplication here. The only duplication would occur if you wanted to draw fill outlines as something other than a 1px line.
The only duplication would occur if you wanted to draw fill outlines as something other than a 1px line.
Yeah, this was what I was trying to say. I think this use might be fairly common.
Any use of line patterns would require a second, duplicated bucket. I ran into that a lot when making this: https://hey.mapbox.com/board/tech/webgl-pencil.gif . If we expose the fade distance for lines (currently 1 pixel for antialiasing) we could use lines with soft edges instead of blurring in many cases (vector terrain, building shadows). Having fills + wide lines is probably fairly common, and the duplication could be significant for layers with many vertices (buildings).
but, after sleeping on it:
I'm going to forget about this for now. Its not that important. I'll see how things are when I start on 1). thanks
Activity
kkaefer commentedon Jan 27, 2014
Since you're going to have two separate classes anyway, why not create two separate buckets with the same filters? Specifically, what does "If text and points need to be placed together, they need to be processed together." mean?
ansis commentedon Jan 27, 2014
I'm seeing two reasons:
To handle placement for text and points/shields together
not yet implemented
For example, you want to place a label together with an icon/shield, and only show either of them when both of them can be shown. This means placement and collision detection needs to happen together for both features. How would we process them together if they were in separate buckets?
To avoid duplicating data
Ideally:
If we want just fills: a line vertex buffer (for gl.LINE_STRIP) and an element buffer for fills
If we want just lines: a triangulated vertex buffer (for gl.TIRANGLE_STRIP)
If we want lines and fills: a triangulated vertex buffer (for gl.TRIANGLE_STRIP) and an element buffer for fills
If we have two separate buckets (one for lines, one for fills), how can we avoid adding the vertices to the buffer twice in two different formats? Or does it not matter that much if we do duplicate the data?
kkaefer commentedon Jan 28, 2014
I can follow 1), but 2) seems a little weird to me: We have a clear distinction between fills and lines, and drawing either one as another type doesn't make much sense? If we're drawing fills, we're drawing a 1px outline too that feeds off the same buffer, so there is no vertex duplication here. The only duplication would occur if you wanted to draw fill outlines as something other than a 1px line.
ansis commentedon Jan 28, 2014
Yeah, this was what I was trying to say. I think this use might be fairly common.
Any use of line patterns would require a second, duplicated bucket. I ran into that a lot when making this: https://hey.mapbox.com/board/tech/webgl-pencil.gif . If we expose the fade distance for lines (currently 1 pixel for antialiasing) we could use lines with soft edges instead of blurring in many cases (vector terrain, building shadows). Having fills + wide lines is probably fairly common, and the duplication could be significant for layers with many vertices (buildings).
but, after sleeping on it:
I'm going to forget about this for now. Its not that important. I'll see how things are when I start on 1). thanks
Merge pull request mapbox#244 from mapbox/make-tests-work