Revision 36746

View differences:

trunk/extensions/extWMS/src/com/iver/cit/gvsig/fmap/layers/FLyrWMS.java
823 823
					layerRaster[i].setRemoveRasterFlag(true);
824 824
					layerRaster[i].getDataSource().close();
825 825
					layerRaster[i].getRender().free();
826
					layerRaster[i].getBufferFactory().free();
826
					if(layerRaster[i].getBufferFactory() != null)
827
						layerRaster[i].getBufferFactory().free();
827 828
					layerRaster[i] = null;
828 829
				}
829 830
			}
......
993 994
		//layerRaster[nLyr].getRender().setBufferFactory(layerRaster[nLyr].getBufferFactory());
994 995
		layerRaster[nLyr].setNoDataValue(getNoDataValue());
995 996
		layerRaster[nLyr].setNoDataType(getNoDataType());
997
		layerRaster[nLyr].init();
996 998

  
997 999
		//Obtenemos la tabla de color del raster abierto ya que se le va a sustituir la lista
998 1000
		//de filtros y el de tabla de color no queremos sustituirlo.
trunk/extensions/extRasterTools-SE/src/org/gvsig/fmap/raster/layers/FLyrRasterSE.java
167 167
	private boolean               loadingFromProject    = false;
168 168
	
169 169
	protected String              readingData           = null;
170
	
171
	//It is set to true if the method init has been called at least once
172
	protected boolean             layerInitialize       = false;
170 173

  
171 174
	private static PathGenerator pathGenerator=PathGenerator.getInstance();
172 175
	
......
341 344
		} catch (Exception e) {
342 345
			throw new LoadLayerException("No existe la capa.", e);
343 346
		}
344
		if (dataset != null)
345
			this.init();
347
		//if (dataset != null)
348
			//this.init();
346 349
	}
347 350

  
348 351
	/**
......
352 355
	 * implementen IRasterDatasource.
353 356
	 */
354 357
	public void init() throws LoadLayerException {
358
		layerInitialize = true;
359
		
355 360
		if (dataset == null)
356 361
			throw new LoadLayerException("Formato no valido", new IOException());
357 362
				
......
561 566
		this.image = image;
562 567
		RasterTask task = RasterTaskQueue.get(Thread.currentThread().toString());
563 568
		
569
		if(!layerInitialize)
570
			try {
571
				init();
572
			} catch (LoadLayerException e1) {
573
				throw new ReadDriverException("Error initializing the layer", e1);
574
			}
575
		
564 576
		task.setEvent(null);
565 577

  
566 578
		try {
......
2074 2086
	 */
2075 2087
	public FLayer cloneLayer() throws Exception {
2076 2088
		FLyrRasterSE newLayer = FLyrRasterSE.createLayer(this.getName(), params, this.getProjection());
2089
		newLayer.init();
2077 2090
		for (int i = 0; i < dataset.getDatasetCount(); i++) {
2078 2091
			String name = dataset.getDataset(i)[0].getOpenParameters();
2079 2092
			if (!(dataset instanceof CompositeDataset) && !name.equals(this.getName()) && !isActionEnabled(IRasterLayerActions.REMOTE_ACTIONS))
trunk/extensions/extWCS/src/com/iver/cit/gvsig/fmap/layers/FLyrWCS.java
435 435
					layerRaster[i].setRemoveRasterFlag(true);
436 436
					layerRaster[i].getDataSource().close();
437 437
					layerRaster[i].getRender().free();
438
					layerRaster[i].getBufferFactory().free();
438
					if(layerRaster[i].getBufferFactory() != null)
439
						layerRaster[i].getBufferFactory().free();
439 440
					layerRaster[i] = null;
440 441
				}
441 442
			}
......
622 623
	private void rasterProcess(String filePath, Graphics2D g, ViewPort vp, double scale, Cancellable cancel, int nLyr) throws ReadDriverException, LoadLayerException, FilterTypeException {
623 624
		//Cargamos el dataset con el raster de disco.
624 625
		layerRaster[nLyr] = FLyrRasterSE.createLayer("", filePath, vp.getProjection());
626
		layerRaster[nLyr].init();
625 627
		//layerRaster[nLyr].getRender().setBufferFactory(layerRaster[nLyr].getBufferFactory());
626 628
		
627 629
		if(visualStatus.dataType == IBuffer.TYPE_UNDEFINED && layerRaster[nLyr].getDataType() != null)

Also available in: Unified diff