Revision 41302 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.mapcontext/org.gvsig.fmap.mapcontext.api/src/main/java/org/gvsig/fmap/mapcontext/layers/FLyrDefault.java

View differences:

FLyrDefault.java
42 42
import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException;
43 43
import org.gvsig.fmap.mapcontext.exceptions.ReloadLayerException;
44 44
import org.gvsig.fmap.mapcontext.exceptions.StartEditionLayerException;
45
import org.gvsig.fmap.mapcontext.impl.DefaultMapContextManager;
45 46
import org.gvsig.fmap.mapcontext.layers.operations.ComposedLayer;
46 47
import org.gvsig.fmap.mapcontext.rendering.legend.events.LegendChangedEvent;
47 48
import org.gvsig.fmap.mapcontext.rendering.legend.events.listeners.LegendListener;
......
274 275
	 * (non-Javadoc)
275 276
	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#load()
276 277
	 */
277
	public void load() throws LoadLayerException {
278
	    MetadataManager manager = MetadataLocator.getMetadataManager();
279
	    try {
278
    public void load() throws LoadLayerException {
279
        MetadataManager manager = MetadataLocator.getMetadataManager();
280
        try {
280 281
            manager.loadMetadata(this);
281 282
        } catch (MetadataException e) {
282
            throw new LoadLayerException("Can't load metadata." , e );
283
            throw new LoadLayerException("Can't load metadata.", e);
283 284
        }
284
	}
285
        DefaultMapContextManager mcmanager = (DefaultMapContextManager) MapContextLocator.getMapContextManager();
286
        mcmanager.notifyLoadLayer(this);
287
    }
285 288

  
286 289
	/*
287 290
	 * (non-Javadoc)
288 291
	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#setVisible(boolean)
289 292
	 */
290 293
	public void setVisible(boolean visibility) {
291
		if (status.visible != visibility){
294
		if (status.visible != visibility){

292 295
			status.visible = visibility;
293
			this.updateDrawVersion();
294

  
295
			//			if (this.getMapContext() != null){
296
			//				this.getMapContext().clearAllCachingImageDrawnLayers();
297
			//			}
296
			this.updateDrawVersion();

297

  
298
			//			if (this.getMapContext() != null){

299
			//				this.getMapContext().clearAllCachingImageDrawnLayers();

300
			//			}

298 301
			callVisibilityChanged(LayerEvent.createVisibilityChangedEvent(this,
299 302
			"visible"));
300 303
		}
......
323 326
	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#setParentLayer(com.iver.cit.gvsig.fmap.layers.FLayers)
324 327
	 */
325 328
	public void setParentLayer(FLayers root) {
326
		if (this.parentLayer != root){
329
		if (this.parentLayer != root){

327 330
			this.parentLayer = root;
328
			this.updateDrawVersion();
331
			this.updateDrawVersion();

329 332
		}
330
	}
333
	}

331 334

  
332 335
	/**
333 336
	 * <p>Inserts the projection to this layer.</p>
......
402 405
	 * @see #getTransparency()
403 406
	 */
404 407
	public void setTransparency(int trans) {
405
		if (this.transparency != trans){
408
		if (this.transparency != trans){

406 409
			transparency = trans;
407
			this.updateDrawVersion();
408
		}
410
			this.updateDrawVersion();

411
		}

409 412
	}
410 413
	
411 414

  
......
446 449
		return layerListeners.remove(o);
447 450
	}
448 451
	/**
449
	 *
450
	 */
451
	private void callDrawValueChanged(LayerEvent e) {
452
		for (Iterator iter = layerListeners.iterator(); iter.hasNext();) {
453
			LayerListener listener = (LayerListener) iter.next();
454

  
455
			listener.drawValueChanged(e);
456
		}
457
	}
458
	/**
452
	 *

453
	 */

454
	private void callDrawValueChanged(LayerEvent e) {

455
		for (Iterator iter = layerListeners.iterator(); iter.hasNext();) {

456
			LayerListener listener = (LayerListener) iter.next();

457

  
458
			listener.drawValueChanged(e);

459
		}

460
	}

461
	/**

459 462
	 * Called by the method {@linkplain #setName(String)}. Notifies all listeners associated to this layer,
460 463
	 *  that its name has changed.
461 464
	 *
......
533 536
	 * @see #getCoordTrans()
534 537
	 */
535 538
	public void setCoordTrans(ICoordTrans ct) {
536
		if (this.ct == ct){
537
			return;
538
		}
539
		if (this.ct != null && this.ct.equals(ct)){
540
			return;
541
		}
539
		if (this.ct == ct){

540
			return;

541
		}

542
		if (this.ct != null && this.ct.equals(ct)){

543
			return;

544
		}

542 545
		this.ct = ct;
543
		this.updateDrawVersion();
546
		this.updateDrawVersion();

544 547
	}
545 548

  
546 549
	/**
......
583 586
	public void setMinScale(double minScale) {
584 587
		if (this.minScale != minScale){
585 588
			this.minScale = minScale;
586
			this.updateDrawVersion();
587
		}
589
			this.updateDrawVersion();

590
		}

588 591
	}
589 592
	/*
590 593
	 * (non-Javadoc)
591 594
	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#setMaxScale(double)
592 595
	 */
593 596
	public void setMaxScale(double maxScale) {
594
		if (this.maxScale != maxScale){
597
		if (this.maxScale != maxScale){

595 598
			this.maxScale = maxScale;
596
			this.updateDrawVersion();
597
		}
599
			this.updateDrawVersion();

600
		}

598 601
	}
599 602
	/*
600 603
	 * (non-Javadoc)
......
604 607

  
605 608
		boolean bVisible = true;
606 609
		if (getMinScale() != -1) {
607
			if (scale < getMinScale()){
610
			if (scale < getMinScale()){

608 611
				bVisible = false;
609 612
			}
610 613
		}
......
679 682
	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#setAvailable(boolean)
680 683
	 */
681 684
	public void setAvailable(boolean available) {
682
		if (status.available != available){
685
		if (status.available != available){

683 686
			status.available = available;
684
			this.updateDrawVersion();
685
		}
687
			this.updateDrawVersion();

688
		}

686 689
	}
687 690
	/*
688 691
	 * (non-Javadoc)
......
697 700
	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#getFLayerStatus()
698 701
	 */
699 702
	public FLayerStatus getFLayerStatus(){
700
		return status.cloneStatus();
703
		return status.cloneStatus();

701 704
	}
702 705
	/*
703 706
	 * (non-Javadoc)
704 707
	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#setFLayerStatus(com.iver.cit.gvsig.fmap.layers.FLayerStatus)
705 708
	 */
706 709
	public void setFLayerStatus(FLayerStatus status){
707
		if (!this.status.equals(status)){
710
		if (!this.status.equals(status)){

708 711
			this.status = status;
709 712
			this.updateDrawVersion();
710
		}
713
		}

711 714
	}
712 715

  
713 716
	/*

Also available in: Unified diff