software.authoring
Class BmpToGeometry

java.lang.Object
  extended by software.authoring.BmpToGeometry
All Implemented Interfaces:
BmpTogeometryInterface

public class BmpToGeometry
extends java.lang.Object
implements BmpTogeometryInterface

Reads in an image, detects the bullets and the donuts on it and builds a geometry file (and a default ElectionSpecification)

Author:
stefan

Field Summary
 java.util.Vector<Cluster> PunchScanColors
           
 
Constructor Summary
BmpToGeometry()
          Initiates the default color to look for.
 
Method Summary
 void createGeometry(java.awt.image.BufferedImage bi, float dpi, int noCols, java.lang.String geometryFile, java.lang.String ElectionSpecFile)
           
 java.util.Vector<Cluster> getAllColors()
           
static void main(java.lang.String[] args)
          debug method
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PunchScanColors

public java.util.Vector<Cluster> PunchScanColors
Constructor Detail

BmpToGeometry

public BmpToGeometry()
Initiates the default color to look for. The color variation is 10 on each color and the discontinuity is 0.01inches.

Method Detail

createGeometry

public void createGeometry(java.awt.image.BufferedImage bi,
                           float dpi,
                           int noCols,
                           java.lang.String geometryFile,
                           java.lang.String ElectionSpecFile)
                    throws java.lang.Exception
Specified by:
createGeometry in interface BmpTogeometryInterface
Parameters:
bi - - the image to be scanned
dpi - - the dpi of the image (it cannot be infered from the image since some images do not have a dpi)
noCols - - the number of columns the contests are arranged in
geometryFile - - where to write the geometry file
ElectionSpecFile - - where to write the default Election Specification
Throws:
java.lang.Exception - - an exception is thrown if the number of bullets is different from the number of dunots for one contest (or for the serial number)

getAllColors

public java.util.Vector<Cluster> getAllColors()
Specified by:
getAllColors in interface BmpTogeometryInterface
Returns:
- all the Colors that the image is scanned for

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
debug method

Parameters:
args -
Throws:
java.lang.Exception