localizationgrid.html

来自「Geotools是一个开源的Java GIS工具包,可利用它来开发符合标准的地理」· HTML 代码 · 共 633 行 · 第 1/3 页

HTML
633
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc (build 1.4.2_13) on Tue Jun 05 11:36:20 GMT-05:00 2007 --><META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><TITLE>LocalizationGrid (Geotools 2.3.x 2.3.2 API)</TITLE><META NAME="keywords" CONTENT="org.geotools.referencing.operation.transform.LocalizationGrid class"><META NAME="keywords" CONTENT="getSize()"><META NAME="keywords" CONTENT="getLocalizationPoint()"><META NAME="keywords" CONTENT="setLocalizationPoint()"><META NAME="keywords" CONTENT="transform()"><META NAME="keywords" CONTENT="isNaN()"><META NAME="keywords" CONTENT="isMonotonic()"><META NAME="keywords" CONTENT="removeSingularities()"><META NAME="keywords" CONTENT="getAffineTransform()"><META NAME="keywords" CONTENT="getPolynomialTransform()"><META NAME="keywords" CONTENT="getMathTransform()"><LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style"><SCRIPT type="text/javascript">function windowTitle(){    parent.document.title="LocalizationGrid (Geotools 2.3.x 2.3.2 API)";}</SCRIPT></HEAD><BODY BGCOLOR="white" onload="windowTitle();"><!-- ========= START OF TOP NAVBAR ======= --><A NAME="navbar_top"><!-- --></A><A HREF="#skip-navbar_top" title="Skip navigation links"></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""><TR><TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">  <TR ALIGN="center" VALIGN="top">  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/LocalizationGrid.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>  </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">&nbsp;<A HREF="../../../../../org/geotools/referencing/operation/transform/LinearTransform1D.html" title="class in org.geotools.referencing.operation.transform"><B>PREV CLASS</B></A>&nbsp;&nbsp;<A HREF="../../../../../org/geotools/referencing/operation/transform/LogarithmicTransform1D.html" title="class in org.geotools.referencing.operation.transform"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">  <A HREF="../../../../../index.html" target="_top"><B>FRAMES</B></A>  &nbsp;&nbsp;<A HREF="LocalizationGrid.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;&nbsp;<SCRIPT type="text/javascript">  <!--  if(window==top) {    document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');  }  //--></SCRIPT><NOSCRIPT>  <A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A></NOSCRIPT></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><A NAME="skip-navbar_top"></A><!-- ========= END OF TOP NAVBAR ========= --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">org.geotools.referencing.operation.transform</FONT><BR>Class LocalizationGrid</H2><PRE><A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A>  <IMG SRC="../../../../../resources/inherit.gif" ALT="extended by"><B>LocalizationGrid</B></PRE><HR><DL><DT>public class <B>LocalizationGrid</B><DT>extends <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A></DL><P>A factory for <CODE>MathTransform2D</CODE> backed by a <cite>grid of localization</cite>. A grid of localization is a two-dimensional array of coordinate points. The grid size is &nbsp;&times;&nbsp;. Input coordinates are (<var>i</var>,<var>j</var>) index in the grid, where <var>i</var> must be in the range  and <var>j</var> in the range  inclusive. Output coordinates are the values stored in the grid of localization at the specified index. <p> The  class is usefull when the "grid to coordinate system" transform for a coverage is not some kind of global mathematical relationship like an <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/awt/geom/AffineTransform.html" title="class or interface in java.awt.geom">affine transform</A>. 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. <p> After a  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 <A HREF="../../../../../org/geotools/referencing/operation/transform/LocalizationGrid.html#getMathTransform()"><CODE>getMathTransform()</CODE></A> method. If this transformation is close enough to an affine transform, then an instance of <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/awt/geom/AffineTransform.html" title="class or interface in java.awt.geom"><CODE>AffineTransform</CODE></A> is returned. Otherwise, a transform backed by the localization grid is returned. <p> 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 <A HREF="../../../../../org/geotools/referencing/datum/DefaultGeodeticDatum.html#WGS84">WGS84</A> ellipsoid. <blockquote><table border='2' cellpadding='6'><tr><td><pre> <FONT color='#008000'>// // Constructs a localization grid of size 10&times;10. //</FONT> LocalizationGrid grid = new LocalizationGrid(10,10); for (int j=0; j<10; j++) {     for (int i=0; i<10; i++) {         double x = ...; <FONT color='#008000'>// Set longitude here</FONT>         double y = ...; <FONT color='#008000'>// Set latitude here</FONT>         grid.<A HREF="../../../../../org/geotools/referencing/operation/transform/LocalizationGrid.html#setLocalizationPoint(int, int, double, double)">setLocalizationPoint</A>(i,j,x,y);     } } <FONT color='#008000'>// // Constructs the grid coordinate reference system. <var>degree</var> 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 <A HREF="../../../../../org/geotools/referencing/operation/transform/LocalizationGrid.html#getMathTransform()">getMathTransform()</A> instead, or use the special value of 0 for the degree // argument. //</FONT> MathTransform2D        realToGrid = grid.<A HREF="../../../../../org/geotools/referencing/operation/transform/LocalizationGrid.html#getPolynomialTransform(int)">getPolynomialTransform</A>(degree).inverse(); CoordinateReferenceSystem realCRS = DefaultGeographicCRS.WGS84; CoordinateReferenceSystem gridCRS = new <A HREF="../../../../../org/geotools/referencing/crs/DefaultDerivedCRS.html" title="class in org.geotools.referencing.crs">DefaultDerivedCRS</A>("The grid CRS",         new <A HREF="../../../../../org/geotools/referencing/operation/DefaultOperationMethod.html#DefaultOperationMethod(org.opengis.referencing.operation.MathTransform)">DefaultOperationMethod</A>(realToGrid),         realCRS,     <FONT color='#008000'>// The target ("real world") CRS</FONT>         realToGrid,  <FONT color='#008000'>// How the grid CRS relates to the "real world" CRS</FONT>         <A HREF="../../../../../org/geotools/referencing/cs/DefaultCartesianCS.html#GRID">DefaultCartesianCS.GRID</A>); <FONT color='#008000'>// // 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). //</FONT> <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/awt/image/WritableRaster.html" title="class or interface in java.awt.image">WritableRaster</A> raster = <A HREF="http://java.sun.com/products/java-media/jai/forDevelopers/jai-apidocs/javax/media/jai/RasterFactory.html" title="class or interface in javax.media.jai">RasterFactory</A>.createBandedRaster(DataBuffer.TYPE_FLOAT,                                                          width, height, 1, null); for (int y=0; y<height; y++) {     for (int x=0; x<width; x++) {         raster.setSample(x, y, 0, <cite>some_value</cite>);     } } GridCoverageFactory factory = FactoryFinder.getGridCoverageFactory(null); GridCoverage coverage = factory.create("My grayscale coverage", raster, gridCRS,                          IdentityTransform.create(2), null, null, null, null, null); coverage.show(); <FONT color='#008000'>// // 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. //</FONT> coverage = (Coverage2D) Operations.DEFAULT.resample(coverage, realCRS); coverage.show(); </pre></td></tr></table></blockquote><P><P><DL><DT><B>Since:</B></DT>  <DD>2.0</DD><DT><B>Author:</B></DT>  <DD>Remi Eve, Martin Desruisseaux, Alessio Fabiani</DD><DT><B>See Also:</B><DD><CODE>DerivedCRS</CODE><DT><B>Module:</B></DT><DD><CODE><B>module/referencing</B></CODE> &nbsp; (<A HREF="http://maven.geotools.fr/repository/org/geotools/gt2-referencing/"><CODE>gt2-referencing.jar</CODE></A>) (<A HREF="http://maven.geotools.fr/reports/referencing/index.html">Maven report</A>) (<A HREF="http://svn.geotools.org/geotools/tags/2.3.2/module/referencing/src/org/geotools/referencing/operation/transform/LocalizationGrid.java">SVN head</A>)</DD></DL><HR><P><!-- ======== NESTED CLASS SUMMARY ======== --><!-- =========== FIELD SUMMARY =========== --><!-- ======== CONSTRUCTOR SUMMARY ======== --><A NAME="constructor_summary"><!-- --></A>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?