root / trunk / libraries / libFMap / src / com / iver / cit / gvsig / fmap / rendering / GraduatedSymbolLegend.java @ 10679
History | View | Annotate | Download (4.04 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
|
4 |
*
|
5 |
* This program is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License
|
7 |
* as published by the Free Software Foundation; either version 2
|
8 |
* of the License, or (at your option) any later version.
|
9 |
*
|
10 |
* This program is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
*
|
15 |
* You should have received a copy of the GNU General Public License
|
16 |
* along with this program; if not, write to the Free Software
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
18 |
*
|
19 |
* For more information, contact:
|
20 |
*
|
21 |
* Generalitat Valenciana
|
22 |
* Conselleria d'Infraestructures i Transport
|
23 |
* Av. Blasco Ib??ez, 50
|
24 |
* 46010 VALENCIA
|
25 |
* SPAIN
|
26 |
*
|
27 |
* +34 963862235
|
28 |
* gvsig@gva.es
|
29 |
* www.gvsig.gva.es
|
30 |
*
|
31 |
* or
|
32 |
*
|
33 |
* IVER T.I. S.A
|
34 |
* Salamanca 50
|
35 |
* 46005 Valencia
|
36 |
* Spain
|
37 |
*
|
38 |
* +34 963163400
|
39 |
* dac@iver.es
|
40 |
*/
|
41 |
|
42 |
/* CVS MESSAGES:
|
43 |
*
|
44 |
* $Id: GraduatedSymbolLegend.java 10679 2007-03-09 11:25:01Z jaume $
|
45 |
* $Log$
|
46 |
* Revision 1.2 2007-03-09 11:20:56 jaume
|
47 |
* Advanced symbology (start committing)
|
48 |
*
|
49 |
* Revision 1.1.2.4 2007/02/15 16:23:44 jaume
|
50 |
* *** empty log message ***
|
51 |
*
|
52 |
* Revision 1.1.2.3 2007/02/14 15:53:35 jaume
|
53 |
* *** empty log message ***
|
54 |
*
|
55 |
* Revision 1.1.2.2 2007/02/13 16:19:19 jaume
|
56 |
* graduated symbol legends (start commiting)
|
57 |
*
|
58 |
* Revision 1.1.2.1 2007/02/12 15:15:20 jaume
|
59 |
* refactored interval legend and added graduated symbol legend
|
60 |
*
|
61 |
*
|
62 |
*/
|
63 |
package com.iver.cit.gvsig.fmap.rendering; |
64 |
|
65 |
import java.awt.Color; |
66 |
|
67 |
import org.hsqldb.lib.StringUtil; |
68 |
|
69 |
import com.iver.utiles.StringUtilities; |
70 |
import com.iver.utiles.XMLEntity; |
71 |
|
72 |
|
73 |
/**
|
74 |
* <p>GraduatedSymbolLegend isa legend that allows to classify ranges of
|
75 |
* values using a value with symbol sizes.<b>
|
76 |
* </p>
|
77 |
* <p>
|
78 |
* The symbol size will be calculated according the min size, the
|
79 |
* max size and the amount of intervals. So for a min size of 1, a max size
|
80 |
* of 5, and 5 intervals, symbol sizes will be [1, 2, 3, 4, 5].
|
81 |
* </p>
|
82 |
* @author jaume dominguez faus - jaume.dominguez@iver.es
|
83 |
*/
|
84 |
public class GraduatedSymbolLegend extends VectorialIntervalLegend { |
85 |
private double maxSymbolSize; |
86 |
private double minSymbolSize; |
87 |
|
88 |
/**
|
89 |
* Returns the max symbol size. Combined with the min symbol size and
|
90 |
* the interval count, will produce the symbol sizes.
|
91 |
* @return double, the max size.
|
92 |
*/
|
93 |
public double getMaxSymbolSize() { |
94 |
return maxSymbolSize;
|
95 |
} |
96 |
|
97 |
/**
|
98 |
* Returns the min symbol size. Combined with the max symbol size and
|
99 |
* the interval count, will produce the symbol sizes.
|
100 |
* @return double, the min size.
|
101 |
*/
|
102 |
public double getMinSymbolSize() { |
103 |
return minSymbolSize;
|
104 |
} |
105 |
|
106 |
/**
|
107 |
* Sets the max symbol size. Combined with the min symbol size and
|
108 |
* the interval count, will produce the symbol sizes.
|
109 |
*/
|
110 |
public void setMaxSymbolSize(double size) { |
111 |
this.maxSymbolSize = size;
|
112 |
} |
113 |
|
114 |
/**
|
115 |
* Sets the min symbol size. Combined with the max symbol size and
|
116 |
* the interval count, will produce the symbol sizes.
|
117 |
*/
|
118 |
public void setMinSymbolSize(double size) { |
119 |
this.minSymbolSize = size;
|
120 |
} |
121 |
|
122 |
public XMLEntity getXMLEntity() {
|
123 |
XMLEntity xml = super.getXMLEntity();
|
124 |
|
125 |
xml.putProperty("className", getClass().getName());
|
126 |
xml.putProperty("maxSymbolSize", maxSymbolSize);
|
127 |
xml.putProperty("minSymbolSize", minSymbolSize);
|
128 |
|
129 |
// remove unuseful properties from supertype
|
130 |
xml.remove("startColor");
|
131 |
xml.remove("endColor");
|
132 |
|
133 |
return xml;
|
134 |
} |
135 |
|
136 |
public void setXMLEntity(XMLEntity xml) { |
137 |
// patch for avoid errors in call to supertype's
|
138 |
// setXMLEntity(XMLEntity)
|
139 |
xml.putProperty("startColor",
|
140 |
StringUtilities.color2String(super.getStartColor()));
|
141 |
xml.putProperty("endColor",
|
142 |
StringUtilities.color2String(super.getEndColor()));
|
143 |
// end patch
|
144 |
super.setXMLEntity(xml);
|
145 |
maxSymbolSize = xml.getDoubleProperty("maxSymbolSize");
|
146 |
minSymbolSize = xml.getDoubleProperty("minSymbolSize");
|
147 |
} |
148 |
} |