Java Doc for OperationJAI.java in  » GIS » GeoTools-2.4.1 » org » geotools » coverage » processing » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » GIS » GeoTools 2.4.1 » org.geotools.coverage.processing 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.geotools.coverage.processing.AbstractOperation
      org.geotools.coverage.processing.Operation2D
         org.geotools.coverage.processing.OperationJAI

All known Subclasses:   org.geotools.coverage.processing.operation.MinFilter,  org.geotools.coverage.processing.operation.Invert,  org.geotools.coverage.processing.operation.SubtractFromConst,  org.geotools.coverage.processing.operation.Rescale,  org.geotools.coverage.processing.operation.MaxFilter,  org.geotools.coverage.processing.operation.Log,  org.geotools.coverage.processing.operation.GradientMagnitude,  org.geotools.coverage.processing.operation.Exp,  org.geotools.coverage.processing.operation.SubtractConst,  org.geotools.coverage.processing.operation.MedianFilter,  org.geotools.coverage.processing.operation.MultiplyConst,  org.geotools.coverage.processing.BilevelOperation,  org.geotools.coverage.processing.operation.Convolve,  org.geotools.coverage.processing.operation.AddConst,  org.geotools.coverage.processing.FilterOperation,  org.geotools.coverage.processing.operation.Absolute,  org.geotools.coverage.processing.AbstractStatisticsOperationJAI,  org.geotools.coverage.processing.operation.DivideByConst,
OperationJAI
public class OperationJAI extends Operation2D (Code)
Wraps a JAI's OperationDescriptor for interoperability with Java Advanced Imaging. This class help to leverage the rich set of JAI operators in an GeoAPI framework. OperationJAI inherits operation name and argument types from OperationDescriptor , except the source argument type (usually .class) which is set to .class. If there is only one source argument, it will be renamed "source" for better compliance with OpenGIS usage.

The entry point for applying an operation is the usual OperationJAI.doOperation doOperation method. The default implementation forward the call to other methods for different bits of tasks, resulting in the following chain of calls:

OperationJAI.doOperation doOperation :  the entry point.
OperationJAI.resampleToCommonGeometry resampleToCommonGeometry :  reprojects all sources to the same coordinate reference system.
OperationJAI.deriveGridCoverage deriveGridCoverage :  gets the destination properties.
OperationJAI.deriveSampleDimension deriveSampleDimension :  gets the destination sample dimensions.
OperationJAI.deriveCategory deriveCategory :  gets the destination categories.
OperationJAI.deriveRange deriveRange :  gets the expected range of values.
OperationJAI.deriveUnit deriveUnit :  gets the destination units.
OperationJAI.createRenderedImage createRenderedImage :  the actual call to JAI.createNS JAI.createNS .

since:
   2.2
version:
   $Id: OperationJAI.java 27848 2007-11-12 13:10:32Z desruisseaux $
author:
   Martin Desruisseaux
author:
   Simone Giannecchini

Inner Class :final protected static class Parameters

Field Summary
final protected static  StringRENDERED_MODE
     The rendered mode for JAI operation.
final protected  OperationDescriptoroperation
     The JAI's operation descriptor.

Constructor Summary
public  OperationJAI(String operation)
     Constructs a grid coverage operation from a JAI operation name.
public  OperationJAI(OperationDescriptor operation)
     Constructs a grid coverage operation backed by a JAI operation.
protected  OperationJAI(OperationDescriptor operation, ParameterDescriptorGroup descriptor)
     Constructs a grid coverage operation backed by a JAI operation.

Method Summary
protected  RenderedImagecreateRenderedImage(ParameterBlockJAI parameters, RenderingHints hints)
     Applies the JAI operation.
protected  CategoryderiveCategory(Category[] categories, Parameters parameters)
     Returns the quantitative category for a single in the target .
protected  GridCoverage2DderiveGridCoverage(GridCoverage2D[] sources, Parameters parameters)
     Applies a JAI operation to a grid coverage.
