org.geotools.parameter
Class MatrixParameterDescriptors

java.lang.Object
  extended byorg.geotools.referencing.wkt.Formattable
      extended byorg.geotools.referencing.AbstractIdentifiedObject
          extended byorg.geotools.parameter.AbstractParameterDescriptor
              extended byorg.geotools.parameter.DefaultParameterDescriptorGroup
                  extended byorg.geotools.parameter.MatrixParameterDescriptors
All Implemented Interfaces:
org.opengis.parameter.GeneralParameterDescriptor, org.opengis.referencing.IdentifiedObject, org.opengis.parameter.ParameterDescriptorGroup, java.io.Serializable

public class MatrixParameterDescriptors
extends DefaultParameterDescriptorGroup

A parameter group for matrix elements. The amount of parameter values is extensible, i.e. it can grown or shrink according the value of "num_row" and "num_col" parameters. The parameters format may vary according the information provided to the constructor, but it is typically as below:

 num_row
 num_col
 elt_0_0
 elt_0_1
 ...
 elt_0_<num_col-1>
 elt_1_0
 elt_1_1
 ...
 elt_<num_row-1>_<num_col-1>
 

Since:
2.1
Version:
$Id: MatrixParameterDescriptors.java 17672 2006-01-19 00:25:55Z desruisseaux $
Author:
Martin Desruisseaux
See Also:
MatrixParameters, Serialized Form

Field Summary
static int DEFAULT_MATRIX_SIZE
          The default matrix size for the one-argument constructor.
protected  org.opengis.parameter.ParameterDescriptor numCol
          The descriptor for the "num_col" parameter.
protected  org.opengis.parameter.ParameterDescriptor numRow
          The descriptor for the "num_row" parameter.
protected  java.lang.String prefix
          The prefix to insert in front of parameter name for each matrix elements.
protected  char separator
          The separator between the row and the column index in parameter names.
 
Fields inherited from class org.geotools.referencing.AbstractIdentifiedObject
EMPTY_ALIAS_ARRAY, EMPTY_IDENTIFIER_ARRAY, IDENTIFIER_COMPARATOR, NAME_COMPARATOR, REMARKS_COMPARATOR
 
Fields inherited from interface org.opengis.referencing.IdentifiedObject
ALIAS_KEY, IDENTIFIERS_KEY, NAME_KEY, REMARKS_KEY
 
Constructor Summary
MatrixParameterDescriptors(java.util.Map properties)
          Constructs a parameter group with default name format matching Well Known Text usages.
MatrixParameterDescriptors(java.util.Map properties, org.opengis.parameter.ParameterDescriptor[] parameters, java.lang.String prefix, char separator)
          Constructs a parameter group.
 
Method Summary
 org.opengis.parameter.GeneralParameterValue createValue()
          Creates a new instance of parameter values with elements initialized to the 1 on the diagonal, and 0 everywere else.
 org.opengis.parameter.ParameterDescriptor descriptor(int row, int column)
          Returns the parameter in this group for a matrix element at the specified index. row and column indices are 0 based.
 org.opengis.parameter.GeneralParameterDescriptor descriptor(java.lang.String name)
          Returns the parameter in this group for the specified name.
 java.util.List descriptors()
          Returns the parameters in this group.
 boolean equals(AbstractIdentifiedObject object, boolean compareMetadata)
          Compares the specified object with this parameter group for equality.
 org.opengis.referencing.operation.Matrix getMatrix(org.opengis.parameter.ParameterValueGroup parameters)
          Constructs a matrix from a group of parameters.
 int hashCode()
          Returns a hash value for this parameter.
 
Methods inherited from class org.geotools.parameter.DefaultParameterDescriptorGroup
getMaximumOccurs
 
Methods inherited from class org.geotools.parameter.AbstractParameterDescriptor
formatWKT, getMinimumOccurs
 
Methods inherited from class org.geotools.referencing.AbstractIdentifiedObject
asSet, ensureAngularUnit, ensureLinearUnit, ensureNonNull, ensureNonNull, ensureTimeUnit, equals, equals, equals, equals, getAlias, getIdentifier, getIdentifier, getIdentifiers, getName, getName, getName, getProperties, getProperties, getRemarks, nameMatches, nameMatches
 
Methods inherited from class org.geotools.referencing.wkt.Formattable
toString, toWKT, toWKT, toWKT
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.opengis.parameter.GeneralParameterDescriptor
getMinimumOccurs
 
Methods inherited from interface org.opengis.referencing.IdentifiedObject
getAlias, getIdentifiers, getName, getRemarks, toWKT
 

Field Detail

DEFAULT_MATRIX_SIZE

