deegree 2.5 (2011/06/29 09:44 build-8-official)

org.deegree.graphics
Class MapView

java.lang.Object
  extended by org.deegree.graphics.MapView

public class MapView
extends java.lang.Object

This interface describes the data model of the map itself. It is built from themes containing DisplayElements to be rendered. Themes can be added and removed. Existing themes can be re-arragned by changing their order.

Version:
$Revision: 18195 $, $Date: 2009-06-18 17:55:39 +0200 (Do, 18 Jun 2009) $
Author:
Andreas Poth, Markus Schneider, last edited by: $Author: mschneider $

Constructor Summary
protected MapView(java.lang.String name, Envelope boundingbox, CoordinateSystem crs, double pixelsize)
           
protected MapView(java.lang.String name, Envelope boundingbox, double pixelsize)
           
 
Method Summary
 void activateTheme(Theme theme)
          activates a theme.
 void addEventController(MapEventController obj)
          adds an eventcontroller to the MapView that's responsible for handling events that targets the map.
 void addHighlighter(Highlighter highlighter)
          A Highlighter is a class that is responsible for managing the highlight capabilities for one or more Themes.
 void addOptimizer(Optimizer optimizer)
          Adds an Optimizer.
 void addSelector(Selector obj)
          A selector is a class that offers methods for selecting and de-selecting single DisplayElements or groups of DisplayElements.
 void addTheme(Theme theme)
          adds a theme to the MapView
 void clear()
          removes all themes from the MapView.
 void enableTheme(Theme theme, boolean enable)
          enables or disables a theme that is part of the MapView.
 Theme[] getAllThemes()
          returns the Themes in correct order.
 Envelope getBoundingBox()
          returns the BoundingBox (Envelope) of the MapView.
 CoordinateSystem getCoordinatesSystem()
          returns the coordinate reference system of the MapView
 java.lang.String getName()
          returns the name of the map
 Optimizer[] getOptimizers()
          Returns the Optimizers.
 GeoTransform getProjection()
          Returns the GeoTransform that is associated to this MapView.
 double getScale()
          Returns the current scale of the MapView.
 double getScale(java.awt.Graphics g)
          Returns the current scale of the MapView.
 int getSize()
          returns the amount of themes within the MapView.
 Theme getTheme(int index)
          returns the Theme that matches the submitted index
 Theme getTheme(java.lang.String name)
          returns the Theme that matches the submitted name
 boolean isThemeActivated(Theme theme)
          returns true if the passed theme is the one that is set to be activated
 boolean isThemeEnabled(Theme theme)
          returns true if the passed theme is set to be enabled
 void moveDown(Theme theme)
          move a theme down for one index position (index = oldindex - 1)
 void moveUp(Theme theme)
          move a theme up for one index position (index = oldindex + 1)
 void paint(java.awt.Graphics g)
          renders the map to the passed graphic context
 void paintHighlighted(java.awt.Graphics g)
          renders the features marked as highlighted of all themes contained within the MapView
 void paintSelected(java.awt.Graphics g)
          renders the features marked as selected of all themes contained within the MapView
 void removeEventController(MapEventController obj)
           
 void removeHighlighter(Highlighter highlighter)
           
 void removeSelector(Selector obj)
           
 void removeTheme(int index)
          removes the theme that matches the submitted index from the MapView
 void removeTheme(java.lang.String name)
          removes the theme that matches the submitted name from the MapView
 void removeTheme(Theme theme)
          removes a theme from the MapView
 void setBoundingBox(Envelope boundingbox)
           
 void setCoordinateSystem(CoordinateSystem crs)
          sets the coordinate reference system of the map;
 void setOptimizers(Optimizer[] optimizers)
          Sets the Optimizers.
 void swapThemes(Theme first, Theme second)
          swaps the positions of the submitted themes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MapView

protected MapView(java.lang.String name,
                  Envelope boundingbox,
                  double pixelsize)
           throws UnknownCRSException
Parameters:
name -
boundingbox -
pixelsize -
Throws:
UnknownCRSException

MapView

protected MapView(java.lang.String name,
                  Envelope boundingbox,
                  CoordinateSystem crs,
                  double pixelsize)
Parameters:
name -
boundingbox -
crs -
pixelsize -
Method Detail

getName

public java.lang.String getName()
returns the name of the map

Returns:
the name of the map

getTheme

public Theme getTheme(java.lang.String name)
returns the Theme that matches the submitted name

Parameters:
name - of the theme to get
Returns:
the theme or null if not found.

getTheme

public Theme getTheme(int index)
returns the Theme that matches the submitted index

Parameters:
index - of the theme
Returns:
the Theme that matches the submitted index or null if the given index has no theme.

getAllThemes

public Theme[] getAllThemes()
returns the Themes in correct order. The first Theme (index == 0) shall be rendered at first (bottom most).

Returns:
the Themes in inserted order

getScale

public double getScale()
Returns the current scale of the MapView.

Returns:
the current scale of the MapView.

getScale

public double getScale(java.awt.Graphics g)
Returns the current scale of the MapView.

Parameters:
g - the graphics to calculate the scale from
Returns:
the current scale of the MapView.

addTheme

public void addTheme(Theme theme)
              throws java.lang.Exception
adds a theme to the MapView

Parameters:
theme - to add
Throws:
java.lang.Exception - if the coordinate system of the theme could not be set to the layer.

removeTheme

public void removeTheme(Theme theme)
removes a theme from the MapView

