Revision 37625
tags/v_2_0_0_Build_2043/extensions/extDwg/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
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 |
|
5 |
http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
6 |
|
|
7 |
<modelVersion>4.0.0</modelVersion> |
|
8 |
<artifactId>org.gvsig.dwg.extension</artifactId> |
|
9 |
<packaging>jar</packaging> |
|
10 |
<version>2.0-SNAPSHOT</version> |
|
11 |
<name>Formats: DWG file format support</name> |
|
12 |
<description>Read support for DWG format.</description> |
|
13 |
<parent> |
|
14 |
<groupId>org.gvsig</groupId> |
|
15 |
<artifactId>gvsig-base-extension-pom</artifactId> |
|
16 |
<version>2.0-SNAPSHOT</version> |
|
17 |
</parent> |
|
18 |
<dependencies> |
|
19 |
<dependency> |
|
20 |
<groupId>org.gvsig</groupId> |
|
21 |
<artifactId>org.gvsig.fmap.dal</artifactId> |
|
22 |
<scope>compile</scope> |
|
23 |
</dependency> |
|
24 |
<dependency> |
|
25 |
<groupId>org.gvsig</groupId> |
|
26 |
<artifactId>org.gvsig.fmap.dal</artifactId> |
|
27 |
<classifier>spi</classifier> |
|
28 |
<scope>compile</scope> |
|
29 |
</dependency> |
|
30 |
<dependency> |
|
31 |
<groupId>org.gvsig</groupId> |
|
32 |
<artifactId>org.gvsig.fmap.dal.file</artifactId> |
|
33 |
<scope>compile</scope> |
|
34 |
</dependency> |
|
35 |
<dependency> |
|
36 |
<groupId>org.gvsig</groupId> |
|
37 |
<artifactId>org.gvsig.symbology.lib.api</artifactId> |
|
38 |
<scope>compile</scope> |
|
39 |
</dependency> |
|
40 |
<dependency> |
|
41 |
<groupId>org.gvsig</groupId> |
|
42 |
<artifactId>org.gvsig.dwg</artifactId> |
|
43 |
<scope>compile</scope> |
|
44 |
</dependency> |
|
45 |
<dependency> |
|
46 |
<groupId>org.gvsig</groupId> |
|
47 |
<artifactId>org.gvsig.app</artifactId> |
|
48 |
<version>2.0-SNAPSHOT</version> |
|
49 |
<scope>compile</scope> |
|
50 |
</dependency> |
|
51 |
<dependency> |
|
52 |
<groupId>org.gvsig</groupId> |
|
53 |
<artifactId>org.gvsig.fmap.mapcontext</artifactId> |
|
54 |
<scope>compile</scope> |
|
55 |
</dependency> |
|
56 |
<dependency> |
|
57 |
<groupId>org.gvsig</groupId> |
|
58 |
<artifactId>org.gvsig.fmap.geometry</artifactId> |
|
59 |
<scope>compile</scope> |
|
60 |
</dependency> |
|
61 |
<dependency> |
|
62 |
<groupId>org.gvsig</groupId> |
|
63 |
<artifactId>org.gvsig.projection</artifactId> |
|
64 |
<scope>compile</scope> |
|
65 |
</dependency> |
|
66 |
<dependency> |
|
67 |
<groupId>org.gvsig</groupId> |
|
68 |
<artifactId>org.gvsig.andami</artifactId> |
|
69 |
<scope>compile</scope> |
|
70 |
</dependency> |
|
71 |
<dependency> |
|
72 |
<groupId>org.gvsig</groupId> |
|
73 |
<artifactId>org.gvsig.timesupport.lib.api</artifactId> |
|
74 |
<scope>compile</scope> |
|
75 |
</dependency> |
|
76 |
<dependency> |
|
77 |
<groupId>org.slf4j</groupId> |
|
78 |
<artifactId>slf4j-api</artifactId> |
|
79 |
<scope>compile</scope> |
|
80 |
</dependency> |
|
81 |
<!-- Test scope --> |
|
82 |
<dependency> |
|
83 |
<groupId>org.gvsig</groupId> |
|
84 |
<artifactId>org.gvsig.fmap.dal</artifactId> |
|
85 |
<classifier>impl</classifier> |
|
86 |
<scope>test</scope> |
|
87 |
</dependency> |
|
88 |
<dependency> |
|
89 |
<groupId>org.gvsig</groupId> |
|
90 |
<artifactId>org.gvsig.fmap.dal</artifactId> |
|
91 |
<classifier>tests</classifier> |
|
92 |
<scope>test</scope> |
|
93 |
</dependency> |
|
94 |
<dependency> |
|
95 |
<groupId>org.gvsig</groupId> |
|
96 |
<artifactId>org.gvsig.fmap.dal.index.spatial</artifactId> |
|
97 |
<classifier>jts</classifier> |
|
98 |
<scope>test</scope> |
|
99 |
</dependency> |
|
100 |
<dependency> |
|
101 |
<groupId>org.gvsig</groupId> |
|
102 |
<artifactId>org.gvsig.fmap.geometry</artifactId> |
|
103 |
<classifier>impl</classifier> |
|
104 |
<scope>test</scope> |
|
105 |
</dependency> |
|
106 |
<dependency> |
|
107 |
<groupId>org.gvsig</groupId> |
|
108 |
<artifactId>org.gvsig.projection</artifactId> |
|
109 |
<classifier>cresques-impl</classifier> |
|
110 |
<scope>test</scope> |
|
111 |
</dependency> |
|
112 |
<dependency> |
|
113 |
<groupId>org.gvsig</groupId> |
|
114 |
<artifactId>org.gvsig.fmap.mapcontext</artifactId> |
|
115 |
<classifier>operation</classifier> |
|
116 |
<scope>test</scope> |
|
117 |
</dependency> |
|
118 |
<dependency> |
|
119 |
<groupId>org.gvsig</groupId> |
|
120 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
121 |
<type>test-jar</type> |
|
122 |
<scope>test</scope> |
|
123 |
</dependency> |
|
124 |
<dependency> |
|
125 |
<groupId>org.gvsig</groupId> |
|
126 |
<artifactId>org.gvsig.metadata.lib.basic.api</artifactId> |
|
127 |
<scope>compile</scope> |
|
128 |
</dependency> |
|
129 |
<dependency> |
|
130 |
<groupId>org.gvsig</groupId> |
|
131 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
132 |
<scope>compile</scope> |
|
133 |
</dependency> |
|
134 |
</dependencies> |
|
135 |
<properties> |
|
136 |
<build-dir>${basedir}/../build</build-dir> |
|
137 |
<eclipse.project.name>extDwg</eclipse.project.name> |
|
138 |
<package.info.state>alpha3</package.info.state> |
|
139 |
</properties> |
|
140 |
<build> |
|
141 |
<sourceDirectory>src</sourceDirectory> |
|
142 |
<testSourceDirectory>src-test</testSourceDirectory> |
|
143 |
<testResources> |
|
144 |
<testResource> |
|
145 |
<directory>src-test</directory> |
|
146 |
</testResource> |
|
147 |
</testResources> |
|
148 |
<resources> |
|
149 |
<resource> |
|
150 |
<directory>resources</directory> |
|
151 |
</resource> |
|
152 |
</resources> |
|
153 |
<plugins> |
|
154 |
<!-- TODO: MAKE TESTS WORK AND REMOVE THIS OPTION --> |
|
155 |
<plugin> |
|
156 |
<groupId>org.apache.maven.plugins</groupId> |
|
157 |
<artifactId>maven-surefire-plugin</artifactId> |
|
158 |
<configuration> |
|
159 |
<skipTests>true</skipTests> |
|
160 |
</configuration> |
|
161 |
</plugin> |
|
162 |
</plugins> |
|
163 |
</build> |
|
164 |
</project> |
|
0 | 165 |
tags/v_2_0_0_Build_2043/extensions/extDwg/resources/org/gvsig/dwg/fmap/dal/store/dwg/DWGMetadata.xml | ||
---|---|---|
1 |
<?xml version="1.0"?> |
|
2 |
<!-- |
|
3 |
Definitions of metadata fields of a DWG file. |
|
4 |
--> |
|
5 |
<definitions> |
|
6 |
<version>1.0.0</version> |
|
7 |
<classes> |
|
8 |
|
|
9 |
<class name="DWG" namespace="Metadata"> |
|
10 |
<extends> |
|
11 |
<class namespace="Metadata" name="SpatialProvider"/> |
|
12 |
</extends> |
|
13 |
<description>Metadata of a DWG store</description> |
|
14 |
<fields> |
|
15 |
</fields> |
|
16 |
</class> |
|
17 |
|
|
18 |
</classes> |
|
19 |
</definitions> |
tags/v_2_0_0_Build_2043/extensions/extDwg/resources/org/gvsig/dwg/fmap/dal/store/dwg/DWGParameters.xml | ||
---|---|---|
1 |
<?xml version= "1.0 "?> |
|
2 |
<definitions> |
|
3 |
<version>1.0.0</version> |
|
4 |
<classes> |
|
5 |
<class name="DWGStoreParameters"> |
|
6 |
<extends> |
|
7 |
<class namespace="dal" name="ProviderParameters"/> |
|
8 |
</extends> |
|
9 |
<description>Store the parameters need to open a dwg file</description> |
|
10 |
<fields> |
|
11 |
<field name="file" type="file" mandatory="true"> |
|
12 |
<description>dwg file</description> |
|
13 |
</field> |
|
14 |
<field name="CRS" type="crs" mandatory="true"> |
|
15 |
<description>The coordinate reference system used in this dwg file</description> |
|
16 |
</field> |
|
17 |
</fields> |
|
18 |
</class> |
|
19 |
</classes> |
|
20 |
</definitions> |
tags/v_2_0_0_Build_2043/extensions/extDwg/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.dwg.fmap.dal.store.dwg.DWGLibrary |
|
2 |
org.gvsig.dwg.fmap.dal.store.dwg.legend.DWGLegendLibrary |
tags/v_2_0_0_Build_2043/extensions/extDwg/distribution/distribution.xml | ||
---|---|---|
1 |
<assembly> |
|
2 |
<id>distribution</id> |
|
3 |
<formats> |
|
4 |
<format>dir</format> |
|
5 |
</formats> |
|
6 |
<fileSets> |
|
7 |
<!-- Extructure for the extension --> |
|
8 |
<fileSet> |
|
9 |
<directory>config</directory> |
|
10 |
<outputDirectory>${extension.install.dir.name} |
|
11 |
</outputDirectory> |
|
12 |
</fileSet> |
|
13 |
<fileSet> |
|
14 |
<directory>images</directory> |
|
15 |
<outputDirectory>/${extension.install.dir.name}/images |
|
16 |
</outputDirectory> |
|
17 |
</fileSet> |
|
18 |
</fileSets> |
|
19 |
<files> |
|
20 |
<file> |
|
21 |
<source>package.info</source> |
|
22 |
<outputDirectory>${extension.install.dir.name} |
|
23 |
</outputDirectory> |
|
24 |
</file> |
|
25 |
</files> |
|
26 |
<!-- |
|
27 |
*********************************************************************** |
|
28 |
--> |
|
29 |
<!-- * *--> |
|
30 |
<!-- |
|
31 |
*********************************************************************** |
|
32 |
--> |
|
33 |
<dependencySets> |
|
34 |
<dependencySet> |
|
35 |
<outputDirectory>${extension.install.dir.name}/${library-dir} |
|
36 |
</outputDirectory> |
|
37 |
<includes> |
|
38 |
<include>org.gvsig:org.gvsig.dwg</include> |
|
39 |
<include>org.gvsig:org.gvsig.dwg.extension</include> |
|
40 |
</includes> |
|
41 |
</dependencySet> |
|
42 |
</dependencySets> |
|
43 |
</assembly> |
|
0 | 44 |
tags/v_2_0_0_Build_2043/extensions/extDwg/buildNumber.properties | ||
---|---|---|
1 |
#maven.buildNumber.plugin properties file |
|
2 |
#Thu Jan 12 18:41:51 CET 2012 |
|
3 |
buildNumber=2043 |
tags/v_2_0_0_Build_2043/extensions/extDwg/src-test/org/gvsig/dwg/fmap/dal/store/dwg/TestDWG.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 |
* 2008 IVER T.I. S.A. {{Task}} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.dwg.fmap.dal.store.dwg; |
|
29 |
|
|
30 |
import java.io.File; |
|
31 |
|
|
32 |
import org.gvsig.fmap.dal.DataStoreParameters; |
|
33 |
import org.gvsig.fmap.dal.exception.DataException; |
|
34 |
import org.gvsig.fmap.dal.feature.BaseTestFeatureStore; |
|
35 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
36 |
|
|
37 |
public class TestDWG extends BaseTestFeatureStore { |
|
38 |
|
|
39 |
protected boolean testDXFInitialized = false; |
|
40 |
|
|
41 |
public static File file_prueba = new File(TestDWG.class.getResource( |
|
42 |
"data/V2000.dwg").getFile()); |
|
43 |
|
|
44 |
/* |
|
45 |
* (non-Javadoc) |
|
46 |
* |
|
47 |
* @see |
|
48 |
* org.gvsig.fmap.dal.feature.BaseTestFeatureStore#getDefaultDataStoreParameters |
|
49 |
* () |
|
50 |
*/ |
|
51 |
public DataStoreParameters getDefaultDataStoreParameters() |
|
52 |
throws DataException { |
|
53 |
DWGStoreParameters dwgParameters = null; |
|
54 |
|
|
55 |
dwgParameters = (DWGStoreParameters) dataManager |
|
56 |
.createStoreParameters(DWGStoreProvider.NAME); |
|
57 |
|
|
58 |
dwgParameters.setFile(file_prueba); |
|
59 |
dwgParameters.setCRS("EPSG:23030"); |
|
60 |
return dwgParameters; |
|
61 |
} |
|
62 |
|
|
63 |
/* |
|
64 |
* (non-Javadoc) |
|
65 |
* |
|
66 |
* @see org.gvsig.fmap.dal.feature.BaseTestFeatureStore#hasExplorer() |
|
67 |
*/ |
|
68 |
public boolean hasExplorer() { |
|
69 |
// TODO Auto-generated method stub |
|
70 |
return false; |
|
71 |
} |
|
72 |
|
|
73 |
public boolean usesResources() { |
|
74 |
return true; |
|
75 |
} |
|
76 |
|
|
77 |
|
|
78 |
public void testLegendAndLabeling() throws Exception { |
|
79 |
DataStoreParameters params = getDefaultDataStoreParameters(); |
|
80 |
FeatureStore store = (FeatureStore) dataManager.openStore(params |
|
81 |
.getDataStoreName(), params); |
|
82 |
|
|
83 |
assertNotNull(store.invokeDynMethod("getLegend", null)); |
|
84 |
assertNotNull(store.invokeDynMethod("getLabeling", null)); |
|
85 |
store.dispose(); |
|
86 |
} |
|
87 |
} |
|
0 | 88 |
tags/v_2_0_0_Build_2043/extensions/extDwg/src-test/org/gvsig/dwg/fmap/dal/store/dwg/TestDWG2004.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 |
* 2009 IVER T.I {{Task}} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.dwg.fmap.dal.store.dwg; |
|
29 |
|
|
30 |
import java.io.File; |
|
31 |
|
|
32 |
public class TestDWG2004 extends TestDWG { |
|
33 |
public static File file_prueba = new File(TestDWG.class.getResource( |
|
34 |
"data/V2004.dwg").getFile()); |
|
35 |
} |
|
0 | 36 |
tags/v_2_0_0_Build_2043/extensions/extDwg/config/config.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
<plugin-config> |
|
3 |
<libraries library-dir="lib"> |
|
4 |
</libraries> |
|
5 |
<depends plugin-name="org.gvsig.app"/> |
|
6 |
<resourceBundle name="text"/> |
|
7 |
<extensions> |
|
8 |
<extension class-name="org.gvsig.dwg.DWGRegisterExtension" |
|
9 |
description="DWG Driver" |
|
10 |
active="true"> |
|
11 |
</extension> |
|
12 |
|
|
13 |
</extensions> |
|
14 |
</plugin-config> |
|
0 | 15 |
tags/v_2_0_0_Build_2043/extensions/extDwg/src/org/gvsig/dwg/DWGRegisterExtension.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.dwg; |
|
23 |
|
|
24 |
import org.gvsig.andami.plugins.Extension; |
|
25 |
import org.gvsig.dwg.fmap.dal.store.dwg.DWGLibrary; |
|
26 |
|
|
27 |
/** |
|
28 |
* Dummy DWG extension, as all the registration happens in the |
|
29 |
* {@link DWGLibrary}. |
|
30 |
* |
|
31 |
* @author gvSIG Team |
|
32 |
*/ |
|
33 |
public class DWGRegisterExtension extends Extension { |
|
34 |
|
|
35 |
public void execute(String actionCommand) { |
|
36 |
// Nothing to do |
|
37 |
} |
|
38 |
|
|
39 |
public void initialize() { |
|
40 |
// Nothing to do |
|
41 |
} |
|
42 |
|
|
43 |
public void postInitialize() { |
|
44 |
super.postInitialize(); |
|
45 |
// Nothing to do |
|
46 |
} |
|
47 |
|
|
48 |
public boolean isEnabled() { |
|
49 |
// Nothing to do |
|
50 |
return false; |
|
51 |
} |
|
52 |
|
|
53 |
public boolean isVisible() { |
|
54 |
// Nothing to do |
|
55 |
return false; |
|
56 |
} |
|
57 |
|
|
58 |
} |
|
0 | 59 |
tags/v_2_0_0_Build_2043/extensions/extDwg/src/org/gvsig/dwg/fmap/dal/store/dwg/legend/DWGGetLabeling.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 |
* 2008 IVER T.I. S.A. {{Task}} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.dwg.fmap.dal.store.dwg.legend; |
|
29 |
|
|
30 |
import org.gvsig.dwg.fmap.dal.store.dwg.DWGStoreProvider; |
|
31 |
import org.gvsig.dwg.fmap.dal.store.dwg.LegendBuilder; |
|
32 |
import org.gvsig.fmap.dal.exception.OpenException; |
|
33 |
import org.gvsig.tools.ToolsLocator; |
|
34 |
import org.gvsig.tools.dynobject.DynClass; |
|
35 |
import org.gvsig.tools.dynobject.DynMethod; |
|
36 |
import org.gvsig.tools.dynobject.DynObject; |
|
37 |
import org.gvsig.tools.dynobject.exception.DynMethodException; |
|
38 |
import org.gvsig.tools.dynobject.exception.DynMethodNotSupportedException; |
|
39 |
|
|
40 |
public class DWGGetLabeling implements DynMethod { |
|
41 |
private static Integer code = null; |
|
42 |
|
|
43 |
static void register(DynClass dwgLegendDynClass) { |
|
44 |
if (code != null) { |
|
45 |
return; |
|
46 |
} |
|
47 |
code = new Integer(ToolsLocator.getDynObjectManager() |
|
48 |
.registerDynMethod(dwgLegendDynClass, new DWGGetLabeling())); |
|
49 |
|
|
50 |
} |
|
51 |
public int getCode() throws DynMethodNotSupportedException { |
|
52 |
return code.intValue(); |
|
53 |
} |
|
54 |
|
|
55 |
public String getDescription() { |
|
56 |
return "DWG Labeling"; |
|
57 |
} |
|
58 |
|
|
59 |
public String getName() { |
|
60 |
return LegendBuilder.DYNMETHOD_GETLABELING_NAME; |
|
61 |
} |
|
62 |
|
|
63 |
public Object invoke(Object self, DynObject context) |
|
64 |
throws DynMethodException { |
|
65 |
try { |
|
66 |
return ((DWGStoreProvider) self).getLabeling(); |
|
67 |
} catch (OpenException e) { |
|
68 |
//FIXME |
|
69 |
throw new RuntimeException(e); |
|
70 |
} |
|
71 |
} |
|
72 |
|
|
73 |
} |
|
0 | 74 |
tags/v_2_0_0_Build_2043/extensions/extDwg/src/org/gvsig/dwg/fmap/dal/store/dwg/legend/DWGGetLegend.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 |
* 2008 IVER T.I. S.A. {{Task}} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.dwg.fmap.dal.store.dwg.legend; |
|
29 |
|
|
30 |
import org.gvsig.dwg.fmap.dal.store.dwg.DWGStoreProvider; |
|
31 |
import org.gvsig.dwg.fmap.dal.store.dwg.LegendBuilder; |
|
32 |
import org.gvsig.fmap.dal.exception.OpenException; |
|
33 |
import org.gvsig.tools.ToolsLocator; |
|
34 |
import org.gvsig.tools.dynobject.DynClass; |
|
35 |
import org.gvsig.tools.dynobject.DynMethod; |
|
36 |
import org.gvsig.tools.dynobject.DynObject; |
|
37 |
import org.gvsig.tools.dynobject.exception.DynMethodException; |
|
38 |
import org.gvsig.tools.dynobject.exception.DynMethodNotSupportedException; |
|
39 |
|
|
40 |
public class DWGGetLegend implements DynMethod { |
|
41 |
private static Integer code = null; |
|
42 |
|
|
43 |
static void register(DynClass dwgLegendDynClass) { |
|
44 |
if (code != null) { |
|
45 |
return; |
|
46 |
} |
|
47 |
code = new Integer(ToolsLocator.getDynObjectManager() |
|
48 |
.registerDynMethod(dwgLegendDynClass, new DWGGetLegend())); |
|
49 |
|
|
50 |
} |
|
51 |
public int getCode() throws DynMethodNotSupportedException { |
|
52 |
return code.intValue(); |
|
53 |
} |
|
54 |
|
|
55 |
public String getDescription() { |
|
56 |
return "DWG Legend"; |
|
57 |
} |
|
58 |
|
|
59 |
public String getName() { |
|
60 |
return LegendBuilder.DYNMETHOD_GETLEGEND_NAME; |
|
61 |
} |
|
62 |
|
|
63 |
public Object invoke(Object self, DynObject context) |
|
64 |
throws DynMethodException { |
|
65 |
try { |
|
66 |
return ((DWGStoreProvider) self).getLegend(); |
|
67 |
} catch (OpenException e) { |
|
68 |
//FIXME |
|
69 |
throw new RuntimeException(e); |
|
70 |
} |
|
71 |
} |
|
72 |
|
|
73 |
} |
|
0 | 74 |
tags/v_2_0_0_Build_2043/extensions/extDwg/src/org/gvsig/dwg/fmap/dal/store/dwg/legend/DWGLegendLibrary.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 |
* 2008 IVER T.I. S.A. {{Task}} |
|
26 |
*/ |
|
27 |
|
|
28 |
/** |
|
29 |
* |
|
30 |
*/ |
|
31 |
package org.gvsig.dwg.fmap.dal.store.dwg.legend; |
|
32 |
|
|
33 |
import org.gvsig.dwg.fmap.dal.store.dwg.DWGLibrary; |
|
34 |
import org.gvsig.dwg.fmap.dal.store.dwg.DWGStoreProvider; |
|
35 |
import org.gvsig.fmap.dal.DALLibrary; |
|
36 |
import org.gvsig.metadata.MetadataLibrary; |
|
37 |
import org.gvsig.metadata.MetadataLocator; |
|
38 |
import org.gvsig.tools.dynobject.DynClass; |
|
39 |
import org.gvsig.tools.library.AbstractLibrary; |
|
40 |
import org.gvsig.tools.library.LibraryException; |
|
41 |
|
|
42 |
/** |
|
43 |
* @author jmvivo |
|
44 |
* |
|
45 |
*/ |
|
46 |
public class DWGLegendLibrary extends AbstractLibrary { |
|
47 |
|
|
48 |
@Override |
|
49 |
public void doRegistration() { |
|
50 |
registerAsImplementationOf(DWGLegendLibrary.class); |
|
51 |
require(MetadataLibrary.class); |
|
52 |
require(DWGLibrary.class); |
|
53 |
require(DALLibrary.class); |
|
54 |
} |
|
55 |
|
|
56 |
@Override |
|
57 |
protected void doInitialize() throws LibraryException { |
|
58 |
} |
|
59 |
|
|
60 |
@Override |
|
61 |
protected void doPostInitialize() throws LibraryException { |
|
62 |
DynClass dynClass = (DynClass) MetadataLocator.getMetadataManager() |
|
63 |
.getDefinition(DWGStoreProvider.METADATA_DEFINITION_NAME); |
|
64 |
|
|
65 |
DWGGetLegendBuilder.register(dynClass); |
|
66 |
DWGGetLegend.register(dynClass); |
|
67 |
DWGGetLabeling.register(dynClass); |
|
68 |
} |
|
69 |
} |
|
0 | 70 |
tags/v_2_0_0_Build_2043/extensions/extDwg/src/org/gvsig/dwg/fmap/dal/store/dwg/legend/DWGGetLegendBuilder.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 |
* 2008 IVER T.I. S.A. {{Task}} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.dwg.fmap.dal.store.dwg.legend; |
|
29 |
|
|
30 |
import org.gvsig.dwg.fmap.dal.store.dwg.LegendBuilder; |
|
31 |
import org.gvsig.tools.ToolsLocator; |
|
32 |
import org.gvsig.tools.dynobject.DynClass; |
|
33 |
import org.gvsig.tools.dynobject.DynMethod; |
|
34 |
import org.gvsig.tools.dynobject.DynObject; |
|
35 |
import org.gvsig.tools.dynobject.exception.DynMethodException; |
|
36 |
import org.gvsig.tools.dynobject.exception.DynMethodNotSupportedException; |
|
37 |
|
|
38 |
public class DWGGetLegendBuilder implements DynMethod { |
|
39 |
private static Integer code = null; |
|
40 |
|
|
41 |
static void register(DynClass dwgLegendDynClass) { |
|
42 |
if (code != null) { |
|
43 |
return; |
|
44 |
} |
|
45 |
code = new Integer(ToolsLocator.getDynObjectManager() |
|
46 |
.registerDynMethod( |
|
47 |
dwgLegendDynClass, new DWGGetLegendBuilder())); |
|
48 |
|
|
49 |
} |
|
50 |
public int getCode() throws DynMethodNotSupportedException { |
|
51 |
return code.intValue(); |
|
52 |
} |
|
53 |
|
|
54 |
public String getDescription() { |
|
55 |
return "DWG LegendBuilder creator"; |
|
56 |
} |
|
57 |
|
|
58 |
public String getName() { |
|
59 |
return LegendBuilder.DYNMETHOD_BUILDER_NAME; |
|
60 |
} |
|
61 |
|
|
62 |
public Object invoke(Object self, DynObject context) |
|
63 |
throws DynMethodException { |
|
64 |
return new DWGLegendBuilder(); |
|
65 |
} |
|
66 |
|
|
67 |
} |
|
0 | 68 |
tags/v_2_0_0_Build_2043/extensions/extDwg/src/org/gvsig/dwg/fmap/dal/store/dwg/legend/DWGLegendBuilder.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 |
* 2008 IVER T.I. S.A. {{Task}} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.dwg.fmap.dal.store.dwg.legend; |
|
29 |
|
|
30 |
import java.awt.Color; |
|
31 |
|
|
32 |
import org.gvsig.dwg.fmap.dal.store.dwg.DWGStoreProvider; |
|
33 |
import org.gvsig.dwg.fmap.dal.store.dwg.LegendBuilder; |
|
34 |
import org.gvsig.dxf.px.dxf.AcadColor; |
|
35 |
import org.gvsig.fmap.dal.DataTypes; |
|
36 |
import org.gvsig.fmap.dal.feature.spi.FeatureProvider; |
|
37 |
import org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider; |
|
38 |
import org.gvsig.fmap.geom.Geometry; |
|
39 |
import org.gvsig.fmap.mapcontext.MapContextLocator; |
|
40 |
import org.gvsig.fmap.mapcontext.rendering.legend.IVectorialUniqueValueLegend; |
|
41 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol; |
|
42 |
import org.gvsig.symbology.SymbologyLocator; |
|
43 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.styling.IAttrInTableLabelingStrategy; |
|
44 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.fill.IFillSymbol; |
|
45 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.line.ILineSymbol; |
|
46 |
|
|
47 |
public class DWGLegendBuilder implements LegendBuilder { |
|
48 |
|
|
49 |
|
|
50 |
private IVectorialUniqueValueLegend defaultLegend = null; |
|
51 |
private IAttrInTableLabelingStrategy labelingStragegy = null; |
|
52 |
|
|
53 |
public void begin() { |
|
54 |
// Nothing to do |
|
55 |
} |
|
56 |
|
|
57 |
public void end() { |
|
58 |
// Nothing to do |
|
59 |
} |
|
60 |
|
|
61 |
public Object getLegend() { |
|
62 |
return defaultLegend; |
|
63 |
} |
|
64 |
|
|
65 |
public LegendBuilder initialize(FeatureStoreProvider store) { |
|
66 |
defaultLegend = (IVectorialUniqueValueLegend) MapContextLocator |
|
67 |
.getMapContextManager().createLegend( |
|
68 |
IVectorialUniqueValueLegend.LEGEND_NAME); |
|
69 |
defaultLegend.setShapeType(Geometry.TYPES.GEOMETRY); |
|
70 |
defaultLegend |
|
71 |
.setClassifyingFieldNames(new String[] { DWGStoreProvider.NAME_FIELD_COLOR }); |
|
72 |
defaultLegend.setClassifyingFieldTypes(new int[] { DataTypes.INT }); |
|
73 |
|
|
74 |
ISymbol myDefaultSymbol = |
|
75 |
MapContextLocator.getSymbolManager() |
|
76 |
.createSymbol(Geometry.TYPES.GEOMETRY, Color.BLACK); |
|
77 |
|
|
78 |
defaultLegend.setDefaultSymbol(myDefaultSymbol); |
|
79 |
|
|
80 |
|
|
81 |
labelingStragegy = |
|
82 |
SymbologyLocator.getSymbologyManager() |
|
83 |
.createAttrInTableLabelingStrategy(); |
|
84 |
labelingStragegy.setTextField(DWGStoreProvider.NAME_FIELD_TEXT); |
|
85 |
labelingStragegy |
|
86 |
.setRotationField(DWGStoreProvider.NAME_FIELD_ROTATIONTEXT); |
|
87 |
labelingStragegy.setHeightField(DWGStoreProvider.NAME_FIELD_HEIGHTTEXT); |
|
88 |
labelingStragegy.setUnit(1); // MapContext.NAMES[1] (meters) |
|
89 |
return this; |
|
90 |
} |
|
91 |
|
|
92 |
public void process(FeatureProvider feature) { |
|
93 |
Integer clave = (Integer) feature.get("Color"); |
|
94 |
if (clave == null) { |
|
95 |
return; |
|
96 |
} |
|
97 |
if (defaultLegend.getSymbolByValue(clave) == null) { |
|
98 |
ISymbol theSymbol; |
|
99 |
Color color = null; |
|
100 |
try { |
|
101 |
color = AcadColor.getColor(clave.intValue()); |
|
102 |
} catch (ArrayIndexOutOfBoundsException e) { |
|
103 |
color = AcadColor.getColor(255); |
|
104 |
} |
|
105 |
// jaume, moved to ISymbol |
|
106 |
theSymbol = |
|
107 |
MapContextLocator.getSymbolManager().createSymbol( |
|
108 |
Geometry.TYPES.GEOMETRY, color); |
|
109 |
|
|
110 |
theSymbol.setDescription(clave.toString()); |
|
111 |
// Asigna los colores de Autocad a los |
|
112 |
// bordes de los pol?gonos y pone el relleno transparente. |
|
113 |
if (theSymbol instanceof IFillSymbol) { |
|
114 |
((IFillSymbol) theSymbol).getOutline().setLineColor(color); |
|
115 |
Color fillColor = new Color(color.getRed(), color.getGreen(), color.getBlue(), 0); |
|
116 |
((IFillSymbol) theSymbol).setFillColor(fillColor); |
|
117 |
} |
|
118 |
// Asigna los colores de Autocad a las l?neas |
|
119 |
if (theSymbol instanceof ILineSymbol) { |
|
120 |
((ILineSymbol) theSymbol).setLineColor(color); |
|
121 |
} |
|
122 |
if (theSymbol != null) { |
|
123 |
defaultLegend.addSymbol(clave, theSymbol); |
|
124 |
} |
|
125 |
} |
|
126 |
|
|
127 |
} |
|
128 |
|
|
129 |
public Object getLabeling() { |
|
130 |
return labelingStragegy; |
|
131 |
} |
|
132 |
|
|
133 |
|
|
134 |
} |
|
0 | 135 |
tags/v_2_0_0_Build_2043/extensions/extDwg/src/org/gvsig/dwg/fmap/dal/store/dwg/UnsupportedDWGVersionException.java | ||
---|---|---|
1 |
package org.gvsig.dwg.fmap.dal.store.dwg; |
|
2 |
|
|
3 |
import org.gvsig.dwg.lib.DwgVersionNotSupportedException; |
|
4 |
import org.gvsig.fmap.dal.exception.DataException; |
|
5 |
|
|
6 |
public class UnsupportedDWGVersionException extends DataException { |
|
7 |
|
|
8 |
/** |
|
9 |
* |
|
10 |
*/ |
|
11 |
private static final long serialVersionUID = -7335241420683266251L; |
|
12 |
private final static String MESSAGE_FORMAT = "Unssuported version of DWG of file '%(file)'. Try to convert using Autodesk convertor from '%(autodeskurl)'"; |
|
13 |
private final static String MESSAGE_KEY = "_UnsupportedDWGVersionException"; |
|
14 |
|
|
15 |
public final static String AUTODESK_URL = "http://usa.autodesk.com/adsk/servlet/item?siteID=123112&id=7024151"; |
|
16 |
|
|
17 |
public UnsupportedDWGVersionException(String file, |
|
18 |
DwgVersionNotSupportedException cause) { |
|
19 |
super(MESSAGE_FORMAT, cause, MESSAGE_KEY, serialVersionUID); |
|
20 |
setValue("file", file); |
|
21 |
setValue("autodeskurl", AUTODESK_URL); |
|
22 |
} |
|
23 |
} |
|
0 | 24 |
tags/v_2_0_0_Build_2043/extensions/extDwg/src/org/gvsig/dwg/fmap/dal/store/dwg/DWGStoreParameters.java | ||
---|---|---|
1 |
package org.gvsig.dwg.fmap.dal.store.dwg; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
|
|
5 |
import org.cresques.cts.IProjection; |
|
6 |
import org.gvsig.fmap.dal.DataStoreParameters; |
|
7 |
import org.gvsig.fmap.dal.FileHelper; |
|
8 |
import org.gvsig.fmap.dal.feature.EditableFeatureType; |
|
9 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
10 |
import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters; |
|
11 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemStoreParameters; |
|
12 |
import org.gvsig.fmap.dal.spi.AbstractDataParameters; |
|
13 |
import org.gvsig.fmap.dal.spi.DataStoreProviderServices; |
|
14 |
import org.gvsig.tools.dynobject.DelegatedDynObject; |
|
15 |
|
|
16 |
public class DWGStoreParameters extends AbstractDataParameters implements |
|
17 |
DataStoreParameters, FilesystemStoreParameters, |
|
18 |
NewFeatureStoreParameters { |
|
19 |
|
|
20 |
public static final String PARAMETERS_DEFINITION_NAME = "DWGStoreParameters"; |
|
21 |
|
|
22 |
private static final String FIELD_FILE = "file"; |
|
23 |
private static final String FIELD_CRS = "CRS"; |
|
24 |
|
|
25 |
private DelegatedDynObject parameters; |
|
26 |
|
|
27 |
public DWGStoreParameters() { |
|
28 |
this(PARAMETERS_DEFINITION_NAME); |
|
29 |
} |
|
30 |
|
|
31 |
protected DWGStoreParameters(String parametersDefinitionName) { |
|
32 |
this(parametersDefinitionName, DWGStoreProvider.NAME); |
|
33 |
} |
|
34 |
|
|
35 |
public DWGStoreParameters(String parametersDefinitionName, String name) { |
|
36 |
super(); |
|
37 |
this.parameters = (DelegatedDynObject) FileHelper |
|
38 |
.newParameters(parametersDefinitionName); |
|
39 |
this |
|
40 |
.setDynValue(DataStoreProviderServices.PROVIDER_PARAMTER_NAME, |
|
41 |
name); |
|
42 |
} |
|
43 |
|
|
44 |
protected DelegatedDynObject getDelegatedDynObject() { |
|
45 |
return parameters; |
|
46 |
} |
|
47 |
|
|
48 |
public String getDataStoreName() { |
|
49 |
return (String) this |
|
50 |
.getDynValue(DataStoreProviderServices.PROVIDER_PARAMTER_NAME); |
|
51 |
} |
|
52 |
|
|
53 |
public String getDescription() { |
|
54 |
return this.getDynClass().getDescription(); |
|
55 |
} |
|
56 |
|
|
57 |
public void setCRS(IProjection crs) { |
|
58 |
setDynValue(FIELD_CRS, crs); |
|
59 |
} |
|
60 |
|
|
61 |
public void setCRS(String crs) { |
|
62 |
setDynValue(FIELD_CRS, crs); |
|
63 |
} |
|
64 |
|
|
65 |
public IProjection getCRS() { |
|
66 |
return (IProjection) getDynValue(FIELD_CRS); |
|
67 |
} |
|
68 |
|
|
69 |
public String getFileName() { |
|
70 |
return this.getFile().getPath(); |
|
71 |
} |
|
72 |
|
|
73 |
public void setFileName(String file) { |
|
74 |
setDynValue(FIELD_FILE, file); |
|
75 |
} |
|
76 |
|
|
77 |
public boolean isValid() { |
|
78 |
if (getCRS() == null) { |
|
79 |
return false; |
|
80 |
} |
|
81 |
if (getFile() == null) { |
|
82 |
return false; |
|
83 |
} |
|
84 |
return true; |
|
85 |
} |
|
86 |
|
|
87 |
public File getFile() { |
|
88 |
return (File) this.getDynValue(FIELD_FILE); |
|
89 |
} |
|
90 |
|
|
91 |
public void setFile(File file) { |
|
92 |
this.setDynValue(FIELD_FILE, file); |
|
93 |
} |
|
94 |
|
|
95 |
public EditableFeatureType getDefaultFeatureType() { |
|
96 |
return null; //TODO ???? |
|
97 |
} |
|
98 |
|
|
99 |
public void setDefaultFeatureType(FeatureType defaultFeatureType) { |
|
100 |
throw new UnsupportedOperationException(); |
|
101 |
} |
|
102 |
|
|
103 |
} |
|
0 | 104 |
tags/v_2_0_0_Build_2043/extensions/extDwg/src/org/gvsig/dwg/fmap/dal/store/dwg/LegendBuilder.java | ||
---|---|---|
1 |
package org.gvsig.dwg.fmap.dal.store.dwg; |
|
2 |
|
|
3 |
import org.gvsig.fmap.dal.feature.spi.FeatureProvider; |
|
4 |
import org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider; |
|
5 |
|
|
6 |
|
|
7 |
public interface LegendBuilder { |
|
8 |
|
|
9 |
final public static String DYNMETHOD_BUILDER_NAME = "getLegendBuilder"; |
|
10 |
final public static String DYNMETHOD_GETLEGEND_NAME = "getLegend"; |
|
11 |
final public static String DYNMETHOD_GETLABELING_NAME = "getLabeling"; |
|
12 |
|
|
13 |
public LegendBuilder initialize(FeatureStoreProvider store); |
|
14 |
|
|
15 |
public void begin(); |
|
16 |
|
|
17 |
public void process(FeatureProvider feature); |
|
18 |
|
|
19 |
public void end(); |
|
20 |
|
|
21 |
public Object getLegend(); |
|
22 |
public Object getLabeling(); |
|
23 |
|
|
24 |
} |
|
0 | 25 |
tags/v_2_0_0_Build_2043/extensions/extDwg/src/org/gvsig/dwg/fmap/dal/store/dwg/DWGLibrary.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 |
* 2008 IVER T.I. S.A. {{Task}} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.dwg.fmap.dal.store.dwg; |
|
29 |
|
|
30 |
import org.gvsig.fmap.dal.DALFileLibrary; |
|
31 |
import org.gvsig.fmap.dal.DALFileLocator; |
|
32 |
import org.gvsig.fmap.dal.DALLibrary; |
|
33 |
import org.gvsig.fmap.dal.DALLocator; |
|
34 |
import org.gvsig.fmap.dal.FileHelper; |
|
35 |
import org.gvsig.fmap.dal.spi.DataManagerProviderServices; |
|
36 |
import org.gvsig.metadata.MetadataLibrary; |
|
37 |
import org.gvsig.metadata.exceptions.MetadataException; |
|
38 |
import org.gvsig.tools.ToolsLocator; |
|
39 |
import org.gvsig.tools.dynobject.DynClass; |
|
40 |
import org.gvsig.tools.dynobject.DynField; |
|
41 |
import org.gvsig.tools.dynobject.DynObjectManager; |
|
42 |
import org.gvsig.tools.library.AbstractLibrary; |
|
43 |
import org.gvsig.tools.library.LibraryException; |
|
44 |
|
|
45 |
public class DWGLibrary extends AbstractLibrary { |
|
46 |
|
|
47 |
@Override |
|
48 |
public void doRegistration() { |
|
49 |
registerAsImplementationOf(DWGLibrary.class); |
|
50 |
require(DALLibrary.class); |
|
51 |
require(DALFileLibrary.class); |
|
52 |
require(MetadataLibrary.class); |
|
53 |
} |
|
54 |
|
|
55 |
@Override |
|
56 |
protected void doInitialize() throws LibraryException { |
|
57 |
} |
|
58 |
|
|
59 |
@Override |
|
60 |
protected void doPostInitialize() throws LibraryException { |
|
61 |
FileHelper.registerParametersDefinition( |
|
62 |
DWGStoreParameters.PARAMETERS_DEFINITION_NAME, |
|
63 |
DWGStoreParameters.class, |
|
64 |
"DWGParameters.xml" |
|
65 |
); |
|
66 |
try { |
|
67 |
FileHelper.registerMetadataDefinition( |
|
68 |
DWGStoreProvider.METADATA_DEFINITION_NAME, |
|
69 |
DWGStoreProvider.class, |
|
70 |
"DWGMetadata.xml" |
|
71 |
); |
|
72 |
} catch (MetadataException e) { |
|
73 |
throw new LibraryException(getClass(), e); |
|
74 |
} |
|
75 |
|
|
76 |
DataManagerProviderServices dataman = (DataManagerProviderServices) DALLocator |
|
77 |
.getDataManager(); |
|
78 |
|
|
79 |
if (!dataman.getStoreProviders().contains(DWGStoreProvider.NAME)) { |
|
80 |
dataman.registerStoreProvider(DWGStoreProvider.NAME, |
|
81 |
DWGStoreProvider.class, DWGStoreParameters.class); |
|
82 |
} |
|
83 |
|
|
84 |
DALFileLocator.getFilesystemServerExplorerManager().registerProvider( |
|
85 |
DWGStoreProvider.NAME, DWGStoreProvider.DESCRIPTION, |
|
86 |
DWGFilesystemServerProvider.class); |
|
87 |
|
|
88 |
DynObjectManager dynMan = ToolsLocator.getDynObjectManager(); |
|
89 |
DynClass dynClass = dynMan.get( |
|
90 |
DWGStoreProvider.METADATA_DEFINITION_NAME); |
|
91 |
DynField field; |
|
92 |
if (dynClass == null) { |
|
93 |
dynClass = dynMan.add( |
|
94 |
DWGStoreProvider.METADATA_DEFINITION_NAME); |
|
95 |
|
|
96 |
} |
|
97 |
} |
|
98 |
} |
|
0 | 99 |
tags/v_2_0_0_Build_2043/extensions/extDwg/src/org/gvsig/dwg/fmap/dal/store/dwg/DWGFilesystemServerProvider.java | ||
---|---|---|
1 |
package org.gvsig.dwg.fmap.dal.store.dwg; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
|
|
5 |
import org.gvsig.fmap.dal.DALLocator; |
|
6 |
import org.gvsig.fmap.dal.DataManager; |
|
7 |
import org.gvsig.fmap.dal.DataServerExplorer; |
|
8 |
import org.gvsig.fmap.dal.DataStoreParameters; |
|
9 |
import org.gvsig.fmap.dal.NewDataStoreParameters; |
|
10 |
import org.gvsig.fmap.dal.exception.CreateException; |
|
11 |
import org.gvsig.fmap.dal.exception.DataException; |
|
12 |
import org.gvsig.fmap.dal.exception.FileNotFoundException; |
|
13 |
import org.gvsig.fmap.dal.exception.RemoveException; |
|
14 |
import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters; |
|
15 |
import org.gvsig.fmap.dal.resource.spi.ResourceConsumer; |
|
16 |
import org.gvsig.fmap.dal.resource.spi.ResourceProvider; |
|
17 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.impl.AbstractFilesystemServerExplorerProvider; |
|
18 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.spi.FilesystemServerExplorerProvider; |
|
19 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.spi.FilesystemServerExplorerProviderServices; |
|
20 |
|
|
21 |
public class DWGFilesystemServerProvider extends AbstractFilesystemServerExplorerProvider |
|
22 |
implements FilesystemServerExplorerProvider, ResourceConsumer { |
|
23 |
|
|
24 |
//private FilesystemServerExplorerProviderServices serverExplorer; |
|
25 |
|
|
26 |
public String getDataStoreProviderName() { |
|
27 |
return DWGStoreProvider.NAME; |
|
28 |
} |
|
29 |
|
|
30 |
public int getMode() { |
|
31 |
return DataServerExplorer.MODE_FEATURE | DataServerExplorer.MODE_GEOMETRY; |
|
32 |
} |
|
33 |
|
|
34 |
public boolean accept(File pathname) { |
|
35 |
return (pathname.getName().toLowerCase().endsWith(".dwg")); |
|
36 |
} |
|
37 |
|
|
38 |
public String getDescription() { |
|
39 |
return DWGStoreProvider.DESCRIPTION; |
|
40 |
} |
|
41 |
|
|
42 |
public DataStoreParameters getParameters(File file) throws DataException { |
|
43 |
DataManager manager = DALLocator.getDataManager(); |
|
44 |
DWGStoreParameters params = (DWGStoreParameters) manager |
|
45 |
.createStoreParameters(this |
|
46 |
.getDataStoreProviderName()); |
|
47 |
params.setFileName(file.getPath()); |
|
48 |
return params; |
|
49 |
} |
|
50 |
|
|
51 |
public boolean canCreate() { |
|
52 |
return true; |
|
53 |
} |
|
54 |
|
|
55 |
public boolean canCreate(NewDataStoreParameters parameters) { |
|
56 |
if (!(parameters instanceof DWGStoreParameters)) { |
|
57 |
throw new IllegalArgumentException(); // FIXME ??? |
|
58 |
} |
|
59 |
DWGStoreParameters dwgParams = (DWGStoreParameters) parameters; |
|
60 |
// TODO comporbar si el ftype es correcto (para este formato es fijo) |
|
61 |
File file = new File(dwgParams.getFileName()); |
|
62 |
|
|
63 |
if (dwgParams.getCRS() == null) { |
|
64 |
return false; |
|
65 |
} |
|
66 |
// TODO comprobamos extension del fichero ?? |
|
67 |
if (file.exists()) { |
|
68 |
return file.canWrite(); |
|
69 |
} else { |
|
70 |
return file.getParentFile().canWrite(); |
|
71 |
} |
|
72 |
} |
|
73 |
|
|
74 |
public void create(NewDataStoreParameters parameters, boolean overwrite) |
|
75 |
throws CreateException { |
|
76 |
// FIXME Exception |
|
77 |
throw new UnsupportedOperationException(); |
|
78 |
} |
|
79 |
|
|
80 |
public NewDataStoreParameters getCreateParameters() throws DataException { |
|
81 |
return (NewFeatureStoreParameters) DALLocator.getDataManager() |
|
82 |
.createStoreParameters(this.getDataStoreProviderName()); |
|
83 |
} |
|
84 |
|
|
85 |
public void initialize( |
|
86 |
FilesystemServerExplorerProviderServices serverExplorer) { |
|
87 |
//this.serverExplorer = serverExplorer; |
|
88 |
} |
|
89 |
|
|
90 |
public void remove(DataStoreParameters parameters) throws RemoveException { |
|
91 |
File file = new File(((DWGStoreParameters) parameters).getFileName()); |
|
92 |
if (!file.exists()) { |
|
93 |
throw new RemoveException(this.getDataStoreProviderName(), |
|
94 |
new FileNotFoundException(file)); |
|
95 |
} |
|
96 |
if (!file.delete()) { |
|
97 |
// FIXME throws ??? |
|
98 |
} |
|
99 |
|
|
100 |
} |
|
101 |
|
|
102 |
public boolean closeResourceRequested(ResourceProvider resource) { |
|
103 |
// while it is using a resource anyone can't close it |
|
104 |
return false; |
|
105 |
} |
|
106 |
|
|
107 |
/* |
|
108 |
* (non-Javadoc) |
|
109 |
* |
|
110 |
* @see |
|
111 |
* org.gvsig.fmap.dal.resource.spi.ResourceConsumer#resourceChanged(org. |
|
112 |
* gvsig.fmap.dal.resource.spi.ResourceProvider) |
|
113 |
*/ |
|
114 |
public void resourceChanged(ResourceProvider resource) { |
|
115 |
//Do nothing |
|
116 |
|
|
117 |
} |
|
118 |
|
|
119 |
|
|
120 |
} |
|
0 | 121 |
tags/v_2_0_0_Build_2043/extensions/extDwg/src/org/gvsig/dwg/fmap/dal/store/dwg/DWGStoreProvider.java | ||
---|---|---|
1 |
package org.gvsig.dwg.fmap.dal.store.dwg; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
import java.io.IOException; |
|
5 |
import java.util.ArrayList; |
|
6 |
import java.util.HashMap; |
|
7 |
import java.util.Iterator; |
|
8 |
import java.util.List; |
|
9 |
import java.util.Map; |
|
10 |
|
|
11 |
import org.cresques.cts.IProjection; |
|
12 |
import org.gvsig.dwg.lib.DwgFile; |
|
13 |
import org.gvsig.dwg.lib.DwgObject; |
|
14 |
import org.gvsig.dwg.lib.DwgVersionNotSupportedException; |
|
15 |
import org.gvsig.dwg.lib.IDwg2FMap; |
|
16 |
import org.gvsig.dwg.lib.IDwg3DTestable; |
|
17 |
import org.gvsig.dwg.lib.objects.DwgMText; |
|
18 |
import org.gvsig.dwg.lib.objects.DwgText; |
|
19 |
import org.gvsig.fmap.dal.DALLocator; |
|
20 |
import org.gvsig.fmap.dal.DataManager; |
|
21 |
import org.gvsig.fmap.dal.DataServerExplorer; |
|
22 |
import org.gvsig.fmap.dal.DataStoreNotification; |
|
23 |
import org.gvsig.fmap.dal.DataTypes; |
|
24 |
import org.gvsig.fmap.dal.FileHelper; |
|
25 |
import org.gvsig.fmap.dal.exception.DataException; |
|
26 |
import org.gvsig.fmap.dal.exception.InitializeException; |
|
27 |
import org.gvsig.fmap.dal.exception.OpenException; |
|
28 |
import org.gvsig.fmap.dal.exception.ReadException; |
|
29 |
import org.gvsig.fmap.dal.exception.ValidateDataParametersException; |
|
30 |
import org.gvsig.fmap.dal.feature.EditableFeatureAttributeDescriptor; |
|
31 |
import org.gvsig.fmap.dal.feature.EditableFeatureType; |
|
32 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
33 |
import org.gvsig.fmap.dal.feature.exception.CreateGeometryException; |
|
34 |
import org.gvsig.fmap.dal.feature.exception.PerformEditingException; |
|
35 |
import org.gvsig.fmap.dal.feature.spi.FeatureProvider; |
|
36 |
import org.gvsig.fmap.dal.feature.spi.FeatureStoreProviderServices; |
|
37 |
import org.gvsig.fmap.dal.feature.spi.memory.AbstractMemoryStoreProvider; |
|
38 |
import org.gvsig.fmap.dal.resource.ResourceAction; |
|
39 |
import org.gvsig.fmap.dal.resource.exception.AccessResourceException; |
|
40 |
import org.gvsig.fmap.dal.resource.file.FileResource; |
Also available in: Unified diff