Revision 30082

View differences:

trunk/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/view/legend/gui/VectorialUniqueValue.java
216 216

  
217 217
			idField = elRs.getFieldIndexByName(fieldName);
218 218
			auxLegend = LegendFactory.createVectorialUniqueValueLegend(layer.getShapeType());
219
			auxLegend.setDefaultSymbol(defaultSymbolPrev.getSymbol());
219 220
			auxLegend.setClassifyingFieldNames(new String[] {fieldName});
220
			auxLegend.setDefaultSymbol(defaultSymbolPrev.getSymbol());
221 221

  
222 222
			//long numReg = elRs.getRowCount();
223 223
			if (idField == -1) {
......
477 477
		if (VectorialUniqueValueLegend.class.equals(legend.getClass())) {
478 478
			try {
479 479
				auxLegend = (VectorialUniqueValueLegend) legend.cloneLegend();
480
				//FIXME: Esto es un parche porque la clase ZSort no est? bien hecha
481
				auxLegend.setZSort(((VectorialUniqueValueLegend) legend).getZSort());
480
				//FIXME: parche
481
				ZSort legendZSort = ((VectorialUniqueValueLegend) legend).getZSort();
482
				if(legendZSort != null){
483
					ZSort auxZSort = new ZSort(auxLegend);
484
					auxZSort.copyLevels(legendZSort);
485
					auxZSort.setUsingZSort(legendZSort.isUsingZSort());
486
					auxLegend.setZSort(auxZSort);
487
				}
488
				//Fin del parche
482 489
			} catch (XMLException e) {
483 490
				// TODO Auto-generated catch block
484 491
				e.printStackTrace();
......
564 571
				// TODO Auto-generated catch block
565 572
				e.printStackTrace();
566 573
			}
567
			//FIXME: Esto es un parche porque la clase ZSort no est? bien hecha
568
			theLegend.setZSort(auxLegend.getZSort());
574
			//FIXME: parche
575
			ZSort auxZSort = ((VectorialUniqueValueLegend) auxLegend).getZSort();
576
			if(auxZSort != null){
577
				ZSort legendZSort = new ZSort(theLegend);
578
				legendZSort.copyLevels(auxZSort);
579
				legendZSort.setUsingZSort(auxZSort.isUsingZSort());
580
				theLegend.setZSort(legendZSort);
581
			}
582
			//Fin del parche
569 583
		}
570 584

  
571 585
		return theLegend;
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/rendering/ZSort.java
230 230
		}
231 231
		return descs;
232 232
	}
233
	
234
	public void copyLevels(ZSort zsort) {
235
		ISymbol[] syms = zsort.getSymbols();
236
		for (int i=0; i<syms.length; i++){
237
			ISymbol sym = syms[i];
238
			int[] levels = zsort.getLevels(sym);
239
			if (levels!=null){
240
				ISymbol[] mySymbols = getSymbols();
241
				for (int j = 0; j < mySymbols.length; j++) {
242
					ISymbol auxSymbol = mySymbols[j];
243
					if (auxSymbol.equals(sym)){
244
						setLevels(auxSymbol, levels);
245
					}
246
				}
247
			}
248
		}
249
	}
233 250

  
234 251

  
235 252
	/*
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/rendering/VectorialUniqueValueLegend.java
762 762
	}
763 763

  
764 764
	public void replace(ISymbol oldSymbol, ISymbol newSymbol) {
765
		if (symbols.containsValue(oldSymbol)) {
765
//		if (symbols.containsValue(oldSymbol)) {
766 766
			Iterator<Entry<Value, ISymbol>> it = symbols.entrySet().iterator();
767 767
			while (it.hasNext()) {
768 768
				Entry<Value, ISymbol> entry = it.next();
......
773 773
					break;
774 774
				}
775 775
			}
776
			if(oldSymbol.equals(this.getDefaultSymbol())) {
777
				this.setDefaultSymbol(newSymbol);
778
			}
776 779
			
777
		}
780
//		}
778 781
	}
779 782

  
780 783
	public Color[] getColorScheme() {

Also available in: Unified diff