protected  InternationalStringderiveName(GridCoverage2D[] sources, int primarySourceIndex, Parameters parameters)
     Returns a name for the target based on the given sources.
protected  NumberRangederiveRange(NumberRange[] ranges, Parameters parameters)
     Returns the range of value for a single in the target .
protected  GridSampleDimension[]deriveSampleDimension(GridSampleDimension[][] bandLists, Parameters parameters)
     Returns the for the target .
protected  UnitderiveUnit(Unit[] units, Parameters parameters)
     Returns the unit of data for a single in the target .
public  CoveragedoOperation(ParameterValueGroup parameters, Hints hints)
     Applies a process operation to a grid coverage. The default implementation performs the following steps:
  1. Converts source grid coverages to their geophysics view using (true). This allow to performs all computation on geophysics values instead of encoded samples.
public  booleanequals(Object object)
     Compares the specified object with this operation for equality.
public static  JAIgetJAI(RenderingHints hints)
     Returns the JAI instance to use for operations on RenderedImage . If no JAI instance is defined for the Hints.JAI_INSTANCE key, then the default instance is returned.
Parameters:
  hints - The rendering hints, or null if none.
protected static  OperationDescriptorgetOperationDescriptor(String name)
     Returns the operation descriptor for the specified JAI operation name.
protected  MapgetProperties(RenderedImage data, CoordinateReferenceSystem crs, InternationalString name, MathTransform gridToCRS, GridCoverage2D[] sources, Parameters parameters)
     Prepares the properties to be given to the coverage created by the OperationJAI.deriveGridCoverage deriveGridCoverage method.
protected static  intgetQuantitative(Category[] categories)
     Returns the index of the quantitative category, providing that there is one and only one quantitative category.
protected  ParameterBlockJAIprepareParameters(ParameterValueGroup parameters)
     Copies parameter values from the specified ParameterValueGroup to the ParameterBlockJAI , except the sources.

Note: it would be possible to use ImagingParameters.parameters directly in some occasions.

protected  voidresampleToCommonGeometry(GridCoverage2D[] sources, CoordinateReferenceSystem crs2D, MathTransform2D gridToCrs2D, Hints hints)
     Resamples all sources grid coverages to the same before to apply the .

Field Detail
RENDERED_MODE
final protected static String RENDERED_MODE(Code)
The rendered mode for JAI operation.



operation
final protected OperationDescriptor operation(Code)
The JAI's operation descriptor.




Constructor Detail
OperationJAI
public OperationJAI(String operation) throws OperationNotFoundException(Code)
Constructs a grid coverage operation from a JAI operation name. This convenience constructor fetch the OperationDescriptor from the specified operation name using the default JAI instance.
Parameters:
  operation - JAI operation name (e.g. "GradientMagnitude" ).
throws:
  OperationNotFoundException - if no JAI descriptor was found for the given name.



OperationJAI
public OperationJAI(OperationDescriptor operation)(Code)
Constructs a grid coverage operation backed by a JAI operation. The operation descriptor must supports the "rendered" mode (which is the case for most JAI operations).
Parameters:
  operation - The JAI operation descriptor.



OperationJAI
protected OperationJAI(OperationDescriptor operation, ParameterDescriptorGroup descriptor)(Code)
Constructs a grid coverage operation backed by a JAI operation. The operation descriptor must supports the "rendered" mode (which is the case for most JAI operations).
Parameters:
  operation - The JAI operation descriptor.
Parameters:
  descriptor - The OGC parameters descriptor.




Method Detail
createRenderedImage
protected RenderedImage createRenderedImage(ParameterBlockJAI parameters, RenderingHints hints)(Code)
Applies the JAI operation. The operation name can be fetch from OperationJAI.operation . The JAI instance to use can be fetch from OperationJAI.getJAI . The default implementation returns the following:
 (hints).
 (
 .getName(), parameters, hints)
 
Subclasses may override this method in order to invokes a different JAI operation according the parameters.
Parameters:
  parameters - The parameters to be given to JAI.
