Source Code Cross Referenced for GeometryPredicate.java in  » GIS » openjump » com » vividsolutions » jump » workbench » ui » plugin » analysis » 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 » com.vividsolutions.jump.workbench.ui.plugin.analysis 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * The Unified Mapping Platform (JUMP) is an extensible, interactive GUI
003:         * for visualizing and manipulating spatial features with geometry and attributes.
004:         *
005:         * Copyright (C) 2003 Vivid Solutions
006:         *
007:         * This program is free software; you can redistribute it and/or
008:         * modify it under the terms of the GNU General Public License
009:         * as published by the Free Software Foundation; either version 2
010:         * of the License, or (at your option) any later version.
011:         *
012:         * This program 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
015:         * GNU General Public License for more details.
016:         *
017:         * You should have received a copy of the GNU General Public License
018:         * along with this program; if not, write to the Free Software
019:         * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
020:         *
021:         * For more information, contact:
022:         *
023:         * Vivid Solutions
024:         * Suite #1A
025:         * 2328 Government Street
026:         * Victoria BC  V8T 5G5
027:         * Canada
028:         *
029:         * (250)385-6040
030:         * www.vividsolutions.com
031:         */
032:
033:        package com.vividsolutions.jump.workbench.ui.plugin.analysis;
034:
035:        import java.util.*;
036:        import com.vividsolutions.jts.algorithm.*;
037:        import com.vividsolutions.jts.geom.*;
038:        import com.vividsolutions.jts.simplify.*;
039:        import com.vividsolutions.jump.qa.diff.BufferGeometryMatcher;
040:        import com.vividsolutions.jump.workbench.ui.GenericNames;
041:
042:        /**
043:         * A function object for {@link Geometry} functions (which return a Geometry).
044:         * Provides metadata about the function.
045:         *
046:         * @author Martin Davis
047:         * @version 1.0
048:         */
049:        public abstract class GeometryPredicate {
050:            static GeometryPredicate[] method = { new IntersectsPredicate(),
051:                    new ContainsPredicate(), new CoversPredicate(),
052:                    new CoveredByPredicate(), new CrossesPredicate(),
053:                    new DisjointPredicate(), new EqualsPredicate(),
054:                    new OverlapsPredicate(), new TouchesPredicate(),
055:                    new WithinPredicate(), new WithinDistancePredicate(),
056:                    new SimilarPredicate(), };
057:
058:            static List getNames() {
059:                List names = new ArrayList();
060:                for (int i = 0; i < method.length; i++) {
061:                    names.add(method[i].name);
062:                }
063:                return names;
064:            }
065:
066:            static GeometryPredicate getPredicate(String name) {
067:                for (int i = 0; i < method.length; i++) {
068:                    if (method[i].name.equals(name))
069:                        return method[i];
070:                }
071:                return null;
072:            }
073:
074:            private String name;
075:            private int nArguments;
076:            private int nParams;
077:            private String description;
078:
079:            public GeometryPredicate(String name, int nParams) {
080:                this (name, 2, nParams, null);
081:            }
082:
083:            public GeometryPredicate(String name) {
084:                this (name, 2, 0, null);
085:            }
086:
087:            public GeometryPredicate(String name, int nArgs, int nParams) {
088:                this (name, nArgs, nParams, null);
089:            }
090:
091:            public GeometryPredicate(String name, int nArgs, int nParams,
092:                    String description) {
093:                this .name = name;
094:                this .nArguments = nArgs;
095:                this .nParams = nParams;
096:                this .description = description;
097:            }
098:
099:            public String getName() {
100:                return name;
101:            }
102:
103:            public int getGeometryArgumentCount() {
104:                return nArguments;
105:            }
106:
107:            public int getParameterCount() {
108:                return nParams;
109:            }
110:
111:            public abstract boolean isTrue(Geometry geom0, Geometry geom1,
112:                    double[] param);
113:
114:            private static class IntersectsPredicate extends GeometryPredicate {
115:                public IntersectsPredicate() {
116:                    super (GenericNames.INTERSECTS);
117:                }
118:
119:                public boolean isTrue(Geometry geom0, Geometry geom1,
120:                        double[] param) {
121:                    return geom0.intersects(geom1);
122:                }
123:            }
124:
125:            private static class ContainsPredicate extends GeometryPredicate {
126:                public ContainsPredicate() {
127:                    super (GenericNames.CONTAINS);
128:                }
129:
130:                public boolean isTrue(Geometry geom0, Geometry geom1,
131:                        double[] param) {
132:                    return geom0.contains(geom1);
133:                }
134:            }
135:
136:            private static class CoversPredicate extends GeometryPredicate {
137:                public CoversPredicate() {
138:                    super (GenericNames.COVERS);
139:                }
140:
141:                public boolean isTrue(Geometry geom0, Geometry geom1,
142:                        double[] param) {
143:                    return geom0.covers(geom1);
144:                }
145:            }
146:
147:            private static class CoveredByPredicate extends GeometryPredicate {
148:                public CoveredByPredicate() {
149:                    super (GenericNames.COVEREDBY);
150:                }
151:
152:                public boolean isTrue(Geometry geom0, Geometry geom1,
153:                        double[] param) {
154:                    return geom0.coveredBy(geom1);
155:                }
156:            }
157:
158:            private static class CrossesPredicate extends GeometryPredicate {
159:                public CrossesPredicate() {
160:                    super (GenericNames.CROSSES);
161:                }
162:
163:                public boolean isTrue(Geometry geom0, Geometry geom1,
164:                        double[] param) {
165:                    return geom0.crosses(geom1);
166:                }
167:            }
168:
169:            public static class DisjointPredicate extends GeometryPredicate {
170:                public DisjointPredicate() {
171:                    super (GenericNames.DISJOINT);
172:                }
173:
174:                public boolean isTrue(Geometry geom0, Geometry geom1,
175:                        double[] param) {
176:                    return geom0.disjoint(geom1);
177:                }
178:            }
179:
180:            private static class EqualsPredicate extends GeometryPredicate {
181:                public EqualsPredicate() {
182:                    super (GenericNames.EQUALS);
183:                }
184:
185:                public boolean isTrue(Geometry geom0, Geometry geom1,
186:                        double[] param) {
187:                    return geom0.equals(geom1);
188:                }
189:            }
190:
191:            private static class OverlapsPredicate extends GeometryPredicate {
192:                public OverlapsPredicate() {
193:                    super (GenericNames.OVERLAPS);
194:                }
195:
196:                public boolean isTrue(Geometry geom0, Geometry geom1,
197:                        double[] param) {
198:                    return geom0.overlaps(geom1);
199:                }
200:            }
201:
202:            private static class TouchesPredicate extends GeometryPredicate {
203:                public TouchesPredicate() {
204:                    super (GenericNames.TOUCHES);
205:                }
206:
207:                public boolean isTrue(Geometry geom0, Geometry geom1,
208:                        double[] param) {
209:                    return geom0.touches(geom1);
210:                }
211:            }
212:
213:            private static class WithinPredicate extends GeometryPredicate {
214:                public WithinPredicate() {
215:                    super (GenericNames.WITHIN);
216:                }
217:
218:                public boolean isTrue(Geometry geom0, Geometry geom1,
219:                        double[] param) {
220:                    return geom0.within(geom1);
221:                }
222:            }
223:
224:            public static class WithinDistancePredicate extends
225:                    GeometryPredicate {
226:                public WithinDistancePredicate() {
227:                    super (GenericNames.WITHIN_DISTANCE, 1);
228:                }
229:
230:                public boolean isTrue(Geometry geom0, Geometry geom1,
231:                        double[] param) {
232:                    return geom0.isWithinDistance(geom1, param[0]);
233:                }
234:            }
235:
236:            public static class SimilarPredicate extends GeometryPredicate {
237:                public SimilarPredicate() {
238:                    super (GenericNames.SIMILAR, 1);
239:                }
240:
241:                public boolean isTrue(Geometry geom0, Geometry geom1,
242:                        double[] param) {
243:                    return BufferGeometryMatcher
244:                            .isMatch(geom0, geom1, param[0]);
245:                }
246:            }
247:        }
www___._ja__va___2_s._c_o___m__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.