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


001:        /*
002:         *    GeoTools - OpenSource mapping toolkit
003:         *    http://geotools.org
004:         *    (C) 2002-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;
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:        package org.geotools.data.property;
017:
018:        import java.io.BufferedWriter;
019:        import java.io.File;
020:        import java.io.FileWriter;
021:
022:        import junit.framework.TestCase;
023:
024:        import org.geotools.data.DefaultQuery;
025:        import org.geotools.data.FeatureSource;
026:        import org.geotools.feature.FeatureCollection;
027:        import org.geotools.feature.FeatureType;
028:        import org.geotools.feature.GeometryAttributeType;
029:        import org.geotools.referencing.CRS;
030:        import org.opengis.filter.Filter;
031:        import org.opengis.referencing.crs.CoordinateReferenceSystem;
032:
033:        /**
034:         * Test non functionality of PropertyDataStore.
035:         * 
036:         * @author Jody Garnett, Refractions Research Inc.
037:         * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/demo/property/src/test/java/org/geotools/data/property/PropertyDataStore2Test.java $
038:         */
039:        public class PropertyDataStore2Test extends TestCase {
040:            PropertyDataStore store;
041:
042:            /**
043:             * Constructor for SimpleDataStoreTest.
044:             * @param arg0
045:             */
046:            public PropertyDataStore2Test(String arg0) {
047:                super (arg0);
048:            }
049:
050:            protected void setUp() throws Exception {
051:                File dir = new File(".", "propertyTestData");
052:                dir.mkdir();
053:
054:                File file = new File(dir, "road.properties");
055:                if (file.exists()) {
056:                    file.delete();
057:                }
058:                BufferedWriter writer = new BufferedWriter(new FileWriter(file));
059:                writer.write("_=id:Integer,*geom:Geometry,name:String");
060:                writer.newLine();
061:                writer.write("fid1=1|LINESTRING(0 0,10 10)|jody");
062:                writer.newLine();
063:                writer.write("fid2=2|LINESTRING(20 20,30 30)|brent");
064:                writer.newLine();
065:                writer.write("fid3=3|LINESTRING(5 0, 5 10)|dave");
066:                writer.newLine();
067:                writer
068:                        .write("fid4=4|LINESTRING(0 5, 5 0, 10 5, 5 10, 0 5)|justin");
069:                writer.close();
070:                store = new PropertyDataStore(dir);
071:                super .setUp();
072:            }
073:
074:            protected void tearDown() throws Exception {
075:                File dir = new File("propertyTestData");
076:                File list[] = dir.listFiles();
077:                for (int i = 0; i < list.length; i++) {
078:                    list[i].delete();
079:                }
080:                dir.delete();
081:                super .tearDown();
082:            }
083:
084:            public void testSimple() throws Exception {
085:                FeatureSource road = store.getFeatureSource("road");
086:                FeatureCollection features = road.getFeatures();
087:
088:                assertEquals(1, features.getFeatureType().getAttributeCount());
089:                assertEquals(4, features.size());
090:            }
091:
092:            public void testQuery() throws Exception {
093:                FeatureSource road = store.getFeatureSource("road");
094:
095:                DefaultQuery query = new DefaultQuery("road", Filter.INCLUDE,
096:                        new String[] { "name" });
097:
098:                FeatureCollection features = road.getFeatures(query);
099:                assertEquals(1, features.getFeatureType().getAttributeCount());
100:            }
101:
102:            public void testQueryReproject() throws Exception {
103:                CoordinateReferenceSystem world = CRS.decode("EPSG:4326"); // world lon/lat
104:                CoordinateReferenceSystem local = CRS.decode("EPSG:3005"); // british columbia
105:
106:                FeatureSource road = store.getFeatureSource("road");
107:                FeatureType origionalType = road.getSchema();
108:
109:                DefaultQuery query = new DefaultQuery("road", Filter.INCLUDE,
110:                        new String[] { "geom", "name" });
111:
112:                query.setCoordinateSystem(local); // FROM
113:                query.setCoordinateSystemReproject(world); // TO
114:
115:                FeatureCollection features = road.getFeatures(query);
116:                FeatureType resultType = features.getSchema();
117:
118:                assertNotNull(resultType);
119:                assertNotSame(resultType, origionalType);
120:
121:                GeometryAttributeType resultGeometryType = resultType
122:                        .getDefaultGeometry();
123:                assertEquals(world, resultGeometryType.getCoordinateSystem());
124:            }
125:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.