Parameters:
  hints - The rendering hints to be given to JAI.



deriveCategory
protected Category deriveCategory(Category[] categories, Parameters parameters)(Code)
Returns the quantitative category for a single in the target . This method is invoked automatically by the OperationJAI.deriveSampleDimension deriveSampleDimension method for each band in the target image. The default implementation creates a default category from the target range of values returned by OperationJAI.deriveRange deriveRange .
Parameters:
  categories - The quantitative categories from every sources. For unary operationslike "GradientMagnitude" , this array has a length of 1. For binaryoperations like "add" and "multiply" , this array has a length of 2.
Parameters:
  parameters - Parameters, rendering hints and coordinate reference system to use. The quantative category to use in the destination image, or null if unknow.



deriveGridCoverage
protected GridCoverage2D deriveGridCoverage(GridCoverage2D[] sources, Parameters parameters)(Code)
Applies a JAI operation to a grid coverage. This method is invoked automatically by OperationJAI.doOperation . The default implementation performs the following steps:
Parameters:
  sources - The source coverages.
Parameters:
  parameters - Parameters, rendering hints and coordinate reference system to use. The result as a grid coverage.
See Also:   OperationJAI.doOperation
See Also:   OperationJAI.deriveSampleDimension
See Also:   JAI.createNS



deriveName
protected InternationalString deriveName(GridCoverage2D[] sources, int primarySourceIndex, Parameters parameters)(Code)
Returns a name for the target based on the given sources. This method is invoked once by the OperationJAI.deriveGridCoverage deriveGridCoverage method. The default implementation returns the operation name followed by the source name between parenthesis, for example "GradientMagnitude(Sea Surface Temperature)".
Parameters:
  sources - The sources grid coverage.
Parameters:
  primarySourceIndex - The index of what seems to be the primary source, or -1 if none of unknow.
Parameters:
  parameters - Parameters, rendering hints and coordinate reference system to use. A name for the target grid coverage.



deriveRange
protected NumberRange deriveRange(NumberRange[] ranges, Parameters parameters)(Code)
Returns the range of value for a single in the target . This method is invoked automatically by the OperationJAI.deriveCategory deriveCategory method for each band in the target image. Subclasses should override this method in order to compute the target range of values. For example, the "add" operation may implements this method as below:
 double min = ranges[0].getMinimum() + ranges[1].getMinimum();
 double max = ranges[0}.getMaximum() + ranges[1}.getMaximum();
 return new NumberRange(min, max);
 

Parameters:
  ranges - The range of values from every sources. For unary operations like "GradientMagnitude" , this array has a length of 1. For binary operationslike "add" and "multiply" , this array has a length of 2.
Parameters:
  parameters - Parameters, rendering hints and coordinate reference system to use. The range of values to use in the destination image, or null if unknow.



deriveSampleDimension
protected GridSampleDimension[] deriveSampleDimension(GridSampleDimension[][] bandLists, Parameters parameters)(Code)
Returns the for the target . This method is invoked automatically by OperationJAI.deriveGridCoverage deriveGridCoverage with a bandLists argument initialized as below:

  • The bandLists array length is equals to the number of source coverages.
  • The bandLists[i] array length is equals to the number of sample dimensions in the source coverage i.
  • The sample dimension for a band at index band in the source at index source is bandLists[source][band] .

This method shall returns an array with a length equals to the number of bands in the target image. If the sample dimensions can't be determined, then this method is allowed to returns null .

The default implementation iterates among all bands and invokes the OperationJAI.deriveCategoryderiveCategory and OperationJAI.deriveUnit deriveUnit methods for each of them. Subclasses should override this method if they know a more accurate algorithm for determining sample dimensions.
Parameters:
  bandLists - The set of sample dimensions for each source GridCoverage2Ds.
Parameters:
  parameters - Parameters, rendering hints and coordinate reference system to use. The sample dimensions for each band in the destination image, or null if unknow.
See Also:   OperationJAI.deriveCategory
See Also:   OperationJAI.deriveUnit




