Class BasicLayer

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void added​(java.lang.Object source)
      The function called when the layer is added to either a MapCanvas or an EditSession (typically both, MapCanvas first, EditSession later)
      void addPropertyChangeListener​(java.beans.PropertyChangeListener listener)  
      void addPropertyChangeListener​(java.lang.String propertyName, java.beans.PropertyChangeListener listener)  
      void clear()
      Clears all contents of this layer.
      void fromXMLElement​(org.w3c.dom.Element element)
      Loads the content from an XML representation
      MapCanvas getCanvas()
      Gets the map canvas that this layer is displayed on.
      java.awt.geom.Rectangle2D getDataMBR()
      Always return null here.
      java.awt.geom.Rectangle2D getFullExtent()  
      javax.swing.Icon getIcon()  
      java.lang.String getName()
      Gets the name of the layer.
      java.util.Properties getProperties()  
      java.lang.String getProperty​(java.lang.String key)  
      java.lang.String getProperty​(java.lang.String key, java.lang.String defaultValue)  
      java.beans.PropertyChangeListener[] getPropertyChangeListeners()  
      java.beans.PropertyChangeListener[] getPropertyChangeListeners​(java.lang.String propertyName)  
      java.lang.String getProviderID()
      Returns the provider ID
      int getSRID()
      Gets the SRID of the Layer, 0 if it doesn't have an associated SRID
      boolean handleEvent​(java.util.EventObject evt)
      The main method that performs event handling for this tool.
      protected void handleTheEvent​(java.util.EventObject evt)  
      java.util.List<GeoObject> hitTest​(int x, int y, int granularity)
      Performs a hit test for the given mouse location (x,y).
      java.util.List<GeoObject> hitTest​(java.awt.geom.Rectangle2D box, int granularity)
      Performs a hit test for the given rectangle.
      protected boolean isMyEvent​(java.util.EventObject evt)  
      boolean isVisible()
      Checks whether this layer is currently visible.
      void mapRegionChanged​(MapRegionEvent e)
      When the associated canvas's map region is changed, this method is called to notify the layer of the change.
      protected boolean propagateEvent​(java.util.EventObject evt)  
      void removed​(java.lang.Object source)
      The function called when the layer is removed from either a MapCanvas or an EditSession (typically both, MapCanvas first, EditSession later)
      void removePropertyChangeListener​(java.beans.PropertyChangeListener listener)  
      void removePropertyChangeListener​(java.lang.String propertyName, java.beans.PropertyChangeListener listener)  
      long render​(java.awt.Graphics2D g)
      Renders the layer contents to the given Graphics.
      void repaint()
      Tells the layer to repaint itself immediately.
      void setCanvas​(MapCanvas canvas)
      Sets the map canvas on which this layer is displayed.
      protected void setMyCursor​(int x, int y)  
      void setName​(java.lang.String name)
      Sets the name for this layer.
      java.lang.String setProperty​(java.lang.String key, java.lang.String value)  
      void setProviderID​(java.lang.String providerID)
      Sets the provider ID
      void setSRID​(int srid)
      Sets the SRID of the Layer
      void setVisible​(boolean v)
      Sets the visibility of this layer.
      org.w3c.dom.Element toXMLElement()
      Returns an XML representation of the layer
      void update​(long elapsedTime)
      updates the contents data model or structure.
      • Methods inherited from class java.lang.Object

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

      • BasicLayer

        public BasicLayer​(MapCanvas canvas)
    • Method Detail

      • getIcon

        public javax.swing.Icon getIcon()
        Specified by:
        getIcon in interface Layer
      • toXMLElement

        public org.w3c.dom.Element toXMLElement()
        Description copied from interface: Layer
        Returns an XML representation of the layer
        Specified by:
        toXMLElement in interface Layer
        Returns:
      • fromXMLElement

        public void fromXMLElement​(org.w3c.dom.Element element)
        Description copied from interface: Layer
        Loads the content from an XML representation
        Specified by:
        fromXMLElement in interface Layer
      • getName

        public java.lang.String getName()
        Description copied from interface: Layer
        Gets the name of the layer.
        Specified by:
        getName in interface Layer
        Returns:
        the name
      • setName

        public void setName​(java.lang.String name)
        Sets the name for this layer.
        Specified by:
        setName in interface Layer
        Parameters:
        name - the name of the layer
      • isVisible

        public boolean isVisible()
        Description copied from interface: Layer
        Checks whether this layer is currently visible.
        Specified by:
        isVisible in interface Layer
        Returns:
      • setVisible

        public void setVisible​(boolean v)
        Description copied from interface: Layer
        Sets the visibility of this layer.
        Specified by:
        setVisible in interface Layer
      • getProperty

        public java.lang.String getProperty​(java.lang.String key)
        Specified by:
        getProperty in interface PropertySupport
      • getProperty

        public java.lang.String getProperty​(java.lang.String key,
                                            java.lang.String defaultValue)
        Specified by:
        getProperty in interface PropertySupport
      • setProperty

        public java.lang.String setProperty​(java.lang.String key,
                                            java.lang.String value)
        Specified by:
        setProperty in interface PropertySupport
      • addPropertyChangeListener

        public void addPropertyChangeListener​(java.lang.String propertyName,
                                              java.beans.PropertyChangeListener listener)
        Specified by:
        addPropertyChangeListener in interface PropertySupport
      • getPropertyChangeListeners

        public java.beans.PropertyChangeListener[] getPropertyChangeListeners​(java.lang.String propertyName)
        Specified by:
        getPropertyChangeListeners in interface PropertySupport
      • removePropertyChangeListener

        public void removePropertyChangeListener​(java.lang.String propertyName,
                                                 java.beans.PropertyChangeListener listener)
        Specified by:
        removePropertyChangeListener in interface PropertySupport
      • clear

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

        public MapCanvas getCanvas()
        Description copied from interface: Layer
        Gets the map canvas that this layer is displayed on.
        Specified by:
        getCanvas in interface Layer
      • setCanvas

        public void setCanvas​(MapCanvas canvas)
        Description copied from interface: Layer
        Sets the map canvas on which this layer is displayed.
        Specified by:
        setCanvas in interface Layer
      • 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
      • handleTheEvent

        protected void handleTheEvent​(java.util.EventObject evt)
      • setMyCursor

        protected void setMyCursor​(int x,
                                   int y)
      • isMyEvent

        protected boolean isMyEvent​(java.util.EventObject evt)
      • propagateEvent

        protected boolean propagateEvent​(java.util.EventObject evt)
      • 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
        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 box,
                                                 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
        Parameters:
        box - 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.
      • render

        public long render​(java.awt.Graphics2D g)
        Description copied from interface: Layer
        Renders the layer contents to the given Graphics.
        Specified by:
        render in interface Layer
        Parameters:
        g - the graphics object
        Returns:
        the rendering time in milliseconds.
      • 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
      • update

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

        public void repaint()
        Description copied from interface: Layer
        Tells the layer to repaint itself immediately. Typically called when a layer's rendering uses a buffered image, and that image might be in an inconsistent state or should be updated.
        Specified by:
        repaint in interface Layer
      • getSRID

        public int getSRID()
        Description copied from interface: Layer
        Gets the SRID of the Layer, 0 if it doesn't have an associated SRID
        Specified by:
        getSRID in interface Layer
        Returns:
      • setSRID

        public void setSRID​(int srid)
        Description copied from interface: Layer
        Sets the SRID of the Layer
        Specified by:
        setSRID in interface Layer
      • getDataMBR

        public java.awt.geom.Rectangle2D getDataMBR()
        Always return null here.
        Specified by:
        getDataMBR in interface Layer
      • getFullExtent

        public java.awt.geom.Rectangle2D getFullExtent()
        Specified by:
        getFullExtent in interface Layer
      • added

        public void added​(java.lang.Object source)
        Description copied from interface: Layer
        The function called when the layer is added to either a MapCanvas or an EditSession (typically both, MapCanvas first, EditSession later)
        Specified by:
        added in interface Layer
      • removed

        public void removed​(java.lang.Object source)
        Description copied from interface: Layer
        The function called when the layer is removed from either a MapCanvas or an EditSession (typically both, MapCanvas first, EditSession later)
        Specified by:
        removed in interface Layer
      • getProviderID

        public java.lang.String getProviderID()
        Description copied from interface: Layer
        Returns the provider ID
        Specified by:
        getProviderID in interface Layer
        Returns:
      • setProviderID

        public void setProviderID​(java.lang.String providerID)
        Description copied from interface: Layer
        Sets the provider ID
        Specified by:
        setProviderID in interface Layer