Revision 33071

View differences:

tags/v2_0_0_Build_2009/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
	<groupId>org.gvsig</groupId>
9
	<artifactId>org.gvsig.dwg.extension</artifactId>
10
	<packaging>jar</packaging>
11
	<version>2.0-SNAPSHOT</version>
12
	<name>extDwg</name>
13
	<url>http://maven.apache.org</url>
14
	<parent>
15
		<groupId>org.gvsig</groupId>
16
		<artifactId>gvsig-base-extension-pom</artifactId>
17
		<version>2.0-SNAPSHOT</version>
18
	</parent>	
19
	<distributionManagement>
20
		<site>
21
			<id>gvsig-repository</id>
22
			<url>${site-repository}/</url>
23
		</site>
24
	</distributionManagement>
25

  
26
	<dependencies>
27
		<dependency>
28
			<groupId>org.gvsig</groupId>
29
			<artifactId>org.gvsig.fmap.dal</artifactId>
30
			<version>2.0-SNAPSHOT</version>
31
		</dependency>
32
		<dependency>
33
			<groupId>org.gvsig</groupId>
34
			<artifactId>org.gvsig.fmap.dal</artifactId>
35
			<version>2.0-SNAPSHOT</version>
36
			<classifier>spi</classifier>
37
		</dependency>				
38
		<dependency>
39
			<groupId>org.gvsig</groupId>
40
			<artifactId>org.gvsig.fmap.dal.file</artifactId>
41
			<version>2.0-SNAPSHOT</version>
42
		</dependency>
43
		<dependency>
44
			<groupId>org.gvsig</groupId>
45
			<artifactId>org.gvsig.symbology</artifactId>
46
			<version>2.0-SNAPSHOT</version>
47
		</dependency>		
48
		<dependency>
49
			<groupId>org.gvsig</groupId>
50
			<artifactId>org.gvsig.dwg</artifactId>
51
			<version>2.0-SNAPSHOT</version>
52
		</dependency>
53
	    <dependency>
54
	      <groupId>org.gvsig</groupId>
55
	      <artifactId>org.gvsig.app</artifactId>
56
	      <version>2.0-SNAPSHOT</version>
57
	    </dependency>
58
	    <dependency>
59
			<groupId>org.gvsig</groupId>
60
			<artifactId>org.gvsig.fmap.mapcontext</artifactId>
61
			<version>2.0-SNAPSHOT</version>
62
		</dependency>
63
	    <!-- Test scope -->
64
		<dependency>
65
			<groupId>org.gvsig</groupId>
66
			<artifactId>org.gvsig.fmap.dal</artifactId>
67
			<version>2.0-SNAPSHOT</version>
68
			<classifier>impl</classifier>
69
			<scope>test</scope>
70
		</dependency>	
71
		<dependency>
72
			<groupId>org.gvsig</groupId>
73
			<artifactId>org.gvsig.fmap.dal</artifactId>
74
			<version>2.0-SNAPSHOT</version>
75
			<classifier>tests</classifier>
76
			<scope>test</scope>
77
		</dependency>
78
		<dependency>
79
			<groupId>org.gvsig</groupId>
80
			<artifactId>org.gvsig.fmap.dal.index.spatial</artifactId>
81
			<version>2.0-SNAPSHOT</version>
82
			<classifier>jts</classifier>
83
			<scope>test</scope>
84
		</dependency>
85
		<dependency>
86
			<groupId>org.gvsig</groupId>
87
			<artifactId>org.gvsig.fmap.geometry</artifactId>
88
			<version>2.0-SNAPSHOT</version>
89
			<classifier>impl</classifier>
90
			<scope>test</scope>
91
		</dependency>
92
		<dependency>
93
			<groupId>org.gvsig</groupId>
94
			<artifactId>org.gvsig.projection</artifactId>
95
			<version>2.0-SNAPSHOT</version>
96
			<classifier>cresques-impl</classifier>
97
			<scope>test</scope>
98
		</dependency>
99
		<dependency>
100
			<groupId>org.gvsig</groupId>
101
			<artifactId>org.gvsig.fmap.mapcontext</artifactId>
102
			<version>2.0-SNAPSHOT</version>
103
			<classifier>operation</classifier>
104
			<scope>test</scope>
