org.placelab.demo.mapview
Class BitmapMapBacking

java.lang.Object
  extended byorg.placelab.demo.mapview.ItemBacking
      extended byorg.placelab.demo.mapview.BitmapMapBacking
All Implemented Interfaces:
MapBacking

public class BitmapMapBacking
extends ItemBacking
implements MapBacking

MapBacking is the data backing for a map to be displayed. Maps have: + An origin in gps (upper left) + An image that is the map + Pixels per latitude, and Pixels per longitude + A name


Field Summary
 
Fields inherited from class org.placelab.demo.mapview.ItemBacking
image, imageName, loadWad, wadRelativeImagePath
 
Constructor Summary
BitmapMapBacking(org.eclipse.swt.graphics.ImageData mapImage, java.lang.String mapImageName, double originLat, double originLon, double pixelsPerLat, double pixelsPerLon, java.lang.String mapName)
          Use this constructor if you are generating a MapBacking.
BitmapMapBacking(org.eclipse.swt.graphics.ImageData mapImage, java.lang.String mapImageName, java.lang.String mapName, double originLat, double originLon, double upperRightLat, double upperRightLon)
          Use this constructor if you are generating a MapBacking.
BitmapMapBacking(java.lang.String imageName, java.lang.String wadRelativeImagePath, WadData loadedFromWad, double originLat, double originLon, double pixelsPerLat, double pixelsPerLon, java.lang.String mapName)
          Use this constructor when loading a BitmapMapBacking from a map wad
BitmapMapBacking(java.lang.String imageName, java.lang.String wadRelativeImagePath, WadData loadedFromWad, java.lang.String mapName, double originLat, double originLon, double upperRightLat, double upperRightLon)
          Use this constructor when loading a BitmapMapBacking from a map wad and you don't have a pixelsPerLat and pixelsPerLon, but you do have the lat, lon for the upper right corner of the map.
 
Method Summary
 boolean containsCoordinate(TwoDCoordinate coord)
           
 double getLatHeight()
           
 double getLonWidth()
           
 double getMaxLat()
           
 double getMaxLon()
           
 java.lang.String getName()
           
 double getOriginLat()
           
 double getOriginLon()
           
 double getPixelsPerLat()
           
 double getPixelsPerLon()
           
 org.eclipse.swt.graphics.Point getPoint(TwoDCoordinate coord)
           
 int latitudeToPixels(double lat)
           
 int longitudeToPixels(double lon)
           
 
Methods inherited from class org.placelab.demo.mapview.ItemBacking
assignDefaultImagePath, getImageResource, getWadRelativeImagePath
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BitmapMapBacking

public BitmapMapBacking(org.eclipse.swt.graphics.ImageData mapImage,
                        java.lang.String mapImageName,
                        double originLat,
                        double originLon,
                        double pixelsPerLat,
                        double pixelsPerLon,
                        java.lang.String mapName)
Use this constructor if you are generating a MapBacking.

Parameters:
mapImage - the image data for the map
mapImageName - the filename for the map image (like amap.png)
originLat - the latitude of the upper left of the image
originLon - the longitude of the upper left of the image
pixelsPerLat -
pixelsPerLon -
mapName - the user defined name for the map

BitmapMapBacking

public BitmapMapBacking(org.eclipse.swt.graphics.ImageData mapImage,
                        java.lang.String mapImageName,
                        java.lang.String mapName,
                        double originLat,
                        double originLon,
                        double upperRightLat,
                        double upperRightLon)
Use this constructor if you are generating a MapBacking.

Parameters:
mapImage - the image data for the map
mapImageName - the filename for the map image (like amap.png)
mapName - the user defined name for the map
originLat - the latitude of the upper left of the image
originLon - the longitude of the upper left of the image
upperRightLon - ...
upperRightLat - ...

BitmapMapBacking

public BitmapMapBacking(java.lang.String imageName,
                        java.lang.String wadRelativeImagePath,
                        WadData loadedFromWad,
                        double originLat,
                        double originLon,
                        double pixelsPerLat,
                        double pixelsPerLon,
                        java.lang.String mapName)
Use this constructor when loading a BitmapMapBacking from a map wad

Parameters:
imageName - the filename used for the image
wadRelativeImagePath - the path needed to get the image out of the wad
loadedFromWad - the wad this MapBacking was loaded from
mapName - the user defined name for the map

BitmapMapBacking

public BitmapMapBacking(java.lang.String imageName,
                        java.lang.String wadRelativeImagePath,
                        WadData loadedFromWad,
                        java.lang.String mapName,
                        double originLat,
                        double originLon,
                        double upperRightLat,
                        double upperRightLon)
Use this constructor when loading a BitmapMapBacking from a map wad and you don't have a pixelsPerLat and pixelsPerLon, but you do have the lat, lon for the upper right corner of the map. This has the disadvantage of circumventing the lazy loading scheme the WadData uses for the images, since we have to know the image dimensions to use this, which requires loading the image.

Parameters:
imageName - the filename used for the image
wadRelativeImagePath - the path needed to get the image out of the wad
loadedFromWad - the wad this MapBacking was loaded from
mapName - the user defined name for the map
Method Detail

getOriginLat

public double getOriginLat()
Specified by:
getOriginLat in interface MapBacking

getOriginLon

public double getOriginLon()
Specified by:
getOriginLon in interface MapBacking

getPixelsPerLat

public double getPixelsPerLat()

getPixelsPerLon

public double getPixelsPerLon()

latitudeToPixels

public int latitudeToPixels(double lat)

longitudeToPixels

public int longitudeToPixels(double lon)

getName

public java.lang.String getName()
Specified by:
getName in interface MapBacking

getLatHeight

public double getLatHeight()
Specified by:
getLatHeight in interface MapBacking

getLonWidth

public double getLonWidth()
Specified by:
getLonWidth in interface MapBacking

getMaxLat

public double getMaxLat()
Specified by:
getMaxLat in interface MapBacking

getMaxLon

public double getMaxLon()
Specified by:
getMaxLon in interface MapBacking

containsCoordinate

public boolean containsCoordinate(TwoDCoordinate coord)
Specified by:
containsCoordinate in interface MapBacking

getPoint

public org.eclipse.swt.graphics.Point getPoint(TwoDCoordinate coord)