Revision 15103
import/ext3D/trunk/ext3D/src/com/iver/ai2/gvsig3d/gui/ForceNorthMenu3D.java | ||
---|---|---|
1 | 1 |
package com.iver.ai2.gvsig3d.gui; |
2 | 2 |
|
3 |
import java.awt.geom.Rectangle2D;
|
|
3 |
import java.io.File;
|
|
4 | 4 |
|
5 |
import com.iver.ai2.gvsig3d.map3d.layers.FLayers3D; |
|
5 |
import javax.swing.Icon; |
|
6 |
import javax.swing.ImageIcon; |
|
7 |
import javax.swing.JButton; |
|
8 |
import javax.swing.JComponent; |
|
9 |
import javax.swing.JMenu; |
|
10 |
import javax.swing.JMenuBar; |
|
11 |
|
|
6 | 12 |
import com.iver.ai2.gvsig3d.navigation.NavigationMode; |
7 |
import com.iver.ai2.gvsig3d.utils.UtilCoord; |
|
8 | 13 |
import com.iver.andami.PluginServices; |
9 | 14 |
import com.iver.andami.plugins.Extension; |
10 |
import com.iver.cit.gvsig.fmap.MapContext; |
|
11 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
|
12 |
import com.iver.cit.gvsig.fmap.layers.FLyrVect; |
|
13 |
import com.iver.cit.gvsig.fmap.tools.Behavior.Behavior; |
|
15 |
import com.iver.andami.ui.mdiFrame.JMenuItem; |
|
16 |
import com.iver.andami.ui.mdiFrame.JToolBarButton; |
|
14 | 17 |
import com.iver.cit.gvsig.project.documents.gui.FOpenDialog; |
15 | 18 |
import com.iver.cit.gvsig.project.documents.view.IProjectView; |
16 |
import com.iver.cit.gvsig.project.documents.view.gui.BaseView; |
|
17 | 19 |
|
18 |
import es.upv.ai2.libjosg.planets.Planet.PlanetType; |
|
19 |
import es.upv.ai2.libjosg.viewer.Camera; |
|
20 | 20 |
import es.upv.ai2.libjosg.viewer.CustomTerrainManipulator; |
21 |
import es.upv.ai2.libjosg.viewer.Viewer; |
|
22 | 21 |
|
23 | 22 |
public class ForceNorthMenu3D extends Extension { |
24 | 23 |
|
... | ... | |
30 | 29 |
|
31 | 30 |
private boolean wireAct = false; |
32 | 31 |
|
32 |
JMenuItem myMenu = null; |
|
33 |
|
|
34 |
Icon iconVis = null; |
|
35 |
|
|
36 |
Icon iconNoVis = null; |
|
37 |
|
|
38 |
private ImageIcon iconButtonVis; |
|
39 |
|
|
40 |
private ImageIcon iconButtonNoVis; |
|
41 |
|
|
42 |
public void initialize() { |
|
43 |
|
|
44 |
this.setActiva(true); |
|
45 |
|
|
46 |
JMenuBar jMenuBar = PluginServices.getMainFrame().getJMenuBar(); |
|
47 |
|
|
48 |
PluginServices aux = PluginServices |
|
49 |
.getPluginServices("com.iver.cit.gvsig"); |
|
50 |
|
|
51 |
for (int i = 0; i < jMenuBar.getMenuCount(); i++) { |
|
52 |
JMenu menu = jMenuBar.getMenu(i); |
|
53 |
if (menu.getText().equalsIgnoreCase(aux.getText("Vista"))) { |
|
54 |
for (int j = 0; j < menu.getItemCount(); j++) { |
|
55 |
String n = menu.getItem(j).getText(); |
|
56 |
String d = PluginServices.getText(this, "Active_north"); |
|
57 |
if (menu.getItem(j).getText().equalsIgnoreCase( |
|
58 |
PluginServices.getText(this, "Active_north"))) { |
|
59 |
myMenu = (JMenuItem) menu.getItem(j); |
|
60 |
} |
|
61 |
|
|
62 |
} |
|
63 |
} |
|
64 |
} |
|
65 |
|
|
66 |
if (myMenu != null) { |
|
67 |
|
|
68 |
File file = new File(this.getClass().getClassLoader().getResource( |
|
69 |
"images").getFile()); |
|
70 |
String path1 = file.getPath() + "/mini_check_2.png"; |
|
71 |
String path2 = file.getPath() + "/mini_no_check_2.png"; |
|
72 |
|
|
73 |
iconVis = new ImageIcon(path1); |
|
74 |
iconNoVis = new ImageIcon(path2); |
|
75 |
|
|
76 |
myMenu.setIcon(iconNoVis); |
|
77 |
|
|
78 |
String path1B = file.getPath() + "/norte.png"; |
|
79 |
String path2B = file.getPath() + "/NorthDes.png"; |
|
80 |
iconButtonVis = new ImageIcon(path1B); |
|
81 |
iconButtonNoVis = new ImageIcon(path2B); |
|
82 |
|
|
83 |
} |
|
84 |
} |
|
85 |
|
|
33 | 86 |
public void execute(String actionCommand) { |
34 | 87 |
// System.out.println("EXECUTE"); |
35 | 88 |
|
... | ... | |
46 | 99 |
CustomTerrainManipulator ctm = vista3D.getCanvas3d() |
47 | 100 |
.getCustomTerrainManipulator(); |
48 | 101 |
if (actionCommand.equals("ACTIVE")) { |
102 |
|
|
103 |
if ((!ctm.getNorthOrientation()) && (myMenu != null)) { |
|
104 |
myMenu.setIcon(iconVis); |
|
105 |
|
|
106 |
JToolBarButton b = (JToolBarButton) PluginServices.getMainFrame() |
|
107 |
.getButtonByName("NORTH"); |
|
108 |
if (b!=null) |
|
109 |
b.setIcon(iconButtonNoVis); |
|
110 |
} else { |
|
111 |
myMenu.setIcon(iconNoVis); |
|
112 |
|
|
113 |
JToolBarButton b = (JToolBarButton) PluginServices.getMainFrame() |
|
114 |
.getButtonByName("NORTH"); |
|
115 |
if (b!=null) |
|
116 |
b.setIcon(iconButtonVis); |
|
117 |
} |
|
118 |
|
|
49 | 119 |
ctm.setEnabledNorthOrientation(!ctm.getNorthOrientation()); |
50 | 120 |
|
51 |
// System.out.println("orientacion " + ctm.getNorthOrientation());
|
|
121 |
// System.out.println("orientacion " + ctm.getNorthOrientation());
|
|
52 | 122 |
|
53 | 123 |
vista3D.getCanvas3d().repaint(); |
54 | 124 |
|
... | ... | |
60 | 130 |
|
61 | 131 |
} |
62 | 132 |
|
63 |
public void initialize() { |
|
64 |
this.setActiva(true); |
|
133 |
// public void initialize() { |
|
134 |
// this.setActiva(true); |
|
135 |
// |
|
136 |
// } |
|
65 | 137 |
|
66 |
} |
|
67 |
|
|
68 | 138 |
public boolean isEnabled() { |
69 | 139 |
return true; |
70 | 140 |
} |
import/ext3D/trunk/ext3D/config/config.xml | ||
---|---|---|
45 | 45 |
|
46 | 46 |
<menu text="Vista/navegacion/Default_Select" action-command="DEFAULT_SELECT" icon="images/DefaultManipulator.png"/> |
47 | 47 |
<menu text="Vista/navegacion/Pan_Select" action-command="PAN_SELECT" icon="images/RollManipulator.png"/> |
48 |
<menu text="Vista/navegacion/Zoom_Select" action-command="ZOOM_SELECT" icon="images/ZoomManipulator.png"/>
|
|
48 |
<menu text="Vista/navegacion/Zoom_Select" action-command="ZOOM_SELECT" icon="images/zoom.png"/>
|
|
49 | 49 |
<menu text="Vista/navegacion/Azimut_Select" action-command="AZIMUT_SELECT" icon="images/AzimutManipulator.png"/> |
50 | 50 |
<menu text="Vista/modos/Wire_Frame" action-command="WIRE_FRAME" icon="images/WireFrame.png"/> |
51 | 51 |
<tool-bar name="NavigationMenu3D" > |
52 | 52 |
<selectable-tool group="tre" is-default="true" icon="images/DefaultManipulator.png" action-command="DEFAULT_SELECT" tooltip="Default_Select" position="1" /> |
53 |
<selectable-tool group="dos" icon="images/AzimutManipulator.png" action-command="PAN_SELECT" tooltip="Pan_Navigation" position="2"/>
|
|
54 |
<selectable-tool group="dos" icon="images/ZoomManipulator.png" action-command="ZOOM_SELECT" tooltip="Zoom_Navigation" position="3"/>
|
|
53 |
<selectable-tool group="dos" icon="images/rotar.png" action-command="PAN_SELECT" tooltip="Pan_Navigation" position="2"/>
|
|
54 |
<selectable-tool group="dos" icon="images/zoom.png" action-command="ZOOM_SELECT" tooltip="Zoom_Navigation" position="3"/>
|
|
55 | 55 |
<selectable-tool group="tre" icon="images/AzimutManipulator.png" action-command="AZIMUT_SELECT" tooltip="Azimut_Navigation" position="4"/> |
56 | 56 |
<action-tool icon="images/WireFrame.png" action-command="WIRE_FRAME" tooltip="Wire_Frame" position="5"/> |
57 | 57 |
<action-tool icon="images/WireFrame.png" action-command="RESET_VIEW" tooltip="Reset_View" position="6"/> |
... | ... | |
62 | 62 |
description="Extensi?n encargada de manejar los ditintos tipos de manipuladores de la vista." |
63 | 63 |
active="true" |
64 | 64 |
priority="52"> |
65 |
<menu text="Vista/modos/Active_north" action-command="ACTIVE" icon="images/North.png"/>
|
|
65 |
<menu text="Vista/Active_north" action-command="ACTIVE" icon="images/North.png"/> |
|
66 | 66 |
<tool-bar name="ForceNorthMenu3D" > |
67 |
<action-tool icon="images/North.png" action-command="ACTIVE" tooltip="Active_north" position="1"/> |
|
67 |
<action-tool icon="images/North.png" name="NORTH" action-command="ACTIVE" tooltip="Active_north" position="1"/>
|
|
68 | 68 |
</tool-bar> |
69 | 69 |
</extension> |
70 | 70 |
|
Also available in: Unified diff