Revision 5228

View differences:

trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/FLayers.java
109 109
	 * @param listener
110 110
	 */
111 111
	public void addLayerCollectionListener(LayerCollectionListener listener) {
112
		layerCollectionListeners.add(listener);
112
		if (!layerCollectionListeners.contains(listener))
113
			layerCollectionListeners.add(listener);
113 114
	}
114 115

  
115 116

  
......
159 160
		//Notificamos a la capa que va a ser a?adida
160 161
		if (layer instanceof FLyrDefault)
161 162
			((FLyrDefault)layer).wakeUp();
162
		
163

  
163 164
		if (layer instanceof FLayers){
164 165
			FLayers layers=(FLayers)layer;
165 166
			fmap.addAsCollectionListener(layers);
......
256 257
			lyr = ((FLayer) layers.get(i));
257 258

  
258 259
			if (lyr.getName().compareToIgnoreCase(layerName) == 0) {
259
				parent = lyr.getParentLayer(); 
260
				parent = lyr.getParentLayer();
260 261
				removeLayer(i);
261 262
				if (parent != null)
262 263
				//Notificamos a la capa que va a ser a?adida
263 264
				if (layer instanceof FLyrDefault)
264 265
					((FLyrDefault)layer).wakeUp();
265
				
266

  
266 267
				if (layer instanceof FLayers){
267 268
					FLayers layers=(FLayers)layer;
268 269
					fmap.addAsCollectionListener(layers);
......
277 278
			}
278 279
		}
279 280
	}
280
	
281 281

  
282

  
282 283
	/**
283 284
	 * Obtiene el array de capas visibles que penden del arbol cuya ra?z es
284 285
	 * este nodo
......
298 299
	}
299 300

  
300 301
	/**
301
	 * Obtiene el hijo i-?simo (de abajo a arriba) directo de esta colecci?n. 
302
	 * Obtiene el hijo i-?simo (de abajo a arriba) directo de esta colecci?n.
302 303
	 *
303 304
	 * @param index ?ndice.
304 305
	 *
......
974 975
				}
975 976
			}
976 977
		}
977
		
978

  
978 979
	}
979 980

  
980 981
	/**
......
1073 1074
	 * @see com.iver.cit.gvsig.fmap.layers.FLyrDefault#addLayerListener(com.iver.cit.gvsig.fmap.layers.LayerListener)
1074 1075
	 */
1075 1076
	public boolean addLayerListener(LayerListener o) {
1076
		for (int i = 0; i < layers.size(); i++) 
1077
		for (int i = 0; i < layers.size(); i++)
1077 1078
			((FLayer) layers.get(i)).addLayerListener(o);
1078 1079
		return true;
1079 1080
	}
......
1091 1092
				for(int j = 0; j < aux.length; j++){
1092 1093
					items.add(aux[j]);
1093 1094
				}
1094
			}			
1095
			}
1095 1096
		}
1096 1097
		return (XMLItem[])items.toArray(new XMLItem[0]);
1097
		
1098

  
1098 1099
//		for (i = 0; i < this.layers.size(); i++){
1099 1100
//			FLayer laCapa = (FLayer) layers.get(i);
1100 1101
//			if (laCapa instanceof FLyrVect){
......
1104 1105
//					RasterOperations layer = (RasterOperations) laCapa;
1105 1106
//					sb.append(layer.getInfo(p, tolerance));
1106 1107
//				} catch (DriverException e) {
1107
//					e.printStackTrace(); 
1108
//				}				
1108
//					e.printStackTrace();
1109
//				}
1109 1110
//			}
1110 1111
//			else if (laCapa instanceof InfoByPoint) {
1111 1112
//				try {
1112 1113
//					InfoByPoint layer = (InfoByPoint) laCapa;
1113 1114
//					sb.append(layer.getInfo(p, tolerance));
1114 1115
//				} catch (DriverException e) {
1115
//					e.printStackTrace(); 
1116
//					e.printStackTrace();
1116 1117
//				}
1117 1118
//			}
1118
//		}	
1119
//		}
1119 1120

  
1120 1121
	}
1121 1122

  
1122
	
1123 1123

  
1124

  
1124 1125
}

Also available in: Unified diff