courselog.maputils
Class CalibratedMap

java.lang.Object
  extended by courselog.maputils.CalibratedMap
All Implemented Interfaces:
GeoGraphable

public class CalibratedMap
extends java.lang.Object
implements GeoGraphable


Field Summary
static java.lang.String COORDINATESMARKUP
          Markup for coordinates in KML path file.
 double dScPixelOnMeters
          Map scaling factor.
 GeoPoint gpCenter
          Map Center position
 int idxRP1
          Index of first selected reference point.
 int idxRP2
          Index of second selected reference point.
protected  ewe.fx.ImageData imageDataMap
          Image data representation of the map that is used.
protected  ewe.fx.Image imageMap
          Bitmap representation of the map that is used.
 int imgH
          Image height
 int imgW
          Image width
 double maxLat
          Map upper left corner latitude.
 double maxLon
          Map lower right corner longitude.
 double minLat
          Map lower right corner latitude.
 double minLon
          Map upper left corner longitude.
static java.lang.String REFEXTENSION
          Extension associated to files containing reference points.
 java.lang.String stMapFileName
          File name of the image file.
static int UNINITIALISEDSIZE
          Extension associated to files containing reference points.
 GeoDirection vpEast
          Center east direction
 GeoDirection vpNorth
          Center north direction
 ewe.util.Vector vRefPoints
          Vector of reference points associated to calibration.
 
Constructor Summary
CalibratedMap(java.lang.String imageFileName)
          Creates a new instance from the map name
 
Method Summary
 void computeTransformValues()
          Compute transformation values from the 2 identified reference points.
 void computeTransformValues(MapReferencePoint pt1, MapReferencePoint pt2)
          Compute transformation values from 2 reference points.
 MapReferencePoint findClosestReferencepoint(ewe.fx.Point p, double maxD)
          Select closest reference point from a point position on the map.
 void findOptimalRefPoint()
          Compute optimal reference points to use.
 void free()
          Free image data
 ewe.fx.ImageData getImageDataMap()
           
 ewe.fx.Image getImageMap()
           
 ewe.fx.Point getMapPointFromPosition(GeoPoint pos, GeoDirection tmp, ewe.fx.Point pt)
          Compute X and Y on map from geo position.
 GeoPoint getPointFromMap(int xx, int yy, GeoPoint dest)
          Compute lat and long from position on map.
 java.lang.String getReferenceFileName()
          Get the reference file name formed from the Map image file name with the REFEXTENSION extension.
 void initCalibratedMap()
          Initialises a new instance from the bitmap name
 void initCalibratedMapImage()
          Initialise current instance from the bitmap file name
 void initCalibratedMapImage(ewe.fx.Image img)
          Initialise current instance from the bitmap image
 void initReferenceLocationsFromKML(ewe.io.File fKML)
          Initialise current reference points from a kml path file.
 boolean saveReferenceFile(ewe.io.File fRef)
          Save the reference points into a CSV file.
 boolean saveSubMap(ewe.fx.Rect rArea, java.lang.String imageFileName, CalibratedMap tmp)
          Save a part of the bitmap to an image file and the corresponding reference file.
 void setImageMap(ewe.fx.Image imageMap)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REFEXTENSION

public static final java.lang.String REFEXTENSION
Extension associated to files containing reference points.

See Also:
Constant Field Values

UNINITIALISEDSIZE

public static final int UNINITIALISEDSIZE
Extension associated to files containing reference points.

See Also:
Constant Field Values

COORDINATESMARKUP

public static final java.lang.String COORDINATESMARKUP
Markup for coordinates in KML path file.

See Also:
Constant Field Values

vRefPoints

public ewe.util.Vector vRefPoints
Vector of reference points associated to calibration.


idxRP1

public int idxRP1
Index of first selected reference point.


idxRP2

public int idxRP2
Index of second selected reference point.


imageMap

protected ewe.fx.Image imageMap
Bitmap representation of the map that is used.


imageDataMap

protected ewe.fx.ImageData imageDataMap
Image data representation of the map that is used.


imgW

public int imgW
Image width


imgH

public int imgH
Image height


stMapFileName

public java.lang.String stMapFileName
File name of the image file.


gpCenter

public GeoPoint gpCenter
Map Center position


vpNorth

public GeoDirection vpNorth
Center north direction


vpEast

public GeoDirection vpEast
Center east direction


dScPixelOnMeters

public double dScPixelOnMeters
Map scaling factor.


maxLat

public double maxLat
Map upper left corner latitude.


minLon

public double minLon
Map upper left corner longitude.


minLat

public double minLat
Map lower right corner latitude.


maxLon

public double maxLon
Map lower right corner longitude.

Constructor Detail

CalibratedMap

public CalibratedMap(java.lang.String imageFileName)
Creates a new instance from the map name

Method Detail

getImageMap

public ewe.fx.Image getImageMap()

setImageMap

public void setImageMap(ewe.fx.Image imageMap)

getImageDataMap

public ewe.fx.ImageData getImageDataMap()

initCalibratedMapImage

public void initCalibratedMapImage()
Initialise current instance from the bitmap file name


initReferenceLocationsFromKML

public void initReferenceLocationsFromKML(ewe.io.File fKML)
Initialise current reference points from a kml path file.


initCalibratedMapImage

public void initCalibratedMapImage(ewe.fx.Image img)
Initialise current instance from the bitmap image


free

public void free()
Free image data


initCalibratedMap

public void initCalibratedMap()
Initialises a new instance from the bitmap name


saveReferenceFile

public boolean saveReferenceFile(ewe.io.File fRef)
Save the reference points into a CSV file.


saveSubMap

public boolean saveSubMap(ewe.fx.Rect rArea,
                          java.lang.String imageFileName,
                          CalibratedMap tmp)
Save a part of the bitmap to an image file and the corresponding reference file.


findClosestReferencepoint

public MapReferencePoint findClosestReferencepoint(ewe.fx.Point p,
                                                   double maxD)
Select closest reference point from a point position on the map.


findOptimalRefPoint

public void findOptimalRefPoint()
Compute optimal reference points to use. Test all points and verify that the others are close from their given position.


computeTransformValues

public void computeTransformValues()
Compute transformation values from the 2 identified reference points.


computeTransformValues

public void computeTransformValues(MapReferencePoint pt1,
                                   MapReferencePoint pt2)
Compute transformation values from 2 reference points.


getPointFromMap

public GeoPoint getPointFromMap(int xx,
                                int yy,
                                GeoPoint dest)
Compute lat and long from position on map.

Specified by:
getPointFromMap in interface GeoGraphable

getMapPointFromPosition

public ewe.fx.Point getMapPointFromPosition(GeoPoint pos,
                                            GeoDirection tmp,
                                            ewe.fx.Point pt)
Compute X and Y on map from geo position.

Specified by:
getMapPointFromPosition in interface GeoGraphable
Parameters:
pos - geo position to transpose.
tmp - GeoDirection reference to compute intermediate direction. If null a new object is allocated.
pt - point on bitmap image to compute. If null a new Point object is allocated.
Returns:
Computed point. Should be pt or a new Point object.

getReferenceFileName

public java.lang.String getReferenceFileName()
Get the reference file name formed from the Map image file name with the REFEXTENSION extension.