Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GEOT-6494] MBStyle extension #2743

Merged
merged 11 commits into from
Feb 13, 2020
Next Next commit
cleaning up javadoc warnings
Signed-off-by: Jody Garnett <jody.garnett@gmail.com>
  • Loading branch information
jodygarnett committed Feb 8, 2020
commit dc46d3d4db6818d0d9aa32979eebb94feb0935a3
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ public String getGlyphs() {
/**
* Data source specifications.
*
* @see {@link MBSource} and its subclasses.
* @see MBSource
* @return Map of data source name -> {@link MBSource} instances.
*/
public Map<String, MBSource> getSources() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public Expression colorRGBA() {

/**
* Returns a four-element array containing the input color's red, green, blue, and alpha
* components, in that order. Example: ["to-rgba", color]: array<number, 4>
* components, in that order. Example: ["to-rgba", color]: array&lt;number, 4&gt;
*
* @return
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ public MBRampsScalesCurves(JSONArray json) {
* Produces continuous, smooth results by interpolating between pairs of input and output values
* ("stops"). The input may be any numeric expression (e.g., ["get", "population"]). Stop inputs
* must be numeric literals in strictly ascending order. The output type must be number,
* array<number>, or color. Example: ["interpolate", interpolation: ["linear"] | ["exponential",
* base] | ["cubic-bezier", x1, y1, x2, y2 ], input: number, stop_input_1: number,
* stop_output_1: OutputType, stop_input_n: number, stop_output_n: OutputType, ... ]: OutputType
* (number, array<number>, or Color)"
* array&lt;number&gt;, or color. Example: ["interpolate", interpolation: ["linear"] |
* ["exponential", base] | ["cubic-bezier", x1, y1, x2, y2 ], input: number, stop_input_1:
* number, stop_output_1: OutputType, stop_input_n: number, stop_output_n: OutputType, ... ]:
* OutputType (number, array&lt;number&gt;, or Color)"
*
* @return
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ public MBTypes(JSONArray json) {
* Asserts that the input is an array (optionally with a specific item type and length). If,
* when the input expression is evaluated, it is not of the asserted type, then this assertion
* will cause the whole expression to be aborted. Example: ["array", value]: array ["array",
* type: "string" | "number" | "boolean", value]: array<type> ["array", type: "string" |
* "number" | "boolean", N: number (literal), value ]: array<type, N>
* type: "string" | "number" | "boolean", value]: array&lt;type&gt; ["array", type: "string" |
* "number" | "boolean", N: number (literal), value ]: array&lt;type, N&gt;
*
* @return
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ protected SemanticType defaultSemanticType() {
* (Optional) Circle radius in pixels. Defaults to 5.
*
* @return The circle radius
* @throws MBFormatException
* @throws MBFormatException JSON provided does conform to specification
*/
public Number getCircleRadius() throws MBFormatException {
return parse.optional(Double.class, paint, "circle-radius", 5.0);
Expand All @@ -80,7 +80,7 @@ public Number getCircleRadius() throws MBFormatException {
* Access circle-radius as literal or function expression, defaults to 5
*
* @return The circle radius as literal or function expression
* @throws MBFormatException
* @throws MBFormatException JSON provided does conform to specification
*/
public Expression circleRadius() throws MBFormatException {
return parse.percentage(paint, "circle-radius", 5);
Expand All @@ -90,7 +90,7 @@ public Expression circleRadius() throws MBFormatException {
* (Optional) The fill color of the circle. Defaults to #000000.
*
* @return The fill color of the circle
* @throws MBFormatException
* @throws MBFormatException JSON provided does conform to specification
*/
public Color getCircleColor() throws MBFormatException {
return parse.optional(Color.class, paint, "circle-color", Color.BLACK);
Expand All @@ -100,7 +100,7 @@ public Color getCircleColor() throws MBFormatException {
* Access circle-color as literal or function expression, defaults to black.
*
* @return The circle color as literal or function expression
* @throws MBFormatException
* @throws MBFormatException JSON provided does conform to specification
*/
public Expression circleColor() throws MBFormatException {
return parse.color(paint, "circle-color", Color.BLACK);
Expand All @@ -111,7 +111,7 @@ public Expression circleColor() throws MBFormatException {
* full opacity. Defaults to 0.
*
* @return The amount to blur the circle.
* @throws MBFormatException
* @throws MBFormatException JSON provided does conform to specification
*/
public Number getCircleBlur() throws MBFormatException {
return parse.optional(Double.class, paint, "circle-blur", 0.0);
Expand All @@ -121,7 +121,7 @@ public Number getCircleBlur() throws MBFormatException {
* Access circle-blur as literal or function expression, defaults to 0
*
* @return The amount to blur the circle, as literal or function expression
* @throws MBFormatException
* @throws MBFormatException JSON provided does conform to specification
*/
public Expression circleBlur() throws MBFormatException {
return parse.percentage(paint, "circle-blur", 0);
Expand All @@ -131,7 +131,7 @@ public Expression circleBlur() throws MBFormatException {
* (Optional) The opacity at which the circle will be drawn. Defaults to 1.
*
* @return The opacity at which the circle will be drawn.
* @throws MBFormatException
* @throws MBFormatException JSON provided does conform to specification
*/
public Number getCircleOpacity() throws MBFormatException {
return parse.optional(Double.class, paint, "circle-opacity", 1.0);
Expand All @@ -141,7 +141,7 @@ public Number getCircleOpacity() throws MBFormatException {
* Access circle-opacity, defaults to 1.
*
* @return The opacity at which the circle will be drawn as literal or function expression.
* @throws MBFormatException
* @throws MBFormatException JSON provided does conform to specification
*/
public Expression circleOpacity() throws MBFormatException {
return parse.percentage(paint, "circle-opacity", 1);
Expand All @@ -152,7 +152,7 @@ public Expression circleOpacity() throws MBFormatException {
* respectively. Units in pixels. Defaults to 0, 0.
*
* @return x and y offset in pixels.
* @throws MBFormatException
* @throws MBFormatException JSON provided does conform to specification
*/
public int[] getCircleTranslate() throws MBFormatException {
return parse.array(paint, "circle-translate", new int[] {0, 0});
Expand All @@ -162,7 +162,7 @@ public int[] getCircleTranslate() throws MBFormatException {
* Access circle-translate
*
* @return x and y offset in pixels as Point
* @throws MBFormatException
* @throws MBFormatException JSON provided does conform to specification
*/
public Point circleTranslate() throws MBFormatException {
int[] circleTranslate = getCircleTranslate();
Expand Down Expand Up @@ -253,7 +253,7 @@ public CirclePitchScale getCirclePitchScale() {
* <p>Units in pixels. Defaults to 0.
*
* @return The circle stroke width.
* @throws MBFormatException
* @throws MBFormatException JSON provided does conform to specificationthrows
*/
public Number getCircleStrokeWidth() throws MBFormatException {
return parse.optional(Double.class, paint, "circle-stroke-width", 0.0);
Expand All @@ -263,7 +263,7 @@ public Number getCircleStrokeWidth() throws MBFormatException {
* Access circle-stroke-width, defaults to 0.
*
* @return The circle stroke width.
* @throws MBFormatException
* @throws MBFormatException JSON provided does conform to specification
*/
public Expression circleStrokeWidth() throws MBFormatException {
return parse.percentage(paint, "circle-stroke-width", 0);
Expand All @@ -275,7 +275,7 @@ public Expression circleStrokeWidth() throws MBFormatException {
* <p>Defaults to #000000.
*
* @return The color of the circle stroke.
* @throws MBFormatException
* @throws MBFormatException JSON provided does conform to specification
*/
public Color getCircleStrokeColor() throws MBFormatException {
return parse.optional(Color.class, paint, "circle-stroke-color", Color.BLACK);
Expand All @@ -285,7 +285,7 @@ public Color getCircleStrokeColor() throws MBFormatException {
* Access circle-stroke-color as literal or function expression, defaults to black.
*
* @return The color of the circle stroke.
* @throws MBFormatException
* @throws MBFormatException JSON provided does conform to specification
jodygarnett marked this conversation as resolved.
Show resolved Hide resolved
*/
public Expression circleStrokeColor() throws MBFormatException {
return parse.color(paint, "circle-stroke-color", Color.BLACK);
Expand All @@ -297,7 +297,7 @@ public Expression circleStrokeColor() throws MBFormatException {
* <p>Defaults to 1.
*
* @return Number representing the stroke opacity.
* @throws MBFormatException
* @throws MBFormatException JSON provided does conform to specification
*/
public Number getCircleStrokeOpacity() throws MBFormatException {
return parse.optional(Double.class, paint, "circle-stroke-opacity", 1.0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public LineJoin getLineJoin() {
*
* <p>Since piecewise constant functions is supported a {@link RecodeFunction} may be generated.
*
* @return Expression for {@link Stroke#getLineJoin()()} use.
* @return Expression for {@link Stroke#getLineJoin()} use.
*/
public Expression lineJoin() {
return parse.enumToExpression(layout, "line-join", LineJoin.class, LineJoin.MITER);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ public Alignment getTextRotationAlignment() {
* Converts {@link #getTextRotationAlignment()} to a GeoTools expression.
*
* @return A GeoTools expression that evaluates to "map", "viewport", or "auto".
* @see {@link #getTextRotationAlignment()}}.
* @see #getTextRotationAlignment()
*/
public Expression textRotationAlignment() {
return parse.enumToExpression(
Expand Down Expand Up @@ -976,7 +976,7 @@ public Justification getTextJustify() {
* Converts {@link #getTextJustify()} to a GeoTools expression. Returns an expression that
* evaluates to one of "left", "right", or "center".
*
* @see {@link #getTextJustify()}
* @see #getTextJustify()
*/
public Expression textJustify() {
return parse.enumToExpression(
Expand Down Expand Up @@ -1027,7 +1027,7 @@ public TextAnchor getTextAnchor() {
* evaluates to one of "center", "left", or "right", "top", "bottom", "top_left", "top_right",
* "bottom_left", "bottom_right".
*
* @see {@link #getTextAnchor()}
* @see #getTextAnchor()
*/
public Expression textAnchor() {
return parse.enumToExpression(layout, "text-anchor", TextAnchor.class, TextAnchor.CENTER);
Expand Down Expand Up @@ -1199,7 +1199,7 @@ public boolean hasTextTransform() {
* Converts {@link #getTextTransform()} to a GeoTools expression. Returns an expression that
* evaluates to one of "uppercase", "lowercase", "none".
*
* @see {@link #getTextTransform()}
* @see #getTextTransform()
*/
public Expression textTransform() {
return parse.enumToExpression(
Expand Down Expand Up @@ -1356,7 +1356,7 @@ public Expression iconOpacity() throws MBFormatException {
*
* <p>The color of the icon. This can only be used with sdf icons.
*
* @link Color of the icon.
* <p>return Color of the icon.
*/
public Color getIconColor() {
return parse.optional(Color.class, paint, "icon-color", Color.BLACK);
Expand All @@ -1365,7 +1365,7 @@ public Color getIconColor() {
/**
* Access icon-color as literal or function expression, defaults to black.
*
* @link Color of the icon.
* @return Color of the icon as an Expression
*/
public Expression iconColor() {
return parse.color(paint, "icon-color", Color.BLACK);
Expand Down Expand Up @@ -1501,7 +1501,7 @@ public TranslateAnchor getIconTranslateAnchor() {
* Converts {@link #getIconTranslateAnchor()} to a GeoTools expression. Returns an expression
* that evaluates to one of "map", "viewport".
*
* @see {@link #getIconTranslateAnchor()}
* @see #getIconTranslateAnchor()
*/
public Expression iconTranslateAnchor() {
return parse.enumToExpression(
Expand Down Expand Up @@ -1691,7 +1691,7 @@ public TranslateAnchor getTextTranslateAnchor() {
* Converts {@link #getTextTranslateAnchor()} to a GeoTools expression. Returns an expression
* that evaluates to one of "map", "viewport".
*
* @see {@link #getTextTranslateAnchor()}
* @see #getTextTranslateAnchor()
*/
public Expression textTranslateAnchor() {
return parse.enumToExpression(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* Wrapper around a {@link JSONObject} holding a Mapbox GeoJSON source. Data must be provided via a
* "data" property, whose value can be a URL or inline GeoJSON.
*
* @see {@link MBSource}
* @see MBSource
* @see <a
* href="https://www.mapbox.com/mapbox-gl-js/style-spec/#sources-geojson">https://www.mapbox.com/mapbox-gl-js/style-spec/#sources-geojson</a>
*/
Expand All @@ -37,7 +37,11 @@ public GeoJsonMBSource(JSONObject json, MBObjectParser parser) {
super(json, parser);
}

/** (Optional) A URL to a GeoJSON file, or inline GeoJSON. */
/**
* (Optional) A URL to a GeoJSON file, or inline GeoJSON.
*
* @return GeoJSON to draw, either inline or a URL.
*/
public Object getData() {
return json.get("data");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ public static MBSource create(JSONObject json, MBObjectParser parser) {
"Mapbox source \"type\" is required and must be one of: vector, raster, geojson, image, video, or canvas.");
}

/** Must be one of "vector", "raster", "geojson", "image", "video", "canvas" */
/**
* Type of source.
*
* @return One of "vector", "raster", "geojson", "image", "video", "canvas".
*/
public abstract String getType();
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* Wrapper around a {@link JSONObject} holding a Mapbox raser source. Tiled sources (vector and
* raster) must specify their details in terms of the TileJSON specification.
*
* @see {@link MBSource}
* @see MBSource
* @see <a
* href="https://www.mapbox.com/mapbox-gl-js/style-spec/#sources-raster">https://www.mapbox.com/mapbox-gl-js/style-spec/#sources-raster</a>
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* Wrapper around a {@link JSONObject} holding a tiled Mapbox source. Tiled sources (vector and
* raster) must specify their details in terms of the TileJSON specification.
*
* @see {@link MBSource}
* @see MBSource
* @see <a
* href="https://www.mapbox.com/mapbox-gl-js/style-spec/#sources">https://www.mapbox.com/mapbox-gl-js/style-spec/#sources</a>
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
*
* <p>Note that this factory expects the {@link MBStyleTransformer} to produce {@link
* ExternalGraphic} instances with slightly modified URLs using one of the following forms: <code>
* {baseUrl}#{iconName}</code> <code>{baseUrl}#icon={iconName}&size={sizeMultiplier}</code>
* {baseUrl}#{iconName}</code> <code>{baseUrl}#icon={iconName}&amp;size={sizeMultiplier}</code>
*
* <p>Only the baseUrl is used to retrieve the sprite sheet (at {baseUrl}.png) and sprite index (at
* {baseUrl}.json). The iconName (required) is then used by this factory to select the correct icon
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public MBStyleTransformer(MBObjectParser parse) {
* Graphic referencing the full URL of the image for consumption by the {@link
* SpriteGraphicFactory}. (The format of the image will be {@link SpriteGraphicFactory#FORMAT}).
*
* @see {@link SpriteGraphicFactory} for more information.
* @see org.geotools.mbstyle.sprite.SpriteGraphicFactory
* @param iconName The name of the icon inside the spritesheet.
* @param iconSize The size (scale multiplier) to apply to the icon. (Nullable).
* @param styleContext The style context in which to resolve the icon name to the full sprite
Expand Down Expand Up @@ -113,7 +113,7 @@ public ExternalGraphic createExternalGraphicForSprite(
* Graphic referencing the full URL of the image for consumption by the {@link
* SpriteGraphicFactory}. (The format of the image will be {@link SpriteGraphicFactory#FORMAT}).
*
* @see {@link SpriteGraphicFactory} for more information.
* @see SpriteGraphicFactory
* @param iconName The name of the icon inside the spritesheet.
* @param styleContext The style context in which to resolve the icon name to the full sprite
* URL (for consumption by the {@link SpriteGraphicFactory}).
Expand Down