Class MapOverview

java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
org.gvsig.fmap.mapcontrol.MapControl
org.gvsig.app.project.documents.view.MapOverview
All Implemented Interfaces:
ComponentListener, ImageObserver, MenuContainer, Serializable, EventListener, org.gvsig.fmap.mapcontext.events.listeners.ViewPortListener, org.gvsig.tools.dispose.Disposable, org.gvsig.tools.observer.Observer

public class MapOverview extends org.gvsig.fmap.mapcontrol.MapControl implements org.gvsig.fmap.mapcontext.events.listeners.ViewPortListener

Lightweight MapControl that uses another MapControl's MapContext, and updates any rectangular extent selected, to the associated MapControl.

Both MapControl instances work in the same projection. And, always, the not undefined adjusted extent of the associated one, will be enhanced as a red-bordered grey-filled rectangle in this one. Furthermore, draws a horizontal and vertical this component's width or height, black lines centered in that rectangle.

Author:
FJP
See Also:
  • Constructor Details

    • MapOverview

      public MapOverview(org.gvsig.fmap.mapcontrol.MapControl mapAssoc)

      Creates a MapOverview instance associated to mapAssoc.

      Parameters:
      mapAssoc - MapControl this component will be the overview
  • Method Details

    • getAssociatedMapContext

      public org.gvsig.fmap.mapcontext.MapContext getAssociatedMapContext()
      See Also:
      • MapControl.getMapContext()
    • getAssociatedMapControl

      public org.gvsig.fmap.mapcontrol.MapControl getAssociatedMapControl()

      Gets the MapControl instance that wrappers.

      Returns:
      the MapControl instance that wrappers
    • extentChanged

      public void extentChanged(org.gvsig.fmap.mapcontext.events.ExtentEvent evExtent)
      Specified by:
      extentChanged in interface org.gvsig.fmap.mapcontext.events.listeners.ViewPortListener
    • refreshExtent

      public void refreshExtent()

      If this had no extent, calls

      invalid reference
      #delModel()
      , otherwise recalculates this component's view port extent as the union of all extents of all layers of this map.

    • refreshOverView

      public void refreshOverView(org.gvsig.fmap.geom.primitive.Envelope r)

      Repaints this component updating its extent.

      Parameters:
      r - the new extent
    • paintComponent

      protected void paintComponent(Graphics g)

      Paints this component's graphical information using a 8-bit RGBA color double buffer, drawing a red-bordered grey-filled rectangle enhancing the extent selected, and a horizontal and vertical this component's width or height, black lines centered in that rectangle.

      Overrides:
      paintComponent in class org.gvsig.fmap.mapcontrol.MapControl
    • setModel

      public void setModel(org.gvsig.fmap.mapcontext.MapContext model)

      Sets a MapContext to this component, configuring it to manage view port events produced in the associated MapControl and this one's view port.

      This MapContext's projection will be the same as the associated MapControl's one.

      Setting the model includes the following steps:

      • 1.- set model as the MapContext of this.
      • 2.- set as model projection, the associated MapControl's projection.
      • 3.- set this as view port listener of the associated MapControl's view port.
      • 4.- set this as view port listener of this MapContext's view port

      Parameters:
      model - data to set
    • backColorChanged

      public void backColorChanged(org.gvsig.fmap.mapcontext.events.ColorEvent e)

      Removes this component as listener of the the associated MapControl and this one's view port. Besides, removes the extent.

      Specified by:
      backColorChanged in interface org.gvsig.fmap.mapcontext.events.listeners.ViewPortListener
    • projectionChanged

      public void projectionChanged(org.gvsig.fmap.mapcontext.events.ProjectionEvent e)
      Specified by:
      projectionChanged in interface org.gvsig.fmap.mapcontext.events.listeners.ViewPortListener
      See Also:
      • ViewPortListener.projectionChanged(ProjectionEvent)
      • MapControl.setProjection(Projection)
    • setProjection

      public void setProjection(org.gvsig.crs.projection.lib.Projection proj)

      Unimplemented.

      Can't change the projection, because must be the same as the one of the associated MapControl instance.

      Overrides:
      setProjection in class org.gvsig.fmap.mapcontrol.MapControl
    • calculateSnapPoint

      public void calculateSnapPoint(Point point)