org.deegree_impl.graphics.optimizers
Class LabelOptimizer

java.lang.Object
  extended byorg.deegree_impl.graphics.optimizers.AbstractOptimizer
      extended byorg.deegree_impl.graphics.optimizers.LabelOptimizer
All Implemented Interfaces:
Optimizer

public class LabelOptimizer
extends AbstractOptimizer

Selects optimized Labels (graphical representations generated from LabelDisplayElements) that have a minimimal amount of overlapping.

The labeling and optimization approach uses ideas from papers by Ingo Petzold on automated label placement.

TODO: The handling of rotated labels is currently broken. Don't use rotated LabelDisplayElements with this optimizer at the moment!

Version:
$Revision: 1.8 $ $Date: 2004/03/12 15:56:47 $
Author:
Markus Schneider

Field Summary
private  boolean[][] candidates
           
private  java.util.ArrayList choices
           
private  java.util.ArrayList displayElements
           
 
Fields inherited from class org.deegree_impl.graphics.optimizers.AbstractOptimizer
mapView, themes
 
Constructor Summary
LabelOptimizer()
          Creates a new instance of LabelOptimizer.
LabelOptimizer(Theme[] themes)
          Creates a new instance of LabelOptimizer for the given Themes.
 
Method Summary
 void addTheme(Theme theme)
          Adds a Theme that the Optimizer should consider.
private  void anneal()
          Performs the "Simulated Annealing" for the LabelChoices.
private  void buildCollisionMatrix()
          Builds the collision matrix for all LabelChoices.
private  double objectiveFunction()
          Calculates a quality value for the currently selected combination of Labels.
 void optimize(java.awt.Graphics2D g)
          Finds optimized Label representations for the registered LabelDisplayElements.
 
Methods inherited from class org.deegree_impl.graphics.optimizers.AbstractOptimizer
setMapView
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

displayElements

private java.util.ArrayList displayElements

choices

private java.util.ArrayList choices

candidates

private boolean[][] candidates
Constructor Detail

LabelOptimizer

public LabelOptimizer()
Creates a new instance of LabelOptimizer.


LabelOptimizer

public LabelOptimizer(Theme[] themes)
Creates a new instance of LabelOptimizer for the given Themes.

Parameters:
themes -
Method Detail

addTheme

public void addTheme(Theme theme)
Adds a Theme that the Optimizer should consider.

Specified by:
addTheme in interface Optimizer
Overrides:
addTheme in class AbstractOptimizer
Parameters:
theme -

optimize

public void optimize(java.awt.Graphics2D g)
Finds optimized Label representations for the registered LabelDisplayElements.

Specified by:
optimize in interface Optimizer
Specified by:
optimize in class AbstractOptimizer
Parameters:
g -

buildCollisionMatrix

private void buildCollisionMatrix()
Builds the collision matrix for all LabelChoices.


anneal

private void anneal()
Performs the "Simulated Annealing" for the LabelChoices.


objectiveFunction

private double objectiveFunction()
Calculates a quality value for the currently selected combination of Labels.

Returns: