Source Code Cross Referenced for Scale.java in  » GIS » GeoTools-2.4.1 » org » geotools » coverage » processing » operation » 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.coverage.processing.operation 
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:         *
006:         *    This library is free software; you can redistribute it and/or
007:         *    modify it under the terms of the GNU Lesser General Public
008:         *    License as published by the Free Software Foundation; either
009:         *    version 2.1 of the License, or (at your option) any later version.
010:         *
011:         *    This library is distributed in the hope that it will be useful,
012:         *    but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014:         *    Lesser General Public License for more details.
015:         */
016:        package org.geotools.coverage.processing.operation;
017:
018:        import java.awt.geom.NoninvertibleTransformException;
019:
020:        import javax.media.jai.BorderExtender;
021:        import javax.media.jai.BorderExtenderCopy;
022:        import javax.media.jai.Interpolation;
023:        import javax.media.jai.InterpolationNearest;
024:
025:        import org.geotools.coverage.processing.CannotScaleException;
026:        import org.geotools.coverage.processing.Operation2D;
027:        import org.geotools.factory.Hints;
028:        import org.geotools.metadata.iso.citation.Citations;
029:        import org.geotools.parameter.DefaultParameterDescriptor;
030:        import org.geotools.parameter.DefaultParameterDescriptorGroup;
031:        import org.geotools.resources.i18n.ErrorKeys;
032:        import org.geotools.resources.i18n.Errors;
033:        import org.opengis.coverage.Coverage;
034:        import org.opengis.parameter.ParameterDescriptor;
035:        import org.opengis.parameter.ParameterValueGroup;
036:
037:        /**
038:         * This operation is simply a wrapper for the JAI scale operation which allows
039:         * me to arbitrarly scale and translate a rendered image.
040:         *
041:         * @todo Consider refactoring as a {@code OperationJAI} subclass. We could get ride of the
042:         *       {@code ScaledGridCoverage2D} class. The main feature to add is the
043:         *       copy of interpolation and border extender parameters to the hints.
044:         *
045:         * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/coverage/src/main/java/org/geotools/coverage/processing/operation/Scale.java $
046:         * @version $Id: Scale.java 24651 2007-03-01 21:15:45Z simboss $
047:         * @author Simone Giannecchini
048:         * @since 2.3
049:         *
050:         * @see javax.media.jai.operator.ScaleDescriptor
051:         */
052:        public class Scale extends Operation2D {
053:            /**
054:             * Serial number for cross-version compatibility.
055:             */
056:            private static final long serialVersionUID = -3212656385631097713L;
057:
058:            /**
059:             * The X scale factor.
060:             */
061:            public static final ParameterDescriptor xScale = new DefaultParameterDescriptor(
062:                    Citations.GEOTOOLS, "xScale", Float.class, // Value class
063:                    // (mandatory)
064:                    null, // Array of valid values
065:                    new Float(1), // Default value
066:                    null, // Minimal value
067:                    null, // Maximal value
068:                    null, // Unit of measure
069:                    true); // Parameter is optional
070:
071:            /**
072:             * The Y scale factor.
073:             */
074:            public static final ParameterDescriptor yScale = new DefaultParameterDescriptor(
075:                    Citations.GEOTOOLS, "yScale", Float.class, // Value class
076:                    // (mandatory)
077:                    null, // Array of valid values
078:                    new Float(1), // Default value
079:                    null, // Minimal value
080:                    null, // Maximal value
081:                    null, // Unit of measure
082:                    true); // Parameter is optional
083:
084:            /**
085:             * The X translation.
086:             */
087:            public static final ParameterDescriptor xTrans = new DefaultParameterDescriptor(
088:                    Citations.GEOTOOLS, "xTrans", Float.class, // Value class
089:                    // (mandatory)
090:                    null, // Array of valid values
091:                    new Float(0), // Default value
092:                    null, // Minimal value
093:                    null, // Maximal value
094:                    null, // Unit of measure
095:                    true); // Parameter is optional
096:
097:            /**
098:             * The Y translation.
099:             */
100:            public static final ParameterDescriptor yTrans = new DefaultParameterDescriptor(
101:                    Citations.GEOTOOLS, "yTrans", Float.class, // Value class
102:                    // (mandatory)
103:                    null, // Array of valid values
104:                    new Float(0), // Default value
105:                    null, // Minimal value
106:                    null, // Maximal value
107:                    null, // Unit of measure
108:                    true); // Parameter is optional
109:
110:            /**
111:             * The interpolation method for resampling.
112:             */
113:            public static final ParameterDescriptor Interpolation = new DefaultParameterDescriptor(
114:                    Citations.GEOTOOLS, "Interpolation", Interpolation.class, // Value
115:                    // class
116:                    // (mandatory)
117:                    null, // Array of valid values
118:                    new InterpolationNearest(), // Default value
119:                    null, // Minimal value
120:                    null, // Maximal value
121:                    null, // Unit of measure
122:                    true); // Parameter is optional
123:
124:            /**
125:             * The BorderExtender used wth high oerder interpolation methods.
126:             */
127:            public static final ParameterDescriptor BorderExtender = new DefaultParameterDescriptor(
128:                    Citations.GEOTOOLS,
129:                    "BorderExtender",
130:                    BorderExtender.class, // Value
131:                    // class
132:                    // (mandatory)
133:                    null, // Array of valid values
134:                    javax.media.jai.BorderExtender
135:                            .createInstance(javax.media.jai.BorderExtender.BORDER_ZERO), // Default
136:                    // value
137:                    null, // Minimal value
138:                    null, // Maximal value
139:                    null, // Unit of measure
140:                    true); // Parameter is optional
141:
142:            /**
143:             * Default constructor.
144:             */
145:            public Scale() {
146:                super (new DefaultParameterDescriptorGroup(Citations.GEOTOOLS,
147:                        "Scale", new ParameterDescriptor[] { SOURCE_0, xScale,
148:                                yScale, xTrans, yTrans, Interpolation,
149:                                BorderExtender }));
150:
151:            }
152:
153:            /*
154:             * (non-Javadoc)
155:             * 
156:             * @see org.geotools.coverage.processing.AbstractOperation#doOperation(org.opengis.parameter.ParameterValueGroup,
157:             *      org.geotools.factory.Hints)
158:             */
159:            public Coverage doOperation(ParameterValueGroup parameters,
160:                    Hints hints) {
161:                try {
162:                    return ScaledGridCoverage2D.create(parameters,
163:                            (hints instanceof  Hints) ? (Hints) hints
164:                                    : new Hints(hints));
165:                } catch (NoninvertibleTransformException e) {
166:                    throw new CannotScaleException(Errors
167:                            .format(ErrorKeys.NONINVERTIBLE_SCALING_TRANSFORM),
168:                            e);
169:                }
170:            }
171:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.