Revision 31632

View differences:

branches/v2_0_0_prep/extensions/org.gvsig.symbology/src/main/java/org/gvsig/symbology/fmap/mapcontext/rendering/legend/IInterval.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 * 
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 * 
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 * 
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
 * MA  02110-1301, USA.
20
 * 
21
 */
22
package org.gvsig.symbology.fmap.mapcontext.rendering.legend;
23

  
24
import org.gvsig.tools.lang.Cloneable;
25
import org.gvsig.tools.persistence.Persistent;
26

  
27
public interface IInterval extends Persistent, Cloneable {
28

  
29
	/**
30
	 * Returns if the given value is included into the interval.
31
	 * 
32
	 * @param v
33
	 *            value to check. Must be instance of {@link Number}
34
	 * 
35
	 * @return if the given value is included into the interval
36
	 */
37
	boolean isInInterval(Object v);
38

  
39
	/**
40
	 * Returns the interval minimum included value.
41
	 * 
42
	 * @return the minimum value
43
	 */
44
	double getMin();
45

  
46
	/**
47
	 * Returns the interval maximum included value.
48
	 * 
49
	 * @return the maximum value
50
	 */
51
	double getMax();
52

  
53
}
branches/v2_0_0_prep/extensions/org.gvsig.symbology/src/main/java/org/gvsig/symbology/fmap/mapcontext/rendering/legend/IClassifiedLegend.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 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
package org.gvsig.symbology.fmap.mapcontext.rendering.legend;
42

  
43

  
44
import org.gvsig.fmap.mapcontext.rendering.legend.ILegend;
45
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
46

  
47

  
48
/**
49
 * Information of the legend that allows to be represented graphically to the user
50
 * 
51
 */
52
public interface IClassifiedLegend extends ILegend {
53
	/**
54
	 * Obtains the descriptions of the classes that are in the classification
55
	 * @return DOCUMENT ME!
56
	 */
57
	String[] getDescriptions();
58

  
59
	/**
60
	 * Obtains the symbols of each class of the classification for the user.
61
	 *
62
	 * @return DOCUMENT ME!
63
	 */
64
	ISymbol[] getSymbols();
65

  
66
	/**
67
	 * Obtains the values in relation with each class of the classification
68
	 *
69
	 * @return DOCUMENT ME!
70
	 */
71
	Object[] getValues();
72
}
branches/v2_0_0_prep/extensions/org.gvsig.symbology/src/main/java/org/gvsig/symbology/fmap/mapcontext/rendering/legend/IClassifiedRasterLegend.java
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
package org.gvsig.symbology.fmap.mapcontext.rendering.legend;
42

  
43
import org.gvsig.fmap.mapcontext.rendering.legend.IRasterLegend;
44

  
45

  
46
/**
47
 * @author jaume dominguez faus - jaume.dominguez@iver.es
48
 */
49
public interface IClassifiedRasterLegend extends IRasterLegend,
50
		IClassifiedLegend {
51

  
52
	// The interface does not add any new methods.
53
}
branches/v2_0_0_prep/extensions/org.gvsig.symbology/src/main/java/org/gvsig/symbology/fmap/mapcontext/rendering/legend/ISingleSymbolLegend.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 * 
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 * 
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 * 
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
 * MA  02110-1301, USA.
20
 * 
21
 */
22

  
23
/*
24
 * AUTHORS (In addition to CIT):
25
 * 2009 {gvSIG}  {{Task}}
26
 */
27
package org.gvsig.symbology.fmap.mapcontext.rendering.legend;
28

  
29
import org.gvsig.fmap.mapcontext.rendering.legend.IVectorLegend;
30

  
31
/**
32
 * Legend based on one single symbol to use while rendering.
33
 * 
34
 * @author <a href="mailto:cordinyana@gvsig.org">C?sar Ordi?ana</a>
35
 */
36
public interface ISingleSymbolLegend extends IVectorLegend {
37
	
38
	public static final String LEGEND_NAME = "SingleSymbol";
39
	
40
	ZSort getZSort();
41

  
42
	void setZSort(ZSort zSort);
43

  
44
}
branches/v2_0_0_prep/extensions/org.gvsig.symbology/src/main/java/org/gvsig/symbology/fmap/mapcontext/rendering/legend/IClassifiedVectorLegend.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 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
package org.gvsig.symbology.fmap.mapcontext.rendering.legend;
42

  
43

  
44
import org.gvsig.fmap.mapcontext.rendering.legend.IVectorLegend;
45
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
46

  
47
/**
48
 * Interface that offers the methods to classify the legend.
49
 */
