Revision 29870
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/view/legend/gui/VectorialUniqueValue.java | ||
---|---|---|
215 | 215 |
} |
216 | 216 |
|
217 | 217 |
idField = elRs.getFieldIndexByName(fieldName); |
218 |
auxLegend = LegendFactory.createVectorialUniqueValueLegend(layer.getShapeType()); |
|
218 | 219 |
auxLegend.setClassifyingFieldNames(new String[] {fieldName}); |
219 | 220 |
|
220 | 221 |
//long numReg = elRs.getRowCount(); |
... | ... | |
231 | 232 |
ISymbol theSymbol = null; |
232 | 233 |
|
233 | 234 |
//auxLegend=(VectorialUniqueValueLegend)m_lyr.getLegend(); |
234 |
auxLegend = LegendFactory.createVectorialUniqueValueLegend(layer.getShapeType()); |
|
235 |
// auxLegend = LegendFactory.createVectorialUniqueValueLegend(layer.getShapeType());
|
|
235 | 236 |
|
236 | 237 |
Value clave; |
237 | 238 |
|
... | ... | |
475 | 476 |
if (VectorialUniqueValueLegend.class.equals(legend.getClass())) { |
476 | 477 |
try { |
477 | 478 |
auxLegend = (VectorialUniqueValueLegend) legend.cloneLegend(); |
479 |
//FIXME: Esto es un parche porque la clase ZSort no est? bien hecha |
|
480 |
auxLegend.setZSort(((VectorialUniqueValueLegend) legend).getZSort()); |
|
478 | 481 |
} catch (XMLException e) { |
479 | 482 |
// TODO Auto-generated catch block |
480 | 483 |
e.printStackTrace(); |
... | ... | |
560 | 563 |
// TODO Auto-generated catch block |
561 | 564 |
e.printStackTrace(); |
562 | 565 |
} |
566 |
//FIXME: Esto es un parche porque la clase ZSort no est? bien hecha |
|
563 | 567 |
theLegend.setZSort(auxLegend.getZSort()); |
564 | 568 |
} |
565 | 569 |
|
... | ... | |
618 | 622 |
orders.add(symbolTable.getFieldValue(i,1).toString()); |
619 | 623 |
} |
620 | 624 |
auxLegend.setOrders(orders); |
625 |
|
|
626 |
|
|
627 |
|
|
621 | 628 |
} |
622 | 629 |
|
623 | 630 |
//modificar el combobox de valor |
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/gui/styling/SymbolLevelsWindow.java | ||
---|---|---|
271 | 271 |
DefaultTableModel model = new DefaultTableModel(); |
272 | 272 |
Object[][] dataVector = null; |
273 | 273 |
ISymbol[] syms = zSort.getSymbols(); |
274 |
String[] labels = zSort.getDescriptions(); |
|
274 |
// String[] labels = zSort.getDescriptions();
|
|
275 | 275 |
|
276 | 276 |
if (mode == DEFAULT_VIEW) { |
277 | 277 |
// default view (JOIN and MERGE) |
278 | 278 |
dataVector = new Object[syms.length][syms.length]; |
279 | 279 |
for (int i = 0; i < syms.length; i++) { |
280 | 280 |
dataVector[i] = new Object[defaultHeaders.length]; |
281 |
dataVector[i][SYMBOL_COLUMN_INDEX] = syms[i]; |
|
282 |
dataVector[i][DESCRIPTION_COLUMN_INDEX] = labels[i]; |
|
283 |
if (syms[i] instanceof IMultiLayerSymbol) { |
|
281 |
ISymbol symbol = syms[i]; |
|
282 |
dataVector[i][SYMBOL_COLUMN_INDEX] = symbol; |
|
283 |
dataVector[i][DESCRIPTION_COLUMN_INDEX] = symbol.getDescription(); |
|
284 |
if (symbol instanceof IMultiLayerSymbol) { |
|
284 | 285 |
boolean joined = true; |
285 |
int[] levels = zSort.getLevels(syms[i]);
|
|
286 |
int[] levels = zSort.getLevels(symbol);
|
|
286 | 287 |
if(levels != null){ |
287 | 288 |
for (int j = 0; j < levels.length; j++) { |
288 | 289 |
if (joined) |
... | ... | |
339 | 340 |
*/ |
340 | 341 |
1 /* plus 1 to get a count instead of an index */]; |
341 | 342 |
for (int i = 0; i < syms.length; i++) { |
342 |
dataVector[i][SYMBOL_COLUMN_INDEX] = syms[i]; |
|
343 |
dataVector[i][DESCRIPTION_COLUMN_INDEX] = labels[i]; |
|
344 |
if (syms[i] instanceof IMultiLayerSymbol) { |
|
345 |
int[] levels = zSort.getLevels(syms[i]); |
|
343 |
ISymbol symbol = syms[i]; |
|
344 |
dataVector[i][SYMBOL_COLUMN_INDEX] = symbol; |
|
345 |
dataVector[i][DESCRIPTION_COLUMN_INDEX] = symbol.getDescription(); |
|
346 |
if (symbol instanceof IMultiLayerSymbol) { |
|
347 |
int[] levels = zSort.getLevels(symbol); |
|
346 | 348 |
|
347 | 349 |
for (int j = 0; j < levels.length; j++) { |
348 | 350 |
dataVector[i][j+FIRST_LEVEL_COLUMN_INDEX] = levels[j]; |
349 | 351 |
} |
350 | 352 |
} else { |
351 |
dataVector[i][FIRST_LEVEL_COLUMN_INDEX] = new Integer(zSort.getLevels(syms[i])[0]);
|
|
353 |
dataVector[i][FIRST_LEVEL_COLUMN_INDEX] = new Integer(zSort.getLevels(symbol)[0]);
|
|
352 | 354 |
} |
353 | 355 |
} |
354 | 356 |
|
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/rendering/VectorialUniqueValueLegend.java | ||
---|---|---|
46 | 46 |
import java.util.ArrayList; |
47 | 47 |
import java.util.Comparator; |
48 | 48 |
import java.util.Iterator; |
49 |
import java.util.Set; |
|
49 | 50 |
import java.util.TreeMap; |
51 |
import java.util.Map.Entry; |
|
50 | 52 |
|
51 | 53 |
import org.apache.log4j.Logger; |
52 | 54 |
|
... | ... | |
93 | 95 |
new Comparator<Object>() { |
94 | 96 |
public int compare(Object o1, Object o2) { |
95 | 97 |
if (ownOrder) { |
98 |
try { |
|
99 |
if (((BooleanValue)((Value)o1).equals((Value)o2)).getValue()) { |
|
100 |
return 0; |
|
101 |
} |
|
102 |
} catch (IncompatibleTypesException e) { |
|
103 |
log.info("Cannot compare the values: "+o1.toString()+" - "+o2.toString(), e); |
|
104 |
} |
|
96 | 105 |
if (orders.indexOf(o1.toString()) < orders.indexOf(o2.toString())) { |
97 | 106 |
return -1; |
98 | 107 |
} else if (orders.indexOf(o1.toString()) > orders.indexOf(o2.toString())) { |
... | ... | |
379 | 388 |
sv[i] = value.toString(); |
380 | 389 |
stv[i] = value.getSQLType(); |
381 | 390 |
} |
382 |
xml.addChild(symbols.get(value).getXMLEntity()); |
|
391 |
|
|
392 |
// ISymbol symbol = symbols.get(value); |
|
393 |
//PARCHE |
|
394 |
ISymbol symbol = getSymbolByKey(value); |
|
395 |
//FIN DEL PARCHE |
|
396 |
|
|
397 |
if(symbol != null){ |
|
398 |
xml.addChild(symbol.getXMLEntity()); |
|
399 |
} |
|
383 | 400 |
} |
384 | 401 |
|
385 | 402 |
xml.putProperty("keys", sk); |
... | ... | |
669 | 686 |
* @see com.iver.cit.gvsig.fmap.rendering.UniqueValueLegend#getSymbolByValue(com.hardcode.gdbms.engine.values.Value) |
670 | 687 |
*/ |
671 | 688 |
public ISymbol getSymbolByValue(Value key) { |
672 |
ISymbol symbol = symbols.get(key); |
|
689 |
|
|
690 |
// ISymbol symbol = symbols.get(key); |
|
691 |
|
|
692 |
//PARCHE |
|
693 |
ISymbol symbol = getSymbolByKey(key); |
|
694 |
//FIN DEL PARCHE |
|
695 |
|
|
673 | 696 |
if (symbol != null) { |
674 | 697 |
return symbol; |
675 | 698 |
} else if (useDefaultSymbol) { |
... | ... | |
678 | 701 |
return null; |
679 | 702 |
|
680 | 703 |
} |
704 |
|
|
705 |
private ISymbol getSymbolByKey(Value key) { |
|
706 |
//FIXME: Esto es un parche para sustituir symbols.get(key) |
|
707 |
// porque parece que no funciona bien el metodo get sobre un |
|
708 |
// TreeMap cuyas claves son Values. Si se consigue que funcione |
|
709 |
// correctamente, eliminar este metodo. |
|
710 |
ISymbol symbol = null; |
|
711 |
Set<Entry<Value, ISymbol>> entrySet = symbols.entrySet(); |
|
712 |
Iterator<Entry<Value, ISymbol>> it = entrySet.iterator(); |
|
713 |
while(it.hasNext()){ |
|
714 |
Entry<Value, ISymbol> entry = it.next(); |
|
715 |
try { |
|
716 |
if (((BooleanValue)key.equals(entry.getKey())).getValue()) { |
|
717 |
symbol=entry.getValue(); |
|
718 |
} |
|
719 |
} catch (IncompatibleTypesException e) { |
|
720 |
log.info("Cannot compare the values: "+key.toString()+" - "+entry.getKey().toString(), e); |
|
721 |
} |
|
722 |
} |
|
723 |
if (symbol != null) { |
|
724 |
return symbol; |
|
725 |
} |
|
726 |
return null; |
|
727 |
} |
|
681 | 728 |
|
682 | 729 |
public int getShapeType() { |
683 | 730 |
return shapeType; |
... | ... | |
710 | 757 |
|
711 | 758 |
public void replace(ISymbol oldSymbol, ISymbol newSymbol) { |
712 | 759 |
if (symbols.containsValue(oldSymbol)) { |
713 |
Iterator<Value> it = symbols.keySet().iterator();
|
|
760 |
Iterator<Entry<Value, ISymbol>> it = symbols.entrySet().iterator();
|
|
714 | 761 |
while (it.hasNext()) { |
715 |
Value key = it.next(); |
|
716 |
if (symbols.get(key).equals(oldSymbol)) { |
|
762 |
Entry<Value, ISymbol> entry = it.next(); |
|
763 |
if (entry.getValue().equals(oldSymbol)) { |
|
764 |
entry.setValue(newSymbol); |
|
717 | 765 |
fireClassifiedSymbolChangeEvent(new SymbolLegendEvent( |
718 |
symbols.put(key, newSymbol), newSymbol)); |
|
766 |
oldSymbol, newSymbol)); |
|
767 |
break; |
|
719 | 768 |
} |
720 |
|
|
721 | 769 |
} |
770 |
|
|
722 | 771 |
} |
723 | 772 |
} |
724 | 773 |
|
Also available in: Unified diff