Source Code Cross Referenced for PirolFeatureCollection.java in  » GIS » openjump » de » fho » jump » pirol » utilities » FeatureCollection » 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 » openjump » de.fho.jump.pirol.utilities.FeatureCollection 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Created on 22.09.2005 for PIROL
003:         *
004:         * SVN header information:
005:         *  $Author: javamap $
006:         *  $Rev: 856 $
007:         *  $Date: 2007-06-18 21:15:27 -0700 (Mon, 18 Jun 2007) $
008:         *  $Id: PirolFeatureCollection.java 856 2007-06-19 04:15:27Z javamap $
009:         */
010:        package de.fho.jump.pirol.utilities.FeatureCollection;
011:
012:        import java.util.ArrayList;
013:        import java.util.Collection;
014:        import java.util.Iterator;
015:        import java.util.List;
016:
017:        import com.vividsolutions.jts.geom.Envelope;
018:        import com.vividsolutions.jump.feature.Feature;
019:        import com.vividsolutions.jump.feature.FeatureCollection;
020:        import com.vividsolutions.jump.feature.FeatureDataset;
021:        import com.vividsolutions.jump.feature.FeatureSchema;
022:
023:        import de.fho.jump.pirol.utilities.apiTools.CollectionsTools;
024:        import de.fho.jump.pirol.utilities.apiTools.FeatureCollectionTools;
025:        import de.fho.jump.pirol.utilities.metaData.MetaDataMap;
026:        import de.fho.jump.pirol.utilities.metaData.ObjectContainingMetaInformation;
027:
028:        /**
029:         * 
030:         * Class that wraps a FeatureDataset and adds methods to get and set meta information objects. 
031:         *
032:         * @author Ole Rahn
033:         * <br>
034:         * <br>FH Osnabr&uuml;ck - University of Applied Sciences Osnabr&uuml;ck,
035:         * <br>Project: PIROL (2005),
036:         * <br>Subproject: Daten- und Wissensmanagement
037:         * 
038:         * @version $Rev: 856 $
039:         * @see de.fhOsnabrueck.jump.pirol.utilities.metaData.MetaInformationHandler#createPirolFeatureCollection(FeatureCollection)
040:         *
041:         */
042:        public class PirolFeatureCollection implements  FeatureCollection,
043:                ObjectContainingMetaInformation {
044:
045:            private static final long serialVersionUID = 1997134887214940597L;
046:
047:            protected FeatureCollection featureDataSet = null;
048:            protected MetaDataMap metaInformation = null;
049:
050:            protected PirolFeatureCollectionRole[] roles = null;
051:
052:            public PirolFeatureCollection(FeatureCollection featureDataSet,
053:                    PirolFeatureCollectionRole initRole) {
054:                this .featureDataSet = featureDataSet;
055:
056:                this .roles = new PirolFeatureCollectionRole[PirolFeatureCollectionRole.numOfExistentRoles];
057:                this .roles[0] = initRole;
058:            }
059:
060:            /**
061:             * Constructor - for java2xml, only!!
062:             *
063:             */
064:            public PirolFeatureCollection() {
065:            }
066:
067:            /**
068:             * for java2xml
069:             */
070:            public Collection getXmlRoles() {
071:                ArrayList rolesForXml = new ArrayList();
072:                CollectionsTools.addArrayToList(rolesForXml, this .roles);
073:                return rolesForXml;
074:            }
075:
076:            /**
077:             * for java2xml
078:             */
079:            public void addXmlRole(PirolFeatureCollectionRole role) {
080:                this .addRole(role);
081:            }
082:
083:            /**
084:             * for java2xml
085:             */
086:            public FeatureCollection getFeatureDataSet() {
087:                return featureDataSet;
088:            }
089:
090:            /**
091:             * for java2xml
092:             */
093:            public void setFeatureDataSet(FeatureCollection featureDataSet) {
094:                this .featureDataSet = featureDataSet;
095:            }
096:
097:            public void addRole(PirolFeatureCollectionRole role) {
098:                for (int i = 0; i < this .roles.length; i++) {
099:                    if (this .roles[i] == null) {
100:                        this .roles[i] = role;
101:                        return;
102:                    } else if (this .roles[i].equalsRole(role)) {
103:                        return;
104:                    }
105:                }
106:            }
107:
108:            public void removeRole(PirolFeatureCollectionRole role) {
109:                int removedRoleIndex = -1;
110:                for (int i = 0; i < this .roles.length; i++) {
111:                    if (this .roles[i] == null) {
112:                        return;
113:                    } else if (this .roles[i].equalsRole(role)) {
114:                        this .roles[i] = null;
115:                        removedRoleIndex = i;
116:                        return;
117:                    } else {
118:                        if (removedRoleIndex > -1 && i > removedRoleIndex) {
119:                            this .roles[i - 1] = this .roles[i];
120:                            this .roles[i] = null;
121:                        }
122:                    }
123:                }
124:            }
125:
126:            public PirolFeatureCollectionRole[] getRoles() {
127:                return roles;
128:            }
129:
130:            /**
131:             * Check if this FeatureCollection has a role like the given one
132:             *@param role the role to check for
133:             *@return the role if this FeatureCollection has a role like the given one, else null
134:             *
135:             *@see PirolFeatureCollectionRoleTypes
136:             */
137:            public PirolFeatureCollectionRole getRole(
138:                    PirolFeatureCollectionRole role) {
139:                for (int i = 0; i < this .roles.length && this .roles[i] != null; i++) {
140:                    if (this .roles[i].equalsRole(role)) {
141:                        return this .roles[i];
142:                    }
143:                }
144:                return null;
145:            }
146:
147:            /**
148:             * Check if this FeatureCollection has a role like the given one
149:             *@param role the role to check for
150:             *@return the role if this FeatureCollection has a role like the given one, else null
151:             *
152:             *@see PirolFeatureCollectionRoleTypes
153:             */
154:            public PirolFeatureCollectionRole getRole(
155:                    PirolFeatureCollectionRoleTypes role) {
156:                for (int i = 0; i < this .roles.length && this .roles[i] != null; i++) {
157:                    if (this .roles[i].equalsRole(role)) {
158:                        return this .roles[i];
159:                    }
160:                }
161:                return null;
162:            }
163:
164:            /**
165:             * Check if this FeatureCollection has a role with the given ID
166:             *@param roleId id of the role type to check for
167:             *@return the role if this FeatureCollection has a role with the given ID, else null
168:             *
169:             *@see PirolFeatureCollectionRoleTypes
170:             */
171:            public PirolFeatureCollectionRole getRole(int roleId) {
172:                for (int i = 0; i < this .roles.length && this .roles[i] != null; i++) {
173:                    if (this .roles[i].equalsRole(roleId)) {
174:                        return this .roles[i];
175:                    }
176:                }
177:                return null;
178:            }
179:
180:            public MetaDataMap getMetaInformation() {
181:                return metaInformation;
182:            }
183:
184:            public void setMetaInformation(MetaDataMap metaInformation) {
185:                this .metaInformation = metaInformation;
186:            }
187:
188:            public void invalidateEnvelope(boolean simpleInvalidation) {
189:
190:                if (FeatureDataset.class.isInstance(featureDataSet)) {
191:                    ((FeatureDataset) featureDataSet).invalidateEnvelope();
192:                }
193:
194:                if (simpleInvalidation)
195:                    return;
196:
197:                this .featureDataSet.getEnvelope().setToNull();
198:
199:                Feature[] features = FeatureCollectionTools
200:                        .FeatureCollection2FeatureArray(this .featureDataSet);
201:                for (int i = 0; i < features.length; i++) {
202:                    features[i].getGeometry().geometryChanged();
203:                }
204:
205:                //        throw new UnsupportedOperationException("the wrapped FeatureCollection does not support this operation: " + this.featureDataSet.getClass().getName());
206:            }
207:
208:            public void add(Feature feature) {
209:                this .invalidateEnvelope(true);
210:                featureDataSet.add(feature);
211:            }
212:
213:            public void addAll(Collection features) {
214:                this .invalidateEnvelope(true);
215:                featureDataSet.addAll(features);
216:            }
217:
218:            public void clear() {
219:                this .invalidateEnvelope(true);
220:                featureDataSet.clear();
221:            }
222:
223:            public boolean equals(Object arg0) {
224:                return featureDataSet.equals(arg0);
225:            }
226:
227:            public Envelope getEnvelope() {
228:                this .invalidateEnvelope(true);
229:                return featureDataSet.getEnvelope();
230:            }
231:
232:            public List getFeatures() {
233:                this .invalidateEnvelope(true);
234:                return featureDataSet.getFeatures();
235:            }
236:
237:            public FeatureSchema getFeatureSchema() {
238:                return featureDataSet.getFeatureSchema();
239:            }
240:
241:            public int hashCode() {
242:                return featureDataSet.hashCode();
243:            }
244:
245:            public boolean isEmpty() {
246:                return featureDataSet.isEmpty();
247:            }
248:
249:            public Iterator iterator() {
250:                this .invalidateEnvelope(true);
251:                return featureDataSet.iterator();
252:            }
253:
254:            public List query(Envelope envelope) {
255:                return featureDataSet.query(envelope);
256:            }
257:
258:            public Collection remove(Envelope env) {
259:                this .invalidateEnvelope(true);
260:                return featureDataSet.remove(env);
261:            }
262:
263:            public void remove(Feature feature) {
264:                this .invalidateEnvelope(true);
265:                featureDataSet.remove(feature);
266:            }
267:
268:            public void removeAll(Collection features) {
269:                this .invalidateEnvelope(true);
270:                featureDataSet.removeAll(features);
271:            }
272:
273:            public int size() {
274:                return featureDataSet.size();
275:            }
276:
277:            public String toString() {
278:                return featureDataSet.toString();
279:            }
280:
281:            public Feature[] toArray() {
282:                return FeatureCollectionTools
283:                        .FeatureCollection2FeatureArray(this .featureDataSet);
284:            }
285:
286:            protected void finalize() throws Throwable {
287:                super .finalize();
288:
289:                for (int i = 0; i < this .roles.length && this .roles[i] != null; i++) {
290:                    this .roles[i].clearRam();
291:                }
292:            }
293:
294:            /**
295:             * the PirolFeatureCollection is a wrapper for other feature collections
296:             * in some cases one might want to work with the original FC. Therefor you can use this method.
297:             *@return the feature collection wrapped by this PirolFeatureCollection
298:             */
299:            public FeatureCollection getWrappee() {
300:                return this.featureDataSet;
301:            }
302:
303:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.