LEONARDI Application Composer - 8.9.0.40 by W4 S.A.

leon.view.win.swing
Class LySwingMapRegion

java.lang.Object
  extended by leon.view.graphic.LyGraphicalObject
      extended by leon.view.win.swing.LySwingObject
          extended by leon.view.win.swing.LySwingMapObject
              extended by leon.view.win.swing.LySwingMapRegion
All Implemented Interfaces:
LyGetIdInterface, LyGraphicalComponent, LyGraphicalMapRegion, LyViewComponent, LyFreeInterface, LySetHiddenInterface, LySetSelectedInterface, LySwingComponent, leon.view.win.swing.map.LyMapElement

public class LySwingMapRegion
extends LySwingMapObject
implements LyGraphicalMapRegion, leon.view.win.swing.map.LyMapElement

This class implements the Map region object (as described in the dtd) for swing viewer.

A region allows to display on a map a graphical element made up of a finite set of points. These points define polygons that are displayed on the map with a given color. These elements follow the zooms made on the map (their size increases or decreases when zooming in or out).

See Also:
LyMapRegion

Field Summary
static java.lang.String __VERSION
           
static int SHADOW_OFFSET
          Offset for region shadow.
 
Fields inherited from interface leon.view.win.swing.map.LyMapElement
NORMAL_MODE, REDUCED_MODE
 
Constructor Summary
LySwingMapRegion(LyMapRegion mapRegion)
          Class constructor of a Map region object for the Swing target.
 
Method Summary
 void addMapRegion(LyMapRegion mapRegion, int pos)
          Don't do anything in this implementation.
 void draw(leon.view.win.swing.map.LyAbstractMapComponentManager map, java.awt.Graphics g, int mode)
          Draws the map region.
 void drawInViewer(leon.view.win.swing.map.LyAbstractMapComponentManager map, java.awt.Graphics g)
          (non-Javadoc).
 void drawMouseOverTooltip(leon.view.win.swing.map.LyAbstractMapComponentManager map, java.awt.Graphics g)
          Draws this map region's mouse over tooltip (for a treemap layout only).
 Ly3DBox getBoundingBox(leon.view.win.swing.map.LyAbstractMapComponentManager map)
          Gets the bounding box of this map region.
 java.awt.Rectangle getBoundingRectangle(leon.view.win.swing.map.LyAbstractMapComponentManager map)
          Gets the bounding rectangle of this map region.
 java.awt.Shape getClippingArea(leon.view.win.swing.map.LyAbstractMapComponentManager map, java.awt.Image image)
          Gets the clipping area of this region.
 java.lang.String getId()
          (non-Javadoc).
 java.awt.Image[] getImages()
          This map region component does not use any images.
 java.lang.String getLabel()
          Gets the label of this map region.
 int getLayer()
          (non-Javadoc).
 java.util.Vector<LyPoint> getPoints()
          Gets the points of all the polygon elements in the map.
 java.lang.String getTooltip()
          Gets the tooltip of this map region.
 boolean isAtPosition(leon.view.win.swing.map.LyAbstractMapComponentManager map, java.awt.Graphics g, int x, int y)
          (non-Javadoc).
 boolean isHidden()
          (non-Javadoc).
 boolean isMouseOver()
          Indicates whether the moue is over this region or not.
 boolean isOverlay()
          This map region has the overlay property if it is selected.
 boolean isSelected()
          (non-Javadoc).
 boolean isSensitive()
          (non-Javadoc).
 void removeMapRegion(LyMapRegion mapRegion)
          Don't do anything in this implementation.
 void setContent()
          Sets the content of this component and initializes its default colors and fonts.
 void setHidden(boolean hidden)
          (non-Javadoc).
 void setLabelFrame(java.awt.Rectangle rect)
          Sets the position of the label frame.
 void setMouseOver(boolean mouseOver, int x, int y)
          Sets the mouse over mode.
 void setSelected(boolean selected)
          (non-Javadoc).
 void setSmallImage(java.lang.String smallImage)
          A map region doesn't handle small images.
 void setSmallImageTooltip(java.lang.String tooltip)
          A map region doesn't handle tooltips for its small images.
 void setWeight(float weight)
          A map region doesn't handle weight.
 void translate(float dx, float dy, float dz)
          A map region doesn't handle translations.
 
Methods inherited from class leon.view.win.swing.LySwingObject
getBounds, getChildrenBounds, getComponent, getDefaultFrame
 
Methods inherited from class leon.view.graphic.LyGraphicalObject
expand, free, getController, getEnv, getEnvironment, getIdCode, getIntResource, getMessage, getMessage, getResource, getString, getString, getString, getViewComponent, getViewManager, isFreed, isFreeing, isImageAnimated, processDemand, processDemand, testResource, translate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface leon.view.graphic.LyGraphicalComponent
free, getViewComponent
 

Field Detail

__VERSION

public static final java.lang.String __VERSION
See Also:
Constant Field Values