public static final int DEFAULT_MATRIX_SIZE
The default matrix size for the one-argument constructor.

See Also:
Constant Field Values

numRow

protected final org.opengis.parameter.ParameterDescriptor numRow
The descriptor for the "num_row" parameter.


numCol

protected final org.opengis.parameter.ParameterDescriptor numCol
The descriptor for the "num_col" parameter.


prefix

protected final java.lang.String prefix
The prefix to insert in front of parameter name for each matrix elements.


separator

protected final char separator
The separator between the row and the column index in parameter names.

Constructor Detail

MatrixParameterDescriptors

public MatrixParameterDescriptors(java.util.Map properties)
Constructs a parameter group with default name format matching Well Known Text usages.

Parameters:
properties - Set of properties. Should contains at least "name".

MatrixParameterDescriptors

public MatrixParameterDescriptors(java.util.Map properties,
                                  org.opengis.parameter.ParameterDescriptor[] parameters,
                                  java.lang.String prefix,
                                  char separator)
Constructs a parameter group. The properties map is given unchanged to the super-class constructor. The array should contains parameters other than matrix elements. The first parameter is assumed to be the number of rows, and the second parameter the number of columns. All extra parameters are ignored.

Parameters:
properties - Set of properties. Should contains at least "name".
parameters - The "num_row" and "num_col" parameters.
prefix - The prefix to insert in front of parameter name for each matrix elements.
separator - The separator between the row and the column index in parameter names.
Method Detail

descriptor

public final org.opengis.parameter.GeneralParameterDescriptor descriptor(java.lang.String name)
                                                                  throws org.opengis.parameter.ParameterNotFoundException
Returns the parameter in this group for the specified name. The name can be a matrix element if it uses the following syntax: "elt_row_col" where "elt_" is the prefix for all matrix elements, and row and col are row and column indices respectively. For example "elt_2_1" is the element name for the value at line 2 and row 1. The row and column index are 0 based.

Specified by:
descriptor in interface org.opengis.parameter.ParameterDescriptorGroup
Overrides:
descriptor in class DefaultParameterDescriptorGroup
Parameters:
name - The case insensitive name of the parameter to search for.
Returns:
The parameter for the given name.
Throws:
org.opengis.parameter.ParameterNotFoundException - if there is no parameter for the given name.

descriptor

public final org.opengis.parameter.ParameterDescriptor descriptor(int row,
                                                                  int column)
                                                           throws java.lang.IndexOutOfBoundsException
Returns the parameter in this group for a matrix element at the specified index. row and column indices are 0 based. Indices must be lower that the maximum values given to the numRow and numCol parameters.

Parameters:
row - The row indice.
column - The column indice
Returns:
The parameter descriptor for the specified matrix element.
Throws:
java.lang.IndexOutOfBoundsException - if or is out of bounds.

descriptors

public final java.util.List descriptors()
Returns the parameters in this group. The number or elements is inferred from the default values given to the numRow and numCol parameters.

Specified by:
descriptors in interface org.opengis.parameter.ParameterDescriptorGroup
Overrides:
descriptors in class DefaultParameterDescriptorGroup
Returns:
The matrix parameters, including all elements.

createValue

public org.opengis.parameter.GeneralParameterValue createValue()
Creates a new instance of parameter values with elements initialized to the 1 on the diagonal, and 0 everywere else. The returned parameter group is extensible, i.e. the number of elements will depends upon the value associated to the numRow and numCol parameters.

Specified by:
createValue in interface org.opengis.parameter.GeneralParameterDescriptor
Overrides:
createValue in class DefaultParameterDescriptorGroup

getMatrix

public org.opengis.referencing.operation.Matrix getMatrix(org.opengis.parameter.ParameterValueGroup parameters)
                                                   throws org.opengis.parameter.InvalidParameterNameException
Constructs a matrix from a group of parameters.

Parameters:
parameters - The group of parameters.
Returns:
A matrix constructed from the specified group of parameters.
Throws:
org.opengis.parameter.InvalidParameterNameException - if a parameter name was not recognized.

equals

public boolean equals(AbstractIdentifiedObject object,
                      boolean compareMetadata)
Compares the specified object with this parameter group for equality.

Overrides:
equals in class DefaultParameterDescriptorGroup
Parameters:
object - The object to compare to .
compareMetadata - for performing a strict comparaison, or for comparing only properties relevant to transformations.
Returns:
if both objects are equal.

hashCode

public int hashCode()
Returns a hash value for this parameter.

Overrides:
hashCode in class DefaultParameterDescriptorGroup
Returns:
The hash code value. This value doesn't need to be the same in past or future versions of this class.


Copyright © GeoTools. All Rights Reserved.