deriveUnit
protected Unit deriveUnit(Unit[] units, Parameters parameters)(Code)
Returns the unit of data for a single in the target . This method is invoked automatically by the OperationJAI.deriveSampleDimension deriveSampleDimension method for each band in the target image. Subclasses should override this method in order to compute the target units from the source units. For example a "multiply" operation may implement this method as below:
 if (units[0]!=null && units[1]!=null) {
 return units[0].
Unit.multiply(Unit) multiply (units[1]);
 } else {
 return super.deriveUnit(units, cs, parameters);
 }
 

Parameters:
  units - The units from every sources. For unary operations like "GradientMagnitude" , this array has a length of 1. For binary operationslike "add" and "multiply" , this array has a length of 2.
Parameters:
  parameters - Parameters, rendering hints and coordinate reference system to use. The unit of data in the destination image, or null if unknow.



doOperation
public Coverage doOperation(ParameterValueGroup parameters, Hints hints) throws CoverageProcessingException(Code)
Applies a process operation to a grid coverage. The default implementation performs the following steps:
  1. Converts source grid coverages to their geophysics view using (true). This allow to performs all computation on geophysics values instead of encoded samples. Note: this step is disabled if OperationJAI.computeOnGeophysicsValues computeOnGeophysicsValues returns false .
  2. Ensures that every sources GridCoverage2D s use the same coordinate reference system (at least for the two-dimensional part) with the same GridGeometry2D.getGridToCRS2D gridToCRS relationship.
  3. Invokes OperationJAI.deriveGridCoverage . The sources in the ParameterBlock are RenderedImage objects obtained from GridCoverage2D.getRenderedImage .
  4. If a changes from non-geophysics to geophysics view were performed at step 1, converts the result back to the original view using (false).

Parameters:
  parameters - List of name value pairs for the parameters required for the operation.
Parameters:
  hints - A set of rendering hints, or null if none. The result as a grid coverage.
throws:
  CoverageProcessingException - if the operation can't be applied.
See Also:   OperationJAI.deriveGridCoverage



equals
public boolean equals(Object object)(Code)
Compares the specified object with this operation for equality.



getJAI
public static JAI getJAI(RenderingHints hints)(Code)
Returns the JAI instance to use for operations on RenderedImage . If no JAI instance is defined for the Hints.JAI_INSTANCE key, then the default instance is returned.
Parameters:
  hints - The rendering hints, or null if none. The JAI instance to use (never null ).



getOperationDescriptor
protected static OperationDescriptor getOperationDescriptor(String name) throws OperationNotFoundException(Code)
Returns the operation descriptor for the specified JAI operation name. This method uses the default JAI instance and looks for the mode.
Parameters:
  name - The operation name. The operation descriptor for the given name.
throws:
  OperationNotFoundException - if no JAI descriptor was found for the given name.
since:
   2.4



getProperties
protected Map getProperties(RenderedImage data, CoordinateReferenceSystem crs, InternationalString name, MathTransform gridToCRS, GridCoverage2D[] sources, Parameters parameters)(Code)
Prepares the properties to be given to the coverage created by the OperationJAI.deriveGridCoverage deriveGridCoverage method. The default implementation returns null .
Parameters:
  data - The RenderedImage created by this operation.
Parameters:
  crs - The coordinate reference system assigned to the coverage this OperationJAI will produce.
Parameters:
  name - The name assigned to the coverage this OperationJAI will produce.
Parameters:
  gridToCRS - The from grid to crs to beassigned to the coverage this OperationJAI will produce.
Parameters:
  sources - The sources to be assigned to the coverage this OperationJAI willproduce.
Parameters:
  parameters - The parameters that were used by this OperationJAI. a Map with the properties generated by thisOperationJAI or null if we haven't any.
since:
   2.4



getQuantitative
protected static int getQuantitative(Category[] categories)(Code)
Returns the index of the quantitative category, providing that there is one and only one quantitative category. If categories contains 0, 2 or more quantative category, then this method returns -1 .
since:
   2.4



