Revision 35257
tags/v2_0_0_Build_2026/org.gvsig.annotation.app.extension/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
|
|
3 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
4 |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> |
|
5 |
<modelVersion>4.0.0</modelVersion> |
|
6 |
<artifactId>org.gvsig.annotation.app.extension</artifactId> |
|
7 |
<packaging>jar</packaging> |
|
8 |
<name>Export to annotation tool</name> |
|
9 |
<parent> |
|
10 |
<groupId>org.gvsig</groupId> |
|
11 |
<artifactId>org.gvsig.annotation.app</artifactId> |
|
12 |
<version>1.0.0-SNAPSHOT</version> |
|
13 |
</parent> |
|
14 |
|
|
15 |
<dependencies> |
|
16 |
<dependency> |
|
17 |
<groupId>org.gvsig</groupId> |
|
18 |
<artifactId>org.gvsig.andami</artifactId> |
|
19 |
<scope>compile</scope> |
|
20 |
</dependency> |
|
21 |
<dependency> |
|
22 |
<groupId>org.gvsig</groupId> |
|
23 |
<artifactId>org.gvsig.i18n</artifactId> |
|
24 |
<scope>compile</scope> |
|
25 |
</dependency> |
|
26 |
<dependency> |
|
27 |
<groupId>org.gvsig</groupId> |
|
28 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
29 |
<scope>compile</scope> |
|
30 |
</dependency> |
|
31 |
<dependency> |
|
32 |
<groupId>org.gvsig</groupId> |
|
33 |
<artifactId>org.gvsig.annotation.lib.api</artifactId> |
|
34 |
<scope>compile</scope> |
|
35 |
</dependency> |
|
36 |
<dependency> |
|
37 |
<groupId>org.gvsig</groupId> |
|
38 |
<artifactId>org.gvsig.annotation.swing.api</artifactId> |
|
39 |
<scope>compile</scope> |
|
40 |
</dependency> |
|
41 |
<dependency> |
|
42 |
<groupId>org.gvsig</groupId> |
|
43 |
<artifactId>org.gvsig.annotation.lib.impl</artifactId> |
|
44 |
<scope>compile</scope> |
|
45 |
</dependency> |
|
46 |
<dependency> |
|
47 |
<groupId>org.gvsig</groupId> |
|
48 |
<artifactId>org.gvsig.annotation.swing.impl</artifactId> |
|
49 |
<scope>compile</scope> |
|
50 |
</dependency> |
|
51 |
<dependency> |
|
52 |
<groupId>org.gvsig</groupId> |
|
53 |
<artifactId>org.gvsig.editing</artifactId> |
|
54 |
<scope>compile</scope> |
|
55 |
</dependency> |
|
56 |
<dependency> |
|
57 |
<groupId>org.gvsig</groupId> |
|
58 |
<artifactId>org.gvsig.fmap.dal</artifactId> |
|
59 |
<scope>compile</scope> |
|
60 |
</dependency> |
|
61 |
<dependency> |
|
62 |
<groupId>org.gvsig</groupId> |
|
63 |
<artifactId>org.gvsig.fmap.mapcontext</artifactId> |
|
64 |
<scope>compile</scope> |
|
65 |
</dependency> |
|
66 |
<dependency> |
|
67 |
<groupId>org.gvsig</groupId> |
|
68 |
<artifactId>org.gvsig.utils</artifactId> |
|
69 |
<scope>compile</scope> |
|
70 |
</dependency> |
|
71 |
<dependency> |
|
72 |
<groupId>org.gvsig</groupId> |
|
73 |
<artifactId>org.gvsig.app</artifactId> |
|
74 |
<version>2.0-SNAPSHOT</version> |
|
75 |
<scope>compile</scope> |
|
76 |
</dependency> |
|
77 |
<dependency> |
|
78 |
<groupId>org.gvsig</groupId> |
|
79 |
<artifactId>org.gvsig.ui</artifactId> |
|
80 |
<scope>compile</scope> |
|
81 |
</dependency> |
|
82 |
<dependency> |
|
83 |
<groupId>org.gvsig</groupId> |
|
84 |
<artifactId>org.gvsig.metadata.lib.basic.api</artifactId> |
|
85 |
<scope>compile</scope> |
|
86 |
</dependency> |
|
87 |
<dependency> |
|
88 |
<groupId>org.gvsig</groupId> |
|
89 |
<artifactId>org.gvsig.fmap.control</artifactId> |
|
90 |
<scope>compile</scope> |
|
91 |
</dependency> |
|
92 |
</dependencies> |
|
93 |
<profiles> |
|
94 |
<profile> |
|
95 |
<id>gvsig-install</id> |
|
96 |
<activation> |
|
97 |
<activeByDefault>true</activeByDefault> |
|
98 |
</activation> |
|
99 |
<properties> |
|
100 |
<!-- |
|
101 |
Default gvSIG installation folder relative to the current workspace |
|
102 |
--> |
|
103 |
<gvsig.install.dir>${basedir}/../../build/product</gvsig.install.dir> |
|
104 |
</properties> |
|
105 |
</profile> |
|
106 |
</profiles> |
|
107 |
<properties> |
|
108 |
<build-dir>${basedir}/../../build</build-dir> |
|
109 |
</properties> |
|
110 |
</project> |
|
0 | 111 |
tags/v2_0_0_Build_2026/org.gvsig.annotation.app.extension/distribution/distribution.xml | ||
---|---|---|
1 |
<assembly> |
|
2 |
<id>distribution</id> |
|
3 |
<formats> |
|
4 |
<format>dir</format> |
|
5 |
</formats> |
|
6 |
<fileSets> |
|
7 |
<!-- Estructure for the extension --> |
|
8 |
<fileSet> |
|
9 |
<directory>src/main/resources</directory> |
|
10 |
<outputDirectory>${extension.install.dir.name} |
|
11 |
</outputDirectory> |
|
12 |
</fileSet> |
|
13 |
</fileSets> |
|
14 |
<files> |
|
15 |
<file> |
|
16 |
<source>package.info</source> |
|
17 |
<outputDirectory>${extension.install.dir.name} |
|
18 |
</outputDirectory> |
|
19 |
</file> |
|
20 |
</files> |
|
21 |
<dependencySets> |
|
22 |
<dependencySet> |
|
23 |
<outputDirectory>${extension.install.dir.name}/${library-dir} |
|
24 |
</outputDirectory> |
|
25 |
<includes> |
|
26 |
<include>org.gvsig:org.gvsig.annotation.app.extension</include> |
|
27 |
<include>org.gvsig:org.gvsig.annotation.lib.api</include> |
|
28 |
<include>org.gvsig:org.gvsig.annotation.swing.api</include> |
|
29 |
<include>org.gvsig:org.gvsig.annotation.lib.impl</include> |
|
30 |
<include>org.gvsig:org.gvsig.annotation.swing.impl</include> |
|
31 |
</includes> |
|
32 |
</dependencySet> |
|
33 |
</dependencySets> |
|
34 |
</assembly> |
|
0 | 35 |
tags/v2_0_0_Build_2026/org.gvsig.annotation.app.extension/buildNumber.properties | ||
---|---|---|
1 |
#maven.buildNumber.plugin properties file |
|
2 |
#Tue May 24 15:12:33 CEST 2011 |
|
3 |
buildNumber=2026 |
tags/v2_0_0_Build_2026/org.gvsig.annotation.app.extension/src/main/resources/config.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
<plugin-config> |
|
3 |
<depends plugin-name="org.gvsig.app" /> |
|
4 |
<depends plugin-name="org.gvsig.editing" /> |
|
5 |
<resourceBundle name="text"/> |
|
6 |
<libraries library-dir="lib"/> |
|
7 |
<extensions> |
|
8 |
<extension class-name="org.gvsig.annotation.app.extension.AnnotationExtension" |
|
9 |
description="" |
|
10 |
active="true" |
|
11 |
priority="1"> |
|
12 |
<menu text="Capa/export_to_annotation" |
|
13 |
position="35020" |
|
14 |
action-command="Annotation"/> |
|
15 |
</extension> |
|
16 |
<extension class-name="org.gvsig.annotation.app.extension.AnnotationAboutExtension" |
|
17 |
description="" |
|
18 |
active="true" |
|
19 |
priority="1"> |
|
20 |
</extension> |
|
21 |
</extensions> |
|
22 |
</plugin-config> |
|
0 | 23 |
tags/v2_0_0_Build_2026/org.gvsig.annotation.app.extension/src/main/java/org/gvsig/annotation/app/extension/AnnotationAboutExtension.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 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2010 {Prodevelop} {Task} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.annotation.app.extension; |
|
29 |
|
|
30 |
import org.gvsig.andami.plugins.Extension; |
|
31 |
|
|
32 |
/** |
|
33 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
|
34 |
*/ |
|
35 |
public class AnnotationAboutExtension extends Extension { |
|
36 |
|
|
37 |
public void execute(String actionCommand) { |
|
38 |
// Nothing to do |
|
39 |
} |
|
40 |
|
|
41 |
public void initialize() { |
|
42 |
// Nothing to do |
|
43 |
} |
|
44 |
|
|
45 |
public boolean isEnabled() { |
|
46 |
return false; |
|
47 |
} |
|
48 |
|
|
49 |
public boolean isVisible() { |
|
50 |
return false; |
|
51 |
} |
|
52 |
|
|
53 |
public void postInitialize() { |
|
54 |
super.postInitialize(); |
|
55 |
} |
|
56 |
} |
|
0 | 57 |
tags/v2_0_0_Build_2026/org.gvsig.annotation.app.extension/src/main/java/org/gvsig/annotation/app/extension/AnnotationWindow.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.annotation.app.extension; |
|
23 |
|
|
24 |
import java.awt.BorderLayout; |
|
25 |
import java.awt.Dimension; |
|
26 |
|
|
27 |
import javax.swing.JPanel; |
|
28 |
|
|
29 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
|
30 |
import org.gvsig.andami.ui.mdiManager.WindowInfo; |
|
31 |
import org.gvsig.annotation.swing.AnnotationWindowManager; |
|
32 |
|
|
33 |
/** |
|
34 |
* {@link IWindow} to show a Annotation. |
|
35 |
* |
|
36 |
* @author gvSIG Team |
|
37 |
* @version $Id$ |
|
38 |
*/ |
|
39 |
public class AnnotationWindow extends JPanel implements IWindow { |
|
40 |
|
|
41 |
private static final long serialVersionUID = -4401123724140025094L; |
|
42 |
|
|
43 |
private WindowInfo info; |
|
44 |
|
|
45 |
private Object profile = WindowInfo.EDITOR_PROFILE; |
|
46 |
|
|
47 |
/** |
|
48 |
* Constructor. |
|
49 |
* |
|
50 |
* @param panel |
|
51 |
* the panel to show |
|
52 |
* @param title |
|
53 |
* the window title |
|
54 |
* @param mode |
|
55 |
* the window mode |
|
56 |
* @see {@link AnnotationWindowManager#MODE_DIALOG} |
|
57 |
* @see {@link AnnotationWindowManager#MODE_TOOL} |
|
58 |
* @see {@link AnnotationWindowManager#MODE_WINDOW} |
|
59 |
*/ |
|
60 |
public AnnotationWindow(JPanel panel, String title, int mode) { |
|
61 |
this.setLayout(new BorderLayout()); |
|
62 |
add(panel, BorderLayout.CENTER); |
|
63 |
|
|
64 |
Dimension dimension = new Dimension(700, 400); |
|
65 |
setSize(dimension); |
|
66 |
int code = |
|
67 |
WindowInfo.ICONIFIABLE | WindowInfo.MAXIMIZABLE |
|
68 |
| WindowInfo.RESIZABLE; |
|
69 |
switch (mode) { |
|
70 |
case AnnotationWindowManager.MODE_DIALOG: |
|
71 |
code |= WindowInfo.MODALDIALOG; |
|
72 |
profile = WindowInfo.DIALOG_PROFILE; |
|
73 |
break; |
|
74 |
case AnnotationWindowManager.MODE_TOOL: |
|
75 |
code |= WindowInfo.PALETTE; |
|
76 |
profile = WindowInfo.TOOL_PROFILE; |
|
77 |
break; |
|
78 |
case AnnotationWindowManager.MODE_WINDOW: |
|
79 |
default: |
|
80 |
code |= WindowInfo.MODELESSDIALOG; |
|
81 |
profile = WindowInfo.EDITOR_PROFILE; |
|
82 |
} |
|
83 |
info = new WindowInfo(code); |
|
84 |
info.setTitle(title); |
|
85 |
info.setMinimumSize(dimension); |
|
86 |
} |
|
87 |
|
|
88 |
public WindowInfo getWindowInfo() { |
|
89 |
return info; |
|
90 |
} |
|
91 |
|
|
92 |
public Object getWindowProfile() { |
|
93 |
return profile; |
|
94 |
} |
|
95 |
} |
|
0 | 96 |
tags/v2_0_0_Build_2026/org.gvsig.annotation.app.extension/src/main/java/org/gvsig/annotation/app/extension/AddLayerFinishAction.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 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2010 {Prodevelop} {Task} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.annotation.app.extension; |
|
29 |
|
|
30 |
import javax.swing.JComponent; |
|
31 |
import javax.swing.JOptionPane; |
|
32 |
|
|
33 |
import org.gvsig.andami.PluginServices; |
|
34 |
import org.gvsig.andami.messages.NotificationManager; |
|
35 |
import org.gvsig.annotation.AnnotationCreationFinishAction; |
|
36 |
import org.gvsig.app.project.documents.view.gui.DefaultViewPanel; |
|
37 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
38 |
import org.gvsig.fmap.mapcontext.MapContextLocator; |
|
39 |
import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException; |
|
40 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
41 |
import org.gvsig.tools.locator.LocatorException; |
|
42 |
|
|
43 |
/** |
|
44 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
|
45 |
*/ |
|
46 |
public class AddLayerFinishAction implements AnnotationCreationFinishAction { |
|
47 |
private DefaultViewPanel viewPanel; |
|
48 |
|
|
49 |
public AddLayerFinishAction(DefaultViewPanel viewPanel) { |
|
50 |
this.viewPanel = viewPanel; |
|
51 |
} |
|
52 |
|
|
53 |
public void finished(FeatureStore featureStore) { |
|
54 |
int res = JOptionPane.showConfirmDialog((JComponent) PluginServices.getMDIManager() |
|
55 |
.getActiveWindow(), |
|
56 |
PluginServices.getText(this, |
|
57 |
"insertar_en_la_vista_la_capa_creada"), |
|
58 |
PluginServices.getText(this, "insertar_capa"), |
|
59 |
JOptionPane.YES_NO_OPTION); |
|
60 |
|
|
61 |
if (res == JOptionPane.YES_OPTION) { |
|
62 |
try { |
|
63 |
addShape(featureStore); |
|
64 |
} catch (LoadLayerException e) { |
|
65 |
NotificationManager.addError(e); |
|
66 |
} catch (LocatorException e) { |
|
67 |
NotificationManager.addError(e); |
|
68 |
} |
|
69 |
} |
|
70 |
} |
|
71 |
|
|
72 |
private void addShape(FeatureStore featureStore) throws LoadLayerException, LocatorException { |
|
73 |
FLayer layer = MapContextLocator.getMapContextManager().createLayer("Annotations", featureStore); |
|
74 |
viewPanel.getMapControl().getMapContext().getLayers().addLayer(layer); |
|
75 |
} |
|
76 |
|
|
77 |
} |
|
78 |
|
|
0 | 79 |
tags/v2_0_0_Build_2026/org.gvsig.annotation.app.extension/src/main/java/org/gvsig/annotation/app/extension/AnnotationExtension.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.annotation.app.extension; |
|
23 |
|
|
24 |
import org.gvsig.andami.PluginServices; |
|
25 |
import org.gvsig.andami.messages.NotificationManager; |
|
26 |
import org.gvsig.andami.plugins.Extension; |
|
27 |
import org.gvsig.annotation.AnnotationCreationService; |
|
28 |
import org.gvsig.annotation.AnnotationLocator; |
|
29 |
import org.gvsig.annotation.AnnotationManager; |
|
30 |
import org.gvsig.annotation.swing.AnnotationSwingLocator; |
|
31 |
import org.gvsig.annotation.swing.AnnotationSwingManager; |
|
32 |
import org.gvsig.annotation.swing.AnnotationWindowManager; |
|
33 |
import org.gvsig.annotation.swing.JAnnotationCreationServicePanel; |
|
34 |
import org.gvsig.app.project.documents.view.ViewDocument; |
|
35 |
import org.gvsig.app.project.documents.view.gui.DefaultViewPanel; |
|
36 |
import org.gvsig.editing.EditionUtilities; |
|
37 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
38 |
import org.gvsig.fmap.mapcontext.MapContext; |
|
39 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
40 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
|
41 |
import org.gvsig.tools.ToolsLocator; |
|
42 |
import org.gvsig.tools.extensionpoint.ExtensionPoint; |
|
43 |
import org.gvsig.tools.extensionpoint.ExtensionPointManager; |
|
44 |
import org.gvsig.tools.service.ServiceException; |
|
45 |
|
|
46 |
/** |
|
47 |
* Andami extension to show Annotation in the application. |
|
48 |
* |
|
49 |
* @author gvSIG Team |
|
50 |
* @version $Id$ |
|
51 |
*/ |
|
52 |
public class AnnotationExtension extends Extension { |
|
53 |
private AnnotationManager manager; |
|
54 |
private AnnotationSwingManager swingManager; |
|
55 |
|
|
56 |
public void initialize() { |
|
57 |
ExtensionPointManager extensionPoints = ToolsLocator.getExtensionPointManager(); |
|
58 |
ExtensionPoint ep = extensionPoints.add("AplicationPreferences", ""); |
|
59 |
|
|
60 |
ep.append("AnnotationPreferencesPage", "", new AnnotationPreferencesPage()); |
|
61 |
|
|
62 |
PluginServices.getIconTheme().registerDefault( |
|
63 |
"annotation-properties", |
|
64 |
AnnotationPreferencesPage.class.getClassLoader().getResource("images/AnnotationProperties.png") |
|
65 |
); |
|
66 |
} |
|
67 |
|
|
68 |
@Override |
|
69 |
public void postInitialize() { |
|
70 |
super.postInitialize(); |
|
71 |
manager = AnnotationLocator.getManager(); |
|
72 |
// Asignamos el locator e iniciamos la instancia |
|
73 |
swingManager = AnnotationSwingLocator.getSwingManager(); |
|
74 |
|
|
75 |
swingManager.registerWindowManager(new GvSIGAnnotationWindowManager()); |
|
76 |
} |
|
77 |
|
|
78 |
public void execute(String actionCommand) { |
|
79 |
org.gvsig.andami.ui.mdiManager.IWindow window = PluginServices.getMDIManager().getActiveWindow(); |
|
80 |
|
|
81 |
if (window instanceof DefaultViewPanel) { |
|
82 |
DefaultViewPanel viewPanel = (DefaultViewPanel) window; |
|
83 |
ViewDocument viewDocument = viewPanel.getModel(); |
|
84 |
MapContext mapContext = viewDocument.getMapContext(); |
|
85 |
FLayer[] actives = mapContext.getLayers().getActives(); |
|
86 |
|
|
87 |
FLyrVect fLyrVect = null; |
|
88 |
for (int i=0 ; i<actives.length ; i++){ |
|
89 |
if (actives[i] instanceof FLyrVect){ |
|
90 |
fLyrVect = (FLyrVect)actives[i]; |
|
91 |
break; |
|
92 |
} |
|
93 |
} |
|
94 |
|
|
95 |
if (fLyrVect == null){ |
|
96 |
return; |
|
97 |
} |
|
98 |
|
|
99 |
showAnnotation(manager, (FeatureStore)fLyrVect.getDataStore(), viewPanel); |
|
100 |
} |
|
101 |
} |
|
102 |
|
|
103 |
public void showAnnotation(AnnotationManager manager, FeatureStore featureStore, DefaultViewPanel defaultViewPanel) { |
|
104 |
try { |
|
105 |
AnnotationCreationService service = |
|
106 |
(AnnotationCreationService) manager.getAnnotationCreationService(featureStore); |
|
107 |
service.setAnnotationCreationFinishAction(new AddLayerFinishAction(defaultViewPanel)); |
|
108 |
|
|
109 |
JAnnotationCreationServicePanel panel = |
|
110 |
swingManager.createAnnotation(service); |
|
111 |
swingManager.getWindowManager().showWindow(panel, "Annotation", |
|
112 |
AnnotationWindowManager.MODE_DIALOG); |
|
113 |
|
|
114 |
} catch (ServiceException e) { |
|
115 |
NotificationManager.addError(e); |
|
116 |
} |
|
117 |
} |
|
118 |
|
|
119 |
public boolean isEnabled() { |
|
120 |
int status = EditionUtilities.getEditionStatus(); |
|
121 |
if (( status == EditionUtilities.EDITION_STATUS_ONE_VECTORIAL_LAYER_ACTIVE || status == EditionUtilities.EDITION_STATUS_ONE_VECTORIAL_LAYER_ACTIVE_AND_EDITABLE) |
|
122 |
|| (status == EditionUtilities.EDITION_STATUS_MULTIPLE_VECTORIAL_LAYER_ACTIVE)|| (status == EditionUtilities.EDITION_STATUS_MULTIPLE_VECTORIAL_LAYER_ACTIVE_AND_EDITABLE)) |
|
123 |
{ |
|
124 |
return true; |
|
125 |
} |
|
126 |
return false; |
|
127 |
} |
|
128 |
|
|
129 |
public boolean isVisible() { |
|
130 |
org.gvsig.andami.ui.mdiManager.IWindow f = PluginServices.getMDIManager() |
|
131 |
.getActiveWindow(); |
|
132 |
|
|
133 |
if (f == null) { |
|
134 |
return false; |
|
135 |
} |
|
136 |
|
|
137 |
if (f instanceof DefaultViewPanel) { |
|
138 |
return true; |
|
139 |
} |
|
140 |
return false; |
|
141 |
} |
|
142 |
} |
|
0 | 143 |
tags/v2_0_0_Build_2026/org.gvsig.annotation.app.extension/src/main/java/org/gvsig/annotation/app/extension/AnnotationPreferencesPage.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2005 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 |
* For more information, contact: |
|
20 |
* |
|
21 |
* Generalitat Valenciana |
|
22 |
* Conselleria d'Infraestructures i Transport |
|
23 |
* Av. Blasco Ib��ez, 50 |
|
24 |
* 46010 VALENCIA |
|
25 |
* SPAIN |
|
26 |
* |
|
27 |
* +34 963862235 |
|
28 |
* gvsig@gva.es |
|
29 |
* www.gvsig.gva.es |
|
30 |
* |
|
31 |
* or |
|
32 |
* |
|
33 |
* IVER T.I. S.A |
|
34 |
* Salamanca 50 |
|
35 |
* 46005 Valencia |
|
36 |
* Spain |
|
37 |
* |
|
38 |
* +34 963163400 |
|
39 |
* dac@iver.es |
|
40 |
*/ |
|
41 |
|
|
42 |
package org.gvsig.annotation.app.extension; |
|
43 |
|
|
44 |
import java.awt.GridBagConstraints; |
|
45 |
import java.awt.Insets; |
|
46 |
|
|
47 |
import javax.swing.ImageIcon; |
|
48 |
import javax.swing.JLabel; |
|
49 |
import javax.swing.JPanel; |
|
50 |
import javax.swing.JTextField; |
|
51 |
|
|
52 |
import org.gvsig.andami.PluginServices; |
|
53 |
import org.gvsig.andami.preferences.AbstractPreferencePage; |
|
54 |
import org.gvsig.andami.preferences.StoreException; |
|
55 |
import org.gvsig.annotation.AnnotationLocator; |
|
56 |
import org.gvsig.annotation.AnnotationManager; |
|
57 |
import org.gvsig.annotation.swing.AnnotationSwingLocator; |
|
58 |
import org.gvsig.annotation.swing.JAnnotationPreferencesPanel; |
|
59 |
import org.gvsig.app.gui.panels.ColorChooserPanel; |
|
60 |
import org.gvsig.utils.swing.JComboBox; |
|
61 |
/** |
|
62 |
* Default configuration page. |
|
63 |
* <b><b> |
|
64 |
* Here the user can establish what settings wants to use by default annotations. |
|
65 |
* |
|
66 |
* |
|
67 |
* @author Vicente Caballero Navarro |
|
68 |
*/ |
|
69 |
public class AnnotationPreferencesPage extends AbstractPreferencePage { |
|
70 |
protected String id; |
|
71 |
private ImageIcon icon; |
|
72 |
private JTextField txtDefaultText; |
|
73 |
private JComboBox cmbDefaultTypeFont; |
|
74 |
private JComboBox cmbDefaultStyleFont; |
|
75 |
private JTextField txtDefaultRotate; |
|
76 |
private JTextField txtDefaultHeight; |
|
77 |
private ColorChooserPanel jccDefaultColor; |
|
78 |
private JAnnotationPreferencesPanel panel = null; |
|
79 |
|
|
80 |
private AnnotationManager annotationManager = null; |
|
81 |
|
|
82 |
|
|
83 |
/** |
|
84 |
* Creates a new panel containing View preferences settings. |
|
85 |
* |
|
86 |
*/ |
|
87 |
public AnnotationPreferencesPage() { |
|
88 |
super(); |
|
89 |
id = this.getClass().getName(); |
|
90 |
this.annotationManager = AnnotationLocator.getManager(); |
|
91 |
} |
|
92 |
|
|
93 |
public void initializeValues() { |
|
94 |
getPanel(); // init UI |
|
95 |
} |
|
96 |
|
|
97 |
public String getID() { |
|
98 |
return id; |
|
99 |
} |
|
100 |
|
|
101 |
public String getTitle() { |
|
102 |
return PluginServices.getText(this, "annotation_preferences"); |
|
103 |
} |
|
104 |
|
|
105 |
public JPanel getPanel() { |
|
106 |
if (panel==null) { |
|
107 |
addComponent(new JLabel(PluginServices.getText(this,"text")), |
|
108 |
txtDefaultText = new JTextField(), GridBagConstraints.BOTH, new Insets(4,0,4,8)); |
|
109 |
panel = AnnotationSwingLocator.getSwingManager().createAnnotationPreferences(); |
|
110 |
addComponent(panel); |
|
111 |
} |
|
112 |
return this; |
|
113 |
} |
|
114 |
|
|
115 |
public void storeValues() throws StoreException { |
|
116 |
annotationManager.setDefaultFontColor(panel.getDefaultFontColor()); |
|
117 |
annotationManager.setDefaultTextValue(txtDefaultText.getText()); |
|
118 |
annotationManager.setDefaultFontType(panel.getDefaultFontType()); |
|
119 |
annotationManager.setDefaultFontStyle(panel.getDefaultFontStyle()); |
|
120 |
annotationManager.setDefaultFontHeight(panel.getDefaultFontHeight()); |
|
121 |
annotationManager.setDefaultFontRotation(panel.getDefaultFontRotation()); |
|
122 |
} |
|
123 |
|
|
124 |
|
|
125 |
public void initializeDefaults() { |
|
126 |
txtDefaultText.setText(annotationManager.getDefaultTextValue()); |
|
127 |
panel.setDefaultFontType(annotationManager.getDefaultFontType()); |
|
128 |
panel.setDefaultFontStyle(annotationManager.getDefaultFontStyle()); |
|
129 |
panel.setDefaultFontHeight(annotationManager.getDefaultFontHeight()); |
|
130 |
panel.setDefaultFontColor(annotationManager.getDefaultFontColor()); |
|
131 |
panel.setDefaultFontRotation(annotationManager.getDefaultFontRotation()); |
|
132 |
} |
|
133 |
|
|
134 |
public ImageIcon getIcon() { |
|
135 |
if (icon==null) |
|
136 |
icon = PluginServices.getIconTheme().get("annotation-properties"); |
|
137 |
return icon; |
|
138 |
} |
|
139 |
|
|
140 |
public boolean isValueChanged() { |
|
141 |
return super.hasChanged(); |
|
142 |
} |
|
143 |
|
|
144 |
public void setChangesApplied() { |
|
145 |
setChanged(false); |
|
146 |
} |
|
147 |
} |
|
0 | 148 |
tags/v2_0_0_Build_2026/org.gvsig.annotation.app.extension/src/main/java/org/gvsig/annotation/app/extension/GvSIGAnnotationWindowManager.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.annotation.app.extension; |
|
23 |
|
|
24 |
import java.awt.Component; |
|
25 |
import java.awt.event.ComponentEvent; |
|
26 |
import java.awt.event.ComponentListener; |
|
27 |
|
|
28 |
import javax.swing.JOptionPane; |
|
29 |
|
|
30 |
import org.gvsig.andami.PluginServices; |
|
31 |
import org.gvsig.annotation.swing.AnnotationWindowManager; |
|
32 |
import org.gvsig.annotation.swing.AnnotationWizardPanelActionListener; |
|
33 |
import org.gvsig.annotation.swing.JAnnotationCreationServicePanel; |
|
34 |
import org.gvsig.annotation.swing.JAnnotationPreferencesPanel; |
|
35 |
import org.gvsig.annotation.swing.thread.AnnotationCreationTask; |
|
36 |
|
|
37 |
/** |
|
38 |
* {@link AnnotationWindowManager} implementation to show Annotation |
|
39 |
* windows as gvSIG windows |
|
40 |
* |
|
41 |
* @author gvSIG Team |
|
42 |
* @version $Id$ |
|
43 |
*/ |
|
44 |
public class GvSIGAnnotationWindowManager implements AnnotationWindowManager, ComponentListener { |
|
45 |
|
|
46 |
public void showWindow(JAnnotationCreationServicePanel panel, String title, int mode) { |
|
47 |
AnnotationWindow window = |
|
48 |
new AnnotationWindow(panel, title, mode); |
|
49 |
|
|
50 |
panel.setAnnotationServicePanelActionListener(new AnnotationWizardListener(window)); |
|
51 |
|
|
52 |
window.addComponentListener(this); |
|
53 |
|
|
54 |
PluginServices.getMDIManager().addCentredWindow(window); |
|
55 |
} |
|
56 |
|
|
57 |
public void componentHidden(ComponentEvent componentEvent) { |
|
58 |
AnnotationWindow window = |
|
59 |
(AnnotationWindow) componentEvent.getSource(); |
|
60 |
PluginServices.getMDIManager().closeWindow(window); |
|
61 |
} |
|
62 |
|
|
63 |
public void componentMoved(ComponentEvent e) { |
|
64 |
// Nothing to do |
|
65 |
} |
|
66 |
|
|
67 |
public void componentResized(ComponentEvent e) { |
|
68 |
// Nothing to do |
|
69 |
} |
|
70 |
|
|
71 |
public void componentShown(ComponentEvent e) { |
|
72 |
// Nothing to do |
|
73 |
} |
|
74 |
|
|
75 |
public class AnnotationWizardListener implements AnnotationWizardPanelActionListener{ |
|
76 |
private AnnotationWindow annotationWindow = null; |
|
77 |
|
|
78 |
public AnnotationWizardListener(AnnotationWindow annotationWindow) { |
|
79 |
super(); |
|
80 |
this.annotationWindow = annotationWindow; |
|
81 |
} |
|
82 |
|
|
83 |
public void cancel( |
|
84 |
JAnnotationCreationServicePanel annotationCreationServicePanel) { |
|
85 |
PluginServices.getMDIManager().closeWindow(annotationWindow); |
|
86 |
} |
|
87 |
|
|
88 |
public void finish( |
|
89 |
JAnnotationCreationServicePanel annotationCreationServicePanel) { |
|
90 |
PluginServices.getMDIManager().closeWindow(annotationWindow); |
|
91 |
} |
|
92 |
} |
|
93 |
|
|
94 |
public void showWindow(AnnotationCreationTask annotationCreationTask) { |
|
95 |
PluginServices.cancelableBackgroundExecution(annotationCreationTask); |
|
96 |
} |
|
97 |
|
|
98 |
public boolean showFileExistsPopup(String title, String text) { |
|
99 |
int resp = JOptionPane.showConfirmDialog( |
|
100 |
(Component)PluginServices.getMainFrame(), text, |
|
101 |
title, JOptionPane.YES_NO_OPTION); |
|
102 |
if (resp == JOptionPane.YES_OPTION) { |
|
103 |
return true; |
|
104 |
} |
|
105 |
return false; |
|
106 |
} |
|
107 |
|
|
108 |
public void showPreferencesWindow(JAnnotationPreferencesPanel panel, |
|
109 |
String title, int mode) { |
|
110 |
// TODO Auto-generated method stub |
|
111 |
|
|
112 |
} |
|
113 |
} |
|
0 | 114 |
tags/v2_0_0_Build_2026/org.gvsig.annotation.app.extension/src/main/java/org/gvsig/annotation/app/extension/package.html | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8" ?> |
|
2 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
3 |
<html xmlns="http://www.w3.org/1999/xhtml"> |
|
4 |
<head> |
|
5 |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
|
6 |
<title>org.gvsig.annotation package documentation</title> |
|
7 |
</head> |
|
8 |
<body> |
|
9 |
|
|
10 |
<p>Annotation gvSIG extension</p> |
|
11 |
|
|
12 |
<p> |
|
13 |
Shows Annotation into gvSIG. |
|
14 |
</p> |
|
15 |
|
|
16 |
</body> |
|
17 |
</html> |
|
0 | 18 |
tags/v2_0_0_Build_2026/org.gvsig.annotation.app.extension/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 |
tags/v2_0_0_Build_2026/org.gvsig.annotation.app.extension/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.annotation"> |
|
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 |
Also available in: Unified diff