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


001:        /*
002:         *    GeoTools - OpenSource mapping toolkit
003:         *    http://geotools.org
004:         *    (C) 2004-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; either
009:         *    version 2.1 of the License, or (at your option) any later version.
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.renderer.lite;
017:
018:        import java.awt.Shape;
019:        import java.awt.geom.AffineTransform;
020:        import java.awt.geom.GeneralPath;
021:        import java.awt.geom.Rectangle2D.Double;
022:        import java.util.logging.Logger;
023:
024:        /**
025:         * Utility class used to get well known marks
026:         *
027:         * @author Ian Turton
028:         * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/render/src/main/java/org/geotools/renderer/lite/Java2DMark.java $
029:         * @version $Id: Java2DMark.java 27862 2007-11-12 19:51:19Z desruisseaux $
030:         */
031:        class Java2DMark {
032:            /** The logger for the rendering module. */
033:            private static final Logger LOGGER = org.geotools.util.logging.Logging
034:                    .getLogger("org.geotools.rendering");
035:
036:            /** Cross general path */
037:            private static GeneralPath cross;
038:
039:            /** Star general path */
040:            private static GeneralPath star;
041:
042:            /** Triangle general path */
043:            private static GeneralPath triangle;
044:
045:            /** Arrow general path */
046:            private static GeneralPath arrow;
047:
048:            /** X general path */
049:            private static Shape X;
050:
051:            /** hatch path */
052:            static GeneralPath hatch;
053:
054:            static {
055:                cross = new GeneralPath(GeneralPath.WIND_EVEN_ODD);
056:                cross.moveTo(0.5f, 0.125f);
057:                cross.lineTo(0.125f, 0.125f);
058:                cross.lineTo(0.125f, 0.5f);
059:                cross.lineTo(-0.125f, 0.5f);
060:                cross.lineTo(-0.125f, 0.125f);
061:                cross.lineTo(-0.5f, 0.125f);
062:                cross.lineTo(-0.5f, -0.125f);
063:                cross.lineTo(-0.125f, -0.125f);
064:                cross.lineTo(-0.125f, -0.5f);
065:                cross.lineTo(0.125f, -0.5f);
066:                cross.lineTo(0.125f, -0.125f);
067:                cross.lineTo(0.5f, -0.125f);
068:                cross.lineTo(0.5f, 0.125f);
069:
070:                AffineTransform at = new AffineTransform();
071:                at.rotate(Math.PI / 4.0);
072:                X = cross.createTransformedShape(at);
073:                star = new GeneralPath(GeneralPath.WIND_EVEN_ODD);
074:                star.moveTo(0.191f, 0.0f);
075:                star.lineTo(0.25f, 0.344f);
076:                star.lineTo(0.0f, 0.588f);
077:                star.lineTo(0.346f, 0.638f);
078:                star.lineTo(0.5f, 0.951f);
079:                star.lineTo(0.654f, 0.638f);
080:                star.lineTo(1.0f, 0.588f); // max = 7.887
081:                star.lineTo(0.75f, 0.344f);
082:                star.lineTo(0.89f, 0f);
083:                star.lineTo(0.5f, 0.162f);
084:                star.lineTo(0.191f, 0.0f);
085:                at = new AffineTransform();
086:                at.translate(-.5, -.5);
087:                star.transform(at);
088:                triangle = new GeneralPath(GeneralPath.WIND_EVEN_ODD);
089:                triangle.moveTo(0f, 1f);
090:                triangle.lineTo(0.866f, -.5f);
091:                triangle.lineTo(-0.866f, -.5f);
092:                triangle.lineTo(0f, 1f);
093:                at = new AffineTransform();
094:
095:                at.translate(0, -.25);
096:                at.scale(.5, .5);
097:
098:                triangle.transform(at);
099:
100:                arrow = new GeneralPath(GeneralPath.WIND_EVEN_ODD);
101:                arrow.moveTo(0f, -.5f);
102:                arrow.lineTo(.5f, 0f);
103:                arrow.lineTo(0f, .5f);
104:                arrow.lineTo(0f, .1f);
105:                arrow.lineTo(-.5f, .1f);
106:                arrow.lineTo(-.5f, -.1f);
107:                arrow.lineTo(0f, -.1f);
108:                arrow.lineTo(0f, -.5f);
109:
110:                hatch = new GeneralPath(GeneralPath.WIND_EVEN_ODD);
111:                hatch.moveTo(.55f, .57f);
112:                hatch.lineTo(.52f, .57f);
113:                hatch.lineTo(-.57f, -.52f);
114:                hatch.lineTo(-.57f, -.57f);
115:                hatch.lineTo(-.52f, -.57f);
116:                hatch.lineTo(.57f, .52f);
117:                hatch.lineTo(.57f, .57f);
118:
119:                hatch.moveTo(.57f, -.49f);
120:                hatch.lineTo(.49f, -.57f);
121:                hatch.lineTo(.57f, -.57f);
122:                hatch.lineTo(.57f, -.49f);
123:
124:                hatch.moveTo(-.57f, .5f);
125:                hatch.lineTo(-.5f, .57f);
126:                hatch.lineTo(-.57f, .57f);
127:                hatch.lineTo(-.57f, .5f);
128:            }
129:
130:            /**
131:             * Java2DMark is an utility class, instantiation is not allowed
132:             */
133:            private Java2DMark() {
134:            }
135:
136:            /**
137:             * Returns the shape representing the well known name passed
138:             *
139:             * @param wellKnownName the name of a well known shape
140:             *
141:             * @return the shape representing the well known name passed
142:             */
143:            public static Shape getWellKnownMark(String wellKnownName) {
144:                LOGGER.finer("fetching mark of name " + wellKnownName);
145:
146:                if (wellKnownName.equalsIgnoreCase("cross")) {
147:                    LOGGER.finer("returning cross");
148:
149:                    return cross;
150:                }
151:
152:                if (wellKnownName.equalsIgnoreCase("circle")) {
153:                    LOGGER.finer("returning circle");
154:
155:                    return new java.awt.geom.Ellipse2D.Double(-.5, -.5, 1., 1.);
156:                }
157:
158:                if (wellKnownName.equalsIgnoreCase("triangle")) {
159:                    LOGGER.finer("returning triangle");
160:
161:                    return triangle;
162:                }
163:
164:                if (wellKnownName.equalsIgnoreCase("X")) {
165:                    LOGGER.finer("returning X");
166:
167:                    return X;
168:                }
169:
170:                if (wellKnownName.equalsIgnoreCase("star")) {
171:                    LOGGER.finer("returning star");
172:
173:                    return star;
174:                }
175:
176:                if (wellKnownName.equalsIgnoreCase("arrow")) {
177:                    LOGGER.finer("returning arrow");
178:
179:                    return arrow;
180:                }
181:
182:                if (wellKnownName.equalsIgnoreCase("hatch")) {
183:                    LOGGER.finer("returning hatch");
184:
185:                    return hatch;
186:                }
187:
188:                // failing that return a square?
189:                LOGGER.finer("returning square");
190:
191:                return new Double(-.5, -.5, 1., 1.);
192:            }
193:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.