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


001:        /*
002:         *    GeoTools - OpenSource mapping toolkit
003:         *    http://geotools.org
004:         *    (C) 2007, Geotools Project Managment Committee (PMC)
005:         *    (C) 2007, Geomatys
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.io;
018:
019:        import java.util.Locale;
020:        import javax.imageio.ImageReader;
021:        import javax.imageio.ImageReadParam;
022:
023:        import org.geotools.resources.Utilities;
024:        import org.geotools.resources.i18n.Errors;
025:        import org.geotools.resources.i18n.ErrorKeys;
026:        import org.geotools.resources.IndexedResourceBundle;
027:
028:        /**
029:         * Default parameters for {@link GeographicImageReader}.
030:         *
031:         * @since 2.4
032:         * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/unsupported/coverageio/src/main/java/org/geotools/image/io/GeographicImageReadParam.java $
033:         * @version $Id: GeographicImageReadParam.java 26708 2007-08-27 19:42:59Z desruisseaux $
034:         * @author Martin Desruisseaux
035:         */
036:        public class GeographicImageReadParam extends ImageReadParam {
037:            /**
038:             * The name of the default color palette to apply when none was explicitly specified.
039:             *
040:             * @see #getPaletteName
041:             * @see #setPaletteName
042:             */
043:            public static final String DEFAULT_PALETTE_NAME = "rainbow";
044:
045:            /**
046:             * The name of the color palette.
047:             */
048:            private String palette;
049:
050:            /**
051:             * The band to display.
052:             */
053:            private int visibleBand;
054:
055:            /**
056:             * The locale for formatting error messages. Will be inferred from
057:             * the {@linkplain ImageReader image reader} at construction time.
058:             */
059:            private final Locale locale;
060:
061:            /**
062:             * Creates a new, initially empty, set of parameters.
063:             *
064:             * @param reader The reader for which this parameter block is created
065:             */
066:            public GeographicImageReadParam(final ImageReader reader) {
067:                locale = (reader != null) ? reader.getLocale() : null;
068:            }
069:
070:            /**
071:             * Returns the resources for formatting error messages.
072:             */
073:            private IndexedResourceBundle getErrorResources() {
074:                return Errors.getResources(locale);
075:            }
076:
077:            /**
078:             * Ensures that the specified band number is valid.
079:             */
080:            private void ensureValidBand(final int band)
081:                    throws IllegalArgumentException {
082:                if (band < 0) {
083:                    throw new IllegalArgumentException(getErrorResources()
084:                            .getString(ErrorKeys.BAD_BAND_NUMBER_$1,
085:                                    new Integer(band)));
086:                }
087:            }
088:
089:            /**
090:             * Returns the band to display in the target image. In theory, images backed by
091:             * {@linkplain java.awt.image.IndexColorModel index color model} should have only
092:             * ony band. But sometime we want to load additional bands as numerical data, in
093:             * order to perform computations. In such case, we need to specify which band in
094:             * the destination image will be used as an index for displaying the colors. The
095:             * default value is 0.
096:             */
097:            public int getVisibleBand() {
098:                return visibleBand;
099:            }
100:
101:            /**
102:             * Sets the band to make visible in the destination image.
103:             *
104:             * @param  visibleBand The band to make visible.
105:             * @throws IllegalArgumentException if the specified band index is invalid.
106:             */
107:            public void setVisibleBand(final int visibleBand)
108:                    throws IllegalArgumentException {
109:                ensureValidBand(visibleBand);
110:                this .visibleBand = visibleBand;
111:            }
112:
113:            /**
114:             * Returns a name of the color palette, or a {@linkplain #DEFAULT_PALETTE_NAME default name}
115:             * if none were explicitly specified.
116:             */
117:            final String getNonNullPaletteName() {
118:                final String palette = getPaletteName();
119:                return (palette != null) ? palette : DEFAULT_PALETTE_NAME;
120:            }
121:
122:            /**
123:             * Returns the name of the color palette to apply when creating an
124:             * {@linkplain java.awt.image.IndexColorModel index color model}.
125:             * This is the name specified by the last call to {@link #setPaletteName}.
126:             */
127:            public String getPaletteName() {
128:                return palette;
129:            }
130:
131:            /**
132:             * Sets the color palette as one of the {@linkplain PaletteFactory#getAvailableNames available
133:             * names} provided by the {@linkplain PaletteFactory#getDefault default palette factory}. This
134:             * name will be given by the {@link GeographicImageReader} default implementation to the
135:             * {@linkplain PaletteFactory#getDefault default palette factory} for creating a
136:             * {@linkplain javax.imageio.ImageTypeSpecifier image type specifier}.
137:             *
138:             * @see PaletteFactory#getAvailableNames
139:             */
140:            public void setPaletteName(final String palette) {
141:                this .palette = palette;
142:            }
143:
144:            /**
145:             * Returns a string representation of this block of parameters.
146:             */
147:            //@Override
148:            public String toString() {
149:                final StringBuffer buffer = new StringBuffer(Utilities
150:                        .getShortClassName(this ));
151:                buffer.append('[');
152:                if (sourceRegion != null) {
153:                    buffer.append("sourceRegion=(").append(sourceRegion.x)
154:                            .append(':').append(
155:                                    sourceRegion.x + sourceRegion.width)
156:                            .append(',').append(sourceRegion.y).append(':')
157:                            .append(sourceRegion.y + sourceRegion.height)
158:                            .append("), ");
159:                }
160:                if (sourceXSubsampling != 1 || sourceYSubsampling != 1) {
161:                    buffer.append("subsampling=(").append(sourceXSubsampling)
162:                            .append(',').append(sourceYSubsampling).append(
163:                                    "), ");
164:                }
165:                if (sourceBands != null) {
166:                    buffer.append("sourceBands={");
167:                    for (int i = 0; i < sourceBands.length; i++) {
168:                        if (i != 0) {
169:                            buffer.append(',');
170:                        }
171:                        buffer.append(sourceBands[i]);
172:                    }
173:                    buffer.append("}, ");
174:                }
175:                buffer.append("palette=\"").append(palette).append("\", ")
176:                        .append(']');
177:                return buffer.toString();
178:            }
179:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.