📄 package-summary.html
字号:
<TABLE ALIGN="center" BORDER=1 cellpadding=4><TR><TD> data CRS <img src="doc-files/right.png"> <A HREF="../../../../org/geotools/display/canvas/AbstractCanvas.html#getObjectiveCRS()">objective CRS</A> <img src="doc-files/right.png"> <A HREF="../../../../org/geotools/display/canvas/AbstractCanvas.html#getDisplayCRS()">display CRS</A> <img src="doc-files/right.png"> <A HREF="../../../../org/geotools/display/canvas/AbstractCanvas.html#getDeviceCRS()">device CRS</A> </TD></TR></TABLE> <P> </P> <H2>Painting</H2> <P ALIGN=justify>In the <A HREF="../../../../org/geotools/display/canvas/BufferedCanvas2D.html" title="class in org.geotools.display.canvas"><CODE>BufferedCanvas2D</CODE></A> implementation, when a graphic needs a refresh, the canvas invokes its <A HREF="../../../../org/geotools/display/canvas/GraphicPrimitive2D.html#paint(org.geotools.display.canvas.RenderingContext)"><CODE>paint(...)</CODE></A> method. The paint method receives indirectly (through <A HREF="../../../../org/geotools/display/canvas/RenderingContext.html" title="class in org.geotools.display.canvas"><CODE>RenderingContext</CODE></A>) a <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/awt/Graphics2D.html" title="class or interface in java.awt"><CODE>Graphics2D</CODE></A> object in the default <cite>Java2D</cite> state. This default state uses a coordinate reference system (named <strong>display CRS</strong> above) with properties as below:</P> <TABLE BORDER=1 cellpadding=4> <TR> <TH ALIGN="right" bgcolor=bisque nowrap>Axis origin (0,0):</TH> <TD bgcolor=lightgoldenrodyellow>Screen or paper Upper Left corner.</TD> </TR> <TR> <TH ALIGN="right" bgcolor=bisque nowrap>Axis directions:</TH> <TD bgcolor=lightgoldenrodyellow><var>x</var> values increasing right and <var>y</var> values increasing <strong><U>down</U></strong>.</TD> </TR> <TR> <TH ALIGN="right" bgcolor=bisque nowrap>Axis units:</TH> <TD bgcolor=lightgoldenrodyellow>Pixels or points (about 1/72 of inch).</TD> </TR> <TR> <TH ALIGN="right" bgcolor=bisque nowrap>Line width:</TH> <TD bgcolor=lightgoldenrodyellow>One pixel or one point (1/72 of inch).</TD> </TR> </TABLE> <P ALIGN=justify>This configuration is appropriate for text rendering. A font may be 12 points high, which usually means 12 pixels on a screen output device or 1/6 of inch on a paper. The method may apply temporary changes to the <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/awt/Graphics2D.html" title="class or interface in java.awt"><CODE>Graphics2D</CODE></A> configuration, but shall rollback to its inital state before to return.</P> <P ALIGN="justify">In some occasions, a graphic may wish to performs its rendering directly in "real world" coordinates. This is called <strong>objective CRS</strong> above. It can be set through a call to a <A HREF="../../../../org/geotools/display/canvas/RenderingContext.html#setGraphicsCRS(org.opengis.referencing.crs.CoordinateReferenceSystem)"><CODE>setGraphicsCRS</CODE></A> convenience method and usually has the following properties:</P> <TABLE BORDER=1 cellpadding=4> <TR> <TH ALIGN="right" bgcolor=bisque nowrap>Axis origin (0,0):</TH> <TD bgcolor=lightgoldenrodyellow>Objective CRS dependent. Often outside the displayed area.</TD> </TR> <TR> <TH ALIGN="right" bgcolor=bisque nowrap>Axis directions:</TH> <TD bgcolor=lightgoldenrodyellow>Objective CRS dependent. Usually <var>x</var> values increasing right and <var>y</var> values increasing <strong><U>up</U></strong>, like classical geometry.</TD> </TR> <TR> <TH ALIGN="right" bgcolor=bisque nowrap>Axis units:</TH> <TD bgcolor=lightgoldenrodyellow>Objective CRS dependent. Usually "real world" meters (not meters on the output device!), sometime longitude and latitude degrees.</TD> </TR> <TR> <TH ALIGN="right" bgcolor=bisque nowrap>Line width:</TH> <TD bgcolor=lightgoldenrodyellow>Map resolution dependent. May be 50 "real world" meters for example.</TD> </TR> </TABLE> <P ALIGN="justify">This configuration is convenient for rendering "real world" objects. With such CRS, the implementor doesn't need to care about the scale factor. However, this configuration is unconvenient for text or symbols rendering. For example a font with a size of 12 units will be understood as a 12 meters high font. On a map with a 1:50000 scale, 12 meters high characters will appear like tiny points.</P> <p> </p> <h2>Affine transform tips</h2> <P align="justify"><cite>Java2D</cite> converts "real world" coordinates into a output device coordinates using an instance of the <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> object. An affine transform can be represented as a 3×3 matrix. Using the appropriate coefficients, one can apply any combinations of scale, translation, rotation and shear. The equation below assumes that input coordinates are in meters and output in pixel units, but the same equation can be used with most units:</P> <P ALIGN="center"><IMG src="doc-files/AffineTransform.png"></P> <P align=justify>The <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> class provides a set of methods for changing an affine transform without worrying about the underlying mathematic. For example the method modifies the coefficients of the 3×3 matrix in order to add a rotation effect given a simple angle in radians. In the context of map rendering, there is a useful identity not mentioned in the class javadoc:</P> <P ALIGN="center"><IMG src="doc-files/scaleX0.png"> and <IMG src="doc-files/scaleY0.png"> are unvariant under rotations.</P> <P align=justify>If there is no rotation and no shear, then the <var>m</var><SUB>01</SUB> and <var>m</var><SUB>10</SUB> coefficients are null. The remaining <var>m</var><SUB>00</SUB> and <var>m</var><SUB>11</SUB> coefficient give us the map scale among <var>x</var> and <var>y</var> axis respectively. In this simple case, the usual and methods work.:</P> <P ALIGN="center"><IMG src="doc-files/scaleX0.png"> = <var>m</var><SUB>00</SUB> = <CODE>AffineTransform.getScaleX()</CODE></P> <P ALIGN="center"><IMG src="doc-files/scaleY0.png"> = <var>m</var><SUB>11</SUB> = <CODE>AffineTransform.getScaleY()</CODE></P> <P align=justify>But if there is a rotation (but no shear), then the and methods do not work anymore. We need to use the relationships on the left side. Note that those relationships do not work neither in the presence of shear. But because the default Geotools implementation uses only scales, rotations and translations (no shear), implementors are encouraged to use the relationships on the left side all the time instead of the ordinary and methods. This is especially important since may "real world" coordinate systems swap their axis order (e.g. use (<var>latitude</var>, <var>longitude</var>) values instead of (<var>longitude</var>, <var>latitude</var>) values), which is similar to a rotation. implementations relying only on the ordinary and methods may fail to render a map in such coordinate systems.</P><P><P><HR><!-- ======= START OF BOTTOM NAVBAR ====== --><A NAME="navbar_bottom"><!-- --></A><A HREF="#skip-navbar_bottom" 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_bottom_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> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Package</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-use.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../org/geotools/demo/mappane/package-summary.html"><B>PREV PACKAGE</B></A> <A HREF="../../../../org/geotools/display/canvas/map/package-summary.html"><B>NEXT PACKAGE</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../index.html" target="_top"><B>FRAMES</B></A> <A HREF="package-summary.html" target="_top"><B>NO FRAMES</B></A> <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></TABLE><A NAME="skip-navbar_bottom"></A><!-- ======== END OF BOTTOM NAVBAR ======= --><HR>Copyright © 1996-2007 <a href="http://www.geotools.org">Geotools</a>. All Rights Reserved.</BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -