Java Doc for LocalizationGrid.java in  » GIS » GeoTools-2.4.1 » org » geotools » referencing » operation » builder » 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.referencing.operation.builder 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.geotools.referencing.operation.builder.LocalizationGrid

All known Subclasses:   org.geotools.referencing.operation.transform.LocalizationGrid,
LocalizationGrid
public class LocalizationGrid (Code)
A factory for MathTransform2D backed by a grid of localization. A grid of localization is a two-dimensional array of coordinate points. The grid size is width  ×  height . Input coordinates are (i,j) index in the grid, where i must be in the range [0..width-1] and j in the range [0..height-1] inclusive. Output coordinates are the values stored in the grid of localization at the specified index.

The LocalizationGrid class is usefull when the " " transform for a coverage is not some kind of global mathematical relationship like an . Instead, the "real world" coordinates are explicitly specified for each pixels. If the real world coordinates are know only for some pixels at a fixed interval, then a transformation can be constructed by the concatenation of an affine transform with a grid of localization.

After a LocalizationGrid object has been fully constructed (i.e. real world coordinates have been specified for all grid cells), a transformation from grid coordinates to "real world" coordinates can be obtained with the LocalizationGrid.getMathTransform method. If this transformation is close enough to an affine transform, then an instance of AffineTransform is returned. Otherwise, a transform backed by the localization grid is returned.

The example below goes through the steps of constructing a coordinate reference system for a grid coverage from its grid of localization. This example assumes that the "real world" coordinates are longitudes and latitudes on the ellipsoid.

 //
 // Constructs a localization grid of size 10×10.
 //
 LocalizationGrid grid = new LocalizationGrid(10,10);
 for (int j=0; j<10; j++) {
 for (int i=0; i<10; i++) {
 double x = ...; // Set longitude here
 double y = ...; // Set latitude here
 grid.
 (i,j,x,y);
 }
 }
 //
 // Constructs the grid coordinate reference system. degree is the polynomial
 // degree (e.g. 2) for a math transform that approximately map the grid of localization.
 // For a more accurate (but not always better) math transform backed by the whole grid,
 // invokes 
  instead, or use the special value of 0 for the degree
 // argument.
 //
 MathTransform2D        realToGrid = grid.
 (degree).inverse();
 CoordinateReferenceSystem realCRS = DefaultGeographicCRS.WGS84;
 CoordinateReferenceSystem gridCRS = new 
 ("The grid CRS",
 new 
 (realToGrid),
 realCRS,     // The target ("real world") CRS
 realToGrid,  // How the grid CRS relates to the "real world" CRS
 );
 //
 // Constructs the grid coverage using the grid coordinate system (not the "real world"
 // one). It is usefull to display the coverage in its native CRS before we resample it.
 // Note that if the grid of localization does not define the geographic location for
 // all pixels, then we need to specify some affine transform in place of the call to
 // IdentityTransform. For example if the grid of localization defines the location of
 // 1 pixel, then skip 3, then defines the location of 1 pixel, etc., then the affine
 // transform should be AffineTransform.getScaleInstance(0.25, 0.25).
 //
  raster = 
 .createBandedRaster(DataBuffer.TYPE_FLOAT,
 width, height, 1, null);
 for (int y=0; ysome_value);
 }
 }
 GridCoverageFactory factory = FactoryFinder.getGridCoverageFactory(null);
 GridCoverage coverage = factory.create("My grayscale coverage", raster, gridCRS,
 IdentityTransform.create(2), null, null, null, null, null);
 coverage.show();
 //
 // Projects the coverage from its current 'gridCS' to the 'realCS'. If the grid of
 // localization was built from the orbit of some satellite, then the projected
 // coverage will tpypically have a curved aspect.
 //
 coverage = (Coverage2D) Operations.DEFAULT.resample(coverage, realCRS);
 coverage.show();
 

since:
   2.4
version:
   $Id: LocalizationGrid.java 29101 2008-02-06 12:11:19Z desruisseaux $
author:
   Remi Eve
author:
   Martin Desruisseaux
author:
   Alessio Fabiani
See Also:   org.opengis.referencing.crs.DerivedCRS



Constructor Summary
public  LocalizationGrid(int width, int height)
     Constructs an initially empty localization grid.

Method Summary
public synchronized  AffineTransformgetAffineTransform()
     Returns an affine transform for the whole grid.
public synchronized  Point2DgetLocalizationPoint(Point source)
     Returns the "real world" coordinates for the specified grid coordinates. Grid coordinates must be integers inside this grid's range.
final public  MathTransform2DgetMathTransform()
     Returns a math transform from grid to "real world" coordinates.
public synchronized  MathTransform2DgetPolynomialTransform(int degree)
     Returns a math transform from grid to "real world" coordinates using a polynomial fitting of the specified degree.
public  DimensiongetSize()
     Returns the grid size.
public synchronized  booleanisMonotonic(boolean strict)
     Returns true if all coordinates in this grid are increasing or decreasing. More specifically, returns true if the following conditions are meets:
  • Coordinates in a row must be increasing or decreasing.
