org.eclipse.ohf.stem.ui.views.map
Class StemPolygon

java.lang.Object
  extended by java.awt.Polygon
      extended by org.eclipse.ohf.stem.ui.views.map.StemPolygon
All Implemented Interfaces:
java.awt.Shape, java.io.Serializable

public class StemPolygon
extends java.awt.Polygon

A sub-class of java.awt.Polygon that has an extra field saving the relative value of the polygon. The relative values could be used for intensity values of the labels.

See Also:
Serialized Form

Field Summary
 int npointsDouble
          The number of the lat/long coordinates (which are saved in double format)
 double[] xpointsDouble
          the lat/long coordinates in the X-axis
 double[] ypointsDouble
          the lat/long coordinates in the Y-axis
 
Fields inherited from class java.awt.Polygon
npoints, xpoints, ypoints
 
Constructor Summary
StemPolygon()
          Empty constructor.
StemPolygon(LatLong.Segment latLongSegment, double relativeValueOfPolygon, java.lang.String title)
          Gets a list of a latLongData arrays, and transforms it into a Polygon.
 
Method Summary
 void addLatLongData(LatLong latLongData, double relativeValueOfPolygon)
          Add latLong coordinates to a polygon.
 void addPoint(double x, double y)
          Adds a (double,double) coordinate to the polygon.
 void addTitle(java.lang.String title)
          Add a title to a polygon.
 org.eclipse.swt.graphics.Point getCentralizationFactor()
           
 double getRelativeValue()
          Get the relative value of the polygon (could be intensity value or any other value)
 int getScalingFactorForData()
          Gets the scaling factor of the data.
 java.lang.String getTitle()
          Returns the title of the polygon.
 java.lang.String getWhichProjection()
           
 double getXmax()
          Returns the maximum X coordinate value (in double format) of the polygon
 double getXmin()
          Returns the minimum X coordinate (in double format) value of the polygon
 double getYmax()
          Returns the maximum Y coordinate value (in double format) of the polygon
 double getYmin()
          Returns the minimum Y coordinate value (in double format) of the polygon
 void produceIntCoordinates()
          Performs the projection to the polygon.
 void setCentralizationFactor(org.eclipse.swt.graphics.Point centralizationFactor)
          Set the centralization factor
 void setRelativeValue(double val)
          Set the relative value of the polygon (could be intensity value or any other value)
 void setScalingFactorForData(int scalingFactor)
          Sets the scaling factor of the data.
 void setWhichProjection(java.lang.String whichProjection)
          Set whichProjection
 void setXmax()
          Sets the maximum X coordinate value (in double format) of the polygon
 void setXmin()
          Sets the minimum X coordinate (in double format) value of the polygon.
 void setYmax()
          Sets the maximum Y coordinate value (in double format) of the polygon
 void setYmin()
          Sets the minimum Y coordinate value (in double format) of the polygon
 void translateDoublePointsByCentralizationFactor(org.eclipse.swt.graphics.Point centFactor)
          Translates the double points of the polygon to fit in the frame.
 
Methods inherited from class java.awt.Polygon
addPoint, contains, contains, contains, contains, contains, contains, getBoundingBox, getBounds, getBounds2D, getPathIterator, getPathIterator, inside, intersects, intersects, invalidate, reset, translate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

xpointsDouble

public double[] xpointsDouble
the lat/long coordinates in the X-axis


ypointsDouble

public double[] ypointsDouble
the lat/long coordinates in the Y-axis


npointsDouble

public int npointsDouble
The number of the lat/long coordinates (which are saved in double format)

Constructor Detail

StemPolygon

public StemPolygon()
Empty constructor.


StemPolygon

public StemPolygon(LatLong.Segment latLongSegment,
                   double relativeValueOfPolygon,
                   java.lang.String title)
Gets a list of a latLongData arrays, and transforms it into a Polygon.

Parameters:
latLongSegment -
relativeValueOfPolygon -
title -
Method Detail

addLatLongData

public void addLatLongData(LatLong latLongData,
                           double relativeValueOfPolygon)
Add latLong coordinates to a polygon.

Parameters:
latLongData -
relativeValueOfPolygon -

addPoint

public void addPoint(double x,
                     double y)
Adds a (double,double) coordinate to the polygon. These coordinates are saved for the sake of accuracy (i.e., for the projection process). The (int,int) points are in fact the ones that are drawn, but in order to not lose information, the (double,double) long/lat values are being saved and are used for the calculations.

Parameters:
x -
y -

addTitle

public void addTitle(java.lang.String title)
Add a title to a polygon.

Parameters:
title -

getTitle

public java.lang.String getTitle()
Returns the title of the polygon.

Returns:
String

getRelativeValue

public double getRelativeValue()
Get the relative value of the polygon (could be intensity value or any other value)

Returns:
double

setRelativeValue

public void setRelativeValue(double val)
Set the relative value of the polygon (could be intensity value or any other value)

Parameters:
val -

setXmin

public void setXmin()
Sets the minimum X coordinate (in double format) value of the polygon.


getXmin

public double getXmin()
Returns the minimum X coordinate (in double format) value of the polygon

Returns:
double

setXmax

public void setXmax()
Sets the maximum X coordinate value (in double format) of the polygon


getXmax

public double getXmax()
Returns the maximum X coordinate value (in double format) of the polygon

Returns:
double

setYmin

public void setYmin()
Sets the minimum Y coordinate value (in double format) of the polygon


getYmin

public double getYmin()
Returns the minimum Y coordinate value (in double format) of the polygon

Returns:
double

setYmax

public void setYmax()
Sets the maximum Y coordinate value (in double format) of the polygon


getYmax

public double getYmax()
Returns the maximum Y coordinate value (in double format) of the polygon

Returns:
double

setScalingFactorForData

public void setScalingFactorForData(int scalingFactor)
Sets the scaling factor of the data. The data is read as floating points from the GML files, then it is multiplied by this factor (i.e, 1,000,000) and saved as an integer, in order to preserve the resolution of the data. The Java2D scaling process will shrink it again, so it will fit in the view.

Parameters:
scalingFactor -

getScalingFactorForData

public int getScalingFactorForData()
Gets the scaling factor of the data. The data is read as floating points from the GML files, then it is multiplied by this factor (i.e, 1,000,000) and saved as an integer, in order to preserve the resolution of the data. The Java2D scaling process will shrink it again, so it will fit in the view.

Returns:
int

produceIntCoordinates

public void produceIntCoordinates()
Performs the projection to the polygon. It gets the name of the required projection and the coordinates of the offset needed to be made in order to centralize the map, then produces a new point out of every point (in double format) in the polygon, re-scales it and saves it as an integer value in the polygon's arrays.


translateDoublePointsByCentralizationFactor

public void translateDoublePointsByCentralizationFactor(org.eclipse.swt.graphics.Point centFactor)
Translates the double points of the polygon to fit in the frame.

Parameters:
centFactor -

getCentralizationFactor

public org.eclipse.swt.graphics.Point getCentralizationFactor()
Returns:
the centralization factor

setCentralizationFactor

public void setCentralizationFactor(org.eclipse.swt.graphics.Point centralizationFactor)
Set the centralization factor

Parameters:
centralizationFactor -

getWhichProjection

public java.lang.String getWhichProjection()
Returns:
whichProjection

setWhichProjection

public void setWhichProjection(java.lang.String whichProjection)
Set whichProjection

Parameters:
whichProjection -