Revision 41951
tags/org.gvsig.desktop-2.0.77/org.gvsig.desktop.library/org.gvsig.annotation/org.gvsig.annotation.main/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> |
|
3 |
<modelVersion>4.0.0</modelVersion> |
|
4 |
<artifactId>org.gvsig.annotation.main</artifactId> |
|
5 |
<packaging>jar</packaging> |
|
6 |
<name>${project.artifactId}</name> |
|
7 |
<parent> |
|
8 |
<groupId>org.gvsig</groupId> |
|
9 |
<artifactId>org.gvsig.annotation</artifactId> |
|
10 |
<version>2.0.77</version> |
|
11 |
</parent> |
|
12 |
<dependencies> |
|
13 |
<dependency> |
|
14 |
<groupId>org.gvsig</groupId> |
|
15 |
<artifactId>org.gvsig.annotation.lib.api</artifactId> |
|
16 |
<scope>compile</scope> |
|
17 |
</dependency> |
|
18 |
<dependency> |
|
19 |
<groupId>org.gvsig</groupId> |
|
20 |
<artifactId>org.gvsig.annotation.swing.api</artifactId> |
|
21 |
<scope>compile</scope> |
|
22 |
</dependency> |
|
23 |
<dependency> |
|
24 |
<groupId>org.gvsig</groupId> |
|
25 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
26 |
<scope>compile</scope> |
|
27 |
</dependency> |
|
28 |
<dependency> |
|
29 |
<groupId>org.gvsig</groupId> |
|
30 |
<artifactId>org.gvsig.fmap.dal.api</artifactId> |
|
31 |
<scope>compile</scope> |
|
32 |
</dependency> |
|
33 |
<dependency> |
|
34 |
<groupId>org.gvsig</groupId> |
|
35 |
<artifactId>org.gvsig.projection.api</artifactId> |
|
36 |
<scope>compile</scope> |
|
37 |
</dependency> |
|
38 |
<dependency> |
|
39 |
<groupId>org.gvsig</groupId> |
|
40 |
<artifactId>org.gvsig.metadata.lib.basic.api</artifactId> |
|
41 |
<scope>compile</scope> |
|
42 |
</dependency> |
|
43 |
</dependencies> |
|
44 |
</project> |
|
0 | 45 |
tags/org.gvsig.desktop-2.0.77/org.gvsig.desktop.library/org.gvsig.annotation/org.gvsig.annotation.main/src/main/java/org/gvsig/annotation/main/Main.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 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 3 |
|
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 |
package org.gvsig.annotation.main; |
|
25 |
|
|
26 |
import org.slf4j.Logger; |
|
27 |
import org.slf4j.LoggerFactory; |
|
28 |
|
|
29 |
import org.gvsig.annotation.AnnotationCreationService; |
|
30 |
import org.gvsig.annotation.AnnotationLocator; |
|
31 |
import org.gvsig.annotation.AnnotationManager; |
|
32 |
import org.gvsig.annotation.swing.AnnotationSwingLocator; |
|
33 |
import org.gvsig.annotation.swing.AnnotationSwingManager; |
|
34 |
import org.gvsig.annotation.swing.AnnotationWindowManager; |
|
35 |
import org.gvsig.annotation.swing.JAnnotationCreationServicePanel; |
|
36 |
import org.gvsig.fmap.crs.CRSFactory; |
|
37 |
import org.gvsig.fmap.dal.DALLocator; |
|
38 |
import org.gvsig.fmap.dal.DataManager; |
|
39 |
import org.gvsig.fmap.dal.DataStoreParameters; |
|
40 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
41 |
import org.gvsig.tools.library.impl.DefaultLibrariesInitializer; |
|
42 |
|
|
43 |
/** |
|
44 |
* Main executable class for testing the Annotation library. |
|
45 |
* |
|
46 |
* @author gvSIG Team |
|
47 |
* @version $Id$ |
|
48 |
*/ |
|
49 |
public class Main { |
|
50 |
|
|
51 |
private static final Logger LOG = LoggerFactory.getLogger(Main.class); |
|
52 |
|
|
53 |
private AnnotationManager annotationManager; |
|
54 |
private AnnotationSwingManager annotationSwingManager; |
|
55 |
private DataManager dataManager; |
|
56 |
|
|
57 |
public static void main(String args[]) throws Exception { |
|
58 |
new DefaultLibrariesInitializer().fullInitialize(); |
|
59 |
Main main = new Main(); |
|
60 |
main.show(); |
|
61 |
} |
|
62 |
|
|
63 |
@SuppressWarnings("serial") |
|
64 |
public void show() throws Exception { |
|
65 |
annotationManager = AnnotationLocator.getManager(); |
|
66 |
annotationSwingManager = AnnotationSwingLocator.getSwingManager(); |
|
67 |
dataManager = DALLocator.getDataManager(); |
|
68 |
|
|
69 |
|
|
70 |
JAnnotationCreationServicePanel annotationCreationService = annotationSwingManager.createAnnotation(createService()); |
|
71 |
annotationSwingManager.getWindowManager().showWindow(annotationCreationService, "Annotation App. example", AnnotationWindowManager.MODE_DIALOG); |
|
72 |
} |
|
73 |
|
|
74 |
/** |
|
75 |
* Returns an instance of the {@link AnnotationCreationService}. |
|
76 |
* |
|
77 |
* @return a {@link AnnotationCreationService} instance |
|
78 |
* @throws Exception |
|
79 |
* if there is any error creating the instance |
|
80 |
*/ |
|
81 |
protected AnnotationCreationService createService() throws Exception { |
|
82 |
String sourceFileName = getClass().getClassLoader().getResource("org/gvsig/annotation/data/andalucia.shp").getFile(); |
|
83 |
DataStoreParameters sourceParameters = dataManager.createStoreParameters("Shape"); |
|
84 |
sourceParameters.setDynValue("shpfile", sourceFileName); |
|
85 |
sourceParameters.setDynValue("crs", CRSFactory.getCRS("EPSG:23030")); |
|
86 |
FeatureStore sourceStore = (FeatureStore) dataManager.openStore("Shape", sourceParameters); |
|
87 |
return annotationManager.getAnnotationCreationService(sourceStore); |
|
88 |
} |
|
89 |
|
|
90 |
} |
|
0 | 91 |
tags/org.gvsig.desktop-2.0.77/org.gvsig.desktop.library/org.gvsig.annotation/org.gvsig.annotation.main/src/main/java/org/gvsig/annotation/main/PreferencesMain.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 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 3 |
|
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 |
package org.gvsig.annotation.main; |
|
25 |
|
|
26 |
import org.slf4j.Logger; |
|
27 |
import org.slf4j.LoggerFactory; |
|
28 |
|
|
29 |
import org.gvsig.annotation.AnnotationCreationService; |
|
30 |
import org.gvsig.annotation.AnnotationLocator; |
|
31 |
import org.gvsig.annotation.AnnotationManager; |
|
32 |
import org.gvsig.annotation.swing.AnnotationSwingLocator; |
|
33 |
import org.gvsig.annotation.swing.AnnotationSwingManager; |
|
34 |
import org.gvsig.annotation.swing.AnnotationWindowManager; |
|
35 |
import org.gvsig.annotation.swing.JAnnotationPreferencesPanel; |
|
36 |
import org.gvsig.fmap.crs.CRSFactory; |
|
37 |
import org.gvsig.fmap.dal.DALLocator; |
|
38 |
import org.gvsig.fmap.dal.DataManager; |
|
39 |
import org.gvsig.fmap.dal.DataStoreParameters; |
|
40 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
41 |
import org.gvsig.tools.library.impl.DefaultLibrariesInitializer; |
|
42 |
|
|
43 |
/** |
|
44 |
* Main executable class for testing the Annotation library. |
|
45 |
* |
|
46 |
* @author gvSIG Team |
|
47 |
* @version $Id$ |
|
48 |
*/ |
|
49 |
public class PreferencesMain { |
|
50 |
|
|
51 |
private static final Logger LOG = LoggerFactory.getLogger(PreferencesMain.class); |
|
52 |
|
|
53 |
private AnnotationManager annotationManager; |
|
54 |
private AnnotationSwingManager annotationSwingManager; |
|
55 |
private DataManager dataManager; |
|
56 |
|
|
57 |
public static void main(String args[]) throws Exception { |
|
58 |
new DefaultLibrariesInitializer().fullInitialize(); |
|
59 |
PreferencesMain main = new PreferencesMain(); |
|
60 |
main.show(); |
|
61 |
} |
|
62 |
|
|
63 |
@SuppressWarnings("serial") |
|
64 |
public void show() throws Exception { |
|
65 |
annotationManager = AnnotationLocator.getManager(); |
|
66 |
annotationSwingManager = AnnotationSwingLocator.getSwingManager(); |
|
67 |
dataManager = DALLocator.getDataManager(); |
|
68 |
|
|
69 |
|
|
70 |
JAnnotationPreferencesPanel annotationPreferencesPanel = annotationSwingManager.createAnnotationPreferences(); |
|
71 |
annotationSwingManager.getWindowManager().showPreferencesWindow(annotationPreferencesPanel, "Annotation Preferences. example", AnnotationWindowManager.MODE_DIALOG); |
|
72 |
} |
|
73 |
|
|
74 |
/** |
|
75 |
* Returns an instance of the {@link AnnotationCreationService}. |
|
76 |
* |
|
77 |
* @return a {@link AnnotationCreationService} instance |
|
78 |
* @throws Exception |
|
79 |
* if there is any error creating the instance |
|
80 |
*/ |
|
81 |
protected AnnotationCreationService createService() throws Exception { |
|
82 |
String sourceFileName = getClass().getClassLoader().getResource("org/gvsig/annotation/data/andalucia.shp").getFile(); |
|
83 |
DataStoreParameters sourceParameters = dataManager.createStoreParameters("Shape"); |
|
84 |
sourceParameters.setDynValue("shpfile", sourceFileName); |
|
85 |
sourceParameters.setDynValue("crs", CRSFactory.getCRS("EPSG:23030")); |
|
86 |
FeatureStore sourceStore = (FeatureStore) dataManager.openStore("Shape", sourceParameters); |
|
87 |
return annotationManager.getAnnotationCreationService(sourceStore); |
|
88 |
} |
|
89 |
|
|
90 |
} |
|
0 | 91 |
tags/org.gvsig.desktop-2.0.77/org.gvsig.desktop.library/org.gvsig.annotation/org.gvsig.annotation.main/src/main/java/org/gvsig/annotation/main/package.html | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8" ?> |
|
2 |
<!-- |
|
3 |
|
|
4 |
gvSIG. Desktop Geographic Information System. |
|
5 |
|
|
6 |
Copyright (C) 2007-2013 gvSIG Association. |
|
7 |
|
|
8 |
This program is free software; you can redistribute it and/or |
|
9 |
modify it under the terms of the GNU General Public License |
|
10 |
as published by the Free Software Foundation; either version 3 |
|
11 |
of the License, or (at your option) any later version. |
|
12 |
|
|
13 |
This program is distributed in the hope that it will be useful, |
|
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
16 |
GNU General Public License for more details. |
|
17 |
|
|
18 |
You should have received a copy of the GNU General Public License |
|
19 |
along with this program; if not, write to the Free Software |
|
20 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
21 |
MA 02110-1301, USA. |
|
22 |
|
|
23 |
For any additional information, do not hesitate to contact us |
|
24 |
at info AT gvsig.com, or visit our website www.gvsig.com. |
|
25 |
|
|
26 |
--> |
|
27 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
28 |
<html xmlns="http://www.w3.org/1999/xhtml"> |
|
29 |
<head> |
|
30 |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
|
31 |
<title>org.gvsig.annotation package documentation</title> |
|
32 |
</head> |
|
33 |
<body> |
|
34 |
|
|
35 |
<p>Annotation library testing and demo application.</p> |
|
36 |
|
|
37 |
</body> |
|
38 |
</html> |
|
0 | 39 |
tags/org.gvsig.desktop-2.0.77/org.gvsig.desktop.library/org.gvsig.annotation/org.gvsig.annotation.main/src/main/resources/README.txt | ||
---|---|---|
1 |
Put into this folder the resources needed by your classes. |
|
2 |
|
|
3 |
This folder is added to the 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 classes. |
|
0 | 9 |
tags/org.gvsig.desktop-2.0.77/org.gvsig.desktop.library/org.gvsig.annotation/org.gvsig.annotation.main/src/main/resources/log4j.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1" ?> |
|
2 |
<!-- |
|
3 |
|
|
4 |
gvSIG. Desktop Geographic Information System. |
|
5 |
|
|
6 |
Copyright (C) 2007-2013 gvSIG Association. |
|
7 |
|
|
8 |
This program is free software; you can redistribute it and/or |
|
9 |
modify it under the terms of the GNU General Public License |
|
10 |
as published by the Free Software Foundation; either version 3 |
|
11 |
of the License, or (at your option) any later version. |
|
12 |
|
|
13 |
This program is distributed in the hope that it will be useful, |
|
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
16 |
GNU General Public License for more details. |
|
17 |
|
|
18 |
You should have received a copy of the GNU General Public License |
|
19 |
along with this program; if not, write to the Free Software |
|
20 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
21 |
MA 02110-1301, USA. |
|
22 |
|
|
23 |
For any additional information, do not hesitate to contact us |
|
24 |
at info AT gvsig.com, or visit our website www.gvsig.com. |
|
25 |
|
|
26 |
--> |
|
27 |
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> |
|
28 |
|
|
29 |
<!-- |
|
30 |
Log4J configuration file for unit tests execution. |
|
31 |
--> |
|
32 |
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> |
|
33 |
|
|
34 |
<!-- Appender configuration to show logging messages through the console --> |
|
35 |
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender"> |
|
36 |
<layout class="org.apache.log4j.PatternLayout"> |
|
37 |
<param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %-5p [%c{2}.%M()]\n %m%n" /> |
|
38 |
</layout> |
|
39 |
</appender> |
|
40 |
|
|
41 |
<!-- |
|
42 |
Activate logging messages of DEBUG level of higher only for the |
|
43 |
org.gvsig.tools packages. |
|
44 |
You can put full classes names or packages instead, to configure |
|
45 |
logging for all the classes and subpackages of the package. |
|
46 |
--> |
|
47 |
<category name="org.gvsig.tools"> |
|
48 |
<priority value="DEBUG" /> |
|
49 |
</category> |
|
50 |
<category name="org.gvsig.annotation"> |
|
51 |
<priority value="DEBUG" /> |
|
52 |
</category> |
|
53 |
|
|
54 |
<!-- |
|
55 |
By default, show only logging messages of INFO level or higher, |
|
56 |
through the previously configured CONSOLE appender. |
|
57 |
--> |
|
58 |
<root> |
|
59 |
<priority value="INFO" /> |
|
60 |
<appender-ref ref="CONSOLE" /> |
|
61 |
</root> |
|
62 |
</log4j:configuration> |
|
0 | 63 |
tags/org.gvsig.desktop-2.0.77/org.gvsig.desktop.library/org.gvsig.annotation/org.gvsig.annotation.lib/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
3 |
|
|
4 |
<modelVersion>4.0.0</modelVersion> |
|
5 |
<artifactId>org.gvsig.annotation.lib</artifactId> |
|
6 |
<packaging>pom</packaging> |
|
7 |
<name>org.gvsig.annotation.lib</name> |
|
8 |
<parent> |
|
9 |
<groupId>org.gvsig</groupId> |
|
10 |
<artifactId>org.gvsig.annotation</artifactId> |
|
11 |
<version>2.0.77</version> |
|
12 |
</parent> |
|
13 |
|
|
14 |
<modules> |
|
15 |
<module>org.gvsig.annotation.lib.api</module> |
|
16 |
<module>org.gvsig.annotation.lib.impl</module> |
|
17 |
</modules> |
|
18 |
</project> |
|
0 | 19 |
tags/org.gvsig.desktop-2.0.77/org.gvsig.desktop.library/org.gvsig.annotation/org.gvsig.annotation.lib/org.gvsig.annotation.lib.api/src/test/java/org/gvsig/annotation/AnnotationCreationServiceTest.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 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 3 |
|
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 |
package org.gvsig.annotation; |
|
25 |
|
|
26 |
import java.io.File; |
|
27 |
import java.util.ArrayList; |
|
28 |
import java.util.List; |
|
29 |
|
|
30 |
import org.gvsig.fmap.crs.CRSFactory; |
|
31 |
import org.gvsig.fmap.dal.DALLocator; |
|
32 |
import org.gvsig.fmap.dal.DataManager; |
|
33 |
import org.gvsig.fmap.dal.DataStoreParameters; |
|
34 |
import org.gvsig.fmap.dal.feature.Feature; |
|
35 |
import org.gvsig.fmap.dal.feature.FeatureSet; |
|
36 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
37 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
38 |
import org.gvsig.fmap.geom.Geometry; |
|
39 |
import org.gvsig.fmap.geom.exception.CreateGeometryException; |
|
40 |
import org.gvsig.fmap.geom.primitive.Point; |
|
41 |
import org.gvsig.i18n.Messages; |
|
42 |
import org.gvsig.tools.dispose.DisposableIterator; |
|
43 |
import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase; |
|
44 |
|
|
45 |
|
|
46 |
/** |
|
47 |
* API compatibility tests for {@link AnnotationCreationService} implementations. |
|
48 |
* |
|
49 |
* @author gvSIG Team |
|
50 |
* @version $Id$ |
|
51 |
*/ |
|
52 |
public abstract class AnnotationCreationServiceTest extends |
|
53 |
AbstractLibraryAutoInitTestCase { |
|
54 |
|
|
55 |
protected AnnotationManager manager; |
|
56 |
protected DataManager dataManager; |
|
57 |
|
|
58 |
@Override |
|
59 |
protected void doSetUp() throws Exception { |
|
60 |
manager = AnnotationLocator.getManager(); |
|
61 |
dataManager = DALLocator.getDataManager(); |
|
62 |
} |
|
63 |
|
|
64 |
/** |
|
65 |
* Returns an instance of the {@link AnnotationCreationService}. |
|
66 |
* |
|
67 |
* @return a {@link AnnotationCreationService} instance |
|
68 |
* @throws Exception |
|
69 |
* if there is any error creating the instance |
|
70 |
*/ |
|
71 |
protected AnnotationCreationService createService() throws Exception { |
|
72 |
String sourceFileName = getClass().getClassLoader().getResource("org/gvsig/annotation/data/andalucia.shp").getFile(); |
|
73 |
DataStoreParameters sourceParameters = dataManager.createStoreParameters("Shape"); |
|
74 |
sourceParameters.setDynValue("shpfile", sourceFileName); |
|
75 |
sourceParameters.setDynValue("crs", CRSFactory.getCRS("EPSG:23030")); |
|
76 |
FeatureStore sourceStore = (FeatureStore) dataManager.openStore("Shape", sourceParameters); |
|
77 |
return manager.getAnnotationCreationService(sourceStore); |
|
78 |
} |
|
79 |
|
|
80 |
/** |
|
81 |
* Test for the {@link AnnotationCreationService#getMessage()} method. |
|
82 |
* |
|
83 |
* @throws Exception |
|
84 |
* if there is any error in the tests |
|
85 |
*/ |
|
86 |
public void testAnnotationServiceMessage() throws Exception { |
|
87 |
AnnotationCreationService annotationCreationService = createService(); |
|
88 |
|
|
89 |
File temporalFolder = new File(System.getProperty("java.io.tmpdir") + File.separator + "tmp_gvsig_annotation"); |
|
90 |
if (!temporalFolder.exists()){ |
|
91 |
if (!temporalFolder.mkdir()){ |
|
92 |
throw new Exception("Impossible to create the destination folder"); |
|
93 |
} |
|
94 |
} |
|
95 |
|
|
96 |
String destinationFileName = temporalFolder.getAbsolutePath() + File.separator + Math.random() + ".shp"; |
|
97 |
|
|
98 |
annotationCreationService.createAnnotationStore(destinationFileName, 1); |
|
99 |
|
|
100 |
DataStoreParameters destinationParameters = dataManager.createStoreParameters("Shape"); |
|
101 |
destinationParameters.setDynValue("shpfile", destinationFileName); |
|
102 |
destinationParameters.setDynValue("crs", CRSFactory.getCRS("EPSG:23030")); |
|
103 |
FeatureStore destinationStore = (FeatureStore) dataManager.openStore("Shape", destinationParameters); |
|
104 |
|
|
105 |
assertNotNull(destinationStore); |
|
106 |
|
|
107 |
FeatureType featureType = destinationStore.getDefaultFeatureType(); |
|
108 |
assertEquals(7, featureType.getAttributeDescriptors().length); |
|
109 |
|
|
110 |
assertEquals(destinationStore.getFeatureCount(), annotationCreationService.getFeatureStore().getFeatureCount()); |
|
111 |
|
|
112 |
assertNotNull(featureType.getDefaultGeometryAttribute()); |
|
113 |
assertEquals(featureType.getDefaultGeometryAttribute().getGeometryType(), Geometry.TYPES.POINT); |
|
114 |
|
|
115 |
//Check the geometries |
|
116 |
FeatureSet featureSet = destinationStore.getFeatureSet(); |
|
117 |
DisposableIterator iterator = featureSet.iterator(); |
|
118 |
|
|
119 |
Feature feature; |
|
120 |
TextPointPairList textPointPairList = getResult(); |
|
121 |
while (iterator.hasNext()){ |
|
122 |
feature = (Feature)iterator.next(); |
|
123 |
assertNotNull(feature.get(Messages.getText(AnnotationManager.TEXTVALUE_ATTRIBUTE_NAME))); |
|
124 |
String text = feature.getString(AnnotationManager.TEXTVALUE_ATTRIBUTE_NAME); |
|
125 |
TextPointPair textPointPair = textPointPairList.search(text); |
|
126 |
if (textPointPair != null){ |
|
127 |
//Check the geometry |
|
128 |
Point point = (Point)feature.getDefaultGeometry(); |
|
129 |
assertEquals(point.getX(), textPointPair.getPoint().getX(), 0.01); |
|
130 |
assertEquals(point.getY(), textPointPair.getPoint().getY(), 0.01); |
|
131 |
} |
|
132 |
int color = feature.getInt(AnnotationManager.FONTCOLOR_ATTRIBUTE_NAME); |
|
133 |
assertEquals(color, manager.getDefaultFontColor()); |
|
134 |
|
|
135 |
double heigth = feature.getDouble(AnnotationManager.FONTHEGTH_ATTRIBUTE_NAME); |
|
136 |
assertEquals(heigth, manager.getDefaultFontHeight()); |
|
137 |
|
|
138 |
double rotation = feature.getDouble(AnnotationManager.FONTROTATION_ATTRIBUTE_NAME); |
|
139 |
assertEquals(rotation, manager.getDefaultFontRotation()); |
|
140 |
|
|
141 |
String type = feature.getString(AnnotationManager.FONTTYPE_ATTRIBUTE_NAME); |
|
142 |
assertEquals(type, manager.getDefaultFontType()); |
|
143 |
|
|
144 |
String style = feature.getString(AnnotationManager.FONTSTYLE_ATTRIBUTE_NAME); |
|
145 |
assertEquals(style, manager.getDefaultFontStyle()); |
|
146 |
} |
|
147 |
|
|
148 |
destinationStore.dispose(); |
|
149 |
annotationCreationService.getFeatureStore().dispose(); |
|
150 |
} |
|
151 |
|
|
152 |
public abstract TextPointPairList getResult() throws CreateGeometryException; |
|
153 |
|
|
154 |
public class TextPointPairList{ |
|
155 |
List<TextPointPair> textPointPairs = new ArrayList<TextPointPair>(); |
|
156 |
|
|
157 |
public TextPointPairList() { |
|
158 |
super(); |
|
159 |
} |
|
160 |
|
|
161 |
public void addPoint(String text, Point point){ |
|
162 |
textPointPairs.add(new TextPointPair(text, point)); |
|
163 |
} |
|
164 |
|
|
165 |
public TextPointPair search(String text){ |
|
166 |
for (TextPointPair textPointPair : textPointPairs) { |
|
167 |
if (textPointPair.getText().equals(text)){ |
|
168 |
return textPointPair; |
|
169 |
} |
|
170 |
} |
|
171 |
return null; |
|
172 |
} |
|
173 |
} |
|
174 |
|
|
175 |
|
|
176 |
|
|
177 |
private class TextPointPair{ |
|
178 |
private String text; |
|
179 |
private Point point; |
|
180 |
|
|
181 |
public TextPointPair(String text, Point point) { |
|
182 |
super(); |
|
183 |
this.text = text; |
|
184 |
this.point = point; |
|
185 |
} |
|
186 |
|
|
187 |
public String getText() { |
|
188 |
return text; |
|
189 |
} |
|
190 |
|
|
191 |
public Point getPoint() { |
|
192 |
return point; |
|
193 |
} |
|
194 |
} |
|
195 |
|
|
196 |
/** |
|
197 |
* Test for the {@link AnnotationCreationService#getManager()} method. |
|
198 |
* |
|
199 |
* @throws Exception |
|
200 |
* if there is any error in the tests |
|
201 |
*/ |
|
202 |
public void testAnnotationServiceManager() throws Exception { |
|
203 |
AnnotationCreationService annotationCreationService = createService(); |
|
204 |
assertEquals(manager, annotationCreationService.getManager()); |
|
205 |
} |
|
206 |
} |
|
0 | 207 |
tags/org.gvsig.desktop-2.0.77/org.gvsig.desktop.library/org.gvsig.annotation/org.gvsig.annotation.lib/org.gvsig.annotation.lib.api/src/test/java/org/gvsig/annotation/AnnotationManagerTest.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 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 3 |
|
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 |
package org.gvsig.annotation; |
|
25 |
|
|
26 |
import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase; |
|
27 |
|
|
28 |
/** |
|
29 |
* API compatibility tests for {@link AnnotationManager} implementations. |
|
30 |
* |
|
31 |
* @author gvSIG Team |
|
32 |
* @version $Id$ |
|
33 |
*/ |
|
34 |
public abstract class AnnotationManagerTest extends |
|
35 |
AbstractLibraryAutoInitTestCase { |
|
36 |
|
|
37 |
protected AnnotationManager manager; |
|
38 |
|
|
39 |
@Override |
|
40 |
protected void doSetUp() throws Exception { |
|
41 |
manager = AnnotationLocator.getManager(); |
|
42 |
} |
|
43 |
|
|
44 |
/** |
|
45 |
* Test for the {@link AnnotationManager#getAnnotationCreationService()} |
|
46 |
* method. |
|
47 |
* |
|
48 |
* @throws Exception |
|
49 |
* if there is any error in the tests |
|
50 |
*/ |
|
51 |
public void testGetAnnotationCreationService() throws Exception { |
|
52 |
|
|
53 |
} |
|
54 |
|
|
55 |
} |
|
0 | 56 |
tags/org.gvsig.desktop-2.0.77/org.gvsig.desktop.library/org.gvsig.annotation/org.gvsig.annotation.lib/org.gvsig.annotation.lib.api/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.annotation.AnnotationLibrary |
tags/org.gvsig.desktop-2.0.77/org.gvsig.desktop.library/org.gvsig.annotation/org.gvsig.annotation.lib/org.gvsig.annotation.lib.api/src/main/java/org/gvsig/annotation/AnnotationDataTypes.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 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 3 |
|
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 |
* AUTHORS (In addition to CIT): |
|
26 |
* 2010 {Prodevelop} {Task} |
|
27 |
*/ |
|
28 |
|
|
29 |
package org.gvsig.annotation; |
|
30 |
|
|
31 |
import org.gvsig.fmap.dal.DataStore; |
|
32 |
import org.gvsig.tools.dataTypes.DataTypes; |
|
33 |
|
|
34 |
/** |
|
35 |
* DataTypes for the fields that are created in an annotation {@link DataStore}. |
|
36 |
* |
|
37 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
|
38 |
*/ |
|
39 |
public class AnnotationDataTypes { |
|
40 |
public static int TEXT = DataTypes.STRING; |
|
41 |
public static int FONTROTATION = DataTypes.DOUBLE; |
|
42 |
public static int FONTCOLOR = DataTypes.INT; |
|
43 |
public static int FONTHEIGHT = DataTypes.DOUBLE; |
|
44 |
public static int FONTTYPE = DataTypes.STRING; |
|
45 |
public static int FONTSTYLE = DataTypes.STRING; |
|
46 |
} |
|
47 |
|
|
0 | 48 |
tags/org.gvsig.desktop-2.0.77/org.gvsig.desktop.library/org.gvsig.annotation/org.gvsig.annotation.lib/org.gvsig.annotation.lib.api/src/main/java/org/gvsig/annotation/AnnotationException.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 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 3 |
|
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 |
package org.gvsig.annotation; |
|
25 |
|
|
26 |
import org.gvsig.tools.exception.BaseException; |
|
27 |
|
|
28 |
/** |
|
29 |
* Generic exception thrown in the Annotation API when the exception or error |
|
30 |
* may be dealt by the program or the user of the program which is a client of |
|
31 |
* the Annotation API. |
|
32 |
* |
|
33 |
* @see {@link AnnotationCreationService} |
|
34 |
* @see {@link AnnotationManager} |
|
35 |
* @author gvSIG team. |
|
36 |
* @version $Id$ |
|
37 |
*/ |
|
38 |
public class AnnotationException extends BaseException { |
|
39 |
|
|
40 |
private static final long serialVersionUID = 6756475060924237176L; |
|
41 |
|
|
42 |
private static final String MESSAGE = |
|
43 |
"An error has been produced in the Annotation library"; |
|
44 |
|
|
45 |
private static final String KEY = "_AnnotationException"; |
|
46 |
|
|
47 |
/** |
|
48 |
* Constructor to be used in rare cases, usually you must create a new child |
|
49 |
* exception class for each case. |
|
50 |
* <strong>Don't use this constructor in child classes.</strong> |
|
51 |
*/ |
|
52 |
public AnnotationException() { |
|
53 |
super(MESSAGE, KEY, serialVersionUID); |
|
54 |
} |
|
55 |
|
|
56 |
/** |
|
57 |
* Constructor to be used in rare cases, usually you must create a new child |
|
58 |
* exception class for each case. |
|
59 |
* <p> |
|
60 |
* <strong>Don't use this constructor in child classes.</strong> |
|
61 |
* </p> |
|
62 |
* |
|
63 |
* @param cause |
|
64 |
* the original cause of the exception |
|
65 |
*/ |
|
66 |
public AnnotationException(Exception cause) { |
|
67 |
super(MESSAGE, cause, KEY, serialVersionUID); |
|
68 |
} |
|
69 |
|
|
70 |
/** |
|
71 |
* @see BaseException#BaseException(String, String, long). |
|
72 |
* @param message |
|
73 |
* the default messageFormat to describe the exception |
|
74 |
* @param key |
|
75 |
* the key to use to search a localized messageFormnata |
|
76 |
* @param code |
|
77 |
* the unique code to identify the exception |
|
78 |
*/ |
|
79 |
protected AnnotationException(String message, String key, long code) { |
|
80 |
super(message, key, code); |
|
81 |
} |
|
82 |
|
|
83 |
/** |
|
84 |
* @see BaseException#BaseException(String, Throwable, String, long). |
|
85 |
* @param message |
|
86 |
* the default messageFormat to describe the exception |
|
87 |
* @param cause |
|
88 |
* the original cause of the exception |
|
89 |
* @param key |
|
90 |
* the key to use to search a localized messageFormnata |
|
91 |
* @param code |
|
92 |
* the unique code to identify the exception |
|
93 |
*/ |
|
94 |
protected AnnotationException(String message, Throwable cause, |
|
95 |
String key, long code) { |
|
96 |
super(message, cause, key, code); |
|
97 |
} |
|
98 |
} |
|
0 | 99 |
tags/org.gvsig.desktop-2.0.77/org.gvsig.desktop.library/org.gvsig.annotation/org.gvsig.annotation.lib/org.gvsig.annotation.lib.api/src/main/java/org/gvsig/annotation/calculator/AnnotationPositionCalculationException.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 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 3 |
|
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 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
25 |
* |
|
26 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
27 |
* of the Valencian Government (CIT) |
|
28 |
* |
|
29 |
* This program is free software; you can redistribute it and/or |
|
30 |
* modify it under the terms of the GNU General Public License |
|
31 |
* as published by the Free Software Foundation; either version 2 |
|
32 |
* of the License, or (at your option) any later version. |
|
33 |
* |
|
34 |
* This program is distributed in the hope that it will be useful, |
|
35 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
36 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
37 |
* GNU General Public License for more details. |
|
38 |
* |
|
39 |
* You should have received a copy of the GNU General Public License |
|
40 |
* along with this program; if not, write to the Free Software |
|
41 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
42 |
* MA 02110-1301, USA. |
|
43 |
* |
|
44 |
*/ |
|
45 |
|
|
46 |
/* |
|
47 |
* AUTHORS (In addition to CIT): |
|
48 |
* 2010 {Prodevelop} {Task} |
|
49 |
*/ |
|
50 |
|
|
51 |
package org.gvsig.annotation.calculator; |
|
52 |
|
|
53 |
import org.gvsig.annotation.AnnotationException; |
|
54 |
|
|
55 |
/** |
|
56 |
* This exception is thrown if there is a problem calculating the |
|
57 |
* point where the annotation has to be displayed. |
|
58 |
* |
|
59 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
|
60 |
*/ |
|
61 |
public class AnnotationPositionCalculationException extends AnnotationException { |
|
62 |
private static final long serialVersionUID = -2759803769427383259L; |
|
63 |
|
|
64 |
private static final String MESSAGE = |
|
65 |
"An error has been produced calculating the annotation position"; |
|
66 |
|
|
67 |
private static final String KEY = "_AnnotationPositionCalculationException"; |
|
68 |
|
|
69 |
/** |
|
70 |
* Creates a new {@link AnnotationPositionCalculationException}. |
|
71 |
* |
|
72 |
* @param cause |
|
73 |
* the original cause |
|
74 |
*/ |
|
75 |
public AnnotationPositionCalculationException(Throwable cause) { |
|
76 |
super(MESSAGE, cause, KEY, serialVersionUID); |
|
77 |
} |
|
78 |
} |
|
0 | 79 |
tags/org.gvsig.desktop-2.0.77/org.gvsig.desktop.library/org.gvsig.annotation/org.gvsig.annotation.lib/org.gvsig.annotation.lib.api/src/main/java/org/gvsig/annotation/calculator/AnnotationPositionCalculatorCreationException.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 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 3 |
|
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 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
25 |
* |
|
26 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
27 |
* of the Valencian Government (CIT) |
|
28 |
* |
|
29 |
* This program is free software; you can redistribute it and/or |
|
30 |
* modify it under the terms of the GNU General Public License |
|
31 |
* as published by the Free Software Foundation; either version 2 |
|
32 |
* of the License, or (at your option) any later version. |
|
33 |
* |
|
34 |
* This program is distributed in the hope that it will be useful, |
|
35 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
36 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
37 |
* GNU General Public License for more details. |
|
38 |
* |
|
39 |
* You should have received a copy of the GNU General Public License |
|
40 |
* along with this program; if not, write to the Free Software |
|
41 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
42 |
* MA 02110-1301, USA. |
|
43 |
* |
|
44 |
*/ |
|
45 |
|
|
46 |
/* |
|
47 |
* AUTHORS (In addition to CIT): |
|
48 |
* 2010 {Prodevelop} {Task} |
|
49 |
*/ |
|
50 |
|
|
51 |
package org.gvsig.annotation.calculator; |
|
52 |
|
|
53 |
import org.gvsig.annotation.AnnotationException; |
|
54 |
|
|
55 |
|
|
56 |
/** |
|
57 |
* This exception is thrown if it is not possible to create an |
|
58 |
* {@link AnnotationPositionCalculator} object. |
|
59 |
* |
|
60 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
|
61 |
*/ |
|
62 |
public class AnnotationPositionCalculatorCreationException extends AnnotationException { |
|
63 |
private static final long serialVersionUID = 8725010909175451070L; |
|
64 |
private String name = null; |
|
65 |
|
|
66 |
private static final String MESSAGE = |
|
67 |
"An error has been produced creating the %(name) AnnotationPositionCalculator"; |
|
68 |
|
|
69 |
private static final String KEY = "_CreationAnnotationPositionCalculatoException"; |
|
70 |
|
|
71 |
/** |
|
72 |
* Creates a new {@link AnnotationPositionCalculatorCreationException}. |
|
73 |
* |
|
74 |
* @param cause |
|
75 |
* the original cause |
|
76 |
*/ |
|
77 |
public AnnotationPositionCalculatorCreationException(String name, Throwable cause) { |
|
78 |
super(MESSAGE, cause, KEY, serialVersionUID); |
|
79 |
setValue("name", name); |
|
80 |
} |
|
81 |
|
|
82 |
} |
|
0 | 83 |
tags/org.gvsig.desktop-2.0.77/org.gvsig.desktop.library/org.gvsig.annotation/org.gvsig.annotation.lib/org.gvsig.annotation.lib.api/src/main/java/org/gvsig/annotation/calculator/AnnotationPositionCalculator.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 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 3 |
|
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 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
25 |
* |
|
26 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
27 |
* of the Valencian Government (CIT) |
|
28 |
* |
|
29 |
* This program is free software; you can redistribute it and/or |
|
30 |
* modify it under the terms of the GNU General Public License |
|
31 |
* as published by the Free Software Foundation; either version 2 |
|
32 |
* of the License, or (at your option) any later version. |
|
33 |
* |
|
34 |
* This program is distributed in the hope that it will be useful, |
|
35 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
36 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
37 |
* GNU General Public License for more details. |
|
38 |
* |
|
39 |
* You should have received a copy of the GNU General Public License |
|
40 |
* along with this program; if not, write to the Free Software |
|
41 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
42 |
* MA 02110-1301, USA. |
|
43 |
* |
|
44 |
*/ |
|
45 |
|
|
46 |
/* |
|
47 |
* AUTHORS (In addition to CIT): |
|
48 |
* 2010 {Prodevelop} {Task} |
|
49 |
*/ |
|
50 |
|
|
51 |
package org.gvsig.annotation.calculator; |
|
52 |
|
|
53 |
import org.gvsig.fmap.dal.feature.Feature; |
|
54 |
import org.gvsig.fmap.geom.primitive.Point; |
|
55 |
|
|
56 |
/** |
|
57 |
* This class calculates the position of an annotation layer. It has a |
|
58 |
* method that calculates the {@link Point} where the annotation has to |
|
59 |
* be displayed. |
|
60 |
* |
|
61 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
|
62 |
*/ |
|
63 |
public interface AnnotationPositionCalculator { |
|
64 |
|
|
65 |
/** |
|
66 |
* This method returns the position where the annotation has to be displayed. |
|
67 |
* @param feature |
|
68 |
* the feature that is used like input. |
|
69 |
* @return |
|
70 |
* the point where the annotation is displayed. |
|
71 |
* @throws AnnotationPositionCalculationException |
|
72 |
* if there is an exception calculating the point |
|
73 |
*/ |
|
74 |
public Point getAnnotationPosition(Feature feature) throws AnnotationPositionCalculationException; |
|
75 |
|
|
76 |
} |
|
77 |
|
|
0 | 78 |
tags/org.gvsig.desktop-2.0.77/org.gvsig.desktop.library/org.gvsig.annotation/org.gvsig.annotation.lib/org.gvsig.annotation.lib.api/src/main/java/org/gvsig/annotation/AnnotationCreationException.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 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 3 |
|
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 |
package org.gvsig.annotation; |
|
25 |
|
|
26 |
/** |
|
27 |
* Exception thrown when there is an error creating an Annotation layer. |
|
28 |
* |
|
29 |
* @author gvSIG team |
|
30 |
* @version $Id$ |
|
31 |
*/ |
|
32 |
public class AnnotationCreationException extends AnnotationException { |
|
33 |
|
|
34 |
private static final long serialVersionUID = -4051458353306878010L; |
|
35 |
|
|
36 |
private static final String MESSAGE = |
|
37 |
"An error has been produced " + "creating the Annotation layer"; |
|
38 |
|
|
39 |
private static final String KEY = "_AnnotationCreationException"; |
|
40 |
|
|
41 |
/** |
|
42 |
* Creates a new {@link AnnotationCreationException}. |
|
43 |
* |
|
44 |
* @param cause |
|
45 |
* the original cause |
|
46 |
*/ |
|
47 |
public AnnotationCreationException(Throwable cause) { |
|
48 |
super(MESSAGE, cause, KEY, serialVersionUID); |
|
49 |
} |
|
50 |
|
|
51 |
public AnnotationCreationException(String message) { |
|
52 |
super(message, KEY, serialVersionUID); |
|
53 |
} |
|
54 |
} |
|
0 | 55 |
tags/org.gvsig.desktop-2.0.77/org.gvsig.desktop.library/org.gvsig.annotation/org.gvsig.annotation.lib/org.gvsig.annotation.lib.api/src/main/java/org/gvsig/annotation/AnnotationCreationFinishAction.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 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 3 |
|
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 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
25 |
* |
|
26 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
27 |
* of the Valencian Government (CIT) |
|
28 |
* |
|
29 |
* This program is free software; you can redistribute it and/or |
|
30 |
* modify it under the terms of the GNU General Public License |
|
31 |
* as published by the Free Software Foundation; either version 2 |
|
32 |
* of the License, or (at your option) any later version. |
|
33 |
* |
|
34 |
* This program is distributed in the hope that it will be useful, |
|
35 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
36 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
37 |
* GNU General Public License for more details. |
|
38 |
* |
|
39 |
* You should have received a copy of the GNU General Public License |
|
40 |
* along with this program; if not, write to the Free Software |
|
41 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
42 |
* MA 02110-1301, USA. |
|
43 |
* |
|
44 |
*/ |
|
45 |
|
|
46 |
/* |
|
47 |
* AUTHORS (In addition to CIT): |
|
48 |
* 2010 {Prodevelop} {Task} |
|
49 |
*/ |
|
50 |
|
|
51 |
package org.gvsig.annotation; |
|
52 |
|
|
53 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
54 |
|
|
55 |
/** |
|
56 |
* Action that can be executed at the end of the annotation |
|
57 |
* creation process. An example of action can be load the destination |
|
58 |
* {@link FeatureStore} like a layer in a view. |
|
59 |
* |
|
60 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
|
61 |
*/ |
|
62 |
public interface AnnotationCreationFinishAction { |
|
63 |
|
|
64 |
/** |
|
65 |
* This method is called at the end of an annotation |
|
66 |
* creation process. |
|
67 |
* @param featureStore |
|
68 |
* the destination store. |
|
69 |
*/ |
|
70 |
public void finished(FeatureStore featureStore); |
|
71 |
} |
|
72 |
|
|
0 | 73 |
tags/org.gvsig.desktop-2.0.77/org.gvsig.desktop.library/org.gvsig.annotation/org.gvsig.annotation.lib/org.gvsig.annotation.lib.api/src/main/java/org/gvsig/annotation/AnnotationLocator.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 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 3 |
|
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 |
package org.gvsig.annotation; |
|
25 |
|
|
26 |
import org.gvsig.tools.locator.BaseLocator; |
|
27 |
import org.gvsig.tools.locator.Locator; |
|
28 |
import org.gvsig.tools.locator.LocatorException; |
|
29 |
|
|
30 |
/** |
|
31 |
* This locator is the entry point for the Annotation library, providing |
|
32 |
* access to all Annotation services through the {@link AnnotationManager} |
|
33 |
* . |
|
34 |
* |
|
35 |
* @author gvSIG team |
|
36 |
* @version $Id$ |
|
37 |
*/ |
|
38 |
public class AnnotationLocator extends BaseLocator { |
|
39 |
|
|
40 |
/** |
|
41 |
* Annotation manager name. |
|
42 |
*/ |
|
43 |
public static final String MANAGER_NAME = "Annotation.manager"; |
|
44 |
|
|
45 |
/** |
|
46 |
* Annotation manager description. |
|
47 |
*/ |
|
48 |
public static final String MANAGER_DESCRIPTION = "Annotation Manager"; |
|
49 |
|
|
50 |
private static final String LOCATOR_NAME = "Annotation.locator"; |
|
51 |
|
|
52 |
/** |
|
53 |
* Unique instance. |
|
54 |
*/ |
|
55 |
private static final AnnotationLocator INSTANCE = |
|
56 |
new AnnotationLocator(); |
|
57 |
|
|
58 |
/** |
|
59 |
* Return the singleton instance. |
|
60 |
* |
|
61 |
* @return the singleton instance |
|
62 |
*/ |
|
63 |
public static AnnotationLocator getInstance() { |
|
64 |
return INSTANCE; |
|
65 |
} |
|
66 |
|
|
67 |
/** |
|
68 |
* Return the Locator's name. |
|
69 |
* |
|
70 |
* @return a String with the Locator's name |
|
71 |
*/ |
|
72 |
public final String getLocatorName() { |
|
73 |
return LOCATOR_NAME; |
|
74 |
} |
|
75 |
|
|
76 |
/** |
|
77 |
* Return a reference to the AnnotationManager. |
|
78 |
* |
|
79 |
* @return a reference to the AnnotationManager |
|
80 |
* @throws LocatorException |
|
81 |
* if there is no access to the class or the class cannot be |
|
82 |
* instantiated |
|
83 |
* @see Locator#get(String) |
|
84 |
*/ |
|
85 |
public static AnnotationManager getManager() throws LocatorException { |
|
86 |
return (AnnotationManager) getInstance().get(MANAGER_NAME); |
|
87 |
} |
|
88 |
|
|
89 |
/** |
|
90 |
* Registers the Class implementing the AnnotationManager interface. |
|
91 |
* |
|
92 |
* @param clazz |
|
93 |
* implementing the AnnotationManager interface |
|
94 |
*/ |
|
95 |
public static void registerManager( |
|
96 |
Class<? extends AnnotationManager> clazz) { |
|
97 |
getInstance().register(MANAGER_NAME, MANAGER_DESCRIPTION, clazz); |
|
98 |
} |
|
99 |
|
|
100 |
} |
|
0 | 101 |
Also available in: Unified diff