ch.epfl.scapetoad
Class Cartogram

java.lang.Object
  extended by com.sun.swing.SwingWorker
      extended by ch.epfl.scapetoad.Cartogram

public class Cartogram
extends com.sun.swing.SwingWorker

The cartogram class is the main computation class. It is a subclass of the SwingWorker class. It has methods for setting all the parameters and for launching the computation.


Method Summary
 java.lang.Object construct()
          The construct method is an overriden method from SwingWorker which does initiate the computation process.
 double estimateMaximumSegmentLength()
          Tries to estimate the maximum segment length allowed for a geometry.
 void finished()
          This method is called once the construct method has finished.
 boolean getAdvancedOptionsEnabled()
           
 java.lang.String getCategoryName()
          Returns the category name for our cartogram layers.
 java.lang.String getComputationReport()
           
 boolean getCreateGridLayer()
          Says whether we should create a grid layer or not.
 boolean getCreateLegendLayer()
          Says whether we should create a legend layer or not.
 int getDiffusionGridSize()
           
 int getDiffusionIterations()
           
 int getGridLayerSize()
          Returns the grid layer size.
 double[] getLegendValues()
           
 void produceComputationReport(Layer projectedMasterLayer)
          Creates the computation report and stores it in the object attribute.
 void setAdvancedOptionsEnabled(boolean enabled)
           
 void setAmountOfDeformation(int deformation)
          Defines the amount of deformation.
 void setConstrainedDeformationLayers(java.util.Vector layers)
          Defines the layers which should not be deformed.
 void setCreateGridLayer(boolean createGridLayer)
          Sets the flag for creating or not a grid layer.
 void setCreateLegendLayer(boolean createLegendLayer)
          Sets the flag which says whether to create a legend layer or not.
 void setDiffusionGridSize(int size)
           
 void setDiffusionIterations(int iterations)
           
 void setGridLayerSize(int gridLayerSize)
          Changes the size of the grid layer to produce.
 void setGridSize(int x, int y)
          Defines the grid size in x and y dimensions.
 void setLayerManager(LayerManager lm)
          Sets the layer manager.
 void setLegendValues(double[] legendValues)
           
 void setMasterAttribute(java.lang.String attributeName)
          Sets the name of the cartogram master attribute.
 void setMasterAttributeIsDensityValue(boolean isDensityValue)
          Lets define us whether the master attribute is a density value or a population value.
 void setMasterLayer(java.lang.String layerName)
          Sets the name of the cartogram master layer.
 void setMaximumRunningTime(int seconds)
          Defines the maximum running time in seconds.
 void setMissingValue(java.lang.String value)
           
 void setSlaveLayers(java.util.Vector slaveLayers)
          Defines the layers to deform during the cartogram process.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

construct

public java.lang.Object construct()
The construct method is an overriden method from SwingWorker which does initiate the computation process.


finished

public void finished()
This method is called once the construct method has finished. It terminates the computation, adds all layers and produces the computation report.


setLayerManager

public void setLayerManager(LayerManager lm)
Sets the layer manager.


setMasterLayer

public void setMasterLayer(java.lang.String layerName)
Sets the name of the cartogram master layer.


setMasterAttribute

public void setMasterAttribute(java.lang.String attributeName)
Sets the name of the cartogram master attribute.


setMasterAttributeIsDensityValue

public void setMasterAttributeIsDensityValue(boolean isDensityValue)
Lets define us whether the master attribute is a density value or a population value.


setSlaveLayers

public void setSlaveLayers(java.util.Vector slaveLayers)
Defines the layers to deform during the cartogram process.


setConstrainedDeformationLayers

public void setConstrainedDeformationLayers(java.util.Vector layers)
Defines the layers which should not be deformed.


setGridSize

public void setGridSize(int x,
                        int y)
Defines the grid size in x and y dimensions.


setAmountOfDeformation

public void setAmountOfDeformation(int deformation)
Defines the amount of deformation. This is an integer value between 0 and 100. The default value is 50.


setMaximumRunningTime

public void setMaximumRunningTime(int seconds)
Defines the maximum running time in seconds. The default value is 259200 seconds (3 days).


getCreateGridLayer

public boolean getCreateGridLayer()
Says whether we should create a grid layer or not.


setCreateGridLayer

public void setCreateGridLayer(boolean createGridLayer)
Sets the flag for creating or not a grid layer.


getGridLayerSize

public int getGridLayerSize()
Returns the grid layer size. This is the grid which is produced for visual effect only.


setGridLayerSize

public void setGridLayerSize(int gridLayerSize)
Changes the size of the grid layer to produce.


getCreateLegendLayer

public boolean getCreateLegendLayer()
Says whether we should create a legend layer or not.


setCreateLegendLayer

public void setCreateLegendLayer(boolean createLegendLayer)
Sets the flag which says whether to create a legend layer or not.


getLegendValues

public double[] getLegendValues()

setLegendValues

public void setLegendValues(double[] legendValues)

getAdvancedOptionsEnabled

public boolean getAdvancedOptionsEnabled()

setAdvancedOptionsEnabled

public void setAdvancedOptionsEnabled(boolean enabled)

getDiffusionGridSize

public int getDiffusionGridSize()

setDiffusionGridSize

public void setDiffusionGridSize(int size)

getDiffusionIterations

public int getDiffusionIterations()

setDiffusionIterations

public void setDiffusionIterations(int iterations)

getCategoryName

public java.lang.String getCategoryName()
Returns the category name for our cartogram layers.


produceComputationReport

public void produceComputationReport(Layer projectedMasterLayer)
Creates the computation report and stores it in the object attribute.


getComputationReport

public java.lang.String getComputationReport()

estimateMaximumSegmentLength

public double estimateMaximumSegmentLength()
Tries to estimate the maximum segment length allowed for a geometry. The length is estimated using the envelope of the master layer and the number of features present in the master layer. The area of the envelope is considered as a square. The length of the square's edge is divided by the square root of the number of features. This gives us an estimate of the number of features along the square's edge. It is further considered that there should be about 10 vertices for one feature along the square's edge.


setMissingValue

public void setMissingValue(java.lang.String value)