ch.epfl.scapetoad
Class CartogramGastner

java.lang.Object
  extended by ch.epfl.scapetoad.CartogramGastner

public class CartogramGastner
extends java.lang.Object

This class implements Gastner's diffusion algorithm.


Field Summary
 CartogramWizard mCartogramWizard
           
 int mProgressEnd
           
 int mProgressStart
          Attributes for the computation progress bar.
 java.lang.String mProgressText
           
 
Constructor Summary
CartogramGastner(CartogramGrid grid)
          The constructor takes the cartogram grid which contains the density values.
 
Method Summary
 void compute(int gridSize)
          Starts the cartogram computation using the given grid size.
static double erf(double value)
          Our wrapper function for the Jakarta Commons Math Erf.erf function.
 void gaussianBlur()
          Performs au Gaussian blur on the density grid.
 boolean newt2(double h, double[] ptappr, double xguess, double yguess, int j, int k)
           
 void writeToShapefile(java.lang.String shapefile)
          Writes the grid into the specified shape file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mProgressStart

public int mProgressStart
Attributes for the computation progress bar.


mProgressEnd

public int mProgressEnd

mProgressText

public java.lang.String mProgressText

mCartogramWizard

public CartogramWizard mCartogramWizard
Constructor Detail

CartogramGastner

public CartogramGastner(CartogramGrid grid)
The constructor takes the cartogram grid which contains the density values.

Method Detail

compute

public void compute(int gridSize)
             throws java.lang.InterruptedException
Starts the cartogram computation using the given grid size.

Parameters:
gridSize - the size of the grid used for computation. The grid size must be a power of 2.
Throws:
java.lang.InterruptedException

gaussianBlur

public void gaussianBlur()
Performs au Gaussian blur on the density grid.


newt2

public boolean newt2(double h,
                     double[] ptappr,
                     double xguess,
                     double yguess,
                     int j,
                     int k)

erf

public static double erf(double value)
Our wrapper function for the Jakarta Commons Math Erf.erf function. For values <= -4 or >= 4, we return -1 or 1 directly, without computation. Erf.erf raises too often an exception for failing convergence.


writeToShapefile

public void writeToShapefile(java.lang.String shapefile)
Writes the grid into the specified shape file.

Parameters:
shapefile - the path to the shape file.