SHADOW_OFFSET

public static final int SHADOW_OFFSET
Offset for region shadow.

See Also:
Constant Field Values
Constructor Detail

LySwingMapRegion

public LySwingMapRegion(LyMapRegion mapRegion)
Class constructor of a Map region object for the Swing target.

Parameters:
mapRegion - a MAP_REGION component defined for every type of view targets. This map region is initialized for the swing view and its attributes are given default values.
Method Detail

setContent

public void setContent()
Sets the content of this component and initializes its default colors and fonts.


setMouseOver

public void setMouseOver(boolean mouseOver,
                         int x,
                         int y)
Sets the mouse over mode.

Parameters:
mouseOver - true if map region must be active, false otherwise
x - the x coordinate of the mouse
y - the y coordinate of the mouse

getImages

public java.awt.Image[] getImages()
This map region component does not use any images.

Specified by:
getImages in interface leon.view.win.swing.map.LyMapElement
Returns:
null

draw

public void draw(leon.view.win.swing.map.LyAbstractMapComponentManager map,
                 java.awt.Graphics g,
                 int mode)
Draws the map region.

Specified by:
draw in interface leon.view.win.swing.map.LyMapElement
Parameters:
map - the map to draw
g - the graphical context
mode - the drawing mode
See Also:
draw(LyAbstractMapComponentManager, Graphics, int, boolean, int), LyMapElement.draw(leon.view.win.swing.map.LyAbstractMapComponentManager, java.awt.Graphics, int)

drawMouseOverTooltip

public void drawMouseOverTooltip(leon.view.win.swing.map.LyAbstractMapComponentManager map,
                                 java.awt.Graphics g)
Draws this map region's mouse over tooltip (for a treemap layout only).

Parameters:
map - the treemap layout to draw its tooltip
g - the graphics context

drawInViewer

public void drawInViewer(leon.view.win.swing.map.LyAbstractMapComponentManager map,
                         java.awt.Graphics g)
(non-Javadoc).

Specified by:
drawInViewer in interface leon.view.win.swing.map.LyMapElement
Parameters:
map - the map
g - the graphical context
See Also:
LyMapElement.drawInViewer(leon.view.win.swing.map.LyAbstractMapComponentManager, java.awt.Graphics)

getBoundingBox

public Ly3DBox getBoundingBox(leon.view.win.swing.map.LyAbstractMapComponentManager map)
Gets the bounding box of this map region. If the region has no point, the resulting bounding box occupies the total space available.

Specified by:
getBoundingBox in interface leon.view.win.swing.map.LyMapElement
Parameters:
map - the map manager
Returns:
the bounding box of this region
See Also:
LyMapElement.getBoundingBox(leon.view.win.swing.map.LyAbstractMapComponentManager)

getBoundingRectangle

public java.awt.Rectangle getBoundingRectangle(leon.view.win.swing.map.LyAbstractMapComponentManager map)
Gets the bounding rectangle of this map region. If the region has no point, the resulting bounding rectangle occupies the total space available.

Specified by:
getBoundingRectangle in interface leon.view.win.swing.map.LyMapElement
Parameters:
map - the map manager
Returns:
the bounding rectangle of this region
See Also:
LyMapElement.getBoundingRectangle(leon.view.win.swing.map.LyAbstractMapComponentManager)

getClippingArea

public java.awt.Shape getClippingArea(leon.view.win.swing.map.LyAbstractMapComponentManager map,
                                      java.awt.Image image)
Gets the clipping area of this region.

Specified by:
getClippingArea in interface leon.view.win.swing.map.LyMapElement
Parameters:
map - the map manager
image - the image to clip. This image is not used in this implementation.
Returns:
the bounding rectangle of the map manager.
See Also:
getBoundingRectangle(LyAbstractMapComponentManager), LyMapElement.getClippingArea(LyAbstractMapComponentManager, Image)

getLayer

public int getLayer()
(non-Javadoc).

Specified by:
getLayer in interface leon.view.win.swing.map.LyMapElement
Returns:
the layer number
See Also:
LyMapElement.getLayer()

getLabel

public java.lang.String getLabel()
Gets the label of this map region. Use a cache to avoid many calls to the translate method.

Specified by:
getLabel in interface leon.view.win.swing.map.LyMapElement
Returns:
the label text
See Also:
LyMapElement.getLabel()

getTooltip

public java.lang.String getTooltip()
Gets the tooltip of this map region. If the mouse is over this map region, the returned value is null and it is managed in the draw method.

Specified by:
getTooltip in interface leon.view.win.swing.map.LyMapElement
Returns:
the tooltip text
See Also:
LyMapElement.getTooltip()

isMouseOver

public boolean isMouseOver()
Indicates whether the moue is over this region or not.

Returns:
true if the mouse is over this region

isAtPosition

public boolean isAtPosition(leon.view.win.swing.map.LyAbstractMapComponentManager map,
                            java.awt.Graphics g,
                            int x,
                            int y)