50
public interface IClassifiedVectorLegend extends IClassifiedLegend, IVectorLegend{
51
	/**
52
	 * Deletes all the information of classification:
53
	 * intervals, values, or other classifying elements
54
	 */
55
	public abstract void clear();
56

  
57
	/**
58
	 * Returns the name of the field
59
	 *
60
	 * @return Name of the field.
61
	 *
62
	 * TODO refactor to allow more than one field name
63
	 */
64
	public abstract String[] getClassifyingFieldNames();
65

  
66
	/**
67
	 * Inserts the name of the field
68
	 *
69
	 * @param fieldNames Names of the fields.
70
	 * TODO refactor to allow more than one field name
71
	 */
72
	public abstract void setClassifyingFieldNames(String[] fieldNames);
73

  
74
	 /**
75
     * Inserts a symbol.
76
     *
77
     * @param key.
78
     * @param symbol.
79
     */
80
	public abstract void addSymbol(Object key, ISymbol symbol);
81

  
82
    /**
83
     * Deletes a symbol using for that its key which is the parameter of the
84
     * method.
85
     *
86
     * @param key clave.
87
     */
88
	public abstract void delSymbol(Object key);
89

  
90
	/**
91
	 * Removes <b>oldSymbol</b> from the Legend and substitutes it with the <b>newSymbol</b>
92
	 * @param oldSymbol
93
	 * @param newSymbol
94
	 */
95
	public abstract void replace(ISymbol oldSymbol, ISymbol newSymbol);
96

  
97
	public int[] getClassifyingFieldTypes();
98

  
99
	public void setClassifyingFieldTypes(int[] fieldTypes);
100
}
branches/v2_0_0_prep/extensions/org.gvsig.symbology/src/main/java/org/gvsig/symbology/fmap/mapcontext/rendering/legend/ZSort.java
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
package org.gvsig.symbology.fmap.mapcontext.rendering.legend;
42

  
43
import java.util.HashMap;
44
import java.util.Map;
45

  
46
import org.gvsig.fmap.mapcontext.MapContextException;
47
import org.gvsig.fmap.mapcontext.rendering.legend.ILegend;
48
import org.gvsig.fmap.mapcontext.rendering.legend.events.LegendChangedEvent;
49
import org.gvsig.fmap.mapcontext.rendering.legend.events.LegendClearEvent;
50
import org.gvsig.fmap.mapcontext.rendering.legend.events.LegendContentsChangedListener;
51
import org.gvsig.fmap.mapcontext.rendering.legend.events.SymbolLegendEvent;
52
import org.gvsig.fmap.mapcontext.rendering.symbols.IMultiLayerSymbol;
53
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
54
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.events.IntervalLegendEvent;
55
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.events.LabelLegendEvent;
56
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.events.ValueLegendEvent;
57

  
58
/**
59
 * Class ZSort is used in order to store information about the symbols
60
 * which are placed in the Z axis (because a level of symbols has been
61
 * used).
62
 *
63
 * @author jaume dominguez faus - jaume.dominguez@iver.es
64
 */