prepareParameters
protected ParameterBlockJAI prepareParameters(ParameterValueGroup parameters)(Code)
Copies parameter values from the specified ParameterValueGroup to the ParameterBlockJAI , except the sources.

Note: it would be possible to use ImagingParameters.parameters directly in some occasions. However, we peform an unconditional copy instead because some operations (e.g. "GradientMagnitude") may change the values.
Parameters:
  parameters - The ParameterValueGroup to be copied. A copy of the provided ParameterValueGroup as a JAI block.
since:
   2.4




resampleToCommonGeometry
protected void resampleToCommonGeometry(GridCoverage2D[] sources, CoordinateReferenceSystem crs2D, MathTransform2D gridToCrs2D, Hints hints) throws InvalidGridGeometryException, CannotReprojectException(Code)
Resamples all sources grid coverages to the same before to apply the . This method is invoked automatically by the OperationJAI.doOperation doOperation method. Only the two-dimensional part is reprojected (usually the spatial component of a CRS). Extra dimension (if any) are left unchanged. Extra dimensions are typically time axis or depth. Note that extra dimensions are not forced to a common geometry; only the two dimensions that apply to a javax.media.jai.PlanarImage are. This is because the extra dimensions don't need to be compatible for all operations. For example if a source image is a slice in a time series, a second source image could be a slice in the frequency representation of this time series.

Subclasses should override this method if they want to specify target and different than the default ones. For example if a subclass wants to force all images to be referenced in a CRS, then it may overrides this method as below:

 protected void resampleToCommonGeometry(...) {
 crs2D = DefaultGeographicCRS.WGS84;
 super.resampleToCommonGeometry(sources, crs2D, gridToCrs2D, hints);
 }

Parameters:
  sources - The source grid coverages to resample. This array is updated in-place asneeded (for example if a grid coverage is replaced by a projected one).
Parameters:
  crs2D - The target coordinate reference system to use, or null for adefault one.
Parameters:
  gridToCrs2D - The target "grid to coordinate reference system" transform, or null for a default one.
Parameters:
  hints - The rendering hints, or null if none.
throws:
  InvalidGridGeometryException - if a source coverage has an unsupported grid geometry.
throws:
  CannotReprojectException - if a grid coverage can't be resampled for some other reason.



Fields inherited from org.geotools.coverage.processing.Operation2D
final protected static int PRIMARY_SOURCE_INDEX(Code)(Java Doc)
final public static ParameterDescriptor SOURCE_0(Code)(Java Doc)

Methods inherited from org.geotools.coverage.processing.Operation2D
protected boolean computeOnGeophysicsValues(ParameterValueGroup parameters)(Code)(Java Doc)
protected ViewType extractSources(ParameterValueGroup parameters, String[] sourceNames, GridCoverage2D[] sources) throws ParameterNotFoundException, InvalidParameterValueException(Code)(Java Doc)
protected static GridCoverageFactory getFactory(Hints hints)(Code)(Java Doc)

Fields inherited from org.geotools.coverage.processing.AbstractOperation
final protected ParameterDescriptorGroup descriptor(Code)(Java Doc)

Methods inherited from org.geotools.coverage.processing.AbstractOperation
abstract public Coverage doOperation(ParameterValueGroup parameters, Hints hints) throws CoverageProcessingException(Code)(Java Doc)
protected static void ensureNonNull(String name, Object object) throws IllegalArgumentException(Code)(Java Doc)
public boolean equals(Object object)(Code)(Java Doc)
public String getDescription()(Code)(Java Doc)
public String getDocURL()(Code)(Java Doc)
public String getName()(Code)(Java Doc)
public int getNumSources()(Code)(Java Doc)
public ParameterValueGroup getParameters()(Code)(Java Doc)
protected static AbstractProcessor getProcessor(RenderingHints hints)(Code)(Java Doc)
public String getVendor()(Code)(Java Doc)
public String getVersion()(Code)(Java Doc)
public int hashCode()(Code)(Java Doc)
public String toString()(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.