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


001:        /*
002:         *    Geotools2 - OpenSource mapping toolkit
003:         *    http://geotools.org
004:         *    (C) 2002, 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;
009:         *    version 2.1 of the License.
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:         */
017:        package org.geotools.gce.image;
018:
019:        import java.io.File;
020:        import java.io.FileNotFoundException;
021:        import java.io.IOException;
022:        import java.util.logging.Logger;
023:
024:        import junit.textui.TestRunner;
025:
026:        import org.geotools.coverage.grid.GridCoverage2D;
027:        import org.geotools.test.TestData;
028:
029:        /**
030:         * TestCase subclass for testing readingb capabilities
031:         * 
032:         * @author Simone Giannecchini
033:         * @author Alessio Fabiani
034:         * @author rgould
035:         * @source $URL:
036:         *         http://svn.geotools.org/geotools/branches/2.4.x/modules/plugin/image/src/test/java/org/geotools/gce/image/WorldImageReaderTest.java $
037:         */
038:        public class WorldImageReaderTest extends WorldImageBaseTestCase {
039:
040:            private WorldImageReader wiReader;
041:
042:            private Logger logger = org.geotools.util.logging.Logging
043:                    .getLogger(WorldImageReaderTest.class.toString());
044:
045:            /**
046:             * Constructor for WorldImageReaderTest.
047:             * 
048:             * @param arg0
049:             */
050:            public WorldImageReaderTest(String arg0) {
051:                super (arg0);
052:            }
053:
054:            /*
055:             * Can't test this, as these files aren't actually expected to exist. The
056:             * constructor tries to create an inputStream and then throws an exception.
057:             * Re-enable this if that behaviour changes, or if you feel like writing a
058:             * windows-only test.
059:             */
060:            // public void testSource() throws Exception {
061:            // URL altDrive = new URL("file://E:/somedir/foo.tif");
062:            // WorldImageReader r = new WorldImageReader(altDrive);
063:            // File result = (File) r.getSource();
064:            // String s1 = result.getAbsolutePath();
065:            // String s2 = "E:\\somedir\\foo.tif";
066:            // assertTrue(s1.equals(s2));
067:            //    	
068:            // URL networkShare = new URL("file://borkServer/somedir/foo.tif");
069:            // r = new WorldImageReader(networkShare);
070:            // result = (File) r.getSource();
071:            // s1 = result.getAbsolutePath();
072:            // s2 = "\\\\borkServer\\somedir\\foo.tif";
073:            // assertTrue(s1.equals(s2));
074:            // }
075:            /*
076:             * @see TestCase#setUp()
077:             */
078:            protected void setUp() throws Exception {
079:                super .setUp();
080:            }
081:
082:            public void testRead() throws IOException {
083:
084:                // set up
085:                Object in;
086:
087:                // checking test data directory for all kind of inputs
088:                final File test_data_dir = TestData.file(this , null);
089:                final String[] fileList = test_data_dir
090:                        .list(new MyFileFilter());
091:                final int length = fileList.length;
092:                for (int i = 0; i < length; i++) {
093:                    // file
094:                    in = TestData.file(this , fileList[i]);
095:                    this .read(in);
096:
097:                }
098:
099:                // checking a WMS get map
100:                // URL url = new URL(
101:                // "http://wms.jpl.nasa.gov/wms.cgi?bbox=9,43,12,45&styles=&Format=image/png&request=GetMap&layers=global_mosaic&width=100&height=100&srs=EPSG:4326");
102:                // // checking that we have an internet connection active and that the
103:                // // website is up
104:                // if (url.openConnection() == null)
105:                // return;
106:                // this.read(url);
107:            }
108:
109:            /**
110:             * Read, test and show a coverage from the supplied source.
111:             * 
112:             * @param source
113:             *            Object
114:             * 
115:             * @throws FileNotFoundException
116:             *             DOCUMENT ME!
117:             * @throws IOException
118:             *             DOCUMENT ME!
119:             * @throws IllegalArgumentException
120:             *             DOCUMENT ME!
121:             */
122:            private void read(Object source) throws FileNotFoundException,
123:                    IOException, IllegalArgumentException {
124:
125:                // can we read it?
126:                assertTrue(new WorldImageFormat().accepts(source));
127:
128:                logger.info(((File) source).getAbsolutePath());
129:
130:                // get a reader
131:                wiReader = new WorldImageReader(source);
132:
133:                // get the coverage
134:                final GridCoverage2D coverage = (GridCoverage2D) wiReader
135:                        .read(null);
136:
137:                // test the coverage
138:                assertNotNull(coverage);
139:                assertNotNull((coverage).getRenderedImage());
140:                assertNotNull(coverage.getEnvelope());
141:
142:                // log some information
143:                if (TestData.isInteractiveTest()) {
144:                    logger
145:                            .info(coverage.getCoordinateReferenceSystem()
146:                                    .toWKT());
147:                    logger.info(coverage.getEnvelope().toString());
148:                }
149:                // show it, but only if tests are interactive
150:                if (TestData.isInteractiveTest())
151:                    coverage.show();
152:                else
153:                    coverage.getRenderedImage().getData();
154:            }
155:
156:            public static void main(String[] args) {
157:                TestRunner.run(WorldImageReaderTest.class);
158:            }
159:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.