Revision 5121
org.gvsig.raster.tools/tags/org.gvsig.raster.tools-2.2.28/org.gvsig.raster.tools.app.basic/buildNumber.properties | ||
---|---|---|
1 |
#Sun Feb 07 09:40:00 CET 2016 |
|
2 |
buildNumber=79 |
|
0 | 3 |
org.gvsig.raster.tools/tags/org.gvsig.raster.tools-2.2.28/org.gvsig.raster.tools.app.basic/src/test/resources/log4j.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1" ?> |
|
2 |
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> |
|
3 |
|
|
4 |
<!-- |
|
5 |
Log4J configuration file for unit tests execution. |
|
6 |
--> |
|
7 |
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> |
|
8 |
|
|
9 |
<!-- Appender configuration to show logging messages through the console --> |
|
10 |
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender"> |
|
11 |
<layout class="org.apache.log4j.PatternLayout"> |
|
12 |
<param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %-5p [%c{2}.%M()]\n %m%n" /> |
|
13 |
</layout> |
|
14 |
</appender> |
|
15 |
|
|
16 |
<!-- |
|
17 |
Activate logging messages of DEBUG level of higher only for the |
|
18 |
org.gvsig.tools packages. |
|
19 |
You can put full classes names or packages instead, to configure |
|
20 |
logging for all the classes and subpackages of the package. |
|
21 |
--> |
|
22 |
<category name="org.gvsig.tools"> |
|
23 |
<priority value="DEBUG" /> |
|
24 |
</category> |
|
25 |
<category name="org.gvsig.raster"> |
|
26 |
<priority value="DEBUG" /> |
|
27 |
</category> |
|
28 |
|
|
29 |
<!-- |
|
30 |
By default, show only logging messages of INFO level or higher, |
|
31 |
through the previously configured CONSOLE appender. |
|
32 |
--> |
|
33 |
<root> |
|
34 |
<priority value="INFO" /> |
|
35 |
<appender-ref ref="CONSOLE" /> |
|
36 |
</root> |
|
37 |
</log4j:configuration> |
|
0 | 38 |
org.gvsig.raster.tools/tags/org.gvsig.raster.tools-2.2.28/org.gvsig.raster.tools.app.basic/src/test/resources/README.txt | ||
---|---|---|
1 |
Put into this folder the resources needed by your test classes. |
|
2 |
|
|
3 |
This folder is added to the Tests classpath, so you can load any resources |
|
4 |
through the ClassLoader. |
|
5 |
|
|
6 |
By default, in this folder you can find an example of log4j configuration, |
|
7 |
prepared to log messages through the console, so logging works when you |
|
8 |
run your tests classes. |
|
0 | 9 |
org.gvsig.raster.tools/tags/org.gvsig.raster.tools-2.2.28/org.gvsig.raster.tools.app.basic/src/test/java/org/gvsig/raster/app/extension/TestNoDataPanel.java | ||
---|---|---|
1 |
package org.gvsig.raster.app.extension; |
|
2 |
|
|
3 |
import javax.swing.JFrame; |
|
4 |
|
|
5 |
import org.gvsig.raster.tools.app.basic.tool.properties.panel.NoDataPanel; |
|
6 |
|
|
7 |
public class TestNoDataPanel { |
|
8 |
private int w = 510; |
|
9 |
private int h = 300; |
|
10 |
private JFrame frame = new JFrame(); |
|
11 |
private NoDataPanel desc = null; |
|
12 |
|
|
13 |
public TestNoDataPanel() { |
|
14 |
desc = new NoDataPanel(); |
|
15 |
frame.getContentPane().add(desc); |
|
16 |
frame.setSize(w, h); |
|
17 |
frame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); |
|
18 |
frame.setVisible(true); |
|
19 |
} |
|
20 |
|
|
21 |
public static void main(String[] args) { |
|
22 |
new TestNoDataPanel(); |
|
23 |
} |
|
24 |
} |
|
0 | 25 |
org.gvsig.raster.tools/tags/org.gvsig.raster.tools-2.2.28/org.gvsig.raster.tools.app.basic/src/test/java/org/gvsig/raster/app/extension/TestClipPanel.java | ||
---|---|---|
1 |
package org.gvsig.raster.app.extension; |
|
2 |
|
|
3 |
import javax.swing.JFrame; |
|
4 |
|
|
5 |
import org.gvsig.raster.tools.app.basic.tool.clip.ui.ClippingPanel; |
|
6 |
import org.gvsig.tools.library.impl.DefaultLibrariesInitializer; |
|
7 |
|
|
8 |
public class TestClipPanel { |
|
9 |
private int w = 510; |
|
10 |
private int h = 300; |
|
11 |
private JFrame frame = new JFrame(); |
|
12 |
private ClippingPanel desc = null; |
|
13 |
|
|
14 |
public TestClipPanel() { |
|
15 |
new DefaultLibrariesInitializer().fullInitialize(true); |
|
16 |
desc = new ClippingPanel(null); |
|
17 |
frame.getContentPane().add(desc); |
|
18 |
frame.setSize(w, h); |
|
19 |
frame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); |
|
20 |
frame.setVisible(true); |
|
21 |
} |
|
22 |
|
|
23 |
public static void main(String[] args) { |
|
24 |
new TestClipPanel(); |
|
25 |
} |
|
26 |
} |
|
0 | 27 |
org.gvsig.raster.tools/tags/org.gvsig.raster.tools-2.2.28/org.gvsig.raster.tools.app.basic/src/main/assembly/gvsig-plugin-package.xml | ||
---|---|---|
1 |
<assembly> |
|
2 |
<id>gvsig-plugin-package</id> |
|
3 |
<formats> |
|
4 |
<format>zip</format> |
|
5 |
</formats> |
|
6 |
<baseDirectory>${project.artifactId}</baseDirectory> |
|
7 |
<includeBaseDirectory>true</includeBaseDirectory> |
|
8 |
<files> |
|
9 |
<file> |
|
10 |
<source>target/${project.artifactId}-${project.version}.jar</source> |
|
11 |
<outputDirectory>lib</outputDirectory> |
|
12 |
</file> |
|
13 |
<file> |
|
14 |
<source>target/package.info</source> |
|
15 |
</file> |
|
16 |
</files> |
|
17 |
|
|
18 |
<fileSets> |
|
19 |
<fileSet> |
|
20 |
<directory>src/main/resources-plugin</directory> |
|
21 |
<outputDirectory>.</outputDirectory> |
|
22 |
</fileSet> |
|
23 |
</fileSets> |
|
24 |
|
|
25 |
|
|
26 |
<dependencySets> |
|
27 |
<dependencySet> |
|
28 |
<useProjectArtifact>false</useProjectArtifact> |
|
29 |
<useTransitiveDependencies>false</useTransitiveDependencies> |
|
30 |
<outputDirectory>lib</outputDirectory> |
|
31 |
<includes> |
|
32 |
<include>org.gvsig:org.gvsig.raster.tools.app.basic:jar</include> |
|
33 |
<include>org.gvsig:org.gvsig.raster.tools.algorithm.layerdatatype:jar</include> |
|
34 |
<include>org.gvsig:org.gvsig.raster.tools.algorithm.saveraster:jar</include> |
|
35 |
<include>org.gvsig:org.gvsig.raster.tools.algorithm.swing.api:jar</include> |
|
36 |
<include>org.gvsig:org.gvsig.raster.tools.algorithm.swing.impl:jar</include> |
|
37 |
<include>org.gvsig:org.gvsig.raster.tools.toolbox.algorithm:jar</include> |
|
38 |
</includes> |
|
39 |
</dependencySet> |
|
40 |
</dependencySets> |
|
41 |
</assembly> |
|
0 | 42 |
org.gvsig.raster.tools/tags/org.gvsig.raster.tools-2.2.28/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/toolbox/SaveAsToolboxAction.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2012 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
|
|
25 |
|
|
26 |
package org.gvsig.raster.tools.app.basic.toolbox; |
|
27 |
|
|
28 |
import javax.swing.ImageIcon; |
|
29 |
|
|
30 |
import org.gvsig.andami.IconThemeHelper; |
|
31 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
32 |
import org.gvsig.geoprocess.sextante.gui.core.GUIFactory; |
|
33 |
import org.gvsig.i18n.Messages; |
|
34 |
import org.gvsig.raster.tools.app.basic.tool.saveas.SaveAsTocMenuEntry; |
|
35 |
|
|
36 |
/** |
|
37 |
* Input in Sextante framework for SaveAs tool |
|
38 |
* |
|
39 |
* @author <a href="mailto:nachobrodin@gmail.com">Nacho Brodin</a> |
|
40 |
*/ |
|
41 |
public class SaveAsToolboxAction extends AbstractToolboxAction { |
|
42 |
|
|
43 |
public SaveAsToolboxAction() { |
|
44 |
ImageIcon ico = IconThemeHelper.getImageIcon("gvsig-icon16x16"); |
|
45 |
GUIFactory.registerExternalTool(Messages.getText("gv_tools"), ico, this); |
|
46 |
} |
|
47 |
|
|
48 |
@Override |
|
49 |
public void execute() { |
|
50 |
if(!super.loadLayer()) |
|
51 |
return; |
|
52 |
SaveAsTocMenuEntry.getSingleton().execute(null, new FLayer[]{lyr}); |
|
53 |
} |
|
54 |
|
|
55 |
@Override |
|
56 |
public String getName() { |
|
57 |
return Messages.getText("save_as"); |
|
58 |
} |
|
59 |
|
|
60 |
public ImageIcon getIcon() { |
|
61 |
return (ImageIcon)SaveAsTocMenuEntry.getSingleton().getIcon(); |
|
62 |
} |
|
63 |
|
|
64 |
public boolean isPluginInstalled() { |
|
65 |
try { |
|
66 |
SaveAsTocMenuEntry.getSingleton(); |
|
67 |
} catch(Exception e) { |
|
68 |
return false; |
|
69 |
} catch(Error e) { |
|
70 |
return false; |
|
71 |
} |
|
72 |
return true; |
|
73 |
} |
|
74 |
} |
|
0 | 75 |
org.gvsig.raster.tools/tags/org.gvsig.raster.tools-2.2.28/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/toolbox/AbstractToolboxAction.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2012 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
|
|
25 |
package org.gvsig.raster.tools.app.basic.toolbox; |
|
26 |
|
|
27 |
import org.gvsig.andami.PluginServices; |
|
28 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
|
29 |
import org.gvsig.app.project.documents.view.gui.AbstractViewPanel; |
|
30 |
import org.gvsig.fmap.mapcontext.MapContext; |
|
31 |
import org.gvsig.fmap.mapcontext.layers.FLayers; |
|
32 |
import org.gvsig.geoprocess.lib.sextante.dataObjects.FLyrRasterIRasterLayer; |
|
33 |
import org.gvsig.i18n.Messages; |
|
34 |
import org.gvsig.raster.fmap.layers.FLyrRaster; |
|
35 |
import org.gvsig.raster.swing.RasterSwingLibrary; |
|
36 |
|
|
37 |
import es.unex.sextante.dataObjects.IRasterLayer; |
|
38 |
import es.unex.sextante.gui.core.SextanteGUI; |
|
39 |
import es.unex.sextante.gui.core.ToolboxAction; |
|
40 |
|
|
41 |
/** |
|
42 |
* Base class for toolBox actions |
|
43 |
* |
|
44 |
* @author <a href="mailto:nachobrodin@gmail.com">Nacho Brodin</a> |
|
45 |
*/ |
|
46 |
public abstract class AbstractToolboxAction extends ToolboxAction { |
|
47 |
protected FLyrRaster lyr = null; |
|
48 |
|
|
49 |
@Override |
|
50 |
public String getGroup() { |
|
51 |
return Messages.getText("group_tools"); |
|
52 |
} |
|
53 |
|
|
54 |
|
|
55 |
@Override |
|
56 |
public boolean isActive() { |
|
57 |
IWindow[] windows = PluginServices.getMDIManager().getAllWindows(); |
|
58 |
for (int i = 0; i < windows.length; i++) { |
|
59 |
if(windows[i] instanceof AbstractViewPanel) { |
|
60 |
FLayers lyrs = ((AbstractViewPanel)windows[i]).getMapControl().getMapContext().getLayers(); |
|
61 |
for (int j = 0; j < lyrs.getLayersCount(); j++) { |
|
62 |
if(lyrs.getLayer(j) instanceof FLyrRaster) |
|
63 |
return true; |
|
64 |
} |
|
65 |
} |
|
66 |
} |
|
67 |
return false; |
|
68 |
} |
|
69 |
|
|
70 |
/** |
|
71 |
* Returns true if the plugin which gives the functionality is installed |
|
72 |
* in gvSIG |
|
73 |
* @return |
|
74 |
*/ |
|
75 |
public abstract boolean isPluginInstalled(); |
|
76 |
|
|
77 |
/** |
|
78 |
* Loads the raster layer for the tool |
|
79 |
* @return |
|
80 |
*/ |
|
81 |
public boolean loadLayer() { |
|
82 |
if(!isPluginInstalled()) { |
|
83 |
RasterSwingLibrary.messageBoxError(Messages.getText("plugin_not_installed"), null); |
|
84 |
return false; |
|
85 |
} |
|
86 |
|
|
87 |
if(!isActive()) { |
|
88 |
RasterSwingLibrary.messageBoxError(Messages.getText("layer_not_valid"), null); |
|
89 |
return false; |
|
90 |
} |
|
91 |
|
|
92 |
boolean existsRasterButNotActive = false; |
|
93 |
lyr = null; |
|
94 |
IWindow[] windows = PluginServices.getMDIManager().getOrderedWindows(); |
|
95 |
MapContext mapCtx = null; |
|
96 |
for (int i = 0; i < windows.length; i++) { |
|
97 |
if(windows[i] instanceof AbstractViewPanel) { |
|
98 |
mapCtx = ((AbstractViewPanel)windows[i]).getMapControl().getMapContext(); |
|
99 |
break; |
|
100 |
} |
|
101 |
} |
|
102 |
|
|
103 |
IRasterLayer[] layers = SextanteGUI.getInputFactory().getRasterLayers(); |
|
104 |
for (int i = 0; i < layers.length; i++) { |
|
105 |
FLyrRaster l = (FLyrRaster)((FLyrRasterIRasterLayer)layers[i]).getBaseDataObject(); |
|
106 |
existsRasterButNotActive = true; |
|
107 |
if(l.isActive() && mapCtx == l.getMapContext()) { |
|
108 |
existsRasterButNotActive = false; |
|
109 |
lyr = l; |
|
110 |
break; |
|
111 |
} |
|
112 |
} |
|
113 |
|
|
114 |
if(existsRasterButNotActive) { |
|
115 |
RasterSwingLibrary.messageBoxError(Messages.getText("raster_layer_not_active"), null); |
|
116 |
return false; |
|
117 |
} |
|
118 |
|
|
119 |
return true; |
|
120 |
} |
|
121 |
|
|
122 |
} |
|
0 | 123 |
org.gvsig.raster.tools/tags/org.gvsig.raster.tools-2.2.28/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/toolbox/SetViewProjectionToolboxAction.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2012 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
|
|
25 |
|
|
26 |
package org.gvsig.raster.tools.app.basic.toolbox; |
|
27 |
|
|
28 |
import javax.swing.ImageIcon; |
|
29 |
|
|
30 |
import org.gvsig.andami.IconThemeHelper; |
|
31 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
32 |
import org.gvsig.geoprocess.sextante.gui.core.GUIFactory; |
|
33 |
import org.gvsig.i18n.Messages; |
|
34 |
import org.gvsig.raster.tools.app.basic.tool.setviewprojection.SetViewProjectionTocMenuEntry; |
|
35 |
|
|
36 |
/** |
|
37 |
* Input in Sextante framework for "SetViewProjection" tool |
|
38 |
* |
|
39 |
* @author <a href="mailto:nachobrodin@gmail.com">Nacho Brodin</a> |
|
40 |
*/ |
|
41 |
public class SetViewProjectionToolboxAction extends AbstractToolboxAction { |
|
42 |
|
|
43 |
public SetViewProjectionToolboxAction() { |
|
44 |
ImageIcon ico = IconThemeHelper.getImageIcon("gvsig-icon16x16"); |
|
45 |
GUIFactory.registerExternalTool(Messages.getText("gv_tools"), ico, this); |
|
46 |
} |
|
47 |
|
|
48 |
@Override |
|
49 |
public void execute() { |
|
50 |
if(!super.loadLayer()) |
|
51 |
return; |
|
52 |
|
|
53 |
SetViewProjectionTocMenuEntry.getSingleton().execute(null, new FLayer[]{lyr}); |
|
54 |
} |
|
55 |
|
|
56 |
@Override |
|
57 |
public String getName() { |
|
58 |
return Messages.getText("set_view_projection"); |
|
59 |
} |
|
60 |
|
|
61 |
public ImageIcon getIcon() { |
|
62 |
return (ImageIcon)SetViewProjectionTocMenuEntry.getSingleton().getIcon(); |
|
63 |
} |
|
64 |
|
|
65 |
public boolean isPluginInstalled() { |
|
66 |
try { |
|
67 |
SetViewProjectionTocMenuEntry.getSingleton(); |
|
68 |
} catch(Exception e) { |
|
69 |
return false; |
|
70 |
} catch(Error e) { |
|
71 |
return false; |
|
72 |
} |
|
73 |
return true; |
|
74 |
} |
|
75 |
|
|
76 |
} |
|
0 | 77 |
org.gvsig.raster.tools/tags/org.gvsig.raster.tools-2.2.28/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/toolbox/FilterToolboxAction.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2012 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
|
|
25 |
package org.gvsig.raster.tools.app.basic.toolbox; |
|
26 |
|
|
27 |
import javax.swing.ImageIcon; |
|
28 |
|
|
29 |
import org.gvsig.andami.IconThemeHelper; |
|
30 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
31 |
import org.gvsig.geoprocess.sextante.gui.core.GUIFactory; |
|
32 |
import org.gvsig.i18n.Messages; |
|
33 |
import org.gvsig.raster.tools.app.basic.tool.filter.FilterTocMenuEntry; |
|
34 |
|
|
35 |
/** |
|
36 |
* Input in Sextante framework for Radiometric enhancement tool |
|
37 |
* |
|
38 |
* @author <a href="mailto:nachobrodin@gmail.com">Nacho Brodin</a> |
|
39 |
*/ |
|
40 |
public class FilterToolboxAction extends AbstractToolboxAction { |
|
41 |
|
|
42 |
public FilterToolboxAction() { |
|
43 |
ImageIcon ico = IconThemeHelper.getImageIcon("gvsig-icon16x16"); |
|
44 |
GUIFactory.registerExternalTool(Messages.getText("gv_tools"), ico, this); |
|
45 |
} |
|
46 |
|
|
47 |
@Override |
|
48 |
public void execute() { |
|
49 |
if(!super.loadLayer()) |
|
50 |
return; |
|
51 |
|
|
52 |
FilterTocMenuEntry.getSingleton().execute(null, new FLayer[]{lyr}); |
|
53 |
} |
|
54 |
|
|
55 |
@Override |
|
56 |
public String getName() { |
|
57 |
return Messages.getText("filters"); |
|
58 |
} |
|
59 |
|
|
60 |
public ImageIcon getIcon() { |
|
61 |
return (ImageIcon)FilterTocMenuEntry.getSingleton().getIcon(); |
|
62 |
} |
|
63 |
|
|
64 |
public boolean isPluginInstalled() { |
|
65 |
try { |
|
66 |
FilterTocMenuEntry.getSingleton(); |
|
67 |
} catch(Exception e) { |
|
68 |
return false; |
|
69 |
} catch(Error e) { |
|
70 |
return false; |
|
71 |
} |
|
72 |
return true; |
|
73 |
} |
|
74 |
|
|
75 |
} |
|
0 | 76 |
org.gvsig.raster.tools/tags/org.gvsig.raster.tools-2.2.28/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/toolbox/ClipToolboxAction.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2012 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
|
|
25 |
|
|
26 |
package org.gvsig.raster.tools.app.basic.toolbox; |
|
27 |
|
|
28 |
import javax.swing.ImageIcon; |
|
29 |
|
|
30 |
import org.gvsig.andami.IconThemeHelper; |
|
31 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
32 |
import org.gvsig.geoprocess.sextante.gui.core.GUIFactory; |
|
33 |
import org.gvsig.i18n.Messages; |
|
34 |
import org.gvsig.raster.tools.app.basic.tool.clip.ClippingTocMenuEntry; |
|
35 |
|
|
36 |
/** |
|
37 |
* Input in Sextante framework for clip tool |
|
38 |
* |
|
39 |
* @author <a href="mailto:nachobrodin@gmail.com">Nacho Brodin</a> |
|
40 |
*/ |
|
41 |
public class ClipToolboxAction extends AbstractToolboxAction { |
|
42 |
|
|
43 |
public ClipToolboxAction() { |
|
44 |
ImageIcon ico = IconThemeHelper.getImageIcon("gvsig-icon16x16"); |
|
45 |
GUIFactory.registerExternalTool(Messages.getText("gv_tools"), ico, this); |
|
46 |
} |
|
47 |
|
|
48 |
@Override |
|
49 |
public void execute() { |
|
50 |
if(!super.loadLayer()) |
|
51 |
return; |
|
52 |
|
|
53 |
ClippingTocMenuEntry.getSingleton().execute(null, new FLayer[]{lyr}); |
|
54 |
} |
|
55 |
|
|
56 |
@Override |
|
57 |
public String getName() { |
|
58 |
return Messages.getText("clip_raster"); |
|
59 |
} |
|
60 |
|
|
61 |
public ImageIcon getIcon() { |
|
62 |
return (ImageIcon)ClippingTocMenuEntry.getSingleton().getIcon(); |
|
63 |
} |
|
64 |
|
|
65 |
public boolean isPluginInstalled() { |
|
66 |
try { |
|
67 |
ClippingTocMenuEntry.getSingleton(); |
|
68 |
} catch(Exception e) { |
|
69 |
return false; |
|
70 |
} catch(Error e) { |
|
71 |
return false; |
|
72 |
} |
|
73 |
return true; |
|
74 |
} |
|
75 |
|
|
76 |
} |
|
0 | 77 |
org.gvsig.raster.tools/tags/org.gvsig.raster.tools-2.2.28/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/toolbox/LayerDatatypeToolboxAction.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2012 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
|
|
25 |
|
|
26 |
package org.gvsig.raster.tools.app.basic.toolbox; |
|
27 |
|
|
28 |
import javax.swing.ImageIcon; |
|
29 |
|
|
30 |
import org.gvsig.andami.IconThemeHelper; |
|
31 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
32 |
import org.gvsig.geoprocess.sextante.gui.core.GUIFactory; |
|
33 |
import org.gvsig.i18n.Messages; |
|
34 |
import org.gvsig.raster.tools.app.basic.tool.layerdatatype.LayerDatatypeTocMenuEntry; |
|
35 |
|
|
36 |
/** |
|
37 |
* Input in Sextante framework for layer datatype tool |
|
38 |
* |
|
39 |
* @author <a href="mailto:nachobrodin@gmail.com">Nacho Brodin</a> |
|
40 |
*/ |
|
41 |
public class LayerDatatypeToolboxAction extends AbstractToolboxAction { |
|
42 |
|
|
43 |
public LayerDatatypeToolboxAction() { |
|
44 |
ImageIcon ico = IconThemeHelper.getImageIcon("gvsig-icon16x16"); |
|
45 |
GUIFactory.registerExternalTool(Messages.getText("gv_tools"), ico, this); |
|
46 |
} |
|
47 |
|
|
48 |
@Override |
|
49 |
public void execute() { |
|
50 |
if(!super.loadLayer()) |
|
51 |
return; |
|
52 |
LayerDatatypeTocMenuEntry.getSingleton().execute(null, new FLayer[]{lyr}); |
|
53 |
} |
|
54 |
|
|
55 |
@Override |
|
56 |
public String getName() { |
|
57 |
return Messages.getText("layer_datatype"); |
|
58 |
} |
|
59 |
|
|
60 |
public ImageIcon getIcon() { |
|
61 |
return (ImageIcon)LayerDatatypeTocMenuEntry.getSingleton().getIcon(); |
|
62 |
} |
|
63 |
|
|
64 |
public boolean isPluginInstalled() { |
|
65 |
try { |
|
66 |
LayerDatatypeTocMenuEntry.getSingleton(); |
|
67 |
} catch(Exception e) { |
|
68 |
return false; |
|
69 |
} catch(Error e) { |
|
70 |
return false; |
|
71 |
} |
|
72 |
return true; |
|
73 |
} |
|
74 |
|
|
75 |
} |
|
0 | 76 |
org.gvsig.raster.tools/tags/org.gvsig.raster.tools-2.2.28/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/toolbox/RadiometricEnhancementToolboxAction.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2012 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
|
|
25 |
package org.gvsig.raster.tools.app.basic.toolbox; |
|
26 |
|
|
27 |
import javax.swing.ImageIcon; |
|
28 |
|
|
29 |
import org.gvsig.andami.IconThemeHelper; |
|
30 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
31 |
import org.gvsig.geoprocess.sextante.gui.core.GUIFactory; |
|
32 |
import org.gvsig.i18n.Messages; |
|
33 |
import org.gvsig.raster.tools.app.basic.tool.enhanced.EnhancedTocMenuEntry; |
|
34 |
|
|
35 |
/** |
|
36 |
* Input in Sextante framework for Radiometric enhancement tool |
|
37 |
* |
|
38 |
* @author <a href="mailto:nachobrodin@gmail.com">Nacho Brodin</a> |
|
39 |
*/ |
|
40 |
public class RadiometricEnhancementToolboxAction extends AbstractToolboxAction { |
|
41 |
|
|
42 |
public RadiometricEnhancementToolboxAction() { |
|
43 |
ImageIcon ico = IconThemeHelper.getImageIcon("gvsig-icon16x16"); |
|
44 |
GUIFactory.registerExternalTool(Messages.getText("gv_tools"), ico, this); |
|
45 |
} |
|
46 |
|
|
47 |
@Override |
|
48 |
public void execute() { |
|
49 |
if(!super.loadLayer()) |
|
50 |
return; |
|
51 |
|
|
52 |
EnhancedTocMenuEntry.getSingleton().execute(null, new FLayer[]{lyr}); |
|
53 |
} |
|
54 |
|
|
55 |
|
|
56 |
@Override |
|
57 |
public String getName() { |
|
58 |
return Messages.getText("radiometric_enhancedment"); |
|
59 |
} |
|
60 |
|
|
61 |
public ImageIcon getIcon() { |
|
62 |
return (ImageIcon)EnhancedTocMenuEntry.getSingleton().getIcon(); |
|
63 |
} |
|
64 |
|
|
65 |
public boolean isPluginInstalled() { |
|
66 |
try { |
|
67 |
EnhancedTocMenuEntry.getSingleton(); |
|
68 |
} catch(Exception e) { |
|
69 |
return false; |
|
70 |
} catch(Error e) { |
|
71 |
return false; |
|
72 |
} |
|
73 |
return true; |
|
74 |
} |
|
75 |
} |
|
0 | 76 |
org.gvsig.raster.tools/tags/org.gvsig.raster.tools-2.2.28/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/toolbox/OverviewsToolboxAction.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2012 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
|
|
25 |
|
|
26 |
package org.gvsig.raster.tools.app.basic.toolbox; |
|
27 |
|
|
28 |
import javax.swing.ImageIcon; |
|
29 |
|
|
30 |
import org.gvsig.andami.IconThemeHelper; |
|
31 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
32 |
import org.gvsig.geoprocess.sextante.gui.core.GUIFactory; |
|
33 |
import org.gvsig.i18n.Messages; |
|
34 |
import org.gvsig.raster.tools.app.basic.tool.overview.OverviewsTocMenuEntry; |
|
35 |
|
|
36 |
/** |
|
37 |
* Input in Sextante framework for overview tool |
|
38 |
* |
|
39 |
* @author <a href="mailto:nachobrodin@gmail.com">Nacho Brodin</a> |
|
40 |
*/ |
|
41 |
public class OverviewsToolboxAction extends AbstractToolboxAction { |
|
42 |
|
|
43 |
public OverviewsToolboxAction() { |
|
44 |
ImageIcon ico = IconThemeHelper.getImageIcon("gvsig-icon16x16"); |
|
45 |
GUIFactory.registerExternalTool(Messages.getText("gv_tools"), ico, this); |
|
46 |
} |
|
47 |
|
|
48 |
@Override |
|
49 |
public void execute() { |
|
50 |
if(!super.loadLayer()) |
|
51 |
return; |
|
52 |
|
|
53 |
OverviewsTocMenuEntry.getSingleton().execute(null, new FLayer[]{lyr}); |
|
54 |
} |
|
55 |
|
|
56 |
@Override |
|
57 |
public String getName() { |
|
58 |
return Messages.getText("overviews"); |
|
59 |
} |
|
60 |
|
|
61 |
public ImageIcon getIcon() { |
|
62 |
return (ImageIcon)OverviewsTocMenuEntry.getSingleton().getIcon(); |
|
63 |
} |
|
64 |
|
|
65 |
public boolean isPluginInstalled() { |
|
66 |
try { |
|
67 |
OverviewsTocMenuEntry.getSingleton(); |
|
68 |
} catch(Exception e) { |
|
69 |
return false; |
|
70 |
} catch(Error e) { |
|
71 |
return false; |
|
72 |
} |
|
73 |
return true; |
|
74 |
} |
|
75 |
|
|
76 |
} |
|
0 | 77 |
org.gvsig.raster.tools/tags/org.gvsig.raster.tools-2.2.28/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/toolbox/ToolboxRasterToolsLoader.java | ||
---|---|---|
1 |
package org.gvsig.raster.tools.app.basic.toolbox; |
|
2 |
|
|
3 |
import java.lang.reflect.Constructor; |
|
4 |
import java.lang.reflect.InvocationTargetException; |
|
5 |
|
|
6 |
import org.slf4j.Logger; |
|
7 |
import org.slf4j.LoggerFactory; |
|
8 |
|
|
9 |
/** |
|
10 |
* Loader for this tool in the toolbox dialog |
|
11 |
* |
|
12 |
* @author <a href="mailto:nachobrodin@gmail.com">Nacho Brodin</a> |
|
13 |
*/ |
|
14 |
public class ToolboxRasterToolsLoader { |
|
15 |
private Logger log = LoggerFactory.getLogger(ToolboxRasterToolsLoader.class); |
|
16 |
private String errorMsg = "The basic raster tools are not been added in the toolbox"; |
|
17 |
|
|
18 |
public void registerTool() { |
|
19 |
try { |
|
20 |
Class<?> c = Class.forName("org.gvsig.raster.tools.app.basic.toolbox.ClipToolboxAction"); |
|
21 |
Constructor<?> constructor = c.getConstructor(); |
|
22 |
constructor.newInstance(); |
|
23 |
|
|
24 |
c = Class.forName("org.gvsig.raster.tools.app.basic.toolbox.FilterToolboxAction"); |
|
25 |
constructor = c.getConstructor(); |
|
26 |
constructor.newInstance(); |
|
27 |
|
|
28 |
c = Class.forName("org.gvsig.raster.tools.app.basic.toolbox.LayerDatatypeToolboxAction"); |
|
29 |
constructor = c.getConstructor(); |
|
30 |
constructor.newInstance(); |
|
31 |
|
|
32 |
Class.forName("org.gvsig.raster.tools.app.basic.toolbox.OverviewsToolboxAction"); |
|
33 |
constructor = c.getConstructor(); |
|
34 |
constructor.newInstance(); |
|
35 |
|
|
36 |
c = Class.forName("org.gvsig.raster.tools.app.basic.toolbox.RadiometricEnhancementToolboxAction"); |
|
37 |
constructor = c.getConstructor(); |
|
38 |
constructor.newInstance(); |
|
39 |
|
|
40 |
c = Class.forName("org.gvsig.raster.tools.app.basic.toolbox.SaveAsToolboxAction"); |
|
41 |
constructor = c.getConstructor(); |
|
42 |
constructor.newInstance(); |
|
43 |
|
|
44 |
c = Class.forName("org.gvsig.raster.tools.app.basic.toolbox.SetViewProjectionToolboxAction"); |
|
45 |
constructor = c.getConstructor(); |
|
46 |
constructor.newInstance(); |
|
47 |
} catch (ClassNotFoundException e) { |
|
48 |
log.info(errorMsg, e); |
|
49 |
} catch (SecurityException e) { |
|
50 |
log.info(errorMsg, e); |
|
51 |
} catch (NoSuchMethodException e) { |
|
52 |
log.info(errorMsg, e); |
|
53 |
} catch (IllegalArgumentException e) { |
|
54 |
log.info(errorMsg, e); |
|
55 |
} catch (InstantiationException e) { |
|
56 |
log.info(errorMsg, e); |
|
57 |
} catch (IllegalAccessException e) { |
|
58 |
log.info(errorMsg, e); |
|
59 |
} catch (InvocationTargetException e) { |
|
60 |
log.info(errorMsg, e); |
|
61 |
} catch (NoClassDefFoundError e) { |
|
62 |
log.info("Geoprocess are not installed." + errorMsg, e); |
|
63 |
} |
|
64 |
} |
|
65 |
|
|
66 |
} |
|
0 | 67 |
org.gvsig.raster.tools/tags/org.gvsig.raster.tools-2.2.28/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/SystemGCExtension.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.tools.app.basic; |
|
23 |
|
|
24 |
import org.gvsig.andami.plugins.Extension; |
|
25 |
|
|
26 |
|
|
27 |
/** |
|
28 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
29 |
*/ |
|
30 |
public class SystemGCExtension extends Extension { |
|
31 |
|
|
32 |
public void execute(String actionCommand) { |
|
33 |
System.gc(); |
|
34 |
} |
|
35 |
|
|
36 |
public void initialize() { |
|
37 |
|
|
38 |
} |
|
39 |
|
|
40 |
public boolean isEnabled() { |
|
41 |
return true; |
|
42 |
} |
|
43 |
|
|
44 |
public boolean isVisible() { |
|
45 |
return true; |
|
46 |
} |
|
47 |
|
|
48 |
} |
|
0 | 49 |
org.gvsig.raster.tools/tags/org.gvsig.raster.tools-2.2.28/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/MainWindow.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2011-2012 Prodevelop S.L |
|
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., 51 Franklin Street, Fifth Floor, Boston, |
|
18 |
* MA 02110-1301, USA. |
|
19 |
* |
|
20 |
*/ |
|
21 |
package org.gvsig.raster.tools.app.basic; |
|
22 |
|
|
23 |
import java.awt.GridBagConstraints; |
|
24 |
import java.awt.GridBagLayout; |
|
25 |
import java.awt.event.ActionEvent; |
|
26 |
import java.awt.event.ActionListener; |
|
27 |
|
|
28 |
import javax.swing.JComponent; |
|
29 |
|
|
30 |
import org.gvsig.andami.PluginServices; |
|
31 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
|
32 |
import org.gvsig.andami.ui.mdiManager.WindowInfo; |
|
33 |
import org.gvsig.gui.beans.buttonspanel.ButtonsPanel; |
|
34 |
import org.gvsig.gui.beans.defaultbuttonspanel.DefaultButtonsPanel; |
|
35 |
|
|
36 |
|
|
37 |
/** |
|
38 |
* Basic frame for a gvSIG <code>IWindow</code> object. This frame adds buttons |
|
39 |
* of Cancel, Accept and others. |
|
40 |
* |
|
41 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
42 |
*/ |
|
43 |
public class MainWindow extends DefaultButtonsPanel implements IWindow, ActionListener { |
|
44 |
|
|
45 |
private static final long serialVersionUID = -4401123724140025094L; |
|
46 |
private ActionListener listener = null; |
|
47 |
private WindowInfo info = null; |
|
48 |
|
|
49 |
private Object profile = WindowInfo.EDITOR_PROFILE; |
|
50 |
|
|
51 |
public MainWindow(JComponent panel, JComponent preview, String title, int w, int h, ActionListener actionListener) { |
|
52 |
this.listener = actionListener; |
|
53 |
|
|
54 |
setLayout(new GridBagLayout()); |
|
55 |
GridBagConstraints gbc = new GridBagConstraints(); |
|
56 |
gbc.fill = GridBagConstraints.BOTH; |
|
57 |
gbc.weightx = 1; |
|
58 |
gbc.weighty = 1; |
|
59 |
add(panel, gbc); |
|
60 |
|
|
61 |
if(preview != null) { |
|
62 |
gbc.anchor = GridBagConstraints.NORTH; |
|
63 |
gbc.fill = GridBagConstraints.NONE; |
|
64 |
gbc.weightx = 0; |
|
65 |
gbc.weighty = 0; |
|
66 |
gbc.gridx = 1; |
|
67 |
add(preview, gbc); |
|
68 |
} |
|
69 |
|
|
70 |
getButtonsPanel().getButton(ButtonsPanel.BUTTON_ACCEPT).addActionListener(this); |
|
71 |
getButtonsPanel().getButton(ButtonsPanel.BUTTON_APPLY).addActionListener(this); |
|
72 |
getButtonsPanel().getButton(ButtonsPanel.BUTTON_CANCEL).addActionListener(this); |
|
73 |
|
|
74 |
info = new WindowInfo(WindowInfo.PALETTE | WindowInfo.RESIZABLE); |
|
75 |
info.setTitle(title); |
|
76 |
info.setWidth(w); |
|
77 |
info.setHeight(h); |
|
78 |
} |
|
79 |
|
|
80 |
public WindowInfo getWindowInfo() { |
|
81 |
return info; |
|
82 |
} |
|
83 |
|
|
84 |
public Object getWindowProfile() { |
|
85 |
return profile; |
|
86 |
} |
|
87 |
|
|
88 |
public void actionPerformed(ActionEvent e) { |
|
89 |
if(e.getSource() == getButtonsPanel().getButton(ButtonsPanel.BUTTON_ACCEPT)) { |
|
90 |
listener.actionPerformed(e); |
|
91 |
PluginServices.getMDIManager().closeWindow(this); |
|
92 |
} |
|
93 |
|
|
94 |
if(e.getSource() == getButtonsPanel().getButton(ButtonsPanel.BUTTON_APPLY)) { |
|
95 |
listener.actionPerformed(e); |
|
96 |
} |
|
97 |
|
|
98 |
if(e.getSource() == getButtonsPanel().getButton(ButtonsPanel.BUTTON_CANCEL)) { |
|
99 |
PluginServices.getMDIManager().closeWindow(this); |
|
100 |
} |
|
101 |
} |
|
102 |
} |
|
0 | 103 |
org.gvsig.raster.tools/tags/org.gvsig.raster.tools-2.2.28/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/RasterExtension.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.tools.app.basic; |
|
23 |
|
|
24 |
import java.util.ArrayList; |
|
25 |
import java.util.prefs.Preferences; |
|
26 |
|
|
27 |
import org.gvsig.andami.IconThemeHelper; |
|
28 |
import org.gvsig.andami.PluginServices; |
|
29 |
import org.gvsig.andami.plugins.Extension; |
|
30 |
import org.gvsig.andami.plugins.IExtensionQueryByAction; |
|
31 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
|
32 |
import org.gvsig.app.ApplicationLocator; |
|
33 |
import org.gvsig.app.ApplicationManager; |
|
34 |
import org.gvsig.app.project.documents.view.ViewDocument; |
|
35 |
import org.gvsig.app.project.documents.view.gui.AbstractViewPanel; |
|
36 |
import org.gvsig.app.project.documents.view.toc.AbstractTocContextMenuAction; |
|
37 |
import org.gvsig.app.project.documents.view.toc.ITocItem; |
|
38 |
import org.gvsig.fmap.dal.coverage.RasterLibrary; |
|
39 |
import org.gvsig.fmap.dal.coverage.RasterLocator; |
|
40 |
import org.gvsig.fmap.dal.coverage.store.RasterDataStore; |
|
41 |
import org.gvsig.fmap.mapcontext.MapContext; |
|
42 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
43 |
import org.gvsig.fmap.mapcontext.layers.FLayers; |
|
44 |
import org.gvsig.raster.algorithm.RasterBaseAlgorithmLibrary; |
|
45 |
import org.gvsig.raster.fmap.FmapRasterLibrary; |
|
46 |
import org.gvsig.raster.fmap.layers.DefaultFLyrRaster; |
|
47 |
import org.gvsig.raster.fmap.layers.FLyrRaster; |
|
48 |
import org.gvsig.raster.mainplugin.config.Configuration; |
|
49 |
import org.gvsig.raster.mainplugin.config.ConfigurationEvent; |
|
50 |
import org.gvsig.raster.mainplugin.config.ConfigurationListener; |
|
51 |
import org.gvsig.raster.tools.app.basic.raster.gui.preference.RasterPreferences; |
|
52 |
import org.gvsig.raster.tools.app.basic.raster.gui.wizard.PrepareDataStoreParametersRaw; |
|
53 |
import org.gvsig.raster.tools.app.basic.raster.gui.wizard.PrepareDataStoreParametersVTR; |
|
54 |
import org.gvsig.raster.tools.app.basic.raster.gui.wizard.PrepareLayerAskCoordinates; |
|
55 |
import org.gvsig.raster.tools.app.basic.raster.gui.wizard.PrepareLayerAskWritableDirectory; |
|
56 |
import org.gvsig.raster.tools.app.basic.raster.process.ClippingProcess; |
|
57 |
import org.gvsig.raster.tools.app.basic.tool.analysisview.ViewRasterAnalysisTocMenuEntry; |
|
58 |
import org.gvsig.raster.tools.app.basic.tool.clip.ClippingTocMenuEntry; |
|
59 |
import org.gvsig.raster.tools.app.basic.tool.colortable.ColorTableTocMenuEntry; |
|
60 |
import org.gvsig.raster.tools.app.basic.tool.colortable.ui.library.RasterColorTablesFactory; |
|
61 |
import org.gvsig.raster.tools.app.basic.tool.enhanced.EnhancedTocMenuEntry; |
|
62 |
import org.gvsig.raster.tools.app.basic.tool.filter.FilterTocMenuEntry; |
|
63 |
import org.gvsig.raster.tools.app.basic.tool.geolocation.GeoLocationTocMenuEntry; |
|
64 |
import org.gvsig.raster.tools.app.basic.tool.histogram.HistogramTocMenuEntry; |
|
65 |
import org.gvsig.raster.tools.app.basic.tool.infobypoint.InfoByRasterPointTocMenuEntry; |
|
66 |
import org.gvsig.raster.tools.app.basic.tool.layerdatatype.LayerDatatypeTocMenuEntry; |
|
67 |
import org.gvsig.raster.tools.app.basic.tool.multiresolution.ZoomResolutionLevelTocMenuEntry; |
|
68 |
import org.gvsig.raster.tools.app.basic.tool.overview.OverviewsTocMenuEntry; |
|
69 |
import org.gvsig.raster.tools.app.basic.tool.properties.panel.EnhancedPanel; |
|
70 |
import org.gvsig.raster.tools.app.basic.tool.properties.panel.GeneralPanel; |
|
71 |
import org.gvsig.raster.tools.app.basic.tool.properties.panel.InfoPanel; |
|
72 |
import org.gvsig.raster.tools.app.basic.tool.properties.panel.TransparencyPanel; |
|
73 |
import org.gvsig.raster.tools.app.basic.tool.rasterresolution.ZoomPixelCursorTocMenuEntry; |
|
74 |
import org.gvsig.raster.tools.app.basic.tool.roi.ROIManagerTocMenuEntry; |
|
75 |
import org.gvsig.raster.tools.app.basic.tool.saveas.SaveAsTocMenuEntry; |
|
76 |
import org.gvsig.raster.tools.app.basic.tool.saveviewtoraster.SaveViewToRasterTocMenuEntry; |
|
77 |
import org.gvsig.raster.tools.app.basic.tool.selectrasterlayer.SelectLayerTocMenuEntry; |
|
78 |
import org.gvsig.raster.tools.app.basic.tool.setviewprojection.SetViewProjectionTocMenuEntry; |
|
79 |
import org.gvsig.raster.tools.app.basic.tool.viewexport.SaveViewToImageTocMenuEntry; |
|
80 |
import org.gvsig.raster.tools.app.basic.toolbox.ToolboxRasterToolsLoader; |
|
81 |
import org.gvsig.tools.ToolsLocator; |
|
82 |
import org.gvsig.tools.extensionpoint.ExtensionBuilder; |
|
83 |
import org.gvsig.tools.extensionpoint.ExtensionPoint; |
|
84 |
import org.gvsig.tools.extensionpoint.ExtensionPointManager; |
|
85 |
|
|
86 |
|
|
87 |
/** |
|
88 |
* Extensi?n que adapta a FMap y gvSIG la nueva implementaci?n de raster. Para |
|
89 |
* el cuadro de Propiedades de visualizaci?n de raster contiene el contenedor |
|
90 |
* base se registran la entrada del men? del TOC y los paneles en el cuadro. |
|
91 |
* Para la parte de FMap contiene una nueva capa raster y los drivers |
|
92 |
* necesarios. |
|
93 |
* |
|
94 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
95 |
*/ |
|
96 |
public class RasterExtension extends Extension implements ConfigurationListener, IExtensionQueryByAction { |
|
97 |
public static final String CLIPPING_PROCESS_LABEL = ClippingProcess.PROCESS_LABEL; |
|
98 |
|
|
99 |
/** |
|
100 |
* Indica si en el panel de preferencias se refresca automaticamente la vista |
|
101 |
* para mostrar los cambios |
|
102 |
*/ |
|
103 |
public static boolean autoRefreshView = true; |
|
104 |
|
|
105 |
/** |
|
106 |
* Indica si se debe preguntar las coordenadas al cargar una capa que no las |
|
107 |
* tenga |
|
108 |
*/ |
|
109 |
public static boolean askCoordinates = false; |
|
110 |
private ExtensionPoint genericToolBarMenuExtensionPoint = null; |
|
111 |
|
|
112 |
public void execute(String actionCommand) { |
|
113 |
//Las entradas en GenericToolBarModule est?n registradas con la misma etiqueta que la del actionCommand |
|
114 |
//De esta forma pueden recuperarse los TocMenuEntry del punto de extensi?n y ejecutar la acci?n a |
|
115 |
//trav?s de este. |
|
116 |
ExtensionBuilder ext = getGenericToolBarMenuExtensionPoint().get(actionCommand).getBuilder(); |
|
117 |
if(ext != null && ext instanceof AbstractTocContextMenuAction) { |
|
118 |
IWindow w = PluginServices.getMDIManager().getActiveWindow(); |
|
119 |
if(w instanceof AbstractViewPanel) { |
|
120 |
FLayers lyrs = ((AbstractViewPanel)w).getMapControl().getMapContext().getLayers(); |
|
121 |
FLayer[] actives = lyrs.getActives(); |
|
122 |
((AbstractTocContextMenuAction)ext).execute(null, actives); |
|
123 |
} |
|
124 |
} |
|
125 |
} |
|
126 |
|
|
127 |
public void initialize() { |
|
128 |
// Asignamos la configuracion global a FlyrRasterSE |
|
129 |
DefaultFLyrRaster.setConfiguration(Configuration.getSingleton()); |
|
130 |
|
|
131 |
Configuration.addValueChangedListener(this); |
|
132 |
loadConfigurationValues(); |
|
133 |
|
|
134 |
registerIcons(); |
|
135 |
|
|
136 |
FmapRasterLibrary fmapRaster = new FmapRasterLibrary(); |
|
137 |
fmapRaster.initialize(); |
|
138 |
|
|
139 |
Preferences prefs = Preferences.userRoot().node("gvsig.foldering"); |
|
140 |
prefs.put("DataFolder", System.getProperty("user.home")); |
|
141 |
ExtensionPointManager extensionPoints = ToolsLocator.getExtensionPointManager(); |
|
142 |
|
|
143 |
// Creaci?n del punto de extensi?n para registrar paneles en el cuadro de propiedades. |
|
144 |
if (!extensionPoints.has("RasterSEPropertiesDialog")) { |
|
145 |
ExtensionPoint point = extensionPoints.add("RasterSEPropertiesDialog"); |
|
146 |
point.setDescription("Raster Properties registrable panels (register instances of javax.swing.JPanel)"); |
|
147 |
} |
|
148 |
|
|
149 |
// A?adimos la configuracion de Raster a gvSIG |
|
150 |
|
|
151 |
ExtensionPoint point = extensionPoints.get("AplicationPreferences"); |
|
152 |
point.append("RasterPreferences", "", RasterPreferences.class); |
|
153 |
|
|
154 |
// A?adimos paneles al cuadro de propiedades. |
|
155 |
point = extensionPoints.get("RasterSEPropertiesDialog"); |
|
156 |
point.append("info", "", InfoPanel.class); |
|
157 |
point.append("general_panel", "", GeneralPanel.class); |
|
158 |
point.append("transparencia", "", TransparencyPanel.class); |
|
159 |
point.append("realce", "", EnhancedPanel.class); |
|
160 |
|
|
161 |
|
|
162 |
// A?adimos las entradas del men? del toc de raster |
|
163 |
point = extensionPoints.get("View_TocActions"); |
|
164 |
//point.append("RasterSEProperties", "Raster Properties", RasterPropertiesTocMenuEntry.getSingleton()); |
|
165 |
point.append("SaveAs", "Save as raster layer", SaveAsTocMenuEntry.getSingleton()); |
|
166 |
point.append("ZoomPixelCursor", "zoom to pixel resolution", ZoomPixelCursorTocMenuEntry.getSingleton()); |
|
167 |
point.append("ROI", "ROIs for a raster layer", ROIManagerTocMenuEntry.getSingleton()); |
|
168 |
point.append("Color table", "Color table for a raster layer", ColorTableTocMenuEntry.getSingleton()); |
|
169 |
point.append("Histogram", "Histogram of a raster layer", HistogramTocMenuEntry.getSingleton()); |
|
170 |
point.append("Overviews", "Build overviews", OverviewsTocMenuEntry.getSingleton()); |
|
171 |
|
|
172 |
ApplicationManager appGvSigMan = ApplicationLocator.getManager(); |
|
173 |
|
|
174 |
appGvSigMan.registerPrepareOpenDataStoreParameters(new PrepareLayerAskWritableDirectory()); |
|
175 |
appGvSigMan.registerPrepareOpenDataStoreParameters(new PrepareDataStoreParametersRaw()); |
|
176 |
appGvSigMan.registerPrepareOpenDataStoreParameters(new PrepareDataStoreParametersVTR()); |
|
177 |
|
|
178 |
appGvSigMan.registerPrepareOpenLayer(new PrepareLayerAskCoordinates()); |
|
179 |
|
|
180 |
appGvSigMan.registerColorTablesFactory(new RasterColorTablesFactory()); |
|
181 |
|
|
182 |
registerMenuElements(); |
|
183 |
registerProcesses(); |
|
184 |
} |
|
185 |
|
|
186 |
private void registerProcesses() { |
|
187 |
RasterBaseAlgorithmLibrary.register(CLIPPING_PROCESS_LABEL, ClippingProcess.class); |
|
188 |
ClippingProcess.registerParameters(); |
|
189 |
} |
|
190 |
|
|
191 |
/** |
|
192 |
* Registra los iconos a utilizar en andami. |
|
193 |
*/ |
|
194 |
private void registerIcons() { |
|
195 |
//Actions |
|
196 |
IconThemeHelper.registerIcon("action", "menu-layer-icon", this); |
|
197 |
IconThemeHelper.registerIcon("action", "menu-process-icon", this); |
|
198 |
IconThemeHelper.registerIcon("action", "menu-transgeo-icon", this); |
|
199 |
IconThemeHelper.registerIcon("action", "menu-raster-export", this); |
|
200 |
|
|
201 |
IconThemeHelper.registerIcon("action", "layer-modify-roi", this); |
|
202 |
IconThemeHelper.registerIcon("action", "layer-histogram", this); |
|
203 |
IconThemeHelper.registerIcon("action", "layer-color-table", this); |
|
204 |
IconThemeHelper.registerIcon("action", "layer-modify-overviews", this); |
|
205 |
IconThemeHelper.registerIcon("action", "layer-properties-raster", this); |
|
206 |
IconThemeHelper.registerIcon("action", "layer-filter-raster", this); |
|
207 |
IconThemeHelper.registerIcon("action", "layer-enhanced", this); |
|
208 |
IconThemeHelper.registerIcon("action", "view-raster-analysis", this); |
|
209 |
IconThemeHelper.registerIcon("action", "view-select-raster-layer", this); |
|
210 |
IconThemeHelper.registerIcon("action", "layer-geolocalization", this); |
|
211 |
IconThemeHelper.registerIcon("action", "tools-raster-reproject", this); |
|
212 |
IconThemeHelper.registerIcon("action", "view-export-georeferenced-raster", this); |
|
213 |
IconThemeHelper.registerIcon("action", "layer-saveas", this); |
Also available in: Unified diff