Source Code Cross Referenced for TransfertRectIter.java in  » GIS » GeoTools-2.4.1 » org » geotools » image » 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.image 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *    GeoTools - OpenSource mapping toolkit
003:         *    http://geotools.org
004:         *    (C) 2006, Geotools Project Managment Committee (PMC)
005:         *    (C) 2001, Institut de Recherche pour le Développement
006:         *
007:         *    This library is free software; you can redistribute it and/or
008:         *    modify it under the terms of the GNU Lesser General Public
009:         *    License as published by the Free Software Foundation; either
010:         *    version 2.1 of the License, or (at your option) any later version.
011:         *
012:         *    This library is distributed in the hope that it will be useful,
013:         *    but WITHOUT ANY WARRANTY; without even the implied warranty of
014:         *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
015:         *    Lesser General Public License for more details.
016:         */
017:        package org.geotools.image;
018:
019:        // J2SE dependencies
020:        import java.awt.image.RasterFormatException;
021:
022:        // JAI dependencies
023:        import javax.media.jai.iterator.RectIter;
024:        import javax.media.jai.iterator.WritableRectIter;
025:
026:        /**
027:         * A {@linkplain WritableRectIter writable iterator} that read pixel values from an image, and
028:         * write pixel values to a different image. All {@code get} methods read values from the
029:         * <cite>source</cite> image specified at {@linkplain #create creation time}. All {@code set}
030:         * methods write values to the <cite>destination</cite> image specified at {@linkplain #create
031:         * creation time}, which may or may not be the same than the <cite>source</cite> image. This is
032:         * different than the usual {@link WritableRectIter} contract, which read and write values in the
033:         * same image. This {@code TransfertRectIter} is convenient for the implementation of some image
034:         * operations.
035:         *
036:         * @since 2.3
037:         * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/coverage/src/main/java/org/geotools/image/TransfertRectIter.java $
038:         * @version $Id: TransfertRectIter.java 20970 2006-08-11 07:53:22Z jgarnett $
039:         * @author Martin Desruisseaux
040:         */
041:        public final class TransfertRectIter implements  WritableRectIter {
042:            /**
043:             * The string for error message.
044:             *
045:             * @todo Localize.
046:             */
047:            private static final String ERROR = "Size mismatch";
048:
049:            /**
050:             * The source.
051:             */
052:            private final RectIter src;
053:
054:            /**
055:             * The destination.
056:             */
057:            private final WritableRectIter dst;
058:
059:            /**
060:             * Constructs a {@code TransfertRectIter} object.
061:             */
062:            private TransfertRectIter(final RectIter src,
063:                    final WritableRectIter dst) {
064:                this .src = src;
065:                this .dst = dst;
066:            }
067:
068:            /**
069:             * Creates a {@link WritableRectIter} for the specified source and destination iterator.
070:             * The two iterators must iterate over a rectangle of the same size, otherwise a
071:             * {@link RasterFormatException} may be thrown during the iteration.
072:             *
073:             * @param  src The source iterator.
074:             * @param  dst The destination iterator.
075:             * @return An iterator that read sample from {@code src} and write sample
076:             *         to {@code dst}. If {@code src == dst}, then the destination
077:             *         iterator itself is returned.
078:             */
079:            public static WritableRectIter create(final RectIter src,
080:                    final WritableRectIter dst) {
081:                if (src == dst) {
082:                    return dst;
083:                }
084:                return new TransfertRectIter(src, dst);
085:            }
086:
087:            /**
088:             * Sets the iterator to the first line of its bounding rectangle.
089:             */
090:            public void startLines() {
091:                src.startLines();
092:                dst.startLines();
093:            }
094:
095:            /**
096:             * Sets the iterator to the leftmost pixel of its bounding rectangle.
097:             */
098:            public void startPixels() {
099:                src.startPixels();
100:                dst.startPixels();
101:            }
102:
103:            /**
104:             * Sets the iterator to the first band of the image.
105:             */
106:            public void startBands() {
107:                src.startBands();
108:                dst.startBands();
109:            }
110:
111:            /**
112:             * Jumps downward num lines from the current position.
113:             */
114:            public void jumpLines(int num) {
115:                src.jumpLines(num);
116:                dst.jumpLines(num);
117:            }
118:
119:            /**
120:             * Jumps rightward num pixels from the current position.
121:             */
122:            public void jumpPixels(int num) {
123:                src.jumpPixels(num);
124:                dst.jumpPixels(num);
125:            }
126:
127:            /**
128:             * Sets the iterator to the next line of the image.
129:             */
130:            public void nextLine() {
131:                src.nextLine();
132:                dst.nextLine();
133:            }
134:
135:            /**
136:             * Sets the iterator to the next pixel in image (that is, move rightward).
137:             */
138:            public void nextPixel() {
139:                src.nextPixel();
140:                dst.nextPixel();
141:            }
142:
143:            /**
144:             * Sets the iterator to the next band in the image.
145:             */
146:            public void nextBand() {
147:                src.nextBand();
148:                dst.nextBand();
149:            }
150:
151:            /**
152:             * Sets the iterator to the next line in the image,
153:             * and returns {@code true} if the bottom row of the bounding rectangle has been passed.
154:             */
155:            public boolean nextLineDone() {
156:                boolean check = src.nextLineDone();
157:                if (check == dst.nextLineDone()) {
158:                    return check;
159:                }
160:                throw new RasterFormatException(ERROR);
161:            }
162:
163:            /**
164:             * Sets the iterator to the next pixel in the image (that is, move rightward).
165:             */
166:            public boolean nextPixelDone() {
167:                boolean check = src.nextPixelDone();
168:                if (check == dst.nextPixelDone()) {
169:                    return check;
170:                }
171:                throw new RasterFormatException(ERROR);
172:            }
173:
174:            /**
175:             * Sets the iterator to the next band in the image,
176:             * and returns {@code true} if the max band has been exceeded.
177:             */
178:            public boolean nextBandDone() {
179:                boolean check = src.nextBandDone();
180:                if (check == dst.nextBandDone()) {
181:                    return check;
182:                }
183:                throw new RasterFormatException(ERROR);
184:            }
185:
186:            /**
187:             * Returns {@code true} if the bottom row of the bounding rectangle has been passed.
188:             */
189:            public boolean finishedLines() {
190:                boolean check = src.finishedLines();
191:                if (check == dst.finishedLines()) {
192:                    return check;
193:                }
194:                throw new RasterFormatException(ERROR);
195:            }
196:
197:            /**
198:             * Returns {@code true} if the right edge of the bounding rectangle has been passed.
199:             */
200:            public boolean finishedPixels() {
201:                boolean check = src.finishedPixels();
202:                if (check == dst.finishedPixels()) {
203:                    return check;
204:                }
205:                throw new RasterFormatException(ERROR);
206:            }
207:
208:            /**
209:             * Returns {@code true} if the max band in the image has been exceeded.
210:             */
211:            public boolean finishedBands() {
212:                boolean check = src.finishedBands();
213:                if (check == dst.finishedBands()) {
214:                    return check;
215:                }
216:                throw new RasterFormatException(ERROR);
217:            }
218:
219:            /**
220:             * Returns the samples of the current pixel from the image in an array of int.
221:             */
222:            public int[] getPixel(int[] array) {
223:                return src.getPixel(array);
224:            }
225:
226:            /**
227:             * Returns the samples of the current pixel from the image in an array of float.
228:             */
229:            public float[] getPixel(float[] array) {
230:                return src.getPixel(array);
231:            }
232:
233:            /**
234:             * Returns the samples of the current pixel from the image in an array of double.
235:             */
236:            public double[] getPixel(double[] array) {
237:                return src.getPixel(array);
238:            }
239:
240:            /**
241:             * Returns the current sample as an integer.
242:             */
243:            public int getSample() {
244:                return src.getSample();
245:            }
246:
247:            /**
248:             * Returns the specified sample of the current pixel as an integer.
249:             */
250:            public int getSample(int b) {
251:                return src.getSample(b);
252:            }
253:
254:            /**
255:             * Returns the current sample as a float.
256:             */
257:            public float getSampleFloat() {
258:                return src.getSampleFloat();
259:            }
260:
261:            /**
262:             * Returns the specified sample of the current pixel as a float.
263:             */
264:            public float getSampleFloat(int b) {
265:                return src.getSampleFloat(b);
266:            }
267:
268:            /**
269:             * Returns the current sample as a double.
270:             */
271:            public double getSampleDouble() {
272:                return src.getSampleDouble();
273:            }
274:
275:            /**
276:             * Returns the specified sample of the current pixel as a double.
277:             */
278:            public double getSampleDouble(int b) {
279:                return src.getSampleDouble(b);
280:            }
281:
282:            /**
283:             * Sets all samples of the current pixel to a set of int values.
284:             */
285:            public void setPixel(int[] array) {
286:                dst.setPixel(array);
287:            }
288:
289:            /**
290:             * Sets all samples of the current pixel to a set of float values.
291:             */
292:            public void setPixel(float[] array) {
293:                dst.setPixel(array);
294:            }
295:
296:            /**
297:             * Sets all samples of the current pixel to a set of double values.
298:             */
299:            public void setPixel(double[] array) {
300:                dst.setPixel(array);
301:            }
302:
303:            /**
304:             * Sets the current sample to an integral value.
305:             */
306:            public void setSample(int s) {
307:                dst.setSample(s);
308:            }
309:
310:            /**
311:             * Sets the current sample to a float value.
312:             */
313:            public void setSample(float s) {
314:                dst.setSample(s);
315:            }
316:
317:            /**
318:             * Sets the current sample to a double value.
319:             */
320:            public void setSample(double s) {
321:                dst.setSample(s);
322:            }
323:
324:            /**
325:             * Sets the specified sample of the current pixel to an integral value.
326:             */
327:            public void setSample(int b, int s) {
328:                dst.setSample(b, s);
329:            }
330:
331:            /**
332:             * Sets the specified sample of the current pixel to a float value.
333:             */
334:            public void setSample(int b, float s) {
335:                dst.setSample(b, s);
336:            }
337:
338:            /**
339:             * Sets the specified sample of the current pixel to a double value.
340:             */
341:            public void setSample(int b, double s) {
342:                dst.setSample(b, s);
343:            }
344:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.