Class ScreenMap


  • public class ScreenMap
    extends Object
    The screenmap is a packed bitmap of the screen, one bit per pixels. It can be used to avoid rendering a lot of very small features in the same pixel.

    The screenmap can be used two ways:

    • By working directly against the pixels using checkAndSet(int, int)
    • By working with real world envelopes using checkAndSet(Envelope), in that case the full math transform from data to screen, and the generalization spans must be set
    When checkAndSet returns false the geometry sits in a pixel that has been already populated and can be skipped.
    Author:
    jeichar, Andrea Aime - OpenGeo
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean canSimplify​(Envelope envelope)  
      boolean checkAndSet​(int x, int y)
      Checks if the geometry should be skipped.
      boolean checkAndSet​(Envelope envelope)  
      boolean get​(int x, int y)
      Returns true if the pixel at location x,y is set or out of bounds.
      boolean get​(Envelope envelope)  
      Geometry getSimplifiedShape​(double minx, double miny, double maxx, double maxy, GeometryFactory geometryFactory, Class geometryType)
      Returns geometry suitable for rendering the pixel that has just been occupied.
      Geometry getSimplifiedShape​(Geometry geometry)
      Returns geometry suitable for rendering the pixel that has just been occupied.
      void set​(int x, int y, boolean value)
      Sets location at position x,y to the value.
      void setSpans​(double spanX, double spanY)  
      void setTransform​(MathTransform mt)  
      • Methods inherited from class Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ScreenMap

        public ScreenMap​(int x,
                         int y,
                         int width,
                         int height,
                         MathTransform mt)
      • ScreenMap

        public ScreenMap​(ScreenMap original,
                         int expandBy)
      • ScreenMap

        public ScreenMap​(int x,
                         int y,
                         int width,
                         int height)
    • Method Detail

      • canSimplify

        public boolean canSimplify​(Envelope envelope)
      • setSpans

        public void setSpans​(double spanX,
                             double spanY)
      • checkAndSet

        public boolean checkAndSet​(int x,
                                   int y)
        Checks if the geometry should be skipped. If the test returns true it means the geometry sits in a pixel that has already been used
      • get

        public boolean get​(int x,
                           int y)
        Returns true if the pixel at location x,y is set or out of bounds.
      • getSimplifiedShape

        public Geometry getSimplifiedShape​(Geometry geometry)
        Returns geometry suitable for rendering the pixel that has just been occupied. The geometry is designed to actually fill the pixel
      • getSimplifiedShape

        public Geometry getSimplifiedShape​(double minx,
                                           double miny,
                                           double maxx,
                                           double maxy,
                                           GeometryFactory geometryFactory,
                                           Class geometryType)
        Returns geometry suitable for rendering the pixel that has just been occupied. The geometry is designed to actually fill the pixel
      • set

        public void set​(int x,
                        int y,
                        boolean value)
        Sets location at position x,y to the value.