65
public class ZSort implements LegendContentsChangedListener {
66
	// private static final String COLUMN_SEPARATOR = ",";
67
	// private static final String ROW_SEPARATOR = ";";
68
	private int[][] matrix;
69
	private boolean usingZSort;
70
	private Map<ISymbol, Integer> symbols = new HashMap<ISymbol, Integer>();
71

  
72
	public ZSort(ILegend legend) {
73
		initialize(legend);
74
	}
75

  
76
	private void initialize(ILegend legend) {
77
		ISymbol[] symbols;
78
		if (legend instanceof IClassifiedLegend) {
79
			symbols = ((IClassifiedLegend) legend).getSymbols();
80

  
81
		} else {
82
			symbols = new ISymbol[] {legend.getDefaultSymbol()};
83
		}
84
		matrix = new int[symbols.length][];
85

  
86
		for (int i = 0; i < symbols.length; i++) {
87
			this.symbols.put(symbols[i], new Integer(i));
88
			int rowLength =  symbols[i] instanceof IMultiLayerSymbol ?
89
                  	 ((IMultiLayerSymbol) symbols[i]).getLayerCount() :
90
	                 1;
91
			matrix[i] = new int[rowLength];
92
		}
93
		legend.addLegendListener(this);
94
	}
95

  
96
	private void addSymbol(ISymbol sym){
97
		if (!symbols.containsKey(sym)) {
98
			int rowLength =  sym instanceof IMultiLayerSymbol ?
99
					((IMultiLayerSymbol) sym).getLayerCount() : 1;
100
			int[][] auxMatrix = new int[matrix.length+1][];
101
			int newIndex = matrix.length;
102
			for (int i=0; i<newIndex; i++){
103
				auxMatrix[i] = matrix[i];
104
			}
105
			int[] row = new int[rowLength];
106
			for (int i=0; i<rowLength; i++){
107
				row[i] = 0;
108
			}
109
			auxMatrix[newIndex] = row;
110
			matrix = auxMatrix;
111
			this.symbols.put(sym, new Integer(newIndex));
112
		}
113
	}
114

  
115
	public void legendChanged(LegendChangedEvent e) throws MapContextException {
116
		symbols.clear();
117
		usingZSort = false;
118
		initialize(e.getNewLegend());
119

  
120
	}
121

  
122
	public String getClassName() {
123
		return getClass().getName();
124
	}
125

  
126
	public int getLevelCount() {
127
		int count = -1;
128
		for (int i = 0; i < matrix.length; i++) {
129
			for (int j = 0; j < matrix[i].length; j++) {
130
				count = Math.max(count, matrix[i][j]);
131
			}
132
		}
133
		return count + 1;
134
	}
135

  
136

  
137
	public void setUsingZSort(boolean usingZSort) {
138
		this.usingZSort = usingZSort;
139
	}
140

  
141
	public void setLevels(ISymbol sym, int[] values) {
142
		setLevels(((Integer)symbols.get(sym)).intValue(), values);
143
	}
144

  
145

  
146
	public void setLevels(int row, int[] values) {
147
		matrix[row] = values;
148
	}
149

  
150
	public int[] getLevels(ISymbol sym) {
151
		Integer row = (Integer) symbols.get(sym);
152
		if (row != null) {
153
			return getLevels(row.intValue());
154
		} else {
155
			ISymbol[] theSymbols = getSymbols();
156
			for (int i = 0; i < theSymbols.length; i++) {
157
				ISymbol auxSymbol = theSymbols[i];
158
				if (auxSymbol.equals(sym)){
159
					return getLevels(((Integer)symbols.get(auxSymbol)).intValue());
160
				}
161
			}
162
		}
163
		return null;
164
	}
165

  
166

  
167
	public int[] getLevels(int row) {
168
		return matrix[row];
169
	}
170

  
171

  
172
	public boolean isUsingZSort() {
173
		return usingZSort;
174
	}
175

  
176

  
177
	public ISymbol[] getSymbols() {
178
		return (ISymbol[])symbols.keySet().toArray(new ISymbol[0]);
179
	}
180

  
181

  
182
	public String[] getDescriptions() {
183
		ISymbol[] symbols = getSymbols();
184
		String[] descs = new String[symbols.length];
185
		for (int i = 0; i < descs.length; i++) {
186
			descs[i] = symbols[i].getDescription();
187
		}
188
		return descs;
189
	}
190

  
191
	/*
192
	 * [PACO] Comentarizado porque no hace lo que se esperar?a de ?l.
193
	 * Si tenemos una leyenda con un simbolo Multilayer compuesto
194
	 * por, entre otros, un simbolo simple que coincide con otro de
195
	 * los simbolos de la leyenda, este metodo devuelve el nivel
196
	 * del s?mbolo que encuentra primero.
197
	 *
198
	 * Se ha eliminado cualquier referencia a este metodo en el resto
199
	 * del workspace, sustituyendola convenientemente por
200
	 * referencias a getLevels.
201
	 */
202
//	public int getSymbolLevel(ISymbol layer) {
203
//		ISymbol[] theSymbols = getSymbols();
204
//
205
//		for (int i = 0; i < theSymbols.length; i++) {
206
//			ISymbol mySymbol = theSymbols[i];
207
//
208
//			if (mySymbol instanceof IMultiLayerSymbol) {
209
//				IMultiLayerSymbol multiSym = (IMultiLayerSymbol) mySymbol;
210
//				for (int j = 0; j < multiSym.getLayerCount(); j++) {
211
//					ISymbol myInnerSymbol = multiSym.getLayer(j);
212
//					if (myInnerSymbol.equals(layer)) {
213
//						int row = ((Integer)symbols.get(multiSym)).intValue();
214
//						return matrix[row][j];
215
//					}
216
//				}
217
//			} else {
218
//				if (mySymbol.equals(layer)) {
219
//					return matrix[((Integer)symbols.get(layer)).intValue()][0];
220
//				}
221
//			}
222
//		}
223
//
224
////		return 0;
225
//		return -1;
226
//	}
227

  
228
	public int getTopLevelIndexAllowed() {
229
		ISymbol[] symbols = getSymbols();
230
		int count=0;
231
		for (int i = 0; i < symbols.length; i++) {
232
			if (symbols[i] instanceof IMultiLayerSymbol) {
233
				IMultiLayerSymbol mSymbol = (IMultiLayerSymbol) symbols[i];
234
				count = Math.max(count, mSymbol.getLayerCount());
235
			} else
236
				count = Math.max(count, 1);
237
		}
238
		return count;
239
	}
240

  
241
	public String toString() {
242
		String out = "Symbols:\n---------\n\n";
243
		ISymbol[] syms = getSymbols();
244
		for (int i = 0; i < syms.length; i++) {
245
			out += syms.getClass()+":\t"+syms[i].getDescription();
246
		}
247
		out += "\nMatrix:\n--------\n\n";
248
		out += "    \t";
249
		for (int i = 0; i < getTopLevelIndexAllowed(); i++) {
250
			out += "column"+i+"\t\t";
251
		}
252
		out += "\n";
253
		for (int i = 0; i < matrix.length; i++) {
254
			out += "row "+i+":\t";
255
			for (int j = 0; j < matrix[i].length; j++) {
256
				out += matrix[i][j]+"\t\t";
257
			}
258
			out += "\n";
259
		}
260
		return out;
261
	}
262

  
263
	private void replaceSymbol(ISymbol oldSymbol, ISymbol newSymbol) {
264
		if (oldSymbol == newSymbol) return;
265

  
266
		if(oldSymbol != null){
267

  
268
			Integer value = (Integer)symbols.get(oldSymbol);
269
			if (value != null){
270

  
271
				int intValue=value.intValue();
272
				if (newSymbol == null) {
273
					// emptying
274
					symbols.remove(oldSymbol);
275
					matrix[intValue] = new int[1];
276
				} else {
277
					symbols.remove(oldSymbol);
278

  
279
					symbols.put(newSymbol, value);
280

  
281
					// update matrix values if need
282
					int newArrayLength = newSymbol instanceof IMultiLayerSymbol ?
283
							((IMultiLayerSymbol) newSymbol).getLayerCount() : 1;
284

  
285
							int[] newRow = new int[newArrayLength];
286
							if (matrix[intValue].length == newArrayLength) {
287
								/*
288
								 * the new row is exactly the same long than the
289
								 * old one. Will use the old values
290
								 */
291
								newRow = matrix[intValue];
292
							} else	if (matrix[intValue].length < newArrayLength) {
293
								/*
294
								 * the new row is larger than the old one,
295
								 * let's copy all the first values and fill
296
								 * the rest with the last copied value
297
								 */
298
								int val=0;
299
								for (int i = 0; i < newRow.length; i++) {
300
									if (i<matrix[intValue].length) {
301
										val = matrix[intValue][i];
302
									}
303

  
304
									newRow[i] = val;
305
								}
306
							} else if (matrix[intValue].length > newArrayLength) {
307
								/*
308
								 * the new row is smaller than the old one,
309
								 * let's copy the first values
310
								 */
311
								for (int i = 0; i < newRow.length; i++) {
312
									newRow[i] = matrix[intValue][i];
313
								}
314
							}
315
							matrix[intValue] = newRow;
316
				}
317
			}
318
		} else {
319
			addSymbol(newSymbol);
320
		}
321
	}
322

  
323
	public boolean symbolChanged(SymbolLegendEvent e) {
324
		replaceSymbol(e.getOldSymbol(), e.getNewSymbol());
325
		return true;
326
	}
327

  
328

  
329
	public boolean classifiedSymbolChange(SymbolLegendEvent e) {
330
		replaceSymbol(e.getOldSymbol(), e.getNewSymbol());
331
		return true;
332
	}
333

  
334
	public boolean intervalChange(IntervalLegendEvent e) {
335
		return false;
336
	}
337

  
338
	public boolean valueChange(ValueLegendEvent e) {
339
		System.out.println("log ValueLegendEvent:"+e.getOldValue()+"->"+e.getNewValue());
340
		return false;
341
	}
342

  
343
	// TODO should not exist here
344
	public boolean labelFieldChange(LabelLegendEvent e) {
345
		return false;
346
	}
347

  
348

  
349
	public void legendCleared(LegendClearEvent event) {
350
//		this.usingZSort = false;
351
//		symbols.clear();
352
//		matrix = null;
353
	}
354

  
355
}
branches/v2_0_0_prep/extensions/org.gvsig.symbology/src/main/java/org/gvsig/symbology/fmap/mapcontext/rendering/legend/IVectorialUniqueValueLegend.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 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
package org.gvsig.symbology.fmap.mapcontext.rendering.legend;
42

  
43

  
44
import java.awt.Color;
45

  
46
import org.gvsig.fmap.mapcontext.MapContextException;
47
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
48

  
49

  
50
/**
51
 * Interface for the legend with unique values.
52
 *
53
 */