105
		</dependency>
106
		<dependency>
107
			<groupId>org.gvsig</groupId>
108
			<artifactId>org.gvsig.tools.lib</artifactId>
109
			<classifier>tests</classifier>
110
			<scope>test</scope>
111
		</dependency>
112
	</dependencies>
113
	<properties>
114
		<build-dir>${basedir}/../build</build-dir>
115
	</properties>
116
	<build>
117
		<sourceDirectory>src</sourceDirectory>
118
		<testSourceDirectory>src-test</testSourceDirectory>
119
                <testResources>
120
                        <testResource>
121
                                <directory>src-test</directory>
122
                        </testResource>
123
                </testResources>
124
	</build>
125
</project>
0 126

  
tags/v2_0_0_Build_2009/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>build.number</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/v2_0_0_Build_2009/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/v2_0_0_Build_2009/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
	@Override
45
	protected void doSetUp() throws Exception {
46
		// Do nothing	
47
	}
48
	
49
	/*
50
	 * (non-Javadoc)
51
	 *
52
	 * @see
53
	 * org.gvsig.fmap.dal.feature.BaseTestFeatureStore#getDefaultDataStoreParameters
54
	 * ()
55
	 */
56
	public DataStoreParameters getDefaultDataStoreParameters()
57
			throws DataException {
58
		DWGStoreParameters dwgParameters = null;
59

  
60
		dwgParameters = (DWGStoreParameters) dataManager
61
				.createStoreParameters(DWGStoreProvider.NAME);
62

  
63
		dwgParameters.setFileName(file_prueba.getAbsolutePath());
64
		dwgParameters.setSRSID("EPSG:23030");
65
		return dwgParameters;
66
	}
67

  
68
	/*
69
	 * (non-Javadoc)
70
	 *
71
	 * @see org.gvsig.fmap.dal.feature.BaseTestFeatureStore#hasExplorer()
72
	 */
73
	public boolean hasExplorer() {
74
		// TODO Auto-generated method stub
75
		return false;
76
	}
77

  
78
	public boolean usesResources() {
79
		return true;
80
	}
81

  
82

  
83
	public void testLegendAndLabeling() throws Exception {
84
		FeatureStore store = (FeatureStore) dataManager
85
				.createStore(getDefaultDataStoreParameters());
86

  
87
		assertNotNull(store.invokeDynMethod("getLegend", null));
88
		assertNotNull(store.invokeDynMethod("getLabeling", null));
89
		store.dispose();
90
	}
91
}
0 92

  
tags/v2_0_0_Build_2009/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/v2_0_0_Build_2009/extensions/extDwg/build.number
1
#Build Number for ANT. Do not edit!
2
#Thu Mar 27 09:58:34 CET 2008
3
build.number=1210
tags/v2_0_0_Build_2009/extensions/extDwg/src/org/gvsig/dwg/DWGRegisterExtension.java
1
/**
2
 *
3
 */
4
package org.gvsig.dwg;
5

  
6
import org.gvsig.andami.plugins.Extension;
7

  
8

  
9
/**
10
 * @author paco
11
 *
12
 */
13
public class DWGRegisterExtension extends Extension {
14
//	private DWGLibrary dwg;
15
//	private DWGLegendLibrary dwgLegend;
16

  
17
	/* (non-Javadoc)
18
	 * @see com.iver.andami.plugins.IExtension#execute(java.lang.String)
19
	 */
20
	public void execute(String actionCommand) {
21
		// TODO Auto-generated method stub
22

  
23
	}
24

  
25
	/* (non-Javadoc)
26
	 * @see com.iver.andami.plugins.IExtension#initialize()
27
	 */
28
	public void initialize() {
29
//		dwg = new DWGLibrary();
30
//		dwg.initialize();
31
//
32
//		dwgLegend = new DWGLegendLibrary();
33
//		dwgLegend.initialize();
34
	}
35

  
36

  
37
	public void postInitialize() {
38
		super.postInitialize();
39

  
40
//		dwg.postInitialize();
41
//
42
//		dwgLegend.postInitialize();
43
	}
44

  
45

  
46
	/* (non-Javadoc)
47
	 * @see com.iver.andami.plugins.IExtension#isEnabled()
48
	 */
49
	public boolean isEnabled() {
50
		// TODO Auto-generated method stub
51
		return false;
52
	}
53

  
54
	/* (non-Javadoc)
55
	 * @see com.iver.andami.plugins.IExtension#isVisible()
56
	 */
57
	public boolean isVisible() {
58
		// TODO Auto-generated method stub
59
		return false;
60
	}
61

  
62

  
63
}
0 64

  
tags/v2_0_0_Build_2009/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/v2_0_0_Build_2009/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/v2_0_0_Build_2009/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.DWGStoreProvider;
34
import org.gvsig.fmap.dal.store.dgn.legend.DGNLegendLibrary;
35
import org.gvsig.metadata.MetadataLibrary;
36
import org.gvsig.tools.ToolsLocator;
37
import org.gvsig.tools.dynobject.DynClass;
38
import org.gvsig.tools.dynobject.DynObjectManager;
39
import org.gvsig.tools.library.AbstractLibrary;
40
import org.gvsig.tools.library.Library;
41
import org.gvsig.tools.library.LibraryException;
42

  
43
/**
44
 * @author jmvivo
45
 *
46
 */