Parameters:
theme - to remove

removeTheme

public void removeTheme(java.lang.String name)
removes the theme that matches the submitted name from the MapView

Parameters:
name - to of the theme to be removed.

removeTheme

public void removeTheme(int index)
removes the theme that matches the submitted index from the MapView

Parameters:
index - of the theme to be removed

clear

public void clear()
removes all themes from the MapView.


swapThemes

public void swapThemes(Theme first,
                       Theme second)
swaps the positions of the submitted themes

Parameters:
first - will be second
second - will be first.

moveUp

public void moveUp(Theme theme)
move a theme up for one index position (index = oldindex + 1)

Parameters:
theme - to move up

moveDown

public void moveDown(Theme theme)
move a theme down for one index position (index = oldindex - 1)

Parameters:
theme - to move down

enableTheme

public void enableTheme(Theme theme,
                        boolean enable)
enables or disables a theme that is part of the MapView. A theme that has been disabled won't be rendered and usually doesn't react to events targeted to the MapView, but still is part of the MapView.

Parameters:
theme - to be dis/en-abled
enable - true if enabled

isThemeEnabled

public boolean isThemeEnabled(Theme theme)
returns true if the passed theme is set to be enabled

Parameters:
theme - to check
Returns:
true if the passed theme is set to be enabled

activateTheme

public void activateTheme(Theme theme)
activates a theme. Usually the activated theme is perferred to react to events (this doesn't mean that other themes are not allowed to react to events).

Parameters:
theme - to activate

isThemeActivated

public boolean isThemeActivated(Theme theme)
returns true if the passed theme is the one that is set to be activated

Parameters:
theme - to check
Returns:
true if the passed theme is the one that is set to be activated

getSize

public int getSize()
returns the amount of themes within the MapView.

Returns:
the amount of themes within the MapView.

addEventController

public void addEventController(MapEventController obj)
adds an eventcontroller to the MapView that's responsible for handling events that targets the map. E.g.: zooming, panning, selecting a feature etc.

Parameters:
obj - event controller to add

removeEventController

public void removeEventController(MapEventController obj)
Parameters:
obj - event controller to be removed
See Also:
addEventController(MapEventController)

addSelector

public void addSelector(Selector obj)
A selector is a class that offers methods for selecting and de-selecting single DisplayElements or groups of DisplayElements. A selector may offers methods like 'select all DisplayElements within a specified bounding box' or 'select all DisplayElements thats area is larger than 120 km' etc.

Parameters:
obj - selector to added to all themes

removeSelector

public void removeSelector(Selector obj)
Parameters:
obj - selector to be removed
See Also:
addSelector(Selector)

getBoundingBox

public Envelope getBoundingBox()
returns the BoundingBox (Envelope) of the MapView. This isn't necessary the BoundingBox of the data that will be rendered. It's the boundingBox of the the visible area of the map measured in its coordinate reference system.

Returns:
the BoundingBox (Envelope) of the MapView.

setBoundingBox

public void setBoundingBox(Envelope boundingbox)
Parameters:
boundingbox - to set.
See Also:
this method may be used for zooming and panning the map

getCoordinatesSystem

public CoordinateSystem getCoordinatesSystem()
returns the coordinate reference system of the MapView

Returns:
the coordinate reference system of the MapView

setCoordinateSystem

public void setCoordinateSystem(CoordinateSystem crs)
                         throws java.lang.Exception
sets the coordinate reference system of the map;

Parameters:
crs - to be set
Throws:
java.lang.Exception - if the crs could not be set to the layers of the themes

paint

public void paint(java.awt.Graphics g)
           throws RenderException
renders the map to the passed graphic context

Parameters:
g -
Throws:
RenderException - thrown if the passed Graphic haven't clipbounds. use g.setClip( .. );

paintSelected

public void paintSelected(java.awt.Graphics g)
                   throws RenderException
renders the features marked as selected of all themes contained within the MapView

Parameters:
g - graphic context to render the map too
Throws:
RenderException - thrown if the passed Graphic haven't clipbounds. use g.setClip( .. );

paintHighlighted

public void paintHighlighted(java.awt.Graphics g)
                      throws RenderException
renders the features marked as highlighted of all themes contained within the MapView

Parameters:
g - graphic context to render the map too
Throws:
RenderException - thrown if the passed Graphic haven't clipbounds. use g.setClip( .. );

addHighlighter

public void addHighlighter(Highlighter highlighter)
A Highlighter is a class that is responsible for managing the highlight capabilities for one or more Themes.

Parameters:
highlighter - to added to all themes

removeHighlighter

public void removeHighlighter(Highlighter highlighter)
Parameters:
highlighter - to be removed from all themes
See Also:
addHighlighter(Highlighter)

getProjection

public GeoTransform getProjection()
Returns the GeoTransform that is associated to this MapView.

Returns:
the associated GeoTransform-instance

addOptimizer

public void addOptimizer(Optimizer optimizer)
Adds an Optimizer.

Parameters:
optimizer -

getOptimizers

public Optimizer[] getOptimizers()
Returns the Optimizers.

Returns:
the Optimizers.

setOptimizers

public void setOptimizers(Optimizer[] optimizers)
Sets the Optimizers.

Parameters:
optimizers -

deegree 2.5 (2011/06/29 09:44 build-8-official)

an open source project founded by lat/lon, Bonn, Germany.
For more information visit: http://www.deegree.org