Class Marker

java.lang.Object
dev.avelar.mapnik.Marker

public final class Marker extends Object
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
 
  • Method Details

    • inspect

      public static Marker inspect(Path file, boolean strict)
      Read the file. Throws MapnikException if it is missing or is not an SVG or image Mapnik can read. With strict, 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 (see Logging).
    • inspect

      public static Marker inspect(Path file)
      As inspect(Path, boolean), not strict.
    • inspectSvg

      public static Marker inspectSvg(String svg, boolean strict)
      As inspect(Path, boolean) for SVG text held in memory.
    • kind

      public Marker.Kind kind()
    • bounds

      public Box2d 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 the width attribute of an SVG. It can differ from width().
    • declaredHeight

      public double declaredHeight()
    • toString

      public String toString()
      Overrides:
      toString in class Object