001: /***********************************************************************************************
002: * File Info: $Id: CircleMapArea.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 final class CircleMapArea extends ImageMapArea implements
057: Serializable {
058: //---only applies to circles
059: private int radius = 5;
060:
061: /***************************************************************************************
062: *
063: * @param x
064: * @param y
065: * @param value
066: * @param xAxisLabel
067: * @param legendLabel
068: ****************************************************************************************/
069: public CircleMapArea(float x, float y, double value,
070: String xAxisLabel, String legendLabel) {
071: super (1, value, xAxisLabel, legendLabel);
072:
073: super .x[0] = (int) x;
074: super .y[0] = (int) y;
075: }
076:
077: /***************************************************************************************
078: *
079: * @param x
080: * @param y
081: * @param value
082: * @param legendLabel
083: ****************************************************************************************/
084: public CircleMapArea(float x, float y, Point2D.Double value,
085: String legendLabel) {
086: super (1, value, legendLabel);
087:
088: super .x[0] = (int) x;
089: super .y[0] = (int) y;
090: }
091:
092: /***************************************************************************************
093: *
094: * @return AreaShape
095: ****************************************************************************************/
096: public AreaShape getAreaShape() {
097: return AreaShape.CIRCLE;
098: }
099:
100: /***************************************************************************************
101: * Allows user to specify the radius for each circle
102: *
103: * @param radius
104: ****************************************************************************************/
105: public void setRadius(int radius) {
106: this .radius = radius;
107: }
108:
109: protected void getCoordinates(StringBuffer html) {
110: html.append(this .x[0] + "," + this .y[0] + "," + this.radius);
111: }
112:
113: }
|