shp_renderer.events
Class SHPMouseOverShapeHandler

java.lang.Object
  extended by shp_renderer.events.SHPMouseOverShapeHandler
All Implemented Interfaces:
java.awt.event.MouseMotionListener, java.util.EventListener

public class SHPMouseOverShapeHandler
extends java.lang.Object
implements java.awt.event.MouseMotionListener

SHPMouseOverShapeHandler - This class is used for managing the event handling for mouse-overs of territories that we can then hightlight.

Author:
Richard McKenna

Constructor Summary
SHPMouseOverShapeHandler(SHPViewer initViewer)
          The constructor sets up everything for use.
 
Method Summary
 javax.swing.JPanel highlightingInformation(int x, int y)
          This method creates a panel that will display information about the current country the user is hovered over.
 void mouseDragged(java.awt.event.MouseEvent me)
           
 void mouseMoved(java.awt.event.MouseEvent me)
          This method responds to mouse movement by testing to see if the mouse is currently over a shape.
 boolean pointIsInPoly(SHPRenderer renderer, SHPPolygon poly, int x, int y)
          This method tests to see if the (x,y) point is inside one of the parts (polygons) of the poly argument.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SHPMouseOverShapeHandler

public SHPMouseOverShapeHandler(SHPViewer initViewer)
The constructor sets up everything for use.

Method Detail

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent me)
This method responds to mouse movement by testing to see if the mouse is currently over a shape. If it is, that shape is highlighted.

Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener
Parameters:
me - The mouse event, holds all the inforamtion about the mouse.

pointIsInPoly

public boolean pointIsInPoly(SHPRenderer renderer,
                             SHPPolygon poly,
                             int x,
                             int y)
This method tests to see if the (x,y) point is inside one of the parts (polygons) of the poly argument. If it is, true is returned, else false.

Parameters:
renderer - The renderer to get updated.
poly - The polygon to test.
x - The x location.
y - The y location.

highlightingInformation

public javax.swing.JPanel highlightingInformation(int x,
                                                  int y)
This method creates a panel that will display information about the current country the user is hovered over.

Parameters:
x - The x location.
y - The y location.
Returns:
A Panel that has all the information about the country hovered over.

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent me)
Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener