Package dev.avelar.mapnik
Class Marker
java.lang.Object
dev.avelar.mapnik.Marker
What Mapnik makes of an SVG or image file used as a marker or a point symbol: whether it can read it, and how big
it is. Use it to check a marker before putting it in a style, for example a file a user uploaded, and to size a
legend entry.
Marker m = Marker.inspect(Paths.get("pin.svg"));
m.width(); // pixels (SVG user units) the symbol takes before any scaling
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionbounds()The area the drawing covers, in the file's own units.doubledoubleThe width the file declares, such as thewidthattribute of an SVG.doubleheight()static MarkerAsinspect(Path, boolean), not strict.static MarkerRead the file.static MarkerinspectSvg(String svg, boolean strict) Asinspect(Path, boolean)for SVG text held in memory.kind()toString()doublewidth()The width of the drawing: of what is drawn for an SVG, of the picture for an image.
-
Method Details
-
inspect
Read the file. ThrowsMapnikExceptionif it is missing or is not an SVG or image Mapnik can read. Withstrict, an SVG with a colour, path, size, style or gradient Mapnik cannot read is refused as well, instead of drawn without it. Elements it does not know at all are skipped either way. The exception does not say which part was wrong; Mapnik's log does (seeLogging). -
inspect
Asinspect(Path, boolean), not strict. -
inspectSvg
Asinspect(Path, boolean)for SVG text held in memory. -
kind
-
bounds
The area the drawing covers, in the file's own units. -
width
public double width()The width of the drawing: of what is drawn for an SVG, of the picture for an image. -
height
public double height() -
declaredWidth
public double declaredWidth()The width the file declares, such as thewidthattribute of an SVG. It can differ fromwidth(). -
declaredHeight
public double declaredHeight() -
toString
-