(non-Javadoc).

Specified by:
isAtPosition in interface leon.view.win.swing.map.LyMapElement
Parameters:
map - the map
g - the graphical context
x - the x coordinate
y - the y coordinate
Returns:
true if this element is at the specified point in the map, false otherwise
See Also:
LyMapElement.isAtPosition(leon.view.win.swing.map.LyAbstractMapComponentManager, java.awt.Graphics, int, int)

getId

public java.lang.String getId()
(non-Javadoc).

Specified by:
getId in interface LyGetIdInterface
See Also:
LyGetIdInterface.getId()

setSelected

public void setSelected(boolean selected)
(non-Javadoc).

Specified by:
setSelected in interface LyGraphicalMapRegion
Specified by:
setSelected in interface LySetSelectedInterface
Specified by:
setSelected in interface leon.view.win.swing.map.LyMapElement
Parameters:
selected - Boolean indicating if attribute selected is set or unset.
See Also:
LySetSelectedInterface.setSelected(boolean)

isSelected

public boolean isSelected()
(non-Javadoc).

Specified by:
isSelected in interface leon.view.win.swing.map.LyMapElement
Returns:
true if this element is selected, false otherwise
See Also:
LyMapElement.isSelected()

setSmallImageTooltip

public void setSmallImageTooltip(java.lang.String tooltip)
A map region doesn't handle tooltips for its small images. This method don't do anything with the given tooltip text.

Specified by:
setSmallImageTooltip in interface LyGraphicalMapRegion
Parameters:
tooltip - Not used in this implementation.
See Also:
LyGraphicalMapRegion.setSmallImageTooltip(java.lang.String)

setWeight

public void setWeight(float weight)
A map region doesn't handle weight. This method don't do anything with the given weight value.

Specified by:
setWeight in interface LyGraphicalMapRegion
Parameters:
weight - Not used in this implementation.
See Also:
LyGraphicalMapRegion.setWeight(float)

setSmallImage

public void setSmallImage(java.lang.String smallImage)
A map region doesn't handle small images. This method don't do anything with the given small image name.

Specified by:
setSmallImage in interface LyGraphicalMapRegion
Parameters:
smallImage - Not used in this implementation.
See Also:
LyGraphicalMapRegion.setSmallImage(String)

translate

public void translate(float dx,
                      float dy,
                      float dz)
A map region doesn't handle translations. This method don't do anything with the given displacement values.

Specified by:
translate in interface leon.view.win.swing.map.LyMapElement
Parameters:
dx - Not used in this implementation.
dy - Not used in this implementation.
dz - Not used in this implementation.
See Also:
LyMapElement.translate(float, float, float)

isHidden

public boolean isHidden()
(non-Javadoc).

Specified by:
isHidden in interface leon.view.win.swing.map.LyMapElement
Returns:
true if this element is hidden, false otherwise
See Also:
LyMapElement.isHidden()

setHidden

public void setHidden(boolean hidden)
(non-Javadoc).

Specified by:
setHidden in interface LyGraphicalMapRegion
Specified by:
setHidden in interface LySetHiddenInterface
Parameters:
hidden - Boolean indicating if attribute hidden is set or unset.
See Also:
LySetHiddenInterface.setHidden(boolean)

isOverlay

public boolean isOverlay()
This map region has the overlay property if it is selected.

Specified by:
isOverlay in interface leon.view.win.swing.map.LyMapElement
Returns:
true if it is overlay, false otherwise
See Also:
LyMapElement.isOverlay()

addMapRegion

public void addMapRegion(LyMapRegion mapRegion,
                         int pos)
Don't do anything in this implementation.

Specified by:
addMapRegion in interface LyGraphicalMapRegion
Parameters:
mapRegion - a map region, not used
pos - the position of the added map region, not used
See Also:
LyGraphicalMapRegion.addMapRegion(LyMapRegion, int)

removeMapRegion

public void removeMapRegion(LyMapRegion mapRegion)
Don't do anything in this implementation.

Specified by:
removeMapRegion in interface LyGraphicalMapRegion
Parameters:
mapRegion - a map region, not used
See Also:
LyGraphicalMapRegion.removeMapRegion(LyMapRegion)

isSensitive

public boolean isSensitive()
(non-Javadoc).

Specified by:
isSensitive in interface leon.view.win.swing.map.LyMapElement
Returns:
true if this element is sensitive, false otherwise
See Also:
LyMapElement.isSensitive()

setLabelFrame

public void setLabelFrame(java.awt.Rectangle rect)
Sets the position of the label frame.

Parameters:
rect - a rectangle that define the borders of the label frame

getPoints

public java.util.Vector<LyPoint> getPoints()
Gets the points of all the polygon elements in the map.

Returns:
the points of all the elements of the map

(c) January 2013 - W4 S.A.

Website: W4 S.A., contact us: support@w4global.com