54
public interface IVectorialUniqueValueLegend extends IClassifiedVectorLegend {
55
	
56
	public static final String LEGEND_NAME = "VectorialUniqueValue";
57
	
58
    /**
59
     * Establishes the symbol for the value which is the argument of the function.
60
     *
61
     * @param id index.
62
     * @param symbol symbol.
63
     */
64
    void setValueSymbolByID(int id, ISymbol symbol);
65

  
66

  
67
    /**
68
     * Returns the symbols starting from an ID. It looks in m_ArrayKeys for the
69
     * element ID and with this key obtains the FSymbol.
70

  
71
     * @param key ID.
72
     *
73
     * @return symbol associated with the ID
74
     */
75

  
76
    // public FSymbol getSymbolByID(int ID);
77

  
78
    /**
79
     * Returns the symbols starting from its key.
80
     *
81
     * @param key ID.
82
     *
83
     * @return symbol associated with the key.
84
     * @throws MapContextException 
85
     */
86
    public ISymbol getSymbolByValue(Object key);
87

  
88
	ZSort getZSort();
89

  
90
	void setZSort(ZSort zSort);
91

  
92
	Color[] getColorScheme();
93

  
94
	void setColorScheme(Color[] colors);
95
}
branches/v2_0_0_prep/extensions/org.gvsig.symbology/src/main/java/org/gvsig/symbology/fmap/mapcontext/rendering/legend/IVectorialIntervalLegend.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 * 
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 * 
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 * 
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
 * MA  02110-1301, USA.
