HiRISE

HiRISE.HiPlan.HiWeb
Class VerticesTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by HiRISE.HiPlan.HiWeb.VerticesTableModel
All Implemented Interfaces:
Serializable, TableModel

public class VerticesTableModel
extends AbstractTableModel

A table model for a list of lat-lon vertices.

Version:
1.11
Author:
Guy McArthur - UA/PIRL
See Also:
Serialized Form

Field Summary
static double d2r
          Degrees to radians.
static String ID
          Class identification name with source code version and date.
static double inc
          Inclination of MRO's orbit in radians.
static double r2d
          Radians to degrees.
static double ra
          Mars equatorial radius in km.
static double rc
          Mars polar radius in km.
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
VerticesTableModel()
           
 
Method Summary
 void addRow()
          Adds a new row with default values to the end of the list.
 void addRow(Object[] row)
          Adds a new row with the given values to the end of the list.
 Class getColumnClass(int col)
          Gets the class of a column by number.
 int getColumnCount()
          Gets the number of columns.
 String getColumnName(int col)
          Gets the name of a column by number.
 int getRowCount()
          Gets the number of vertices.
 Object getValueAt(int row, int col)
          Gets the value at a given cell.
 String getVertices()
          Gets the vertices as a serialized list of lon, lat values.
static String getVertices(double clat, double clon, double himg, double wimg)
          Returns the string-ified version of ROI vertices when given a center latitude-longitude and a footprint height and width.
 void insertRow(int row)
          Inserts a new row at the given row number, the insert will be after the current row with the same number, moving all other by one.
 boolean isCellEditable(int row, int col)
          Returns true if a cell is editable.
 void removeAllRows()
          Removes all ROI rows from the table, effective reinitializing the model.
 void removeRow(int row)
          Removes the row at the offset given.
 void setValueAt(Object value, int row, int col)
          Sets the value for a given cell.
 void setVertices(String vertices)
          Set the vertices from a String of lon-lat vertices.
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ID

public static final String ID
Class identification name with source code version and date.

See Also:
Constant Field Values

d2r

public static final double d2r
Degrees to radians.

See Also:
Constant Field Values

r2d

public static final double r2d
Radians to degrees.

See Also:
Constant Field Values

ra

public static final double ra
Mars equatorial radius in km.

See Also:
Constant Field Values

rc

public static final double rc
Mars polar radius in km.

See Also:
Constant Field Values

inc

public static final double inc
Inclination of MRO's orbit in radians.

See Also:
Constant Field Values
Constructor Detail

VerticesTableModel

public VerticesTableModel()
Method Detail

getRowCount

public int getRowCount()
Gets the number of vertices.

Returns:
number of vertices

getColumnCount

public int getColumnCount()
Gets the number of columns. This will always be three.

Returns:
number of columns.

getValueAt

public Object getValueAt(int row,
                         int col)
Gets the value at a given cell.

Parameters:
row - row number starting from zero
col - col number starting from zero
Returns:
value

getColumnClass

public Class getColumnClass(int col)
Gets the class of a column by number.

Specified by:
getColumnClass in interface TableModel
Overrides:
getColumnClass in class AbstractTableModel
Parameters:
col - col number (starting from zero)
Returns:
class of column

getColumnName

public String getColumnName(int col)
Gets the name of a column by number.

Specified by:
getColumnName in interface TableModel
Overrides:
getColumnName in class AbstractTableModel
Parameters:
col - col number (starts from zero)
Returns:
column name

setValueAt

public void setValueAt(Object value,
                       int row,
                       int col)
Sets the value for a given cell.

Specified by:
setValueAt in interface TableModel
Overrides:
setValueAt in class AbstractTableModel
Parameters:
row - row number starting from zero
col - col number starting from zero
value -

isCellEditable

public boolean isCellEditable(int row,
                              int col)
Returns true if a cell is editable. At present, we do not want the cells to be editable.

Specified by:
isCellEditable in interface TableModel
Overrides:
isCellEditable in class AbstractTableModel
Parameters:
row - row number starting from zero
col - col number starting from zero
Returns:
false, for the cells are not editable.

addRow

public void addRow()
Adds a new row with default values to the end of the list.


addRow

public void addRow(Object[] row)
Adds a new row with the given values to the end of the list.

Parameters:
row - String row, String lat, String lon

insertRow

public void insertRow(int row)
Inserts a new row at the given row number, the insert will be after the current row with the same number, moving all other by one. The new row will copy all the values of the row before it.

Parameters:
row - Row number to insert

removeRow

public void removeRow(int row)
Removes the row at the offset given. Subsequent rows will be moved down.

Parameters:
row - offset

removeAllRows

public void removeAllRows()
Removes all ROI rows from the table, effective reinitializing the model.


getVertices

public String getVertices()
Gets the vertices as a serialized list of lon, lat values.

Returns:
All vertices as a comma seperated String

setVertices

public void setVertices(String vertices)
                 throws ParseException
Set the vertices from a String of lon-lat vertices.

Parameters:
vertices - Comma separated vertices (lon,lat,lon,lat ...)
Throws:
ParseException - Invalid list of vertices

getVertices

public static String getVertices(double clat,
                                 double clon,
                                 double himg,
                                 double wimg)
Returns the string-ified version of ROI vertices when given a center latitude-longitude and a footprint height and width. Coordinates are planetocentric/east-leading, and a footprint height and width are in kilometers.

Parameters:
clat - Center planetocentric latitude
clon - Center planetographic longitude
himg - Height of footprint in kilometers
wimg - Width of footprint in kilometers
Returns:
Vertices

HiRISE

Copyright (C) Arizona Board of Regents on behalf of the Planetary Image Research Laboratory, Lunar and Planetary Laboratory at the University of Arizona