/** * Maps {@link #getIconOffset()} to a {@link Displacement} * * <p>(Optional) Defaults to 0,0. Requires icon-image. Offset distance of icon from its anchor. * Positive values indicate right and down, while negative values indicate left and up. When * combined with icon-rotate the offset will be as if the rotated direction was up. */ public Displacement iconOffsetDisplacement() { return parse.displacement( layout, "icon-offset", sf.displacement(ff.literal(0), ff.literal(0))); }
/** * Maps {@link #getTextOffset()} to a {@link Displacement}. * * <p>(Optional) Units in ems. Defaults to 0,0. Requires text-field. */ public Displacement textOffsetDisplacement() { return parse.displacement( layout, "text-offset", sf.displacement(ff.literal(0), ff.literal(0))); }
/** * Maps {@link #getIconTranslate()} to a {@link Displacement} * * <p>(Optional) Units in pixels. Defaults to 0,0. Requires icon-image. Distance that the icon's * anchor is moved from its original placement. Positive values indicate right and down, while * negative values indicate left and up. */ public Displacement iconTranslateDisplacement() { return parse.displacement( paint, "icon-translate", sf.displacement(ff.literal(0), ff.literal(0))); }
/** * Maps {@link #getTextTranslate()} to a {@link Displacement}. * * <p>Distance that the text's anchor is moved from its original placement. Positive values * indicate right and down, while negative values indicate left and up. (Optional) Units in * pixels. Defaults to 0,0. Requires text-field. */ public Displacement textTranslateDisplacement() { return parse.displacement( paint, "text-translate", sf.displacement(ff.literal(0), ff.literal(0))); }
/** * Maps {@link #getLineTranslate()} to a {@link Displacement}. * * <p>(Optional) The geometry's offset. Values are [x, y] where negatives indicate left and up, * respectively. * * <p>Units in pixels. Defaults to 0,0. * * @return The geometry's offset, as a Displacement. */ public Displacement lineTranslateDisplacement() { return parse.displacement( paint, "line-translate", sf.displacement(ff.literal(0), ff.literal(0))); }
/** * Processes the filter-translate into a Displacement. * * <p>This should handle both literals and function stops: * * <pre> * filter-translate: [0,0] * filter-translate: { property: "building-height", "stops": [[0,[0,0]],[5,[1,2]]] } * filter-translate: [ 0, { property: "building-height", "TYPE":"exponential","stops": [[0,0],[30, 5]] } * </pre> * * @return */ public Displacement circleTranslateDisplacement() { return parse.displacement( paint, "circle-translate", sf.displacement(ff.literal(0), ff.literal(0))); }
/** * Processes the filter-translate into a Displacement. * * <p>This should handle both literals and function stops: * * <pre> * filter-translate: [0,0] * filter-translate: { property: "building-height", "stops": [[0,[0,0]],[5,[1,2]]] } * filter-translate: [ 0, { property: "building-height", "TYPE":"exponential","stops": [[0,0],[30, 5]] } * </pre> * * @return The geometry displacement */ public Displacement fillTranslateDisplacement() { return parse.displacement( paint, "fill-translate", sf.displacement(ff.literal(0), ff.literal(0))); }
} else if (defn instanceof JSONArray) { JSONArray array = (JSONArray) defn; return sf.displacement(number(array, 0, 0), number(array, 1, 0)); } else if (defn instanceof JSONObject) { return sf.displacement(xFn, yFn); } else { throw new MBFormatException(