20
 * 
21
 */
22
package org.gvsig.symbology.fmap.mapcontext.rendering.legend;
23

  
24
import java.awt.Color;
25

  
26
import org.gvsig.fmap.dal.exception.DataException;
27
import org.gvsig.fmap.dal.feature.FeatureStore;
28
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
29

  
30

  
31
/**
32
 * Interface that allows the methods to classify the legend through intervals.
33
 *
34
 */
35
public interface IVectorialIntervalLegend extends IClassifiedVectorLegend {
36
	
37
	public static final String LEGEND_NAME = "VectorialInterval";
38

  
39
    public void setDefaultSymbol(ISymbol s);
40

  
41
    public IInterval getInterval(Object v) ;
42
    public int getIntervalType();
43

  
44
	/**
45
	 *
46
	 * Returns the symbol starting from an interval
47
	 *
48
	 * @param key interval.
49
	 *
50
	 * @return symbol.
51
	 */
52
    public ISymbol getSymbolByInterval(IInterval key);
53

  
54

  
55
    /**
56
     * Inserts the type of the classification of the intervals.
57
	 *
58
	 * @param tipoClasificacion type of the classification.
59
	 */
60
    public void setIntervalType(int tipoClasificacion);
61

  
62
    /**
63
	 * Inserts the initial color
64
	 * @param startColor initial color.
65
	 */
66
	public void setStartColor(Color startColor);
67

  
68
    /**
69
	 * Inserts the final color.
70
	 * @param endColor final color.
71
	 */
72
	public void setEndColor(Color endColor);
73

  
74
    /**
75
	 * Returns the initial color.
76
	 * @return  Color initial color.
77
	 */
78
	public Color getStartColor();
79

  
80
    /**
81
	 * Returns the final color
82
	 * @return Color  final color.
83
	 */
84
	public Color getEndColor();
85

  
86
	public IInterval[] calculateIntervals(FeatureStore featureStore,
87
			String selectedItem, int intervalCount, int shapeType)
88
			throws DataException;
89

  
90

  
91
//    public ISymbol getSymbol(FeatureReference id) throws DataException;
92

  
93
}
94

  

Also available in: Unified diff