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


001:        /*
002:         *    Geotools2 - OpenSource mapping toolkit
003:         *    http://geotools.org
004:         *    (C) 2002-2005, 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.referencing.operation.builder;
017:
018:        import org.geotools.geometry.DirectPosition2D;
019:        import org.opengis.geometry.DirectPosition;
020:
021:        /**
022:         * Simple Circle focused on Delaunays triangulation.
023:         *
024:         * @since 2.4
025:         * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/referencing/src/main/java/org/geotools/referencing/operation/builder/Circle.java $
026:         * @version $Id: Circle.java 28966 2008-01-27 17:36:43Z acuster $
027:         * @author Jan Jezek
028:         */
029:        class Circle {
030:            /** Coordinates of center. */
031:            private DirectPosition2D center;
032:
033:            /** Value of radius */
034:            private double radius;
035:
036:            /** Tolerance for the cotains method. */
037:            private double tolerance = 0.0001;
038:
039:            /**
040:             * Creates a circle with center [0,0] and radius = 0.
041:             *
042:             */
043:            protected Circle() {
044:                this (new DirectPosition2D(0, 0), 0);
045:            }
046:
047:            /**
048:             * Creates a circle using the specified center and radius.
049:             * @param center of the circle.
050:             * @param radius of the circle.
051:             */
052:            protected Circle(DirectPosition center, double radius) {
053:                this .center = new DirectPosition2D(center);
054:                this .radius = radius;
055:            }
056:
057:            /**
058:             * Sets the center.
059:             *
060:             * @param center coordinates
061:             */
062:            protected void setCenter(DirectPosition center) {
063:                this .center = new DirectPosition2D(center);
064:            }
065:
066:            /**
067:             * Sets the radius.
068:             *
069:             * @param radius value
070:             */
071:            protected void setRadius(double radius) {
072:                this .radius = radius;
073:            }
074:
075:            /**
076:             * Returns the coordinate of the center.
077:             *
078:             * @return center coordinates
079:             */
080:            protected DirectPosition getCenter() {
081:                return center;
082:            }
083:
084:            /**
085:             * Returns the radius.
086:             *
087:             * @return radius value.
088:             */
089:            protected double getRadius() {
090:                return radius;
091:            }
092:
093:            /**
094:             * Sets the tolerance for the contains method.
095:             *
096:             * @param tolerance value
097:             */
098:            protected void setTolerance(double tolerance) {
099:                this .tolerance = tolerance;
100:            }
101:
102:            /**
103:             * Raturns the tolerance
104:             *
105:             * @return tolerance value
106:             */
107:            protected double getTolerance() {
108:                return tolerance;
109:            }
110:
111:            /**
112:             * The contains test whether the coordinate p is within the circle.
113:             * Triangle contains coordinate if the distance  between center and p is
114:             * smaller then the radius that is reduced by tolerance. This is used for
115:             * triangulation when there are four points on one circle to avoid
116:             * neverending loop.
117:             *
118:             * @param p - the point to be tested
119:             *
120:             * @return True if the circle contais p, False if not.
121:             */
122:            protected boolean contains(DirectPosition p) {
123:                if (center.distance(new DirectPosition2D(p)) < (this .radius - tolerance)) {
124:                    return true;
125:                } else {
126:                    return false;
127:                }
128:            }
129:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.