Revision 11268
trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/RasterSEAdapterModule.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2007 IVER T.I. and Generalitat Valenciana. |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU General Public License |
|
7 |
* as published by the Free Software Foundation; either version 2 |
|
8 |
* of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program; if not, write to the Free Software |
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
18 |
*/ |
|
19 |
|
|
20 |
package org.gvsig.rastertools; |
|
21 |
|
|
22 |
import org.gvsig.rastertools.cutting.CuttingTocMenuEntry; |
|
23 |
import org.gvsig.rastertools.histogram.HistogramTocMenuEntry; |
|
24 |
import org.gvsig.rastertools.properties.dialog.RasterPropertiesTocMenuEntry; |
|
25 |
import org.gvsig.rastertools.properties.panels.BandSetupPanel; |
|
26 |
import org.gvsig.rastertools.properties.panels.EnhancedPanel; |
|
27 |
import org.gvsig.rastertools.properties.panels.InfoPanel; |
|
28 |
import org.gvsig.rastertools.properties.panels.TransparencyPanel; |
|
29 |
import org.gvsig.rastertools.wizards.FileOpenRasterDialog; |
|
30 |
|
|
31 |
import com.iver.andami.PluginServices; |
|
32 |
import com.iver.andami.plugins.Extension; |
|
33 |
import com.iver.cit.gvsig.AddLayer; |
|
34 |
import com.iver.cit.gvsig.project.documents.view.gui.View; |
|
35 |
import com.iver.utiles.extensionPoints.ExtensionPoint; |
|
36 |
import com.iver.utiles.extensionPoints.ExtensionPoints; |
|
37 |
import com.iver.utiles.extensionPoints.ExtensionPointsSingleton; |
|
38 |
|
|
39 |
/** |
|
40 |
* Extensi?n que adapta a FMap y gvSIG la nueva implementaci?n de raster. Para el cuadro de |
|
41 |
* Propiedades de visualizaci?n de raster contiene el contenedor base se registran la entrada |
|
42 |
* del men? del TOC y los paneles en el cuadro. Para la parte de FMap contiene una nueva |
|
43 |
* capa raster y los drivers necesarios. |
|
44 |
* |
|
45 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
46 |
* |
|
47 |
*/ |
|
48 |
public class RasterSEAdapterModule extends Extension{ |
|
49 |
|
|
50 |
public void execute(String actionCommand) { |
|
51 |
|
|
52 |
} |
|
53 |
|
|
54 |
/* |
|
55 |
* (non-Javadoc) |
|
56 |
* @see com.iver.andami.plugins.IExtension#initialize() |
|
57 |
*/ |
|
58 |
public void initialize() { |
|
59 |
// DiagSignalHandler.install("ALRM"); |
|
60 |
|
|
61 |
InfoPanel info = new InfoPanel(); |
|
62 |
BandSetupPanel bandSetup = new BandSetupPanel(); |
|
63 |
TransparencyPanel transpPanel = new TransparencyPanel(); |
|
64 |
EnhancedPanel enhancedPanel = new EnhancedPanel(); |
|
65 |
|
|
66 |
ExtensionPoints extensionPoints = ExtensionPointsSingleton.getInstance(); |
|
67 |
|
|
68 |
//Creaci?n del punto de extensi?n para registrar paneles en el cuadro de propiedades. |
|
69 |
if (!extensionPoints.containsKey("RasterSEProperties")) { |
|
70 |
extensionPoints.put( |
|
71 |
new ExtensionPoint( |
|
72 |
"RasterSEPropertiesDialog", |
|
73 |
"Raster Properties registrable panels (register instances of javax.swing.JPanel)") |
|
74 |
); |
|
75 |
} |
|
76 |
//A?adimos paneles al cuadro de propiedades. |
|
77 |
extensionPoints.add("RasterSEPropertiesDialog", info.getID(), info); |
|
78 |
extensionPoints.add("RasterSEPropertiesDialog", bandSetup.getID(), bandSetup); |
|
79 |
extensionPoints.add("RasterSEPropertiesDialog", transpPanel.getID(), transpPanel); |
|
80 |
extensionPoints.add("RasterSEPropertiesDialog", enhancedPanel.getID(), enhancedPanel); |
|
81 |
|
|
82 |
//A?adimos la entrada del toc del cuadro de propiedades. Como se llama igual sustituye a la vieja. |
|
83 |
extensionPoints.add("View_TocActions","HistogramPanel",new HistogramTocMenuEntry()); |
|
84 |
extensionPoints.add("View_TocActions","CuttingPanel",new CuttingTocMenuEntry()); |
|
85 |
|
|
86 |
//A?adimos la entrada del toc del cuadro de propiedades. Como se llama igual sustituye a la vieja. |
|
87 |
extensionPoints.add("View_TocActions","RasterSEProperties",new RasterPropertiesTocMenuEntry()); |
|
88 |
|
|
89 |
//A?adimos el panel al winzard de cargar capa. (Esto es temporal hasta que el actual sea totalmente extensible) |
|
90 |
AddLayer.addWizard(FileOpenRasterDialog.class); |
|
91 |
} |
|
92 |
|
|
93 |
/* |
|
94 |
* (non-Javadoc) |
|
95 |
* @see com.iver.andami.plugins.IExtension#isEnabled() |
|
96 |
*/ |
|
97 |
public boolean isEnabled() { |
|
98 |
return true; |
|
99 |
} |
|
100 |
|
|
101 |
/** |
|
102 |
* Mostramos el control si hay alguna capa cargada. |
|
103 |
*/ |
|
104 |
public boolean isVisible() { |
|
105 |
com.iver.andami.ui.mdiManager.IWindow f = PluginServices.getMDIManager().getActiveWindow(); |
|
106 |
if (f == null) |
|
107 |
return false; |
|
108 |
|
|
109 |
return (f instanceof View); |
|
110 |
} |
|
111 |
|
|
112 |
} |
trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/RasterModule.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2007 IVER T.I. and Generalitat Valenciana. |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU General Public License |
|
7 |
* as published by the Free Software Foundation; either version 2 |
|
8 |
* of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program; if not, write to the Free Software |
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
18 |
*/ |
|
19 |
|
|
20 |
package org.gvsig.rastertools; |
|
21 |
|
|
22 |
import org.gvsig.rastertools.histogram.HistogramTocMenuEntry; |
|
23 |
import org.gvsig.rastertools.properties.dialog.RasterPropertiesTocMenuEntry; |
|
24 |
import org.gvsig.rastertools.properties.panels.BandSetupPanel; |
|
25 |
import org.gvsig.rastertools.properties.panels.EnhancedPanel; |
|
26 |
import org.gvsig.rastertools.properties.panels.InfoPanel; |
|
27 |
import org.gvsig.rastertools.properties.panels.TransparencyPanel; |
|
28 |
import org.gvsig.rastertools.saveraster.map.SaveRasterListener; |
|
29 |
import org.gvsig.rastertools.wizards.FileOpenRasterDialog; |
|
30 |
|
|
31 |
import com.iver.andami.PluginServices; |
|
32 |
import com.iver.andami.plugins.Extension; |
|
33 |
import com.iver.cit.gvsig.AddLayer; |
|
34 |
import com.iver.cit.gvsig.fmap.MapContext; |
|
35 |
import com.iver.cit.gvsig.fmap.MapControl; |
|
36 |
import com.iver.cit.gvsig.fmap.tools.Behavior.Behavior; |
|
37 |
import com.iver.cit.gvsig.fmap.tools.Behavior.MouseMovementBehavior; |
|
38 |
import com.iver.cit.gvsig.fmap.tools.Behavior.RectangleBehavior; |
|
39 |
import com.iver.cit.gvsig.project.documents.view.IProjectView; |
|
40 |
import com.iver.cit.gvsig.project.documents.view.gui.View; |
|
41 |
import com.iver.cit.gvsig.project.documents.view.toolListeners.StatusBarListener; |
|
42 |
import com.iver.utiles.extensionPoints.ExtensionPoint; |
|
43 |
import com.iver.utiles.extensionPoints.ExtensionPoints; |
|
44 |
import com.iver.utiles.extensionPoints.ExtensionPointsSingleton; |
|
45 |
|
|
46 |
/** |
|
47 |
* Extensi?n que adapta a FMap y gvSIG la nueva implementaci?n de raster. Para el cuadro de |
|
48 |
* Propiedades de visualizaci?n de raster contiene el contenedor base se registran la entrada |
|
49 |
* del men? del TOC y los paneles en el cuadro. Para la parte de FMap contiene una nueva |
|
50 |
* capa raster y los drivers necesarios. |
|
51 |
* |
|
52 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
53 |
* |
|
54 |
*/ |
|
55 |
public class RasterModule extends Extension{ |
|
56 |
|
|
57 |
public void execute(String actionCommand) { |
|
58 |
if(actionCommand.equals("SAVERASTER")) { |
|
59 |
View theView = (View) PluginServices.getMDIManager().getActiveWindow(); |
|
60 |
MapControl m_MapControl = theView.getMapControl(); |
|
61 |
loadListener(m_MapControl); |
|
62 |
m_MapControl.setTool("saveRaster"); |
|
63 |
} |
|
64 |
} |
|
65 |
|
|
66 |
/** |
|
67 |
* Carga el listener de salvar a raster en el MapControl. |
|
68 |
*/ |
|
69 |
private void loadListener(MapControl m_MapControl){ |
|
70 |
//Si no se ha cargado el listener a?n lo cargamos. |
|
71 |
if(m_MapControl.getNamesMapTools().get("saveRaster") == null){ |
|
72 |
//Listener de eventos de movimiento que pone las coordenadas del rat?n en la barra de estado |
|
73 |
StatusBarListener sbl = new StatusBarListener(m_MapControl); |
|
74 |
|
|
75 |
//Salvar a Raster |
|
76 |
SaveRasterListener srl = new SaveRasterListener(m_MapControl); |
|
77 |
m_MapControl.addMapTool("saveRaster", new Behavior[]{ |
|
78 |
new RectangleBehavior(srl), new MouseMovementBehavior(sbl)}); |
|
79 |
} |
|
80 |
} |
|
81 |
|
|
82 |
/* |
|
83 |
* (non-Javadoc) |
|
84 |
* @see com.iver.andami.plugins.IExtension#initialize() |
|
85 |
*/ |
|
86 |
public void initialize() { |
|
87 |
// DiagSignalHandler.install("ALRM"); |
|
88 |
|
|
89 |
InfoPanel info = new InfoPanel(); |
|
90 |
BandSetupPanel bandSetup = new BandSetupPanel(); |
|
91 |
TransparencyPanel transpPanel = new TransparencyPanel(); |
|
92 |
EnhancedPanel enhancedPanel = new EnhancedPanel(); |
|
93 |
|
|
94 |
ExtensionPoints extensionPoints = ExtensionPointsSingleton.getInstance(); |
|
95 |
|
|
96 |
//Creaci?n del punto de extensi?n para registrar paneles en el cuadro de propiedades. |
|
97 |
if (!extensionPoints.containsKey("RasterSEProperties")) { |
|
98 |
extensionPoints.put( |
|
99 |
new ExtensionPoint( |
|
100 |
"RasterSEPropertiesDialog", |
|
101 |
"Raster Properties registrable panels (register instances of javax.swing.JPanel)") |
|
102 |
); |
|
103 |
} |
|
104 |
//A?adimos paneles al cuadro de propiedades. |
|
105 |
extensionPoints.add("RasterSEPropertiesDialog", info.getID(), info); |
|
106 |
extensionPoints.add("RasterSEPropertiesDialog", bandSetup.getID(), bandSetup); |
|
107 |
extensionPoints.add("RasterSEPropertiesDialog", transpPanel.getID(), transpPanel); |
|
108 |
extensionPoints.add("RasterSEPropertiesDialog", enhancedPanel.getID(), enhancedPanel); |
|
109 |
|
|
110 |
//A?adimos la entrada del toc del cuadro de propiedades. Como se llama igual sustituye a la vieja. |
|
111 |
extensionPoints.add("View_TocActions","HistogramPanel",new HistogramTocMenuEntry()); |
|
112 |
|
|
113 |
//A?adimos la entrada del toc del cuadro de propiedades. Como se llama igual sustituye a la vieja. |
|
114 |
extensionPoints.add("View_TocActions","RasterSEProperties",new RasterPropertiesTocMenuEntry()); |
|
115 |
|
|
116 |
//A?adimos el panel al winzard de cargar capa. (Esto es temporal hasta que el actual sea totalmente extensible) |
|
117 |
AddLayer.addWizard(FileOpenRasterDialog.class); |
|
118 |
} |
|
119 |
|
|
120 |
/* |
|
121 |
* (non-Javadoc) |
|
122 |
* @see com.iver.andami.plugins.IExtension#isEnabled() |
|
123 |
*/ |
|
124 |
public boolean isEnabled() { |
|
125 |
return true; |
|
126 |
} |
|
127 |
|
|
128 |
/** |
|
129 |
* Mostramos el control si hay alguna capa cargada. |
|
130 |
*/ |
|
131 |
public boolean isVisible() { |
|
132 |
com.iver.andami.ui.mdiManager.IWindow f = PluginServices.getMDIManager().getActiveWindow(); |
|
133 |
if (f == null) |
|
134 |
return false; |
|
135 |
|
|
136 |
if (f instanceof View) { |
|
137 |
View vista = (View) f; |
|
138 |
IProjectView model = vista.getModel(); |
|
139 |
MapContext mapa = model.getMapContext(); |
|
140 |
if (mapa.getLayers().getLayersCount() > 0) |
|
141 |
return true; |
|
142 |
} |
|
143 |
|
|
144 |
return false; |
|
145 |
} |
|
146 |
|
|
147 |
} |
|
0 | 148 |
Also available in: Unified diff