Source Code Cross Referenced for Histogram.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) 2005-2007, Geotools Project Managment Committee (PMC)
005:         *    (C) 2007, GeoSolutions S.A.S.
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.coverage.processing.operation;
018:
019:        import java.awt.Shape;
020:        import java.awt.image.RenderedImage;
021:        import java.util.Collections;
022:        import java.util.HashMap;
023:        import java.util.Map;
024:
025:        import javax.media.jai.JAI;
026:        import javax.media.jai.RenderedOp;
027:        import javax.media.jai.operator.HistogramDescriptor;
028:
029:        import org.geotools.coverage.grid.GridCoverage2D;
030:        import org.geotools.coverage.processing.AbstractStatisticsOperationJAI;
031:        import org.opengis.coverage.processing.OperationNotFoundException;
032:        import org.opengis.parameter.ParameterValueGroup;
033:        import org.opengis.referencing.crs.CoordinateReferenceSystem;
034:        import org.opengis.referencing.operation.MathTransform;
035:        import org.opengis.util.InternationalString;
036:
037:        /**
038:         * * This operation simply wraps JAI Extrema operations described by
039:         * {@link HistogramDescriptor} inside a GeoTools operation in order to make it
040:         * spatial-aware.
041:         * 
042:         * <p>
043:         * For the moment this is a very simple wrap. Plans on the 2.4 and successive
044:         * versions of this operation are to add the ability to to use spatial ROIs and
045:         * to specific Spatial subsampling. As of now, ROI has to be a Java2D
046:         * {@link Shape} subclass and the parameters to control x and y subsamplings got
047:         * to be Integer, which means pixel-aware.
048:         * 
049:         * <p>
050:         * For more information on how the underlying {@link JAI} operators works you
051:         * can have a look here: <a
052:         * href="http://download.java.net/media/jai/javadoc/1.1.3/jai-apidocs/javax/media/jai/operator/HistogramDescriptor.html">HistogramDescriptor</a>
053:         * <a
054:         * href="http://download.java.net/media/jai/javadoc/1.1.3/jai-apidocs/javax/media/jai/Histogram.html>Histogram</a>
055:         * 
056:         * <p>
057:         * <strong>How to use this operation</strong> Here is a very simple example on
058:         * how to use this operation in order to get the
059:         * {@link javax.media.jai.Histogram} of the source coverage.
060:         * 
061:         * <code>
062:         * final OperationJAI op=new OperationJAI("Histogram");
063:         * ParameterValueGroup params = op.getParameters();
064:         * params.parameter("Source").setValue(coverage);
065:         * coverage=(GridCoverage2D) op.doOperation(params,null);
066:         * System.out.println(((double[])coverage.getProperty("histogram")));
067:         * </code>
068:         * 
069:         * @author Simone Giannecchini
070:         * @since 2.4
071:         * @see javax.media.jai.Histogram
072:         * 
073:         */
074:        public class Histogram extends AbstractStatisticsOperationJAI {
075:
076:            /**
077:             * 
078:             */
079:            private static final long serialVersionUID = -4256576399698278701L;
080:
081:            /**
082:             * {@link String} key for getting the {@link javax.media.jai.Histogram}
083:             * object.
084:             */
085:            public final static String GT_SYNTHETIC_PROPERTY_HISTOGRAM = "histogram";
086:
087:            /**
088:             * Default constructor for the {@link Histogram} operation.
089:             * 
090:             * @throws OperationNotFoundException
091:             */
092:            public Histogram() throws OperationNotFoundException {
093:                super (getOperationDescriptor("Histogram"));
094:            }
095:
096:            /**
097:             * This operation MUST be performed on the geophysics data for this
098:             * {@link GridCoverage2D}.
099:             * 
100:             * @param parameters
101:             *            {@link ParameterValueGroup} that describes this operation
102:             * @return always true.
103:             */
104:            protected boolean computeOnGeophysicsValues(
105:                    ParameterValueGroup parameters) {
106:                return true;
107:            }
108:
109:            /**
110:             * Prepare the {@link javax.media.jai.Histogram} property for this extream
111:             * operation.
112:             * 
113:             * <p>
114:             * See <a
115:             * href="http://download.java.net/media/jai/javadoc/1.1.3/jai-apidocs/javax/media/jai/operator/ExtremaDescriptor.html">ExtremaDescriptor</a>
116:             * for more info.
117:             * 
118:             * @see OperationJAI#getProperties(RenderedImage, CoordinateReferenceSystem,
119:             *      InternationalString, MathTransform, GridCoverage2D[],
120:             *      org.geotools.coverage.processing.OperationJAI.Parameters),
121:             */
122:            protected Map getProperties(RenderedImage data,
123:                    CoordinateReferenceSystem crs, InternationalString name,
124:                    MathTransform toCRS, GridCoverage2D[] sources,
125:                    Parameters parameters) {
126:                // /////////////////////////////////////////////////////////////////////
127:                //
128:                // If and only if data is a RenderedOp we prepare the properties for
129:                // minimum and maximum as the output of the extrema operation.
130:                //
131:                // /////////////////////////////////////////////////////////////////////
132:                if (data instanceof  RenderedOp) {
133:                    // XXX remove me with 1.5
134:                    final RenderedOp result = (RenderedOp) data;
135:
136:                    // get the properties
137:                    final javax.media.jai.Histogram hist = (javax.media.jai.Histogram) result
138:                            .getProperty(GT_SYNTHETIC_PROPERTY_HISTOGRAM);
139:
140:                    // return the map
141:                    final Map synthProp = new HashMap(2);
142:                    synthProp.put(GT_SYNTHETIC_PROPERTY_HISTOGRAM, hist);
143:                    return Collections.unmodifiableMap(synthProp);
144:
145:                }
146:                return super.getProperties(data, crs, name, toCRS, sources,
147:                        parameters);
148:            }
149:
150:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.