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


001:        /**
002:         * 
003:         */package org.geotools.gce.gtopo30;
004:
005:        import java.awt.Rectangle;
006:        import java.net.URL;
007:
008:        import javax.media.jai.JAI;
009:        import javax.media.jai.RecyclingTileFactory;
010:        import javax.media.jai.TileCache;
011:
012:        import org.geotools.coverage.grid.GeneralGridRange;
013:        import org.geotools.coverage.grid.GridCoverage2D;
014:        import org.geotools.coverage.grid.GridGeometry2D;
015:        import org.geotools.coverage.grid.io.AbstractGridCoverage2DReader;
016:        import org.geotools.coverage.grid.io.AbstractGridFormat;
017:        import org.geotools.resources.TestData;
018:        import org.geotools.resources.image.CoverageUtilities;
019:        import org.opengis.parameter.GeneralParameterValue;
020:        import org.opengis.parameter.ParameterValueGroup;
021:
022:        /**
023:         * Purpose of this class is testing the ability of this plug in to read and
024:         * write back the in gtopo30 format.
025:         * 
026:         * @author Simone Giannecchini
027:         * @source $URL:
028:         *         http://svn.geotools.org/geotools/trunk/gt/plugin/gtopo30/test/org/geotools/gce/gtopo30/GT30ReaderWriterTest.java $
029:         */
030:        public class GT30DecimationTest extends GT30TestBase {
031:            /**
032:             * Constructor for GT30ReaderTest.
033:             * 
034:             * @param arg0
035:             */
036:            public GT30DecimationTest(String arg0) {
037:                super (arg0);
038:            }
039:
040:            /**
041:             * Testing reader and writer for gtopo. This test first of all read an
042:             * existing gtopo tessel into a coverage object, therefore it writes it back
043:             * onto the disk. Once the coverage is written back\ it loads it again
044:             * building a new coverage which is finally visualized.
045:             * 
046:             * @throws Exception
047:             */
048:            public void test() throws Exception {
049:
050:                URL statURL = TestData.url(this , (new StringBuffer(
051:                        this .fileName).append(".DEM").toString()));
052:                AbstractGridFormat format = (AbstractGridFormat) new GTopo30FormatFactory()
053:                        .createFormat();
054:
055:                // using a big tile cache
056:                final JAI jaiDef = JAI.getDefaultInstance();
057:                final TileCache cache = jaiDef.getTileCache();
058:                cache.setMemoryCapacity(64 * 1024 * 1024);
059:                cache.setMemoryThreshold(1.0f);
060:                // final TCTool tool= new TCTool();
061:
062:                // setting JAI wide hints
063:                jaiDef.setRenderingHint(JAI.KEY_CACHED_TILE_RECYCLING_ENABLED,
064:                        Boolean.TRUE);
065:
066:                // tile factory and recycler
067:                final RecyclingTileFactory recyclingFactory = new RecyclingTileFactory();
068:                jaiDef.setRenderingHint(JAI.KEY_TILE_FACTORY, recyclingFactory);
069:                jaiDef
070:                        .setRenderingHint(JAI.KEY_TILE_RECYCLER,
071:                                recyclingFactory);
072:
073:                if (format.accepts(statURL)) {
074:
075:                    /**
076:                     * 
077:                     * STEP 1 Reading the coverage into memory in order to write it down
078:                     * again
079:                     * 
080:                     */
081:                    // get a reader
082:                    AbstractGridCoverage2DReader reader = (AbstractGridCoverage2DReader) format
083:                            .getReader(statURL);
084:
085:                    // get a grid coverage
086:                    final ParameterValueGroup params = reader.getFormat()
087:                            .getReadParameters();
088:                    params.parameter(
089:                            AbstractGridFormat.READ_GRIDGEOMETRY2D.getName()
090:                                    .toString()).setValue(
091:                            new GridGeometry2D(new GeneralGridRange(
092:                                    new Rectangle(0, 0, 640, 480)), reader
093:                                    .getOriginalEnvelope()));
094:                    gc = ((GridCoverage2D) reader
095:                            .read((GeneralParameterValue[]) params.values()
096:                                    .toArray(new GeneralParameterValue[1])));
097:                    assertTrue(CoverageUtilities.hasRenderingCategories(gc));
098:                    if (TestData.isInteractiveTest()) {
099:                        //				 logging some info
100:                        logger
101:                                .info(gc.getCoordinateReferenceSystem2D()
102:                                        .toWKT());
103:                        logger.info(gc.toString());
104:                        gc.show();
105:                    } else {
106:                        gc.getRenderedImage().getData();
107:                    }
108:
109:                }
110:            }
111:
112:            public static final void main(String[] args) throws Exception {
113:                junit.textui.TestRunner.run(GT30DecimationTest.class);
114:            }
115:
116:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.