Revision 38639

View differences:

branches/v2_0_0_prep/applications/appgvSIG/src/org/gvsig/app/project/documents/view/legend/gui/VectorialUniqueValue.java
448 448
					auxLegend.addSymbol(clave, theSymbol);
449 449
				}
450 450
			} else {
451
				/* FIXME: Se optimizar?a descomentarizando el if, pero el metodo equals del AbstractSymbol
452
				 * no tiene en cuenta determinadas propiedades del simbolo, como, por ejemplo, el tama?o.
453
				 * Descomentarizar al arreglar el metodo equals del AbstractSymbol.
454
				 */
455
//				if(!legendSymbol.equals(theSymbol)){
456
					auxLegend.replace(legendSymbol, theSymbol);
457
//				}
451
			    
452
			    // avoid same instance
453
			    if (legendSymbol != theSymbol) {
454

  
455
			        /*
456
			         * Perhaps use this "if" when implementations of ISymbol
457
			         * properly implement the equals method. 
458
			         */
459
			        // if (!legendSymbol.equals(theSymbol)) {
460
			            auxLegend.replace(legendSymbol, theSymbol);
461
			        // }
462
			    }
458 463
			}
459 464
			visitedKeys.add(clave);
460 465
		}
branches/v2_0_0_prep/libraries/org.gvsig.symbology/org.gvsig.symbology.lib/org.gvsig.symbology.lib.impl/src/main/java/org/gvsig/symbology/fmap/mapcontext/rendering/legend/impl/VectorialUniqueValueLegend.java
39 39
import org.gvsig.fmap.mapcontext.MapContextManager;
40 40
import org.gvsig.fmap.mapcontext.rendering.legend.IVectorialUniqueValueLegend;
41 41
import org.gvsig.fmap.mapcontext.rendering.legend.events.LegendClearEvent;
42
import org.gvsig.fmap.mapcontext.rendering.legend.events.LegendContentsChangedListener;
42 43
import org.gvsig.fmap.mapcontext.rendering.legend.events.SymbolLegendEvent;
43 44
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
44 45
import org.gvsig.tools.ToolsLocator;
......
323 324
		}
324 325
		// Clone keys
325 326
		clone.keys = new ArrayList<Object>();
327
		
328
        // ====================================================
329
		// Temporarily remove listeners to prevent
330
		// cascade of notifications
331
		LegendContentsChangedListener[] list = this.getListeners();
332
		removeListeners(list);
333
        // ====================================================
326 334

  
327 335
		// Clone symbols
328 336
		if (symbols != null) {
......
337 345
				clone.addSymbol(entry.getKey(), symbolClone);
338 346
			}
339 347
		}
340

  
348
		
349
        // ====================================================
350
        // Restore listeners
351
        addListeners(list);
352
        // ====================================================
341 353
		return clone;
342 354
	}
343 355

  
344 356

  
345
	private Map<Object, ISymbol> createSymbolMap() {
357
    private void addListeners(LegendContentsChangedListener[] list) {
358
        int len = list.length;
359
        for (int i=0; i<len; i++) {
360
            addLegendListener(list[i]);
361
        }
362
    }
363

  
364
    private void removeListeners(LegendContentsChangedListener[] list) {
365
        int len = list.length;
366
        for (int i=0; i<len; i++) {
367
            removeLegendListener(list[i]);
368
        }
369
    }
370

  
371
    private Map<Object, ISymbol> createSymbolMap() {
346 372
		return new TreeMap<Object, ISymbol>(
347 373
				new Comparator<Object>() { 
348 374
					public int compare(Object o1, Object o2) {
branches/v2_0_0_prep/libraries/org.gvsig.symbology/org.gvsig.symbology.lib/org.gvsig.symbology.lib.impl/src/main/java/org/gvsig/symbology/fmap/mapcontext/rendering/symbol/impl/AbstractSymbol.java
125 125
		if (!obj.getClass().equals(getClass())) {
126 126
			return false;
127 127
		}
128
		
129
		if (! ((ISymbol) obj).getColor().equals(this.getColor())) {
130
		    return false;
131
		}
132
		
128 133
		if (((ISymbol) obj).getOnePointRgb() != getOnePointRgb()) {
129 134
			return false;
130 135
		}

Also available in: Unified diff