GeoTools
  1. GeoTools
  2. GEOT-2906

Enabling renderers to paint polygon fills and SVGs as vectors + paint marks with arbitrary sizes

    Details

    • Type: New Feature New Feature
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.6.0
    • Fix Version/s: 2.6.2
    • Component/s: render
    • Labels:
      None

      Description

      A patch is provided that covers some limitations found in the current renderers (Shapefile and Streaming) as of 2.6.0. It follows discussions from thread http://www.mail-archive.com/geotools-devel@lists.sourceforge.net/msg18546.html

      The limitations and corrections are the following:

      1. Currently, some elements are always rendered as raster images: polygon fills are drawn as an AWT raster-based TexturePaint, and SVG ExternalGraphics are converted to images in SLDStyleFactory. In this way, rendering GeoTools maps on Graphics other than the screen (e.g., Batik's SVGGraphics and Graphics for printing) gives outputs of limited quality. In order to solve this, a rendering hint can now be provided to enable "vector rendering", so that polygon fills are painted directly to the target Graphics and SVGs are not converted to images. This is evidently slower, so if the hint is not provided, everything still works as usual.

      2. Marks are currently always assumed to be square (usually 1x1). This patch also adds the capability of rendering marks with shapes of arbitrary sizes. As such, shapes with rectangular dimensions of any size are now supported. A separate patch will be provided that makes use of this capability to add new shapes (such as hatches with arbitrary angles)

      I am also attaching a PDF file that gives an idea of what we can do now with these features (and the quality of the output). It contains hatches with different angle values (green one is 45 degrees, black ones are 110) and SVG files rendered as vectors.

        Issue Links

          Activity

          Hide
          Milton Jonathan added a comment -
          There are a number of implementation issues and decisions that can be discussed here:
          1. A new GlyphStyle2D class was introduced, for representing Style2D objects that can be rendered by a GlyphRenderer. This is used to allow SVG ExternalGraphics to be rendered directly to the target Graphics

          2. In order to render marks of arbitrary sizes, its shape's bounds are now queried. However, in some cases the shape's exact bounds as defined by its coordinates may be inadequate (e.g., for a mark with a single "dot" in the middle, we would like to paint a polygon fill considering an area bigger that a single coordinate!). Because of that, an "ExplicitBoundsShape" decorator class is provided so that shape bounds can be explicitly defined (and hence be bigger than the area occupied by the shape's coordinates).

          3. In order to correctly paint a MarkStyle2D (and now a GlyphStyle2D), we need a PathIterator of the shape being rendered. However, LiteShape2.getPathIterator() does not work for this, and current practice is to instantiate a GeomCollectionIterator (see code in StyledShapePainter.paint()). Could this code actually be used in LiteShape2.getPathIterator()?
          Show
          Milton Jonathan added a comment - There are a number of implementation issues and decisions that can be discussed here: 1. A new GlyphStyle2D class was introduced, for representing Style2D objects that can be rendered by a GlyphRenderer. This is used to allow SVG ExternalGraphics to be rendered directly to the target Graphics 2. In order to render marks of arbitrary sizes, its shape's bounds are now queried. However, in some cases the shape's exact bounds as defined by its coordinates may be inadequate (e.g., for a mark with a single "dot" in the middle, we would like to paint a polygon fill considering an area bigger that a single coordinate!). Because of that, an "ExplicitBoundsShape" decorator class is provided so that shape bounds can be explicitly defined (and hence be bigger than the area occupied by the shape's coordinates). 3. In order to correctly paint a MarkStyle2D (and now a GlyphStyle2D), we need a PathIterator of the shape being rendered. However, LiteShape2.getPathIterator() does not work for this, and current practice is to instantiate a GeomCollectionIterator (see code in StyledShapePainter.paint()). Could this code actually be used in LiteShape2.getPathIterator()?
          Andrea Aime made changes -
          Field Original Value New Value
          Link This issue is depended upon by GEOS-3792 [ GEOS-3792 ]
          Hide
          Andrea Aime added a comment -
          Last patch applied on both 2.6.x and trunk
          Show
          Andrea Aime added a comment - Last patch applied on both 2.6.x and trunk
          Andrea Aime made changes -
          Status Open [ 1 ] Closed [ 6 ]
          Resolution Fixed [ 1 ]
          Fix Version/s 2.6.2 [ 16075 ]

            People

            • Assignee:
              Andrea Aime
              Reporter:
              Milton Jonathan
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: