visad.data.mcidas
Class BaseMapAdapter

java.lang.Object
  extended by visad.data.mcidas.BaseMapAdapter

public class BaseMapAdapter
extends Object

this is an adapter for McIDAS Base Map files


Constructor Summary
BaseMapAdapter(InputStream is)
          Create a VisAD UnionSet from a McIDAS Base Map file inputstream
BaseMapAdapter(InputStream is, Rectangle2D bbox)
          Create a VisAD UnionSet from a McIDAS Base Map file inputstream
BaseMapAdapter(String filename)
          Create a VisAD UnionSet from a local McIDAS Base Map file
BaseMapAdapter(String filename, Rectangle2D bbox)
          Create a VisAD UnionSet from a McIDAS Base Map file on the Web
BaseMapAdapter(URL url)
          Create a VisAD UnionSet from a McIDAS Base Map file on the Web
BaseMapAdapter(URL url, Rectangle2D bbox)
          Create a VisAD UnionSet from a McIDAS Base Map file on the Web
 
Method Summary
 void doByLatLon()
          Set the MathType of the UnionSet to be lat/lon.
 UnionSet getData()
          getData creates a VisAD UnionSet type with the MathType specified thru one of the other methods.
 boolean isEastPositive()
          determine what sign convention for longitude is currently being used.
 void setCoordinateSystem(CoordinateSystem cs, int numEles, int numLines, RealTupleType domain)
          Define a CoordinateSystem whose fromReference() will be used to transform points from latitude/longitude into element,line.
 void setDomainSet(Linear2DSet domainSet)
          Using the domain_set of the FlatField of an image (when one is available), extract the elements required.
 void setEastPositive(boolean value)
          set the sign of longitude convention.
 void setLatLonLimits(float latmin, float latmax, float lonmin, float lonmax)
          set the limits of Lats and Lons; without this, the getData() will return ALL the points in the file.
 void setLatLonLimits(Rectangle2D bbox)
          set the limits of Lats and Lons; without this, the getData() will return ALL the points in the file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseMapAdapter

public BaseMapAdapter(String filename)
               throws IOException,
                      VisADException
Create a VisAD UnionSet from a local McIDAS Base Map file

Parameters:
filename - name of local file.
Throws:
IOException - if there was a problem reading the file.
VisADException - if an unexpected problem occurs.

BaseMapAdapter

public BaseMapAdapter(String filename,
                      Rectangle2D bbox)
               throws IOException,
                      VisADException
Create a VisAD UnionSet from a McIDAS Base Map file on the Web

Parameters:
filename - name of local file.
bbox - lat/lon bounding box of map lines to include
Throws:
IOException - if there was a problem reading the file.
VisADException - if an unexpected problem occurs.

BaseMapAdapter

public BaseMapAdapter(URL url)
               throws IOException,
                      VisADException
Create a VisAD UnionSet from a McIDAS Base Map file on the Web

Parameters:
url - URL & filename name of remote file
Throws:
IOException - if there was a problem reading the URL.
VisADException - if an unexpected problem occurs.

BaseMapAdapter

public BaseMapAdapter(URL url,
                      Rectangle2D bbox)
               throws IOException,
                      VisADException
Create a VisAD UnionSet from a McIDAS Base Map file on the Web

Parameters:
url - URL of remote file
bbox - lat/lon bounding box of map lines to include
Throws:
IOException - if there was a problem reading the URL.
VisADException - if an unexpected problem occurs.

BaseMapAdapter

public BaseMapAdapter(InputStream is)
               throws IOException,
                      VisADException
Create a VisAD UnionSet from a McIDAS Base Map file inputstream

Parameters:
is - input stream of mapfile
Throws:
IOException - if there was a problem reading the inputstream
VisADException - if an unexpected problem occurs.

BaseMapAdapter

public BaseMapAdapter(InputStream is,
                      Rectangle2D bbox)
               throws IOException,
                      VisADException
Create a VisAD UnionSet from a McIDAS Base Map file inputstream

Parameters:
is - input stream of mapfile
bbox - lat/lon bounding box
Throws:
IOException - if there was a problem reading the inputstream
VisADException - if an unexpected problem occurs.
Method Detail

setLatLonLimits

public void setLatLonLimits(Rectangle2D bbox)
set the limits of Lats and Lons; without this, the getData() will return ALL the points in the file. When this method is used, the feature of the McIDAS map files that has the lat/lon extremes for each line segment will be used to coarsely cull points out of the returned VisAD UnionSet.

This may be used along with any other domain-setting routine, but should be invoked last. Alternatively, pass in the bounding box in the constructor.

Parameters:
bbox - Rectangle2D representing the bounding box

setLatLonLimits

public void setLatLonLimits(float latmin,
                            float latmax,
                            float lonmin,
                            float lonmax)
set the limits of Lats and Lons; without this, the getData() will return ALL the points in the file. When this method is used, the feature of the McIDAS map files that has the lat/lon extremes for each line segment will be used to coarsely cull points out of the returned VisAD UnionSet.

This may be used along with any other domain-setting routine, but should be invoked last.

Parameters:
latmin - the minimum Latitude value
latmax - the maximum Latitude value
lonmin - the minimum Longitude value (-180 -- 180)
lonmax - the maximum Longitude value

setDomainSet

public void setDomainSet(Linear2DSet domainSet)
                  throws VisADException
Using the domain_set of the FlatField of an image (when one is available), extract the elements required. This implies that a CoordinateSystem is available with a reference coordinate of Latitude,Longitude.

Parameters:
domainSet - The VisAD Linear2DSet domain_set used when the associated image FlatField was created
Throws:
VisADException - necessary VisAD object cannot be created

setCoordinateSystem

public void setCoordinateSystem(CoordinateSystem cs,
                                int numEles,
                                int numLines,
                                RealTupleType domain)
                         throws VisADException
Define a CoordinateSystem whose fromReference() will be used to transform points from latitude/longitude into element,line.

Parameters:
cs - is that
numEles - is number of elements (x)
numLines - is number of lines (y)
domain - is the desired domain (ordered element, line)
Throws:
VisADException - a necessary VisAD object could not be created

doByLatLon

public void doByLatLon()
Set the MathType of the UnionSet to be lat/lon.


getData

public UnionSet getData()
getData creates a VisAD UnionSet type with the MathType specified thru one of the other methods. By default, the MathType is a RealTupleType of Latitude,Longitude, so the UnionSet (a union of Gridded2DSets) will have lat/lon values. Each Gridded2DSet is a line segment that is supposed to be drawn as a continuous line. This should only be called once after construction.

Returns:
UnionSet of maplines or null if there are no maplines in the domain of the display.

setEastPositive

public void setEastPositive(boolean value)
set the sign of longitude convention. By default, the longitudes are positive eastward

Parameters:
value - set to true for positive eastward, set to false for positive westward.

isEastPositive

public boolean isEastPositive()
determine what sign convention for longitude is currently being used.

Returns:
true if the convention is positive eastward; false if positive westward.