47
public class DWGLegendLibrary extends AbstractLibrary {
48

  
49
	public DWGLegendLibrary() {
50
		super(DWGLegendLibrary.class, Library.TYPE.IMPL);
51
		require(MetadataLibrary.class);
52
	}
53
	
54
	@Override
55
	protected void doInitialize() throws LibraryException {
56
	}
57

  
58
	@Override
59
	protected void doPostInitialize() throws LibraryException {
60
		DynObjectManager dynMan = ToolsLocator.getDynObjectManager();
61
		DynClass dynClass = dynMan.get(DWGStoreProvider.METADATA_DEFINITION_NAME);
62

  
63
		if (dynClass == null) {
64
			dynClass = dynMan.add(DWGStoreProvider.METADATA_DEFINITION_NAME);
65
		}
66

  
67
		DWGGetLegendBuilder.register(dynClass);
68
		DWGGetLegend.register(dynClass);
69
		DWGGetLabeling.register(dynClass);
70
	}
71
}
0 72

  
tags/v2_0_0_Build_2009/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/v2_0_0_Build_2009/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.fmap.mapcontext.rendering.legend.styling.AttrInTableLabelingStrategy;
43
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.fill.IFillSymbol;
44

  
45
public class DWGLegendBuilder implements LegendBuilder {
46

  
47

  
48
	private IVectorialUniqueValueLegend defaultLegend = null;
49
	private AttrInTableLabelingStrategy labelingStragegy = null;
50

  
51
	public void begin() {
52
		// Nothing to do
53
	}
54

  
55
	public void end() {
56
		// Nothing to do
57
	}
58

  
59
	public Object getLegend() {
60
		return defaultLegend;
61
	}
62

  
63
	public LegendBuilder initialize(FeatureStoreProvider store) {
64
		defaultLegend = (IVectorialUniqueValueLegend) MapContextLocator
65
				.getMapContextManager().createLegend(
66
						IVectorialUniqueValueLegend.LEGEND_NAME);
67
		defaultLegend.setShapeType(Geometry.TYPES.GEOMETRY);
68
		defaultLegend
69
				.setClassifyingFieldNames(new String[] { DWGStoreProvider.NAME_FIELD_COLOR });
70
		defaultLegend.setClassifyingFieldTypes(new int[] { DataTypes.INT });
71

  
72
		ISymbol myDefaultSymbol =
73
				MapContextLocator.getSymbolManager()
74
				.createSymbol(Geometry.TYPES.GEOMETRY, Color.BLACK);
75

  
76
		defaultLegend.setDefaultSymbol(myDefaultSymbol);
77

  
78

  
79
		labelingStragegy = new AttrInTableLabelingStrategy();
80
		labelingStragegy.setTextField(DWGStoreProvider.NAME_FIELD_TEXT);
81
		labelingStragegy
82
				.setRotationField(DWGStoreProvider.NAME_FIELD_ROTATIONTEXT);
83
		labelingStragegy.setHeightField(DWGStoreProvider.NAME_FIELD_HEIGHTTEXT);
84
		labelingStragegy.setUnit(1); // MapContext.NAMES[1] (meters)
85
		return this;
86
	}
87

  
88
	public void process(FeatureProvider feature) {
89
		Integer clave = (Integer) feature.get("Color");
90
		if (clave == null) {
91
			return;
92
		}
93
		if (defaultLegend.getSymbolByValue(clave) == null) {
94
			ISymbol theSymbol;
95
			Color color = null;
96
			try {
97
				color = AcadColor.getColor(clave.intValue());
98
			} catch (ArrayIndexOutOfBoundsException e) {
99
				color = AcadColor.getColor(255);
100
			}
101
			// jaume, moved to ISymbol
102
			theSymbol =
103
					MapContextLocator.getSymbolManager().createSymbol(
104
					Geometry.TYPES.GEOMETRY, color);
105
			
106
			theSymbol.setDescription(clave.toString());
107
			// Asigna los colores de Autocad a los
108
			// bordes
109
			// de los pol?gonos.
110
			if (theSymbol instanceof IFillSymbol) {
111
				((IFillSymbol) theSymbol).getOutline().setLineColor(color);
112

  
113
			}
114
			if (theSymbol != null) {
115
				defaultLegend.addSymbol(clave, theSymbol);
116
			}
117
		}
118

  
119
	}
120

  
121
	public Object getLabeling() {
122
		return labelingStragegy;
123
	}
124

  
125

  
126
}
0 127

  
tags/v2_0_0_Build_2009/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/v2_0_0_Build_2009/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.crs.CRSFactory;
7
import org.gvsig.fmap.dal.DataStoreParameters;
8
import org.gvsig.fmap.dal.DataTypes;
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.tools.ToolsLocator;
14
import org.gvsig.tools.dynobject.DelegatedDynObject;
15
import org.gvsig.tools.dynobject.DynClass;
16
import org.gvsig.tools.dynobject.DynStruct;
17
import org.gvsig.tools.persistence.PersistenceManager;
18

  
19
public class DWGStoreParameters extends AbstractDataParameters implements
20
		DataStoreParameters, FilesystemStoreParameters,
