Revision 22628 trunk/extensions/ext3Dgui/src/org/gvsig/gvsig3dgui/import3D/MenuImport3D.java

View differences:

MenuImport3D.java
4 4

  
5 5
import org.gvsig.GeometryFactory3D;
6 6
import org.gvsig.fmap.geom.GeometryManager;
7
import org.gvsig.gvsig3d.cacheservices.OSGCacheService;
7 8
import org.gvsig.gvsig3d.drivers.GvsigDriverOSG;
8 9
import org.gvsig.gvsig3dgui.view.View3D;
9 10

  
11
import com.iver.ai2.gvsig3d.map3d.layers.Layer3DProps;
10 12
import com.iver.andami.PluginServices;
11 13
import com.iver.andami.plugins.Extension;
14
import com.iver.cit.gvsig.fmap.MapContext;
15
import com.iver.cit.gvsig.fmap.layers.FLayer;
16
import com.iver.cit.gvsig.fmap.layers.FLayers;
12 17
import com.iver.cit.gvsig.fmap.layers.LayerFactory;
18
import com.iver.cit.gvsig.project.documents.view.IProjectView;
13 19

  
14 20

  
15 21
/**
......
32 38
		else if( actionCommand.equals("OBJECT_GIS_VECTORIAL") )
33 39
			tipoObjeto = 1;
34 40
	
35
		this.controlImport = new ControlImport3D(tipoObjeto);
41
		
42
		
43
		View3D vista = (View3D) PluginServices.getMDIManager().getActiveWindow();
44
		
45
		this.controlImport = new ControlImport3D(tipoObjeto,vista);
46
		
36 47
        PluginServices.getMDIManager().addWindow(controlImport);
37 48
		
38 49
	}
......
53 64

  
54 65
	public boolean isEnabled() {
55 66
		
56
		com.iver.andami.ui.mdiManager.IWindow f = PluginServices
57
		.getMDIManager().getActiveWindow();
58

  
59
		if (f == null) {
67
//		com.iver.andami.ui.mdiManager.IWindow f = PluginServices
68
//		.getMDIManager().getActiveWindow();
69
//
70
//		if (f == null) {
71
//			return false;
72
//		}
73
//		
74
//		// Only isEnable = true, where the view has a view3D.
75
//		if (f instanceof View3D) {
76
//			return true;
77
//		}
78
//		return false;
79
		View3D vista = (View3D) PluginServices.getMDIManager().getActiveWindow();
80
		IProjectView model = vista.getModel();
81
		MapContext mapContext = model.getMapContext();
82
		FLayers layers = mapContext.getLayers();
83
		FLayer[] actives = layers.getActives();
84
		//Layer3DProps props3D = Layer3DProps.getLayer3DProps(actives[0]);
85
		if (actives.length == 1
86
				&& Layer3DProps.getLayer3DProps(actives[0]).getType() == Layer3DProps.layer3DOSG) {
87
			OSGCacheService osgCache = (OSGCacheService) Layer3DProps.getLayer3DProps(actives[0]).getCacheService();
88
			return true;
89
		}else
60 90
			return false;
61
		}
62 91
		
63
		// Only isVisible = true, where the view has a view3D.
64
		if (f instanceof View3D) {
65
			return true;
66
		}
67
		return false;
68 92
		
93
		
69 94
	}
70 95

  
71 96
	public boolean isVisible() {

Also available in: Unified diff