public synchronized  booleanisNaN()
     Returns true if this localization grid contains at least one NaN value.
public  voidremoveSingularities()
     Makes sure that the grid doesn't contains identical consecutive ordinates.
public  voidsetLocalizationPoint(Point source, Point2D target)
     Set a point in this localization grid.
public synchronized  voidsetLocalizationPoint(int sourceX, int sourceY, double targetX, double targetY)
     Set a point in this localization grid.
public synchronized  voidtransform(AffineTransform transform, Rectangle region)
     Apply a transformation to every "real world" coordinate points in a sub-region of this grid.


Constructor Detail
LocalizationGrid
public LocalizationGrid(int width, int height)(Code)
Constructs an initially empty localization grid. All "real worlds" coordinates are initially set to (NaN,NaN) .
Parameters:
  width - Number of grid's columns.
Parameters:
  height - Number of grid's rows.




Method Detail
getAffineTransform
public synchronized AffineTransform getAffineTransform()(Code)
Returns an affine transform for the whole grid. This transform is only an approximation for this localization grid. It is fitted (like "curve fitting") to grid data using the "least squares" method. A global affine transform as an approximation for the whole localization grid.



getLocalizationPoint
public synchronized Point2D getLocalizationPoint(Point source)(Code)
Returns the "real world" coordinates for the specified grid coordinates. Grid coordinates must be integers inside this grid's range. For general transformations involving non-integer grid coordinates and/or coordinates outside this grid's range, use LocalizationGrid.getMathTransform instead.
Parameters:
  source - The point in grid coordinates. target The corresponding point in "real world" coordinates.
throws:
  IndexOutOfBoundsException - If the source point is not in this grid's range.



getMathTransform
final public MathTransform2D getMathTransform()(Code)
Returns a math transform from grid to "real world" coordinates. The math transform is backed by the full grid of localization. In terms of JAI's operations, this math transform is backed by a WarpGrid while the previous methods return math transforms backed by WarpPolynomial .



getPolynomialTransform
public synchronized MathTransform2D getPolynomialTransform(int degree)(Code)
Returns a math transform from grid to "real world" coordinates using a polynomial fitting of the specified degree. By convention, a degree of 0 will returns the . Greater values will use a fitted polynomial ( for degree 1, quadratic transform for degree 2, cubic transform for degree 3, etc.).
Parameters:
  degree - The polynomial degree for the fitting, or 0 for a transform backed by thewhole grid.



getSize
public Dimension getSize()(Code)
Returns the grid size. Grid coordinates are always in the range xinput = [0..width-1] and yinput = [0..height-1] inclusive.



isMonotonic
public synchronized boolean isMonotonic(boolean strict)(Code)
Returns true if all coordinates in this grid are increasing or decreasing. More specifically, returns true if the following conditions are meets:
  • Coordinates in a row must be increasing or decreasing. If strict is true , then coordinates must be strictly increasing or decreasing (i.e. equals value are not accepted). NaN values are always ignored.
  • Coordinates in all rows must be increasing, or coordinates in all rows must be decreasing.
  • Idem for columns (Coordinates in a columns must be increasing or decreasing, etc.).
x and y coordinates are tested independently.
Parameters:
  strict - true to require strictly increasing or decreasing order,or false to accept values that are equals. true if coordinates are increasing or decreasing in the samedirection for all rows and columns.



isNaN
public synchronized boolean isNaN()(Code)
Returns true if this localization grid contains at least one NaN value.



removeSingularities
public void removeSingularities()(Code)
Makes sure that the grid doesn't contains identical consecutive ordinates. If many consecutives ordinates are found to be identical in a row or in a column, then the first one is left inchanged and the other ones are linearly interpolated.



setLocalizationPoint
public void setLocalizationPoint(Point source, Point2D target)(Code)
Set a point in this localization grid.
Parameters:
  source - The point in grid coordinates.
Parameters:
  target - The corresponding point in "real world" coordinates.
throws:
  IndexOutOfBoundsException - If the source point is not in this grid's range.



setLocalizationPoint
public synchronized void setLocalizationPoint(int sourceX, int sourceY, double targetX, double targetY)(Code)
Set a point in this localization grid.
Parameters:
  sourceX - x coordinates in grid coordinates,in the range [0..width-1] inclusive.
Parameters:
  sourceY - y coordinates in grid coordinates.in the range [0..height-1] inclusive.
Parameters:
  targetX - x coordinates in "real world" coordinates.
Parameters:
  targetY - y coordinates in "real world" coordinates.
throws:
  IndexOutOfBoundsException - If the source coordinates is not in this grid's range.



transform
public synchronized void transform(AffineTransform transform, Rectangle region)(Code)
Apply a transformation to every "real world" coordinate points in a sub-region of this grid.
Parameters:
  transform - The transform to apply.
Parameters:
  region - The bounding rectangle (in grid coordinate) for region where toapply the transform, or null to transform the whole grid.



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.