21
		NewFeatureStoreParameters {
22

  
23
    public static final String DYNCLASS_NAME = "DWGStoreParameters";
24

  
25
    private static final String FIELD_FILEPATH = "filepath";
26
    private static final String FIELD_SRS = "srsid";
27

  
28
	private static DynClass DYNCLASS = null;
29

  
30
	private DelegatedDynObject delegatedDynObject;
31

  
32
    public DWGStoreParameters() {
33
		this.delegatedDynObject = (DelegatedDynObject) ToolsLocator
34
				.getDynObjectManager()
35
				.createDynObject(DYNCLASS);
36
	}
37

  
38
	protected DelegatedDynObject getDelegatedDynObject() {
39
		return delegatedDynObject;
40
	}
41

  
42
	public String getDataStoreName() {
43
		return DWGStoreProvider.NAME;
44
	}
45

  
46
	public String getDescription() {
47
		return DWGStoreProvider.DESCRIPTION;
48
	}
49

  
50
	public String getSRSID() {
51
		IProjection srs = (IProjection) getDynValue(FIELD_SRS);
52
		if (srs == null) {
53
			return null;
54
		}
55
		return srs.getAbrev();
56
	}
57

  
58
	public void setSRSID(String srsid) {
59
		if (srsid == null) {
60
			setDynValue(FIELD_SRS, null);
61
		} else {
62
			setDynValue(FIELD_SRS, CRSFactory.getCRS(srsid));
63
		}
64
	}
65

  
66
	public void setSRS(IProjection srs) {
67
		setDynValue(FIELD_SRS, srs);
68
	}
69

  
70
	public IProjection getSRS() {
71
		if (this.getSRSID() == null) {
72
			return null;
73
		}
74
		return (IProjection) getDynValue(FIELD_SRS);
75
	}
76

  
77
	public String getFileName() {
78
		return (String) getDynValue(FIELD_FILEPATH);
79
	}
80

  
81
	public void setFileName(String file) {
82
		setDynValue(FIELD_FILEPATH, file);
83
	}
84

  
85
	public boolean isValid() {
86
		if (getSRSID() == null || getSRSID().equals("")) {
87
			return false;
88
		}
89
		if (getFileName() == null) {
90
			return false;
91
		}
92
		return true;
93
	}
94

  
95
	public File getFile() {
96
		return new File(this.getFileName());
97
	}
98

  
99
	public void setFile(File file) {
100
		this.setFileName(file.getPath());
101
	}
102

  
103
	public FeatureType getDefaultFeatureType() {
104
		return null; //TODO ????
105
	}
106

  
107
	public void setDefaultFeatureType(FeatureType defaultFeatureType) {
108
		throw new UnsupportedOperationException();
109
	}
110

  
111
    protected static void registerDynClass() {
112
        if (DYNCLASS == null) {
113
    		PersistenceManager manager = ToolsLocator.getPersistenceManager();
114
    		DynStruct definition = manager.addDefinition(
115
    				DWGStoreParameters.class,
116
    				DYNCLASS_NAME,
117
    				"DWGStoreParameters Persistence definition",
118
    				null, 
119
    				null
120
    		);
121

  
122
            definition.addDynFieldObject(FIELD_SRS)
123
	            .setType(DataTypes.CRS)
124
	            .setDescription("The SRS identifier")
125
	            .setMandatory(true);
126

  
127
            definition.addDynFieldString(FIELD_FILEPATH)
128
	            .setDescription("The DWG file path")
129
	            .setMandatory(true);
130
            
131
            DYNCLASS = (DynClass) definition;
132
        }
133
    }
134

  
135

  
136
}
0 137

  
tags/v2_0_0_Build_2009/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/v2_0_0_Build_2009/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.DALLocator;
33
import org.gvsig.fmap.dal.spi.DataManagerProviderServices;
34
import org.gvsig.metadata.MetadataLibrary;
35
import org.gvsig.tools.ToolsLocator;
36
import org.gvsig.tools.dynobject.DynClass;
37
import org.gvsig.tools.dynobject.DynField;
38
import org.gvsig.tools.dynobject.DynObjectManager;
39
import org.gvsig.tools.library.AbstractLibrary;
40
import org.gvsig.tools.library.Library;
41
import org.gvsig.tools.library.LibraryException;
42

  
43
public class DWGLibrary extends AbstractLibrary {
44

  
45
	public DWGLibrary() {
46
		super(DWGLibrary.class, Library.TYPE.IMPL);
47
		require(MetadataLibrary.class);
48
	}
49
		
50
	@Override
51
	protected void doInitialize() throws LibraryException {
52
	}
53

  
54
	@Override
55
	protected void doPostInitialize() throws LibraryException {
56
		new DALFileLibrary().postInitialize();
57
		
58
		DWGStoreParameters.registerDynClass();
59
		DWGStoreProvider.registerMetadataDefinition();
60

  
61

  
62
        DataManagerProviderServices dataman = (DataManagerProviderServices) DALLocator
63
				.getDataManager();
64

  
65
		if (!dataman.getStoreProviders().contains(DWGStoreProvider.NAME)) {
66
			dataman.registerStoreProvider(DWGStoreProvider.NAME,
67
					DWGStoreProvider.class, DWGStoreParameters.class);
68
		}
69

  
70
		DALFileLocator.getFilesystemServerExplorerManager().registerProvider(
71
				DWGStoreProvider.NAME, DWGStoreProvider.DESCRIPTION,
72
				DWGFilesystemServerProvider.class);
73

  
74
		DynObjectManager dynMan = ToolsLocator.getDynObjectManager();
75
		DynClass dynClass = dynMan.get(
76
				DWGStoreProvider.METADATA_DEFINITION_NAME);
77
		DynField field;
78
		if (dynClass == null) {
79
			dynClass = dynMan.add(
80
					DWGStoreProvider.METADATA_DEFINITION_NAME);
81

  
82
		}
83
	}
84
}
0 85

  
tags/v2_0_0_Build_2009/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.DataStoreParameters;
8
import org.gvsig.fmap.dal.NewDataStoreParameters;
9
import org.gvsig.fmap.dal.exception.CreateException;
10
import org.gvsig.fmap.dal.exception.DataException;
11
import org.gvsig.fmap.dal.exception.FileNotFoundException;
12
import org.gvsig.fmap.dal.exception.RemoveException;
13
import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters;
14
import org.gvsig.fmap.dal.resource.spi.ResourceConsumer;
15
import org.gvsig.fmap.dal.resource.spi.ResourceProvider;
16
import org.gvsig.fmap.dal.serverexplorer.filesystem.spi.FilesystemServerExplorerProvider;
17
import org.gvsig.fmap.dal.serverexplorer.filesystem.spi.FilesystemServerExplorerProviderServices;
18

  
19
public class DWGFilesystemServerProvider implements
20
		FilesystemServerExplorerProvider, ResourceConsumer {
21

  
22
	private FilesystemServerExplorerProviderServices serverExplorer;
23

  
24
	public String getDataStoreProviderName() {
25
		return DWGStoreProvider.NAME;
26
	}
27

  
28
	public boolean accept(File pathname) {
29
		return (pathname.getName().toLowerCase().endsWith(".dwg"));
30
	}
31

  
32
	public String getDescription() {
33
		return DWGStoreProvider.DESCRIPTION;
34
	}
35

  
36
	public DataStoreParameters getParameters(File file) throws DataException {
37
		DataManager manager = DALLocator.getDataManager();
38
		DWGStoreParameters params = (DWGStoreParameters) manager
39
				.createStoreParameters(this
40
				.getDataStoreProviderName());
41
		params.setFileName(file.getPath());
42
		return params;
43
	}
44

  
45
	public boolean canCreate() {
46
		return true;
47
	}
48

  
49
	public boolean canCreate(NewDataStoreParameters parameters) {
50
		if (!(parameters instanceof DWGStoreParameters)) {
51
			throw new IllegalArgumentException(); // FIXME ???
52
		}
53
		DWGStoreParameters dwgParams = (DWGStoreParameters) parameters;
54
		// TODO comporbar si el ftype es correcto (para este formato es fijo)
55
		File file = new File(dwgParams.getFileName());
56

  
57
		if (dwgParams.getSRSID() == null) {
58
			return false;
59
		}
60
		// TODO comprobamos extension del fichero ??
61
		if (file.exists()) {
62
			return file.canWrite();
63
		} else {
64
			return file.getParentFile().canWrite();
65
		}
66
	}
67

  
68
	public void create(NewDataStoreParameters parameters, boolean overwrite)
69
			throws CreateException {
70
		// FIXME Exception
71
		throw new UnsupportedOperationException();
72
	}
73

  
74
	public NewDataStoreParameters getCreateParameters() throws DataException {
75
		return (NewFeatureStoreParameters) DALLocator.getDataManager()
76
				.createStoreParameters(this.getDataStoreProviderName());
77
	}
78

  
79
	public void initialize(
80
			FilesystemServerExplorerProviderServices serverExplorer) {
81
		this.serverExplorer = serverExplorer;
82
	}
83

  
84
	public void remove(DataStoreParameters parameters) throws RemoveException {
85
		File file = new File(((DWGStoreParameters) parameters).getFileName());
86
		if (!file.exists()) {
87
			throw new RemoveException(this.getDataStoreProviderName(),
88
					new FileNotFoundException(file));
89
		}
90
		if (!file.delete()) {
91
			// FIXME throws ???
92
		}
93

  
94
	}
95

  
96
	public boolean closeResourceRequested(ResourceProvider resource) {
97
		// while it is using a resource anyone can't close it
98
		return false;
99
	}
100

  
101
	/*
102
	 * (non-Javadoc)
103
	 *
104
	 * @see
105
	 * org.gvsig.fmap.dal.resource.spi.ResourceConsumer#resourceChanged(org.
106
	 * gvsig.fmap.dal.resource.spi.ResourceProvider)
107
	 */
108
	public void resourceChanged(ResourceProvider resource) {
109
		//Do nothing
110

  
111
	}
112

  
113

  
114
}
0 115

  
tags/v2_0_0_Build_2009/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.exception.DataException;
25
import org.gvsig.fmap.dal.exception.InitializeException;
26
import org.gvsig.fmap.dal.exception.OpenException;
27
import org.gvsig.fmap.dal.exception.ReadException;
28
import org.gvsig.fmap.dal.exception.ValidateDataParametersException;
29
import org.gvsig.fmap.dal.feature.EditableFeatureAttributeDescriptor;
30
import org.gvsig.fmap.dal.feature.EditableFeatureType;
31
import org.gvsig.fmap.dal.feature.FeatureStore;
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;
41
import org.gvsig.fmap.dal.resource.spi.ResourceConsumer;
42
import org.gvsig.fmap.dal.resource.spi.ResourceProvider;
43
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorer;
44
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorerParameters;
45
import org.gvsig.fmap.dal.spi.DataStoreProviderServices;
46
import org.gvsig.fmap.geom.Geometry;
47
import org.gvsig.fmap.geom.GeometryLocator;
48
import org.gvsig.fmap.geom.GeometryManager;
49
import org.gvsig.fmap.geom.Geometry.SUBTYPES;
50
import org.gvsig.fmap.geom.exception.CreateEnvelopeException;
51
import org.gvsig.fmap.geom.primitive.Envelope;
52
import org.gvsig.fmap.geom.primitive.Point;
53
import org.gvsig.tools.ToolsLocator;
54
import org.gvsig.tools.dynobject.DynClass;
55
import org.gvsig.tools.dynobject.DynField;
56
import org.gvsig.tools.dynobject.DynObjectManager;
57
import org.gvsig.tools.dynobject.exception.DynMethodException;
58
import org.gvsig.tools.exception.NotYetImplemented;
59
import org.gvsig.tools.persistence.PersistentState;
60
import org.gvsig.tools.persistence.exception.PersistenceException;
61
import org.slf4j.Logger;
62
import org.slf4j.LoggerFactory;
63

  
64
public class DWGStoreProvider extends AbstractMemoryStoreProvider implements
65
		ResourceConsumer {
66
	private static final Logger logger = LoggerFactory.getLogger(DWGStoreProvider.class);
67

  
68
	public static final String NAME = "DWG";
69
	public static final String DESCRIPTION = "DWG file";
70
	public static final String METADATA_DEFINITION_NAME = "DWGStore";
71
	protected static DynClass DYNCLASS = null;
72

  
73
	public static final String NAME_FIELD_ID = "ID";
74
	public static final String NAME_FIELD_GEOMETRY = "Geometry";
75
	public static final String NAME_FIELD_ENTITY = "Entity";
76
	public static final String NAME_FIELD_LAYER = "Layer";
77
	public static final String NAME_FIELD_COLOR = "Color";
78
	public static final String NAME_FIELD_ELEVATION = "Elevation";
79
	public static final String NAME_FIELD_THICKNESS = "Thickness";
80
	public static final String NAME_FIELD_TEXT = "Text";
81
	public static final String NAME_FIELD_HEIGHTTEXT = "HeightText";
82
	public static final String NAME_FIELD_ROTATIONTEXT = "Rotation";
83

  
84
	private int ID_FIELD_ID = 0;
85
	private int ID_FIELD_GEOMETRY = 1;
86
	private int ID_FIELD_ENTITY = 2;
87
	private int ID_FIELD_LAYER = 3;
88
	private int ID_FIELD_COLOR = 4;
89
	private int ID_FIELD_ELEVATION = 5;
90
	private int ID_FIELD_THICKNESS = 6;
91
	private int ID_FIELD_TEXT = 7;
92
	private int ID_FIELD_HEIGHTTEXT = 8;
93
	private int ID_FIELD_ROTATIONTEXT = 9;
94

  
95
	private IProjection projection;
96
	private ResourceProvider resource;
97
	private LegendBuilder legendBuilder;
98

  
99
	private long counterNewsOIDs = 0;
100
	protected GeometryManager geomManager = GeometryLocator.getGeometryManager();
101

  
102

  
103

  
104

  
105
	public DWGStoreProvider(DWGStoreParameters parameters,
106
			DataStoreProviderServices storeServices) throws InitializeException {
107
		super(parameters,storeServices,ToolsLocator
108
				.getDynObjectManager()
109
				.createDynObject(DYNCLASS));
110

  
111
		counterNewsOIDs = 0;
112
		//		projection = CRSFactory.getCRS(getParameters().getSRSID());
113

  
114
		File file = getDWGParameters().getFile();
115
		resource = this.createResource(
116
				FileResource.NAME,
117
				new Object[] { file.getAbsolutePath() }
118
			);
119

  
120
		resource.addConsumer(this);
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff