Class NFERenderer<V extends NFEGeoObject>

    • Field Detail

      • geoObjects

        protected java.util.Map<java.lang.String,​V extends NFEGeoObject> geoObjects
      • lastViewportTransform

        protected java.awt.geom.AffineTransform lastViewportTransform
      • lastDataWindow

        protected java.awt.geom.Rectangle2D lastDataWindow
      • hoverColor

        protected java.awt.Color hoverColor
      • hoverBorderColor

        protected java.awt.Color hoverBorderColor
      • simpleStroke

        protected java.awt.Stroke simpleStroke
      • hoverStroke

        protected java.awt.Stroke hoverStroke
      • boundaryColor

        protected java.awt.Color boundaryColor
      • nontargetAnimatedStroke

        protected AnimatedStroke nontargetAnimatedStroke
      • textDefaultFont

        protected java.awt.Font textDefaultFont
      • textDefaultColor

        protected java.awt.Color textDefaultColor
      • editable

        protected boolean editable
      • imageOpacityAlpha

        protected float imageOpacityAlpha
      • refreshRegionQueue

        protected java.util.concurrent.PriorityBlockingQueue<java.awt.geom.Rectangle2D> refreshRegionQueue
    • Constructor Detail

      • NFERenderer

        public NFERenderer​(MapCanvas canvas)
        Constructor called from a subclass constructor. It initializes the basic renderer state.
        Parameters:
        canvas - the MapCanvas where the layer will be rendered
    • Method Detail

      • getScreenTolerance

        protected double getScreenTolerance()
      • getTolerance

        public double getTolerance()
        Gets the screen tolerance converted to the model's coordinate system
        Returns:
        the tolerance value or zero if it is not specified or could not be converted
      • findTier

        protected NFERenderer.Tier findTier​(java.lang.String name)
        Gets the tier identified by the given name
        Parameters:
        name - the tier's name
        Returns:
        a tier or null if none was found
      • sortTiers

        protected void sortTiers()
        Sorts tiers by its z order in an ascending way
      • refresh

        public void refresh()
        Refreshes the current data window
      • refresh

        public void refresh​(java.awt.geom.Rectangle2D dataWindow)
        Refreshes the data window at the given area
        Parameters:
        dataWindow - a region to be refreshed
      • renderTiers

        protected void renderTiers​(java.awt.Graphics2D graphics,
                                   java.awt.geom.AffineTransform transform)
        Renders all the layer's tiers using the given graphics and affine transform
        Parameters:
        graphics - a graphics object
        transform - the affine transform used
      • renderTier

        protected void renderTier​(NFERenderer.Tier tier,
                                  java.awt.Graphics2D graphics,
                                  java.awt.geom.AffineTransform transform)
        Renders the given tier
        Parameters:
        tier - a tier to be rendered
        graphics - a graphics object
        transform - the affine transform used
      • renderHoveredObjects

        protected void renderHoveredObjects​(java.awt.Graphics2D graphics,
                                            java.awt.geom.AffineTransform transform)
        Renders the currently hovered GeoObjects
        Parameters:
        graphics - a graphics object
        transform - the affine transform used
      • renderHoveredObject

        protected void renderHoveredObject​(V hoverShape,
                                           java.awt.Graphics2D graphics,
                                           java.awt.geom.AffineTransform transform)
      • renderSelectedObjects

        protected void renderSelectedObjects​(java.awt.Graphics2D graphics,
                                             java.awt.geom.AffineTransform transform)
      • renderHoveredShape

        protected void renderHoveredShape​(V geoObj,
                                          java.awt.Shape shape,
                                          java.awt.Graphics2D graphics,
                                          java.awt.geom.AffineTransform transform)
      • renderHoveredPoint

        protected void renderHoveredPoint​(java.awt.geom.Point2D point,
                                          java.awt.Graphics2D graphics)
      • renderGeoObjects

        protected void renderGeoObjects​(NFERenderer.Tier tier,
                                        java.awt.geom.Area area,
                                        java.awt.Graphics2D graphics,
                                        java.awt.geom.AffineTransform transform)
      • renderGeoObject

        protected void renderGeoObject​(V geoObj,
                                       java.awt.Graphics2D graphics,
                                       java.awt.geom.AffineTransform transform)
      • renderGeoObject

        protected void renderGeoObject​(V geoObj,
                                       oracle.sdovis.style.Style style,
                                       java.awt.Graphics2D graphics,
                                       java.awt.geom.AffineTransform transform)
      • containsTag

        protected boolean containsTag​(java.lang.String tag)
      • containsTag

        protected boolean containsTag​(Layer layer,
                                      java.lang.String tag)
      • getImageOpacityAlpha

        public float getImageOpacityAlpha()
        Gets the opacity
        Returns:
        the opacity value
      • setImageOpacityAlpha

        public void setImageOpacityAlpha​(float imageOpacityAlpha)
        Sets the opacity for the layer's rendered images
        Parameters:
        imageOpacityAlpha - the opacity value
      • addContextualMenuHandler

        public void addContextualMenuHandler​(ContextualMenuHandler contextualMenuHandler)
        Add a contextual menu handler
        Parameters:
        contextualMenuHandler - contextual menu handler
      • removeContextualMenuHandler

        public void removeContextualMenuHandler​(ContextualMenuHandler contextualMenuHandler)
        Remove a contextual menu handler
        Parameters:
        contextualMenuHandler - contextual menu handler
      • renderGeoObjLabel

        protected void renderGeoObjLabel​(java.awt.Graphics2D g,
                                         java.awt.geom.AffineTransform transform,
                                         V geoObj,
                                         java.lang.String label,
                                         java.awt.Font font,
                                         java.awt.Color color)
      • getGeoObject

        public V getGeoObject​(java.lang.String key)
        Gets the GeoObject identified by the given key
        Parameters:
        key - a GeoObject's key
        Returns:
        a GeoObject or null if it was not found
      • getGeoObjects

        protected abstract java.util.Collection<V> getGeoObjects​(java.awt.geom.Point2D point,
                                                                 int granularity)
        Gets all the GeoObjects interacting with the given point
        Parameters:
        point - a spatial point in screen coordinate system
        granularity -
        Returns:
        a collection containing all the GeoObjects interacting with the point
      • getGeoObjects

        protected abstract java.util.Collection<V> getGeoObjects​(java.awt.geom.Rectangle2D rect)
        Gets all the GeoObjects interacting with the given rectangle
        Parameters:
        rect - a rectangle in screen coordinate system
        Returns:
        a collection containing all the GeoObjects interacting with the rectangle
      • getGeoObjects

        protected abstract java.util.Collection<V> getGeoObjects​(java.awt.geom.Area area)
        Gets all the GeoObjects interacting with the given area
        Parameters:
        area - an area in screen coordinate system
        Returns:
        a collection containing all the GeoObjects interacting with the area
      • getGeoObjectStyle

        protected abstract oracle.sdovis.style.Style getGeoObjectStyle​(V geoObj)
        Gets the style used for rendering the GeoObject
        Parameters:
        geoObj - a GeoObject
        Returns:
        the GeoObject's style
      • belongsToTier

        protected abstract boolean belongsToTier​(V geoObj,
                                                 java.lang.String tierName)
        Tells whether the GeoObject is rendered by the given tier
        Parameters:
        geoObj - a layer's GeoObject
        tierName - a tier name
        Returns:
        true if the GeoObject is rendered by (belongs to) the given tier
      • isVisible

        protected abstract boolean isVisible​(V geoObj)
        Tells whether the GeoObject is visible
        Parameters:
        geoObj - a layer's GeoObject
        Returns:
        true if the GeoObject is visible
      • isSelected

        public boolean isSelected​(GeoObject obj)
        Description copied from interface: SelectableLayer
        Checks if an object is selected
        Specified by:
        isSelected in interface SelectableLayer
        Returns:
        true if the provided object is selected
      • clearSelection

        public boolean clearSelection()
        Description copied from interface: SelectableLayer
        Clears all selected objects
        Specified by:
        clearSelection in interface SelectableLayer
        Returns:
        true if changes where made
      • numSelected

        public int numSelected()
        Description copied from interface: SelectableLayer
        Returns the number of selected objects
        Specified by:
        numSelected in interface SelectableLayer
        Returns:
        the number of selected objects
      • getSelection

        public java.util.List<GeoObject> getSelection​(GeoObject obj)
        Description copied from interface: SelectableLayer
        Returns selected objects that are children of the provided objects GeoObject's isSubElementOf() determines if an object is children of another object
        Specified by:
        getSelection in interface SelectableLayer
        Returns:
      • setSelection

        public boolean setSelection​(java.util.List<GeoObject> selectedGeoObjects)
        Description copied from interface: SelectableLayer
        Clears selection before setting the provided objects as selected
        Specified by:
        setSelection in interface SelectableLayer
        Returns:
      • select

        public boolean select​(java.util.List<GeoObject> objs)
        Description copied from interface: SelectableLayer
        Adds the provided objects to the selection list
        Specified by:
        select in interface SelectableLayer
        Returns:
      • unselect

        public boolean unselect​(java.util.List<GeoObject> objs)
        Description copied from interface: SelectableLayer
        Removes the provided objects from the selection list
        Specified by:
        unselect in interface SelectableLayer
        Returns:
      • stateChanged

        public void stateChanged​(javax.swing.event.ChangeEvent event)
        Specified by:
        stateChanged in interface javax.swing.event.ChangeListener
      • setHover

        public boolean setHover​(java.util.List<GeoObject> objs)
        Description copied from interface: HoverableLayer
        A list of geo-objects being hovered
        Specified by:
        setHover in interface HoverableLayer
        Returns:
        true if the objects were hovered
      • clearHover

        public boolean clearHover()
        Description copied from interface: HoverableLayer
        Removes the hovering state from all the geo-objects
        Specified by:
        clearHover in interface HoverableLayer
        Returns:
      • numHovered

        public int numHovered()
        Description copied from interface: HoverableLayer
        Returns the number of geo-objects that are being hovered
        Specified by:
        numHovered in interface HoverableLayer
        Returns:
      • getSnapPoint

        public oracle.sdovis.edit.util.JGeometrySegmentPoint getSnapPoint​(java.lang.Object key,
                                                                          java.awt.geom.Point2D point,
                                                                          double tolerance)
      • clear

        public void clear()
        Description copied from interface: Layer
        Clears all contents of this layer.
        Specified by:
        clear in interface Layer
        Overrides:
        clear in class BasicLayer
      • handleEvent

        public boolean handleEvent​(java.util.EventObject evt)
        Description copied from interface: Layer
        The main method that performs event handling for this tool. Returns whether the event should be propagated to other layers down stream (further down the layer stack) after the event has been handled.
        Specified by:
        handleEvent in interface Layer
        Overrides:
        handleEvent in class BasicLayer
      • update

        public void update​(long elapsedTime)
        Description copied from interface: Layer
        updates the contents data model or structure.
        Specified by:
        update in interface Layer
        Overrides:
        update in class BasicLayer
        Parameters:
        elapsedTime - The elapsed time since last update.
      • getObject

        public V getObject​(java.lang.Object key)
        Description copied from interface: GeoObjectLayer
        Gets the GeoObject corresponding to the provided key
        Specified by:
        getObject in interface GeoObjectLayer
        Returns:
      • hitTest

        public java.util.List<GeoObject> hitTest​(int x,
                                                 int y,
                                                 int granularity)
        Description copied from interface: Layer
        Performs a hit test for the given mouse location (x,y). All the geo-objects that pass the hit test will be returned.
        Specified by:
        hitTest in interface Layer
        Overrides:
        hitTest in class BasicLayer
        Parameters:
        x - mouse location x
        y - mouse location y
        Returns:
        a list of features that pass the hit test; if no feature passes the hit test, the list is empty.
      • hitTest

        public java.util.List<GeoObject> hitTest​(java.awt.geom.Rectangle2D mbr,
                                                 int granularity)
        Description copied from interface: Layer
        Performs a hit test for the given rectangle. All the geo-objects that are either inside or intersect the rectangle will be returned.
        Specified by:
        hitTest in interface Layer
        Overrides:
        hitTest in class BasicLayer
        Parameters:
        mbr - the test rectangle, in device coordinates
        Returns:
        a list of features that pass the box hit test; if no feature passes the hit test, the list is empty.
      • mapRegionChanged

        public void mapRegionChanged​(MapRegionEvent e)
        Description copied from interface: Layer
        When the associated canvas's map region is changed, this method is called to notify the layer of the change. Note that either a device window change (as a result of resizing the application window) or a data window change can cause this method to be invoked. Query the canvas' MapRegion object to get the changed values. Inside a mapRegionChanged() implementation, the layer typically needs to update its data contents accordingly.
        Specified by:
        mapRegionChanged in interface Layer
        Overrides:
        mapRegionChanged in class BasicLayer
      • render

        public long render​(java.awt.Graphics2D graphics)
        Description copied from interface: Layer
        Renders the layer contents to the given Graphics.
        Specified by:
        render in interface Layer
        Overrides:
        render in class BasicLayer
        Parameters:
        graphics - the graphics object
        Returns:
        the rendering time in milliseconds.
      • refreshAsync

        protected void refreshAsync()
      • refreshAsync

        protected void refreshAsync​(java.awt.geom.Rectangle2D region)