Revision 25845

View differences:

trunk/libraries/lib3DMap/src/org/gvsig/gvsig3d/map3d/MapContext3D.java
107 107

  
108 108
	PlanetViewer printViewer = null;
109 109

  
110
	private boolean visibilityChange = false;
111

  
110 112
	@Override
111 113
	public void draw(BufferedImage image, Graphics2D g, Cancellable cancel,
112 114
			double scale) throws ReadDriverException {
......
572 574

  
573 575
		if (!m_bListenToLegend)
574 576
			return;
575
		if (e == null) {
577
		if ((e == null) && (!visibilityChange)){
576 578

  
577 579
			// find layer whose legend changed
578 580
			FLayer found = null;
......
592 594
						props3D.VerifyLegend(m_planet.getPlanetName());
593 595
						m_bListenToLegend = true;
594 596
						
595
//						try {
596
//							((PlanetViewer) m_canvas3d.getOSGViewer()).activePlanet(0);
597
//						} catch (ChildIndexOutOfBoundsExceptions e1) {
598
//							// TODO Auto-generated catch block
599
//							e1.printStackTrace();
600
//						}
601
//						((PlanetViewer) m_canvas3d.getOSGViewer()).computeActiveCoordinateSystemNodePath();
602 597
						// REPAINTING VIWER
603 598
						if (m_canvas3d != null)
604 599
							m_canvas3d.repaint();
......
612 607
				view3D.getTOC().refresh();
613 608
			}
614 609
		}
615

  
616
		// IVectorLegend newLegend = (IVectorLegend) e.getNewLegend();
617
		// // find layer whose legend changed
618
		// FLayer found = null;
619
		// // found.i
620
		// SingleLayerIterator lyrIterator = new SingleLayerIterator(layers);
621
		// while (lyrIterator.hasNext()) {
622
		// FLayer lyr = lyrIterator.next();
623
		// if (lyr instanceof Classifiable) {
624
		// Classifiable classLyr = (Classifiable) lyr;
625
		// ILegend legend = classLyr.getLegend();
626
		// if (legend instanceof IVectorLegend) {
627
		// if ((IVectorLegend) legend == newLegend) {
628
		// found = lyr;
629
		// break;
630
		// }
631
		// }
632
		// }
633
		// }
634

  
635
		// if (found != null) {
636
		// Layer3DProps props3D = getLayer3DProps(found);
637
		// refreshLayerInPlanet(props3D, true);
638
		// if (found instanceof FLyrVect) {
639
		// FLyrVect fvect = (FLyrVect) found;
640
		// props3D.drawVersion = fvect.getDrawVersion();
641
		// }
642
		// m_bListenToLegend = false;
643
		// props3D.VerifyLegend(m_planet.getPlanetName());
644
		// m_bListenToLegend = true;
645
		// // REPAINTING VIWER
646
		// if (m_canvas3d != null)
647
		// m_canvas3d.repaint();
648
		// }
610
		visibilityChange = false;
649 611
	}
650 612

  
651 613
	public void visibilityChanged(LayerEvent e) {
......
660 622
		}else {
661 623
			refreshLayerVisibility(lyr);
662 624
		}
663
		if (m_canvas3d != null) {
664
			m_canvas3d.getOSGViewer().releaseGLContext();
665
			m_canvas3d.getOSGViewer().configureGLContext();
666
		}
625
		visibilityChange = true;
667 626
	}
668 627

  
669 628
	private void refreshLayer3DOSGVisibility(FLayer lyr) {
......
690 649
		if (props3D.getType() == Layer3DProps.layer3DElevation) {
691 650
			m_planet.setEnabledHeightfieldLayer(0, layer.isVisible());
692 651
		}
693
		
694 652
//		try {
695 653
//			((PlanetViewer) m_canvas3d.getOSGViewer()).activePlanet(0);
696 654
//		} catch (ChildIndexOutOfBoundsExceptions e1) {

Also available in: Unified diff