Source Code Cross Referenced for ImageMapArea.java in  » Chart » jCharts » org » krysalis » jcharts » imageMap » 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 » Chart » jCharts » org.krysalis.jcharts.imageMap 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /***********************************************************************************************
002:         * File Info: $Id: ImageMapArea.java,v 1.1 2003/05/17 16:59:18 nathaniel_auvil Exp $
003:         * Copyright (C) 2001
004:         * Author: Nathaniel G. Auvil
005:         * Contributor(s):
006:         *
007:         * Copyright 2002 (C) Nathaniel G. Auvil. All Rights Reserved.
008:         *
009:         * Redistribution and use of this software and associated documentation
010:         * ("Software"), with or without modification, are permitted provided
011:         * that the following conditions are met:
012:         *
013:         * 1. Redistributions of source code must retain copyright
014:         *    statements and notices.  Redistributions must also contain a
015:         *    copy of this document.
016:         *
017:         * 2. Redistributions in binary form must reproduce the
018:         *    above copyright notice, this list of conditions and the
019:         *    following disclaimer in the documentation and/or other
020:         *    materials provided with the distribution.
021:         *
022:         * 3. The name "jCharts" or "Nathaniel G. Auvil" must not be used to
023:         * 	  endorse or promote products derived from this Software without
024:         * 	  prior written permission of Nathaniel G. Auvil.  For written
025:         *    permission, please contact nathaniel_auvil@users.sourceforge.net
026:         *
027:         * 4. Products derived from this Software may not be called "jCharts"
028:         *    nor may "jCharts" appear in their names without prior written
029:         *    permission of Nathaniel G. Auvil. jCharts is a registered
030:         *    trademark of Nathaniel G. Auvil.
031:         *
032:         * 5. Due credit should be given to the jCharts Project
033:         *    (http://jcharts.sourceforge.net/).
034:         *
035:         * THIS SOFTWARE IS PROVIDED BY Nathaniel G. Auvil AND CONTRIBUTORS
036:         * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
037:         * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
038:         * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
039:         * jCharts OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
040:         * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
041:         * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
042:         * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
043:         * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
044:         * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
045:         * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
046:         * OF THE POSSIBILITY OF SUCH DAMAGE.
047:         ************************************************************************************************/package org.krysalis.jcharts.imageMap;
048:
049:        import java.io.Serializable;
050:        import java.awt.geom.Point2D;
051:
052:        /*****************************************************************************************
053:         *
054:         *
055:         ******************************************************************************************/
056:        public abstract class ImageMapArea implements  Serializable {
057:            //---less overhead than creating Point Objects
058:            int[] x;
059:            int[] y;
060:
061:            private double value;
062:            private String xAxisLabel;
063:            private String legendLabel;
064:
065:            /***************************************************************************************
066:             *
067:             * @param numberOfPoints
068:             * @param value
069:             * @param xAxisLabel
070:             * @param legendLabel
071:             ****************************************************************************************/
072:            ImageMapArea(int numberOfPoints, double value, String xAxisLabel,
073:                    String legendLabel) {
074:                this .x = new int[numberOfPoints];
075:                this .y = new int[numberOfPoints];
076:
077:                this .value = value;
078:                this .xAxisLabel = xAxisLabel;
079:                this .legendLabel = legendLabel;
080:            }
081:
082:            /***************************************************************************************
083:             *
084:             * @param numberOfPoints
085:             * @param point
086:             * @param legendLabel
087:             ****************************************************************************************/
088:            ImageMapArea(int numberOfPoints, Point2D.Double point,
089:                    String legendLabel) {
090:                this .x = new int[numberOfPoints];
091:                this .y = new int[numberOfPoints];
092:
093:                this .value = point.getY();
094:                this .xAxisLabel = Double.toString(point.getX());
095:                this .legendLabel = legendLabel;
096:            }
097:
098:            /************************************************************************************
099:             *
100:             * @return AreaShape
101:             ***********************************************************************************/
102:            abstract AreaShape getAreaShape();
103:
104:            /***************************************************************************************
105:             * Returns the number of x,y coordinate pairs stored for the area
106:             *
107:             * @return int
108:             ****************************************************************************************/
109:            public final int getNumberOfCoordinates() {
110:                return this .x.length;
111:            }
112:
113:            /***************************************************************************************
114:             * Returns the x coordinate at the specified index. Not returned as a Point Object so we
115:             *	can avoid uneeded Object creation/destruction overhead.
116:             *
117:             * @return int
118:             ****************************************************************************************/
119:            public final int getXCoordinate(int index) {
120:                return this .x[index];
121:            }
122:
123:            /***************************************************************************************
124:             * Returns the y coordinate at the specified index. Not returned as a Point Object so we
125:             *	can avoid uneeded Object creation/destruction overhead.
126:             *
127:             * @return int
128:             ****************************************************************************************/
129:            public final int getYCoordinate(int index) {
130:                return this .y[index];
131:            }
132:
133:            /***************************************************************************************
134:             * Returns the data set value represented by this map.
135:             *
136:             * @return double
137:             ****************************************************************************************/
138:            public final double getValue() {
139:                return this .value;
140:            }
141:
142:            /***************************************************************************************
143:             * Rather than create an AxisChart specifc map area class just for this field, i put it
144:             *	here. This is not applicable for PieCharts.
145:             *
146:             * @return String  will return NULL for PieCharts
147:             ****************************************************************************************/
148:            public final String getXAxisLabel() {
149:                return this .xAxisLabel;
150:            }
151:
152:            /***************************************************************************************
153:             * Returns the legend label represented by this map area. Will be NULL if you did not
154:             *	pass a name to the data set constructor.
155:             *
156:             * @return String
157:             ****************************************************************************************/
158:            public final String getLengendLabel() {
159:                return this .legendLabel;
160:            }
161:
162:            /***************************************************************************************
163:             * Appends the coordinates to the passed html buffer.  This is needed to facilitate the
164:             *	'circle' map areas 'radius' value.
165:             *
166:             * @param html pass a reference to the StringBuffer so I can minimize Object creation
167:             ****************************************************************************************/
168:            protected void getCoordinates(StringBuffer html) {
169:                for (int i = 0; i < this .x.length; i++) {
170:                    html.append(this .x[i] + "," + this .y[i]);
171:                    if (i + 1 != this .x.length) {
172:                        html.append(",");
173:                    }
174:                }
175:            }
176:
177:            /**************************************************************************************************
178:             * Returns a <pre><area shape="..." coords="....."  + mapElementAttributes ></pre> HTML element.
179:             * 	The mapElementAttributes frees this method from having to declare all attributes of the HTML map
180:             *	element.
181:             *
182:             * @param mapElementAttributes allows you to place any map attributes you want:
183:             * 				href, alt, onClick, onMouseOver, etc...
184:             * @return String the HTML
185:             ***************************************************************************************************/
186:            public final String toHTML(String mapElementAttributes) {
187:                StringBuffer html = new StringBuffer(250);
188:
189:                html.append("<area");
190:                html
191:                        .append(" shape=\"" + this .getAreaShape().getValue()
192:                                + "\"");
193:
194:                html.append(" coords=\"");
195:                this .getCoordinates(html);
196:                html.append("\" ");
197:
198:                html.append(mapElementAttributes);
199:                html.append(">\n");
200:
201:                return html.toString();
202:            }
203:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.