Revision 691
org.gvsig.dxf/tags/org.gvsig.dxf-2.0.147/org.gvsig.dxf.app/org.gvsig.dxf.app.mainplugin/src/main/assembly/gvsig-plugin-package.xml | ||
---|---|---|
1 |
<assembly> |
|
2 |
<id>gvsig-plugin-package</id> |
|
3 |
<formats> |
|
4 |
<format>zip</format> |
|
5 |
</formats> |
|
6 |
<baseDirectory>${project.artifactId}</baseDirectory> |
|
7 |
<includeBaseDirectory>true</includeBaseDirectory> |
|
8 |
<files> |
|
9 |
<file> |
|
10 |
<source>target/${project.artifactId}-${project.version}.jar</source> |
|
11 |
<outputDirectory>lib</outputDirectory> |
|
12 |
</file> |
|
13 |
<file> |
|
14 |
<source>target/package.info</source> |
|
15 |
</file> |
|
16 |
</files> |
|
17 |
|
|
18 |
<fileSets> |
|
19 |
<fileSet> |
|
20 |
<directory>src/main/resources-plugin</directory> |
|
21 |
<outputDirectory>.</outputDirectory> |
|
22 |
</fileSet> |
|
23 |
</fileSets> |
|
24 |
|
|
25 |
<dependencySets> |
|
26 |
<dependencySet> |
|
27 |
<useProjectArtifact>false</useProjectArtifact> |
|
28 |
<useTransitiveDependencies>false</useTransitiveDependencies> |
|
29 |
<outputDirectory>lib</outputDirectory> |
|
30 |
<includes> |
|
31 |
<include>org.gvsig:org.gvsig.dxf.provider.legend</include> |
|
32 |
<include>org.gvsig:org.gvsig.dxf.provider</include> |
|
33 |
<include>org.gvsig:org.gvsig.dxf.lib</include> |
|
34 |
<include>org.gvsig:org.gvsig.dxf.exportto</include> |
|
35 |
</includes> |
|
36 |
</dependencySet> |
|
37 |
</dependencySets> |
|
38 |
|
|
39 |
</assembly> |
org.gvsig.dxf/tags/org.gvsig.dxf-2.0.147/org.gvsig.dxf.app/org.gvsig.dxf.app.mainplugin/src/main/resources-plugin/config.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
<plugin-config> |
|
3 |
<libraries library-dir="lib/"/> |
|
4 |
<depends plugin-name="org.gvsig.app.mainplugin"/> |
|
5 |
<depends plugin-name="org.gvsig.exportto.app.mainplugin" optional="true"/> |
|
6 |
<resourceBundle name="text"/> |
|
7 |
<extensions> |
|
8 |
<extension class-name="org.gvsig.andami.LibraryExtension" active="false"/> |
|
9 |
</extensions> |
|
10 |
</plugin-config> |
org.gvsig.dxf/tags/org.gvsig.dxf-2.0.147/org.gvsig.dxf.app/org.gvsig.dxf.app.mainplugin/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" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
4 |
|
|
5 |
<modelVersion>4.0.0</modelVersion> |
|
6 |
<artifactId>org.gvsig.dxf.app.mainplugin</artifactId> |
|
7 |
<packaging>jar</packaging> |
|
8 |
<name>${project.artifactId}</name> |
|
9 |
<description>DXF file format support</description> |
|
10 |
<parent> |
|
11 |
<groupId>org.gvsig</groupId> |
|
12 |
<artifactId>org.gvsig.dxf.app</artifactId> |
|
13 |
<version>2.0.147</version> |
|
14 |
</parent> |
|
15 |
|
|
16 |
<dependencies> |
|
17 |
<dependency> |
|
18 |
<groupId>org.gvsig</groupId> |
|
19 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
20 |
<scope>compile</scope> |
|
21 |
</dependency> |
|
22 |
<dependency> |
|
23 |
<groupId>org.gvsig</groupId> |
|
24 |
<artifactId>org.gvsig.andami</artifactId> |
|
25 |
<scope>compile</scope> |
|
26 |
</dependency> |
|
27 |
<dependency> |
|
28 |
<groupId>org.gvsig</groupId> |
|
29 |
<artifactId>org.gvsig.dxf.provider</artifactId> |
|
30 |
<scope>compile</scope> |
|
31 |
</dependency> |
|
32 |
<dependency> |
|
33 |
<groupId>org.gvsig</groupId> |
|
34 |
<artifactId>org.gvsig.dxf.lib</artifactId> |
|
35 |
<scope>runtime</scope> |
|
36 |
</dependency> |
|
37 |
<dependency> |
|
38 |
<groupId>org.gvsig</groupId> |
|
39 |
<artifactId>org.gvsig.dxf.exportto</artifactId> |
|
40 |
<scope>runtime</scope> |
|
41 |
</dependency> |
|
42 |
<dependency> |
|
43 |
<groupId>org.gvsig</groupId> |
|
44 |
<artifactId>org.gvsig.dxf.provider.legend</artifactId> |
|
45 |
<scope>compile</scope> |
|
46 |
</dependency> |
|
47 |
|
|
48 |
</dependencies> |
|
49 |
|
|
50 |
<properties> |
|
51 |
<!-- Package info property values --> |
|
52 |
<!-- Default values in org.gvsig.desktop --> |
|
53 |
<gvsig.package.info.name>Formats: DXF file format support</gvsig.package.info.name> |
|
54 |
<gvsig.package.info.state>testing</gvsig.package.info.state> |
|
55 |
<gvsig.package.info.official>true</gvsig.package.info.official> |
|
56 |
<gvsig.package.info.dependencies>required: org.gvsig.app.mainplugin -ge 2.1.0-A</gvsig.package.info.dependencies> |
|
57 |
<gvsig.package.info.categories>Formats,Vector</gvsig.package.info.categories> |
|
58 |
<gvsig.package.info.poolURL>https://devel.gvsig.org/download/projects/gvsig-dxf/pool</gvsig.package.info.poolURL> |
|
59 |
</properties> |
|
60 |
|
|
61 |
|
|
62 |
</project> |
org.gvsig.dxf/tags/org.gvsig.dxf-2.0.147/org.gvsig.dxf.app/org.gvsig.dxf.app.mainplugin/buildNumber.properties | ||
---|---|---|
1 |
#Mon Feb 15 23:17:16 CET 2021 |
|
2 |
buildNumber=2203 |
|
0 | 3 |
org.gvsig.dxf/tags/org.gvsig.dxf-2.0.147/org.gvsig.dxf.app/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" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
4 |
|
|
5 |
<modelVersion>4.0.0</modelVersion> |
|
6 |
<artifactId>org.gvsig.dxf.app</artifactId> |
|
7 |
<packaging>pom</packaging> |
|
8 |
<name>${project.artifactId}</name> |
|
9 |
<parent> |
|
10 |
<groupId>org.gvsig</groupId> |
|
11 |
<artifactId>org.gvsig.dxf</artifactId> |
|
12 |
<version>2.0.147</version> |
|
13 |
</parent> |
|
14 |
|
|
15 |
<modules> |
|
16 |
<module>org.gvsig.dxf.app.mainplugin</module> |
|
17 |
</modules> |
|
18 |
|
|
19 |
|
|
20 |
</project> |
org.gvsig.dxf/tags/org.gvsig.dxf-2.0.147/org.gvsig.dxf.exportto/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.export.dxf.ExportDXFLibrary |
org.gvsig.dxf/tags/org.gvsig.dxf-2.0.147/org.gvsig.dxf.exportto/src/main/java/org/gvsig/export/dxf/service/ExportDXFService.java | ||
---|---|---|
1 |
package org.gvsig.export.dxf.service; |
|
2 |
|
|
3 |
import org.gvsig.export.ExportException; |
|
4 |
import org.gvsig.export.spi.AbstractExportService; |
|
5 |
import org.gvsig.export.spi.ExportService; |
|
6 |
import org.gvsig.export.spi.ExportServiceFactory; |
|
7 |
import org.gvsig.fmap.dal.DALLocator; |
|
8 |
import org.gvsig.fmap.dal.DataManager; |
|
9 |
import org.gvsig.fmap.dal.DataServerExplorer; |
|
10 |
import org.gvsig.fmap.dal.NewDataStoreParameters; |
|
11 |
import org.gvsig.fmap.dal.OpenDataStoreParameters; |
|
12 |
import org.gvsig.fmap.dal.exception.DataException; |
|
13 |
import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters; |
|
14 |
import org.gvsig.fmap.dal.feature.OpenFeatureStoreParameters; |
|
15 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorer; |
|
16 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorerParameters; |
|
17 |
import org.gvsig.tools.util.HasAFile; |
|
18 |
|
|
19 |
/** |
|
20 |
* |
|
21 |
* @author jjdelcerro |
|
22 |
*/ |
|
23 |
public class ExportDXFService |
|
24 |
extends AbstractExportService |
|
25 |
implements ExportService |
|
26 |
{ |
|
27 |
|
|
28 |
public static final int MAX_FIELD_NAME_LENGTH = 10; |
|
29 |
|
|
30 |
protected ExportDXFService(ExportServiceFactory factory, ExportDXFParameters parameters) { |
|
31 |
super(factory, parameters); |
|
32 |
} |
|
33 |
|
|
34 |
@Override |
|
35 |
public ExportDXFParameters getParameters() { |
|
36 |
return (ExportDXFParameters) super.getParameters(); |
|
37 |
} |
|
38 |
|
|
39 |
@Override |
|
40 |
protected DataServerExplorer createServerExplorer() throws ExportException{ |
|
41 |
|
|
42 |
DataManager dataManager = DALLocator.getDataManager(); |
|
43 |
|
|
44 |
FilesystemServerExplorerParameters explorerParams; |
|
45 |
try { |
|
46 |
explorerParams = |
|
47 |
(FilesystemServerExplorerParameters) dataManager |
|
48 |
.createServerExplorerParameters(FilesystemServerExplorer.NAME); |
|
49 |
} catch (Exception e) { |
|
50 |
throw new ExportException(e); |
|
51 |
} |
|
52 |
explorerParams.setRoot(this.getParameters().getFile().getParent()); |
|
53 |
|
|
54 |
FilesystemServerExplorer explorer; |
|
55 |
try { |
|
56 |
explorer = (FilesystemServerExplorer) dataManager.openServerExplorer( |
|
57 |
"FilesystemExplorer", explorerParams |
|
58 |
); |
|
59 |
return explorer; |
|
60 |
} catch (Exception e) { |
|
61 |
throw new ExportException(e); |
|
62 |
} |
|
63 |
} |
|
64 |
|
|
65 |
@Override |
|
66 |
protected NewDataStoreParameters createTargetNewStoreParameters() throws ExportException { |
|
67 |
try { |
|
68 |
FilesystemServerExplorer explorer = (FilesystemServerExplorer) this.createServerExplorer(); |
|
69 |
NewFeatureStoreParameters newStoreParameters = (NewFeatureStoreParameters) explorer.getAddParameters( |
|
70 |
this.getParameters().getFile() |
|
71 |
); |
|
72 |
newStoreParameters.setDynValue("CRS", this.getParameters().getTargetProjection()); |
|
73 |
// Usamos el featureType por defecto del DXF. |
|
74 |
return newStoreParameters; |
|
75 |
} catch (DataException ex) { |
|
76 |
throw new ExportException(ex); |
|
77 |
} |
|
78 |
} |
|
79 |
|
|
80 |
@Override |
|
81 |
public OpenDataStoreParameters createTargetOpenStoreParameters() throws ExportException { |
|
82 |
try { |
|
83 |
DataManager dataManager = DALLocator.getDataManager(); |
|
84 |
OpenFeatureStoreParameters openStoreParameters = (OpenFeatureStoreParameters) dataManager.createStoreParameters("DXF"); |
|
85 |
((HasAFile)openStoreParameters).setFile(getParameters().getFile()); |
|
86 |
openStoreParameters.setDynValue("CRS", this.getParameters().getTargetProjection()); |
|
87 |
return openStoreParameters; |
|
88 |
} catch (DataException ex) { |
|
89 |
throw new ExportException(ex); |
|
90 |
} |
|
91 |
} |
|
92 |
|
|
93 |
|
|
94 |
|
|
95 |
|
|
96 |
} |
org.gvsig.dxf/tags/org.gvsig.dxf-2.0.147/org.gvsig.dxf.exportto/src/main/java/org/gvsig/export/dxf/service/ExportDXFParameters.java | ||
---|---|---|
1 |
package org.gvsig.export.dxf.service; |
|
2 |
|
|
3 |
//import org.gvsig.export.dbf.service.ExportDBFParameters; |
|
4 |
import org.gvsig.export.ExportParametersGeometry; |
|
5 |
import org.gvsig.tools.util.HasAFile; |
|
6 |
|
|
7 |
/** |
|
8 |
* |
|
9 |
* @author jjdelcerro |
|
10 |
*/ |
|
11 |
public interface ExportDXFParameters extends ExportParametersGeometry, HasAFile { |
|
12 |
|
|
13 |
} |
org.gvsig.dxf/tags/org.gvsig.dxf-2.0.147/org.gvsig.dxf.exportto/src/main/java/org/gvsig/export/dxf/service/ExportDXFParametersImpl.java | ||
---|---|---|
1 |
package org.gvsig.export.dxf.service; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
import org.apache.commons.io.FilenameUtils; |
|
5 |
import org.gvsig.export.spi.AbstractExportParametersGeometryFile; |
|
6 |
import org.gvsig.export.spi.ExportServiceFactory; |
|
7 |
|
|
8 |
/** |
|
9 |
* |
|
10 |
* @author jjdelcerro |
|
11 |
*/ |
|
12 |
public class ExportDXFParametersImpl |
|
13 |
extends AbstractExportParametersGeometryFile |
|
14 |
implements ExportDXFParameters |
|
15 |
{ |
|
16 |
private File file; |
|
17 |
|
|
18 |
public ExportDXFParametersImpl(ExportServiceFactory factory) { |
|
19 |
super(factory); |
|
20 |
} |
|
21 |
|
|
22 |
@Override |
|
23 |
public String getServiceName() { |
|
24 |
return ExportDXFServiceFactory.SERVICE_NAME; |
|
25 |
} |
|
26 |
|
|
27 |
@Override |
|
28 |
public File getFile() { |
|
29 |
return this.file; |
|
30 |
} |
|
31 |
|
|
32 |
@Override |
|
33 |
public void setFile(File file) { |
|
34 |
this.file = new File(FilenameUtils.removeExtension(file.getAbsolutePath()) + ".dxf"); |
|
35 |
} |
|
36 |
|
|
37 |
} |
org.gvsig.dxf/tags/org.gvsig.dxf-2.0.147/org.gvsig.dxf.exportto/src/main/java/org/gvsig/export/dxf/service/ExportDXFServiceFactory.java | ||
---|---|---|
1 |
package org.gvsig.export.dxf.service; |
|
2 |
|
|
3 |
import org.gvsig.export.ExportParameters; |
|
4 |
import org.gvsig.export.spi.AbstractExportServiceFactory; |
|
5 |
|
|
6 |
/** |
|
7 |
* |
|
8 |
* @author jjdelcerro |
|
9 |
*/ |
|
10 |
public class ExportDXFServiceFactory |
|
11 |
extends AbstractExportServiceFactory |
|
12 |
{ |
|
13 |
|
|
14 |
public static final String SERVICE_NAME = "DXF"; |
|
15 |
|
|
16 |
public ExportDXFServiceFactory() { |
|
17 |
super( |
|
18 |
SERVICE_NAME, |
|
19 |
"DXF file", |
|
20 |
"DXF file" |
|
21 |
); |
|
22 |
} |
|
23 |
|
|
24 |
@Override |
|
25 |
public ExportDXFService createService(ExportParameters parameters) { |
|
26 |
ExportDXFService service = new ExportDXFService(this, (ExportDXFParameters) parameters); |
|
27 |
return service; |
|
28 |
} |
|
29 |
|
|
30 |
@Override |
|
31 |
public ExportDXFParameters createParameters() { |
|
32 |
ExportDXFParameters parameters = new ExportDXFParametersImpl(this); |
|
33 |
return parameters; |
|
34 |
} |
|
35 |
|
|
36 |
@Override |
|
37 |
public boolean hasTabularSupport() { |
|
38 |
return true; |
|
39 |
} |
|
40 |
|
|
41 |
@Override |
|
42 |
public boolean hasVectorialSupport() { |
|
43 |
return true; |
|
44 |
} |
|
45 |
|
|
46 |
} |
org.gvsig.dxf/tags/org.gvsig.dxf-2.0.147/org.gvsig.dxf.exportto/src/main/java/org/gvsig/export/dxf/swing/ExportDXFPanelsFactory.java | ||
---|---|---|
1 |
package org.gvsig.export.dxf.swing; |
|
2 |
|
|
3 |
import org.gvsig.export.ExportParameters; |
|
4 |
import org.gvsig.export.dxf.service.ExportDXFServiceFactory; |
|
5 |
import org.gvsig.export.swing.JExportProcessPanel; |
|
6 |
import org.gvsig.export.swing.spi.AbstractExportPanelsFactory; |
|
7 |
import org.gvsig.export.swing.spi.ExportPanels; |
|
8 |
import org.gvsig.export.swing.spi.ExportPanelsFactory; |
|
9 |
|
|
10 |
/** |
|
11 |
* |
|
12 |
* @author jjdelcerro |
|
13 |
*/ |
|
14 |
public class ExportDXFPanelsFactory |
|
15 |
extends AbstractExportPanelsFactory |
|
16 |
implements ExportPanelsFactory { |
|
17 |
|
|
18 |
public ExportDXFPanelsFactory() { |
|
19 |
super(ExportDXFServiceFactory.SERVICE_NAME); |
|
20 |
} |
|
21 |
|
|
22 |
@Override |
|
23 |
public ExportPanels createPanels(JExportProcessPanel processPanel, ExportParameters parameters) { |
|
24 |
return new ExportDXFPanels(this, processPanel, parameters); |
|
25 |
} |
|
26 |
|
|
27 |
} |
org.gvsig.dxf/tags/org.gvsig.dxf-2.0.147/org.gvsig.dxf.exportto/src/main/java/org/gvsig/export/dxf/swing/ExportDXFPanels.java | ||
---|---|---|
1 |
package org.gvsig.export.dxf.swing; |
|
2 |
|
|
3 |
import org.gvsig.export.ExportParameters; |
|
4 |
import org.gvsig.export.swing.ExportSwingLocator; |
|
5 |
import org.gvsig.export.swing.JExportProcessPanel; |
|
6 |
import org.gvsig.export.swing.spi.AbstractExportPanels; |
|
7 |
import org.gvsig.export.swing.spi.ExportPanels; |
|
8 |
import org.gvsig.export.swing.spi.ExportPanelsFactory; |
|
9 |
import org.gvsig.export.swing.spi.ExportPanelsManager; |
|
10 |
|
|
11 |
/** |
|
12 |
* |
|
13 |
* @author jjdelcerro |
|
14 |
*/ |
|
15 |
public class ExportDXFPanels |
|
16 |
extends AbstractExportPanels |
|
17 |
implements ExportPanels |
|
18 |
{ |
|
19 |
|
|
20 |
ExportDXFPanels( |
|
21 |
ExportPanelsFactory factory, |
|
22 |
JExportProcessPanel processPanel, |
|
23 |
ExportParameters parameters |
|
24 |
) { |
|
25 |
super(factory, processPanel, parameters); |
|
26 |
this.initPanels(); |
|
27 |
} |
|
28 |
|
|
29 |
private void initPanels() { |
|
30 |
ExportPanelsManager manager = ExportSwingLocator.getExportPanelsManager(); |
|
31 |
|
|
32 |
|
|
33 |
this.add( manager.createStandardPanel( |
|
34 |
ExportPanelsManager.PANEL_SELECT_OUTPUT_FILE, |
|
35 |
this.getProcessPanel(), |
|
36 |
this.getParameters() |
|
37 |
) |
|
38 |
); |
|
39 |
} |
|
40 |
|
|
41 |
} |
org.gvsig.dxf/tags/org.gvsig.dxf-2.0.147/org.gvsig.dxf.exportto/src/main/java/org/gvsig/export/dxf/ExportDXFLibrary.java | ||
---|---|---|
1 |
package org.gvsig.export.dxf; |
|
2 |
|
|
3 |
import org.gvsig.export.ExportLibrary; |
|
4 |
import org.gvsig.export.ExportLocator; |
|
5 |
import org.gvsig.export.dxf.service.ExportDXFServiceFactory; |
|
6 |
import org.gvsig.export.dxf.swing.ExportDXFPanelsFactory; |
|
7 |
import org.gvsig.export.spi.ExportServiceManager; |
|
8 |
import org.gvsig.export.swing.ExportSwingLibrary; |
|
9 |
import org.gvsig.export.swing.ExportSwingLocator; |
|
10 |
import org.gvsig.export.swing.spi.ExportPanelsManager; |
|
11 |
import org.gvsig.tools.library.AbstractLibrary; |
|
12 |
import org.gvsig.tools.library.LibraryException; |
|
13 |
|
|
14 |
/** |
|
15 |
* |
|
16 |
* @author jjdelcerro |
|
17 |
*/ |
|
18 |
public class ExportDXFLibrary extends AbstractLibrary { |
|
19 |
|
|
20 |
@Override |
|
21 |
public void doRegistration() { |
|
22 |
registerAsServiceOf(ExportSwingLibrary.class); |
|
23 |
registerAsServiceOf(ExportLibrary.class); |
|
24 |
} |
|
25 |
|
|
26 |
@Override |
|
27 |
protected void doInitialize() throws LibraryException { |
|
28 |
// Nothing to do |
|
29 |
} |
|
30 |
|
|
31 |
@Override |
|
32 |
protected void doPostInitialize() throws LibraryException { |
|
33 |
ExportServiceManager manager = ExportLocator.getServiceManager(); |
|
34 |
ExportPanelsManager swingManager = ExportSwingLocator.getExportPanelsManager(); |
|
35 |
|
|
36 |
manager.register(new ExportDXFServiceFactory()); |
|
37 |
swingManager.register(new ExportDXFPanelsFactory()); |
|
38 |
} |
|
39 |
|
|
40 |
} |
org.gvsig.dxf/tags/org.gvsig.dxf-2.0.147/org.gvsig.dxf.exportto/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
3 |
<modelVersion>4.0.0</modelVersion> |
|
4 |
<parent> |
|
5 |
<groupId>org.gvsig</groupId> |
|
6 |
<artifactId>org.gvsig.dxf</artifactId> |
|
7 |
<version>2.0.147</version> |
|
8 |
</parent> |
|
9 |
<artifactId>org.gvsig.dxf.exportto</artifactId> |
|
10 |
<packaging>jar</packaging> |
|
11 |
|
|
12 |
<dependencies> |
|
13 |
<dependency> |
|
14 |
<groupId>org.gvsig</groupId> |
|
15 |
<artifactId>org.gvsig.exportto.swing.api</artifactId> |
|
16 |
<scope>compile</scope> |
|
17 |
</dependency> |
|
18 |
<dependency> |
|
19 |
<groupId>org.gvsig</groupId> |
|
20 |
<artifactId>org.gvsig.exportto.swing.prov.dbf</artifactId> |
|
21 |
<scope>compile</scope> |
|
22 |
</dependency> |
|
23 |
<dependency> |
|
24 |
<groupId>org.gvsig</groupId> |
|
25 |
<artifactId>org.gvsig.fmap.dal.api</artifactId> |
|
26 |
<scope>compile</scope> |
|
27 |
</dependency> |
|
28 |
<dependency> |
|
29 |
<groupId>org.gvsig</groupId> |
|
30 |
<artifactId>org.gvsig.tools.swing.api</artifactId> |
|
31 |
<scope>compile</scope> |
|
32 |
</dependency> |
|
33 |
<dependency> |
|
34 |
<groupId>org.gvsig</groupId> |
|
35 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
36 |
<scope>compile</scope> |
|
37 |
</dependency> |
|
38 |
<dependency> |
|
39 |
<groupId>org.gvsig</groupId> |
|
40 |
<artifactId>org.gvsig.fmap.geometry.api</artifactId> |
|
41 |
<scope>compile</scope> |
|
42 |
</dependency> |
|
43 |
<dependency> |
|
44 |
<groupId>org.gvsig</groupId> |
|
45 |
<artifactId>org.gvsig.projection.api</artifactId> |
|
46 |
<scope>compile</scope> |
|
47 |
</dependency> |
|
48 |
<dependency> |
|
49 |
<groupId>org.gvsig</groupId> |
|
50 |
<artifactId>org.gvsig.metadata.lib.basic.api</artifactId> |
|
51 |
<scope>compile</scope> |
|
52 |
</dependency> |
|
53 |
|
|
54 |
|
|
55 |
<dependency> |
|
56 |
<groupId>org.gvsig</groupId> |
|
57 |
<artifactId>org.gvsig.tools.swing.impl</artifactId> |
|
58 |
<scope>runtime</scope> |
|
59 |
</dependency> |
|
60 |
|
|
61 |
<dependency> |
|
62 |
<groupId>org.gvsig</groupId> |
|
63 |
<artifactId>org.gvsig.fmap.dal.file.shp</artifactId> |
|
64 |
<scope>compile</scope> |
|
65 |
</dependency> |
|
66 |
<dependency> |
|
67 |
<groupId>org.gvsig</groupId> |
|
68 |
<artifactId>org.gvsig.fmap.dal.file.dbf</artifactId> |
|
69 |
<scope>compile</scope> |
|
70 |
</dependency> |
|
71 |
|
|
72 |
</dependencies> |
|
73 |
<name>org.gvsig.dxf.exportto</name> |
|
74 |
</project> |
|
0 | 75 |
org.gvsig.dxf/tags/org.gvsig.dxf-2.0.147/org.gvsig.dxf.lib/src/main/java/org/gvsig/dxf/geo/Point3D.java | ||
---|---|---|
1 |
/* |
|
2 |
* Cresques Mapping Suite. Graphic Library for constructing mapping applications. |
|
3 |
* |
|
4 |
* Copyright (C) 2004-5. |
|
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
19 |
* |
|
20 |
* For more information, contact: |
|
21 |
* |
|
22 |
* cresques@gmail.com |
|
23 |
*/ |
|
24 |
package org.gvsig.dxf.geo; |
|
25 |
|
|
26 |
import java.awt.geom.Point2D; |
|
27 |
|
|
28 |
|
|
29 |
/** |
|
30 |
* @author "Luis W. Sevilla" <sevilla_lui@gva.es> |
|
31 |
*/ |
|
32 |
public class Point3D extends Point2D { |
|
33 |
public double X; |
|
34 |
public double Y; |
|
35 |
public double Z; |
|
36 |
|
|
37 |
public Point3D() { |
|
38 |
setLocation(0.0, 0.0); |
|
39 |
} |
|
40 |
|
|
41 |
public Point3D(double x, double y) { |
|
42 |
setLocation(x, y); |
|
43 |
} |
|
44 |
|
|
45 |
public Point3D(double x, double y, double z) { |
|
46 |
setLocation(x, y, z); |
|
47 |
} |
|
48 |
|
|
49 |
public Point3D(Point2D pt) { |
|
50 |
setLocation(pt.getX(), pt.getY()); |
|
51 |
} |
|
52 |
|
|
53 |
public Point3D(Point3D pt) { |
|
54 |
setLocation(pt.getX(), pt.getY(), pt.getZ()); |
|
55 |
} |
|
56 |
|
|
57 |
public double getX() { |
|
58 |
return X; |
|
59 |
} |
|
60 |
|
|
61 |
public double getY() { |
|
62 |
return Y; |
|
63 |
} |
|
64 |
|
|
65 |
public double getZ() { |
|
66 |
return Z; |
|
67 |
} |
|
68 |
|
|
69 |
public void setLocation(double x, double y) { |
|
70 |
X = x; |
|
71 |
Y = y; |
|
72 |
Z = 0D; |
|
73 |
} |
|
74 |
|
|
75 |
public void setLocation(double x, double y, double z) { |
|
76 |
X = x; |
|
77 |
Y = y; |
|
78 |
Z = z; |
|
79 |
} |
|
80 |
|
|
81 |
public String toString() { |
|
82 |
return "(" + getX() + "," + getY() + ")"; |
|
83 |
} |
|
84 |
} |
org.gvsig.dxf/tags/org.gvsig.dxf-2.0.147/org.gvsig.dxf.lib/src/main/java/org/gvsig/dxf/geo/.cvsignore | ||
---|---|---|
1 |
*.dfPackage |
|
2 |
*.wmf |
org.gvsig.dxf/tags/org.gvsig.dxf-2.0.147/org.gvsig.dxf.lib/src/main/java/org/gvsig/dxf/geo/Polygon2D.java | ||
---|---|---|
1 |
/* |
|
2 |
* Cresques Mapping Suite. Graphic Library for constructing mapping applications. |
|
3 |
* |
|
4 |
* Copyright (C) 2004-5. |
|
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
19 |
* |
|
20 |
* For more information, contact: |
|
21 |
* |
|
22 |
* cresques@gmail.com |
|
23 |
*/ |
|
24 |
package org.gvsig.dxf.geo; |
|
25 |
|
|
26 |
import java.awt.Graphics2D; |
|
27 |
import java.awt.geom.GeneralPath; |
|
28 |
import java.awt.geom.Point2D; |
|
29 |
|
|
30 |
import java.util.Iterator; |
|
31 |
import java.util.Vector; |
|
32 |
|
|
33 |
import org.cresques.geo.ViewPortData; |
|
34 |
|
|
35 |
|
|
36 |
/** |
|
37 |
* Clase que representa un pol?gono 2D |
|
38 |
* @author "Luis W. Sevilla" <sevilla_lui@gva.es> |
|
39 |
*/ |
|
40 |
public class Polygon2D extends Vector { |
|
41 |
GeneralPath gp = null; |
|
42 |
|
|
43 |
public Polygon2D() { |
|
44 |
super(); |
|
45 |
gp = null; |
|
46 |
} |
|
47 |
|
|
48 |
/** |
|
49 |
* A?ade un vertice al po??gono |
|
50 |
* @param pt punto 2D que representa el vertice a?adido |
|
51 |
*/ |
|
52 |
public void addPoint(Point2D pt) { |
|
53 |
super.add(pt); |
|
54 |
} |
|
55 |
|
|
56 |
/** |
|
57 |
* Dibuja el pol?gono |
|
58 |
* @param g Graphics sobre el que dibuja |
|
59 |
* @param vp ViewPort con la vista |
|
60 |
*/ |
|
61 |
public void draw(Graphics2D g, ViewPortData vp) { |
|
62 |
newGP(vp); |
|
63 |
g.draw(gp); |
|
64 |
|
|
65 |
//g.draw(new Line2D.Double(pt,pt0)); |
|
66 |
} |
|
67 |
|
|
68 |
/** |
|
69 |
* |
|
70 |
* @param g |
|
71 |
* @param vp |
|
72 |
*/ |
|
73 |
public void fill(Graphics2D g, ViewPortData vp) { |
|
74 |
newGP(vp); |
|
75 |
g.fill(gp); |
|
76 |
} |
|
77 |
|
|
78 |
/** |
|
79 |
* |
|
80 |
* @param vp |
|
81 |
*/ |
|
82 |
private void newGP(ViewPortData vp) { |
|
83 |
//if (gp != null) return; |
|
84 |
gp = new GeneralPath(); |
|
85 |
|
|
86 |
Point2D pt0 = null; |
|
87 |
Point2D pt = null; |
|
88 |
Point2D pt1 = null; |
|
89 |
Point2D.Double ptTmp = new Point2D.Double(0.0, 0.0); |
|
90 |
Iterator iter = iterator(); |
|
91 |
|
|
92 |
while (iter.hasNext()) { |
|
93 |
pt1 = (Point2D) iter.next(); |
|
94 |
vp.mat.transform(pt1, ptTmp); |
|
95 |
|
|
96 |
if (pt0 == null) { |
|
97 |
pt0 = ptTmp; |
|
98 |
gp.moveTo((float) ptTmp.getX(), (float) ptTmp.getY()); |
|
99 |
} else { |
|
100 |
gp.lineTo((float) ptTmp.getX(), (float) ptTmp.getY()); |
|
101 |
} |
|
102 |
} |
|
103 |
|
|
104 |
gp.closePath(); |
|
105 |
} |
|
106 |
} |
org.gvsig.dxf/tags/org.gvsig.dxf-2.0.147/org.gvsig.dxf.lib/src/main/java/org/gvsig/dxf/geo/cover/package.html | ||
---|---|---|
1 |
<html> |
|
2 |
<body>Clases relacionadas con coverturas espaciales. |
|
3 |
</body> |
|
4 |
</html> |
org.gvsig.dxf/tags/org.gvsig.dxf-2.0.147/org.gvsig.dxf.lib/src/main/java/org/gvsig/dxf/geo/cover/Hoja.java | ||
---|---|---|
1 |
/* |
|
2 |
* Cresques Mapping Suite. Graphic Library for constructing mapping applications. |
|
3 |
* |
|
4 |
* Copyright (C) 2004-5. |
|
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
19 |
* |
|
20 |
* For more information, contact: |
|
21 |
* |
|
22 |
* cresques@gmail.com |
|
23 |
*/ |
|
24 |
package org.gvsig.dxf.geo.cover; |
|
25 |
|
|
26 |
import org.cresques.cts.ICoordTrans; |
|
27 |
import org.cresques.cts.IProjection; |
|
28 |
|
|
29 |
import org.cresques.geo.Projected; |
|
30 |
import org.cresques.px.Extent; |
|
31 |
|
|
32 |
|
|
33 |
import java.awt.geom.Point2D; |
|
34 |
|
|
35 |
import java.io.InputStream; |
|
36 |
import java.io.OutputStream; |
|
37 |
|
|
38 |
import java.util.Vector; |
|
39 |
|
|
40 |
|
|
41 |
/** |
|
42 |
* @author Luis W. Sevilla <sevilla_lui@gva.es> |
|
43 |
*/ |
|
44 |
public class Hoja implements Projected { |
|
45 |
IProjection proj; |
|
46 |
String code = null; |
|
47 |
String name = null; |
|
48 |
Extent extent = null; |
|
49 |
Point2D tl; |
|
50 |
Point2D tr; |
|
51 |
Point2D bl; |
|
52 |
Point2D br; |
|
53 |
|
|
54 |
public Hoja(IProjection proj, String code, String name) { |
|
55 |
this.proj = proj; |
|
56 |
this.code = code; |
|
57 |
this.name = name; |
|
58 |
tl = tr = bl = br = null; |
|
59 |
} |
|
60 |
|
|
61 |
public Hoja(String cod, Point2D p1, Point2D p2, Point2D p3, Point2D p4, |
|
62 |
String name) { |
|
63 |
code = cod; |
|
64 |
tl = p1; |
|
65 |
tr = p2; |
|
66 |
bl = p3; |
|
67 |
br = p4; |
|
68 |
|
|
69 |
if (name != null) { |
|
70 |
this.name = name; |
|
71 |
} |
|
72 |
|
|
73 |
setExtent(); |
|
74 |
} |
|
75 |
|
|
76 |
public Hoja(String cod, Point2D[] pt, String name) { |
|
77 |
code = cod; |
|
78 |
tl = pt[0]; |
|
79 |
tr = pt[1]; |
|
80 |
br = pt[2]; |
|
81 |
bl = pt[3]; |
|
82 |
|
|
83 |
if (name != null) { |
|
84 |
this.name = name; |
|
85 |
} |
|
86 |
|
|
87 |
setExtent(); |
|
88 |
} |
|
89 |
|
|
90 |
public Hoja(String cod, Vector pt, String name) { |
|
91 |
code = cod; |
|
92 |
tl = (Point2D) pt.get(0); |
|
93 |
tr = (Point2D) pt.get(1); |
|
94 |
br = (Point2D) pt.get(2); |
|
95 |
bl = (Point2D) pt.get(3); |
|
96 |
|
|
97 |
if (name != null) { |
|
98 |
this.name = name; |
|
99 |
} |
|
100 |
|
|
101 |
setExtent(); |
|
102 |
} |
|
103 |
|
|
104 |
public Hoja(String cod, Hoja h, String name) { |
|
105 |
code = cod; |
|
106 |
tl = h.tl; |
|
107 |
tr = h.tr; |
|
108 |
br = h.br; |
|
109 |
bl = h.bl; |
|
110 |
|
|
111 |
if (name != null) { |
|
112 |
this.name = name; |
|
113 |
} |
|
114 |
|
|
115 |
setExtent(); |
|
116 |
} |
|
117 |
|
|
118 |
public IProjection getProjection() { |
|
119 |
return proj; |
|
120 |
} |
|
121 |
|
|
122 |
public void setProjection(IProjection p) { |
|
123 |
proj = p; |
|
124 |
} |
|
125 |
|
|
126 |
public void reProject(ICoordTrans rp) { |
|
127 |
// TODO metodo reProject pendiente de implementar |
|
128 |
} |
|
129 |
|
|
130 |
public Point2D getTL() { |
|
131 |
return tl; |
|
132 |
} |
|
133 |
|
|
134 |
public void setTL(Point2D pt) { |
|
135 |
tl = pt; |
|
136 |
extent.add(pt); |
|
137 |
} |
|
138 |
|
|
139 |
public Point2D getTR() { |
|
140 |
return tr; |
|
141 |
} |
|
142 |
|
|
143 |
public void setTR(Point2D pt) { |
|
144 |
tr = pt; |
|
145 |
extent.add(pt); |
|
146 |
} |
|
147 |
|
|
148 |
public Point2D getBL() { |
|
149 |
return bl; |
|
150 |
} |
|
151 |
|
|
152 |
public void setBL(Point2D pt) { |
|
153 |
bl = pt; |
|
154 |
extent.add(pt); |
|
155 |
} |
|
156 |
|
|
157 |
public Point2D getBR() { |
|
158 |
return br; |
|
159 |
} |
|
160 |
|
|
161 |
public void setBR(Point2D pt) { |
|
162 |
br = pt; |
|
163 |
extent.add(pt); |
|
164 |
} |
|
165 |
|
|
166 |
public Extent getExtent() { |
|
167 |
return extent; |
|
168 |
} |
|
169 |
|
|
170 |
private void setExtent() { |
|
171 |
extent = new Extent(tl, br); |
|
172 |
extent.add(tr); |
|
173 |
extent.add(bl); |
|
174 |
} |
|
175 |
|
|
176 |
public String getCode() { |
|
177 |
return code; |
|
178 |
} |
|
179 |
|
|
180 |
public String getName() { |
|
181 |
return name; |
|
182 |
} |
|
183 |
|
|
184 |
public Point2D[] getVertex() { |
|
185 |
Point2D[] v = { tl, tr, br, bl }; |
|
186 |
|
|
187 |
return v; |
|
188 |
} |
|
189 |
|
|
190 |
public void toXml(OutputStream os) { |
|
191 |
} |
|
192 |
|
|
193 |
public void fromXml(InputStream is) { |
|
194 |
} |
|
195 |
} |
org.gvsig.dxf/tags/org.gvsig.dxf-2.0.147/org.gvsig.dxf.lib/src/main/java/org/gvsig/dxf/io/DxfFile.java | ||
---|---|---|
1 |
/* |
|
2 |
* Cresques Mapping Suite. Graphic Library for constructing mapping applications. |
|
3 |
* |
|
4 |
* Copyright (C) 2004-5. |
|
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
19 |
* |
|
20 |
* For more information, contact: |
|
21 |
* |
|
22 |
* cresques@gmail.com |
|
23 |
*/ |
|
24 |
package org.gvsig.dxf.io; |
|
25 |
|
|
26 |
import java.io.BufferedReader; |
|
27 |
import java.io.FileReader; |
|
28 |
import java.io.FileWriter; |
|
29 |
import java.io.IOException; |
|
30 |
import java.io.InputStream; |
|
31 |
import java.io.InputStreamReader; |
|
32 |
import java.io.Reader; |
|
33 |
import java.util.Date; |
|
34 |
import java.util.Hashtable; |
|
35 |
import java.util.Vector; |
|
36 |
|
|
37 |
import org.cresques.cts.ICoordTrans; |
|
38 |
import org.cresques.cts.IProjection; |
|
39 |
import org.cresques.geo.Projected; |
|
40 |
import org.cresques.px.Extent; |
|
41 |
import org.gvsig.dxf.px.IObjList; |
|
42 |
import org.gvsig.dxf.px.dxf.DxfEntityMaker; |
|
43 |
import org.gvsig.dxf.px.dxf.DxfHeaderManager; |
|
44 |
import org.gvsig.dxf.px.dxf.DxfHeaderVariables; |
|
45 |
import org.slf4j.Logger; |
|
46 |
import org.slf4j.LoggerFactory; |
|
47 |
|
|
48 |
/** |
|
49 |
* Clase que representa un fichero en formato DXF. Contiene los interfaces y |
|
50 |
* m�todos necesarios para acceder a la informaci�n almacenada en su |
|
51 |
* interior. |
|
52 |
* |
|
53 |
* @author jmorell |
|
54 |
*/ |
|
55 |
public class DxfFile extends GeoFile { |
|
56 |
|
|
57 |
public static Logger logger = LoggerFactory.getLogger(DxfFile.class); |
|
58 |
|
|
59 |
private boolean cadFlag = true; |
|
60 |
|
|
61 |
long lineNr = 0; |
|
62 |
|
|
63 |
String buf = null; |
|
64 |
|
|
65 |
BufferedReader fi; |
|
66 |
long l = 0; |
|
67 |
int count = 0; |
|
68 |
DxfGroup grp = null; |
|
69 |
|
|
70 |
EntityFactory entityMaker = null; |
|
71 |
VarSettings headerManager; |
|
72 |
private boolean dxf3DFlag; |
|
73 |
|
|
74 |
/** |
|
75 |
* Crea los objetos en el Modelo correspondiente. |
|
76 |
* |
|
77 |
* @author "Luis W. Sevilla" <sevilla_lui@gva.es> |
|
78 |
*/ |
|
79 |
public interface EntityFactory extends Projected { |
|
80 |
|
|
81 |
/** |
|
82 |
* Permite saber si se est�n a�adiendo elementos a un bloque |
|
83 |
* |
|
84 |
* @param booleano que indica si se est�n a�adiendo elementos a un |
|
85 |
* bloque |
|
86 |
*/ |
|
87 |
public void setAddingToBlock(boolean a); |
|
88 |
|
|
89 |
/** |
|
90 |
* Crea una nueva capa partiendo de la informaci�n almacenada en el |
|
91 |
* DXF |
|
92 |
* |
|
93 |
* @param DxfGroupVector con informaci�n para la construcci�n de la |
|
94 |
* nueva capa |
|
95 |
* @throws Exception |
|
96 |
*/ |
|
97 |
public void createLayer(DxfGroupVector v) throws Exception; |
|
98 |
|
|
99 |
/** |
|
100 |
* Crea una nueva polil�nea partiendo de la informaci�n almacenada |
|
101 |
* en el DXF |
|
102 |
* |
|
103 |
* @param DxfGroupVector con informaci�n para la construcci�n de la |
|
104 |
* nueva polil�nea |
|
105 |
* @throws Exception |
|
106 |
*/ |
|
107 |
public void createPolyline(DxfGroupVector v) throws Exception; |
|
108 |
|
|
109 |
/** |
|
110 |
* A�ade un v�rtice a la polil�nea que se est� creando |
|
111 |
* |
|
112 |
* @param DxfGroupVector con la informaci�n necesaria para la |
|
113 |
* adici�n del v�rtice |
|
114 |
* @throws Exception |
|
115 |
*/ |
|
116 |
public void addVertex(DxfGroupVector v) throws Exception; |
|
117 |
|
|
118 |
/** |
|
119 |
* Fin de secuencia |
|
120 |
* |
|
121 |
* @throws Exception |
|
122 |
*/ |
|
123 |
public void endSeq() throws Exception; |
|
124 |
|
|
125 |
/** |
|
126 |
* Crea una nueva LwPolyline partiendo de la informaci�n almacenada en |
|
127 |
* el DXF |
|
128 |
* |
|
129 |
* @param DxfGroupVector con informaci�n para la construcci�n de la |
|
130 |
* nueva polil�nea |
|
131 |
* @throws Exception |
|
132 |
*/ |
|
133 |
public void createLwPolyline(DxfGroupVector v) throws Exception; |
|
134 |
|
|
135 |
/** |
|
136 |
* Crea una nueva l�nea partiendo de la informaci�n almacenada en el |
|
137 |
* DXF |
|
138 |
* |
|
139 |
* @param DxfGroupVector con informaci�n para la construcci�n de la |
|
140 |
* nueva l�nea |
|
141 |
* @throws Exception |
|
142 |
*/ |
|
143 |
public void createLine(DxfGroupVector v) throws Exception; |
|
144 |
|
|
145 |
/** |
|
146 |
* Crea un nuevo texto partiendo de la informaci�n almacenada en el |
|
147 |
* DXF |
|
148 |
* |
|
149 |
* @param DxfGroupVector con informaci�n para la construcci�n del |
|
150 |
* nuevo texto |
|
151 |
* @throws Exception |
|
152 |
*/ |
|
153 |
public void createText(DxfGroupVector v) throws Exception; |
|
154 |
|
|
155 |
/** |
|
156 |
* Crea un nuevo MText partiendo de la informaci�n almacenada en el |
|
157 |
* DXF |
|
158 |
* |
|
159 |
* @param DxfGroupVector con informaci�n para la construcci�n del |
|
160 |
* nuevo MText |
|
161 |
* @throws Exception |
|
162 |
*/ |
|
163 |
public void createMText(DxfGroupVector v) throws Exception; |
|
164 |
|
|
165 |
/** |
|
166 |
* Crea un nuevo punto partiendo de la informaci�n almacenada en el |
|
167 |
* DXF |
|
168 |
* |
|
169 |
* @param DxfGroupVector con informaci�n para la construcci�n del |
|
170 |
* nuevo punto |
|
171 |
* @throws Exception |
|
172 |
*/ |
|
173 |
public void createPoint(DxfGroupVector v) throws Exception; |
|
174 |
|
|
175 |
/** |
|
176 |
* Crea un nuevo c�rculo partiendo de la informaci�n almacenada en |
|
177 |
* el DXF |
|
178 |
* |
|
179 |
* @param DxfGroupVector con informaci�n para la construcci�n del |
|
180 |
* nuevo c�rculo |
|
181 |
* @throws Exception |
|
182 |
*/ |
|
183 |
public void createCircle(DxfGroupVector v) throws Exception; |
|
184 |
|
|
185 |
/** |
|
186 |
* Crea una nueva elipse partiendo de la informaci�n almacenada en el |
|
187 |
* DXF |
|
188 |
* |
|
189 |
* @param DxfGroupVector con informaci�n para la construcci�n de la |
|
190 |
* nueva elipse |
|
191 |
* @throws Exception |
|
192 |
*/ |
|
193 |
public void createEllipse(DxfGroupVector v) throws Exception; |
|
194 |
|
|
195 |
/** |
|
196 |
* Crea un nuevo arco partiendo de la informaci�n almacenada en el DXF |
|
197 |
* |
|
198 |
* @param DxfGroupVector con informaci�n para la construcci�n del |
|
199 |
* nuevo arco |
|
200 |
* @throws Exception |
|
201 |
*/ |
|
202 |
public void createArc(DxfGroupVector v) throws Exception; |
|
203 |
|
|
204 |
/** |
|
205 |
* Crea un nuevo punto de inserci�n partiendo de la informaci�n |
|
206 |
* almacenada en el DXF |
|
207 |
* |
|
208 |
* @param DxfGroupVector con informaci�n para la construcci�n del |
|
209 |
* nuevo punto de inserci�n |
|
210 |
* @throws Exception |
|
211 |
*/ |
|
212 |
public void createInsert(DxfGroupVector v) throws Exception; |
|
213 |
|
|
214 |
/** |
|
215 |
* Crea un nuevo s�lido 2D partiendo de la informaci�n almacenada en |
|
216 |
* el DXF |
|
217 |
* |
|
218 |
* @param DxfGroupVector con informaci�n para la construcci�n del |
|
219 |
* nuevo s�lido |
|
220 |
* @throws Exception |
|
221 |
*/ |
|
222 |
public void createSolid(DxfGroupVector v) throws Exception; |
|
223 |
|
|
224 |
/** |
|
225 |
* Crea un nuevo Spline partiendo de la informaci�n almacenada en el |
|
226 |
* DXF |
|
227 |
* |
|
228 |
* @param DxfGroupVector con informaci�n para la construcci�n del |
|
229 |
* nuevo Spline |
|
230 |
* @throws Exception |
|
231 |
*/ |
|
232 |
public void createSpline(DxfGroupVector v) throws Exception; |
|
233 |
|
|
234 |
/** |
|
235 |
* Construye la definici�n de un nuevo atributo partiendo de la |
|
236 |
* informaci�n almacenada en el DXF |
|
237 |
* |
|
238 |
* @param DxfGroupVector con informaci�n para la construcci�n de la |
|
239 |
* definici�n del nuevo atributo |
|
240 |
* @throws Exception |
|
241 |
*/ |
|
242 |
public void createAttdef(DxfGroupVector v) throws Exception; |
|
243 |
|
|
244 |
/** |
|
245 |
* Crea un nuevo atributo partiendo de la informaci�n almacenada en el |
|
246 |
* DXF |
|
247 |
* |
|
248 |
* @param DxfGroupVector con informaci�n para la creaci�n del nuevo |
|
249 |
* atributo |
|
250 |
* @throws Exception |
|
251 |
*/ |
|
252 |
public void createAttrib(DxfGroupVector v) throws Exception; |
|
253 |
|
|
254 |
/** |
|
255 |
* Crea un bloque |
|
256 |
* |
|
257 |
* @param DxfGroupVector con informaci�n para la creaci�n del nuevo |
|
258 |
* elemento |
|
259 |
* @throws Exception |
|
260 |
*/ |
|
261 |
public void createBlock(DxfGroupVector v) throws Exception; |
|
262 |
|
|
263 |
/** |
|
264 |
* Fin de la definici�n de un bloqe |
|
265 |
* |
|
266 |
* @param DxfGroupVector con informaci�n referente al final de un |
|
267 |
* bloque |
|
268 |
* @throws Exception |
|
269 |
*/ |
|
270 |
public void endBlk(DxfGroupVector v) throws Exception; |
|
271 |
|
|
272 |
/** |
|
273 |
* Gestiona los bloques que no se han tratado en la primera vuelta |
|
274 |
*/ |
|
275 |
void testBlocks(); |
|
276 |
|
|
277 |
/** |
|
278 |
* Devuelve el extent |
|
279 |
* |
|
280 |
* @return el extent |
|
281 |
*/ |
|
282 |
public Extent getExtent(); |
|
283 |
|
|
284 |
/** |
|
285 |
* Devuelve la lista de bloques |
|
286 |
* |
|
287 |
* @return la lista de bloques |
|
288 |
*/ |
|
289 |
public Vector getBlkList(); |
|
290 |
|
|
291 |
/** |
|
292 |
* Permite la gesti�n de los atributos almacenados en unn DXF |
|
293 |
* |
|
294 |
* @return un Vector con la lista de atributos |
|
295 |
*/ |
|
296 |
public Vector getAttributes(); |
|
297 |
|
|
298 |
/** |
|
299 |
* Borra los atributos repetidos |
|
300 |
*/ |
|
301 |
public void depureAttributes(); |
|
302 |
|
|
303 |
/** |
|
304 |
* Devuelve los objetos almacenados en el DXF |
|
305 |
* |
|
306 |
* @return IObjList con los objetos procedentes del DXF |
|
307 |
*/ |
|
308 |
public IObjList getObjects(); |
|
309 |
|
|
310 |
/** |
|
311 |
* Permite saber si se trata de un fichero DXF en 2D o en 3D |
|
312 |
* |
|
313 |
* @return booleano que indica si se trata de un fichero DXF 3D |
|
314 |
*/ |
|
315 |
public boolean isDxf3DFile(); |
|
316 |
}; |
|
317 |
|
|
318 |
/** |
|
319 |
* Establece el estado de las variables propias de un DXF que est�n |
|
320 |
* definidas en la secci�n HEADER. Por ejemplo, la versi�n del DXF. |
|
321 |
* |
|
322 |
* @author jmorell (jose.morell@gmail.com) |
|
323 |
* @version 15-dic-2004 |
|
324 |
*/ |
|
325 |
public interface VarSettings { |
|
326 |
|
|
327 |
/** |
|
328 |
* Establece la versi�n de Autocad en la que fue generado el DXF. |
|
329 |
* |
|
330 |
* @param informaci�n de base |
|
331 |
* @throws Exception |
|
332 |
*/ |
|
333 |
public void setAcadVersion(DxfGroupVector v) throws Exception; |
|
334 |
|
|
335 |
/** |
|
336 |
* Devuelve la versi�n de Autocad en la que fue generado el DXF. |
|
337 |
* |
|
338 |
* @return |
|
339 |
*/ |
|
340 |
public String getAcadVersion(); |
|
341 |
|
|
342 |
/** |
|
343 |
* Devuelve el estado de las variables propias de un DXF |
|
344 |
* |
|
345 |
* @return |
|
346 |
*/ |
|
347 |
public DxfHeaderVariables getDxfHeaderVars(); |
|
348 |
|
|
349 |
public boolean isWritedDxf3D(); |
|
350 |
|
|
351 |
public void loadMinZFromHeader(double d); |
|
352 |
|
|
353 |
public void loadMaxZFromHeader(double d); |
|
354 |
}; |
|
355 |
|
|
356 |
/** |
|
357 |
* Constructor de la clase |
|
358 |
* |
|
359 |
* @param proj, la proyecci�n cartogr�fica |
|
360 |
* @param name, el path absoluto hasta el fichero DXF |
|
361 |
* @param maker, el interface que permite la construcci�n de las entidades |
|
362 |
* procedentes del DXF |
|
363 |
*/ |
|
364 |
public DxfFile(IProjection proj, String name, EntityFactory maker) { |
|
365 |
super(proj, name); |
|
366 |
entityMaker = maker; |
|
367 |
headerManager = new DxfHeaderManager(); |
|
368 |
} |
|
369 |
|
|
370 |
/** |
|
371 |
* Constructor de la clase que adem�s incorpora la capacidad de leer una |
|
372 |
* porci�n del HEADER |
|
373 |
* |
|
374 |
* @param proj, la proyecci�n cartogr�fica |
|
375 |
* @param name, el path absoluto hasta el fichero DXF |
|
376 |
* @param maker, el interface que permite la construcci�n de las entidades |
|
377 |
* procedentes del DXF |
|
378 |
* @param dxfVars, el interface que permite la lectura del HEADER de un DXF |
|
379 |
*/ |
|
380 |
public DxfFile(IProjection proj, String name, EntityFactory maker, VarSettings dxfVars) { |
|
381 |
super(proj, name); |
|
382 |
entityMaker = maker; |
|
383 |
headerManager = dxfVars; |
|
384 |
} |
|
385 |
|
|
386 |
/** |
|
387 |
* Carga un fichero en formato DXF |
|
388 |
* |
|
389 |
* @throws Exception |
|
390 |
*/ |
|
391 |
public GeoFile load() throws Exception { |
|
392 |
logger.debug("Dxf: Cargando " + name + " ..."); |
|
393 |
if (ZipFileFolder.isUrl(name)) { |
|
394 |
ZipFileFolder zFolder = new ZipFileFolder(name); |
|
395 |
InputStream is = zFolder.getInputStream(name); |
|
396 |
return load(new InputStreamReader(is)); |
|
397 |
} else { |
|
398 |
return load(new FileReader(name)); |
|
399 |
} |
|
400 |
|
|
401 |
} |
|
402 |
|
|
403 |
/** |
|
404 |
* Carga un fichero en formato DXF tomando un Reader como par�metro |
|
405 |
* |
|
406 |
* @param fr, Reader que se le pasa como par�metro |
|
407 |
* @return devuelve un objeto GeoFile, padre de DxfFile |
|
408 |
* @throws Exception |
|
409 |
* @throws Exception |
|
410 |
*/ |
|
411 |
public GeoFile load(Reader fr) throws Exception { |
|
412 |
logger.debug("Dxf: Cargando '" + name + "' ..."); |
|
413 |
fi = new BufferedReader(fr); |
|
414 |
while ((grp = readGrp()) != null) { |
|
415 |
l += 2; |
|
416 |
|
|
417 |
if (grp.equals(0, "EOF")) { |
|
418 |
break; |
|
419 |
} |
|
420 |
if (grp.equals(0, "SECTION")) { |
|
421 |
readSection(); |
|
422 |
} |
|
423 |
} |
|
424 |
fi.close(); |
|
425 |
extent.add(entityMaker.getExtent()); |
|
426 |
logger.debug("Dxf: '" + name + "' cargado. (" + l + " l�neas)."); |
|
427 |
this.lineNr = l; |
|
428 |
return this; |
|
429 |
} |
|
430 |
|
|
431 |
/** |
|
432 |
* El fichero DXF se divide en grupos. Este m�todo permite leer cada grupo |
|
433 |
* individualmente |
|
434 |
* |
|
435 |
* @return devuelve la informaci�n del DXF en forma de objetos de la clase |
|
436 |
* DxfGroup |
|
437 |
* @throws NumberFormatException |
|
438 |
* @throws IOException |
|
439 |
*/ |
|
440 |
private DxfGroup readGrp() throws NumberFormatException, IOException { |
|
441 |
DxfGroup g = DxfGroup.read(fi); |
|
442 |
if (g != null) { |
|
443 |
l += 2; |
|
444 |
} |
|
445 |
/*if (g.code == 8) |
|
446 |
if (((String) g.data).length() < 1) { |
|
447 |
logger.error("a que un layer no puede ser ''?"); |
|
448 |
System.exit(1); |
|
449 |
}*/ |
|
450 |
return g; |
|
451 |
} |
|
452 |
|
|
453 |
/** |
|
454 |
* El fichero DXF se divide en varias secciones. Este m�todo se encarga de |
|
455 |
* leer cada una de ellas |
|
456 |
* |
|
457 |
* @throws NumberFormatException |
|
458 |
* @throws Exception |
|
459 |
*/ |
|
460 |
private void readSection() throws NumberFormatException, Exception { |
|
461 |
while (true) { |
|
462 |
grp = readGrp(); |
|
463 |
logger.debug("-1:" + grp); |
|
464 |
if (grp.code == 2) { |
|
465 |
if (((String) grp.data).compareTo("HEADER") == 0) { |
|
466 |
readHeader(); |
|
467 |
} else if (((String) grp.data).compareTo("CLASSES") == 0) { |
|
468 |
readAnySection(); |
|
469 |
} else if (((String) grp.data).compareTo("TABLES") == 0) { |
|
470 |
readTables(); |
|
471 |
} else if (((String) grp.data).compareTo("BLOCKS") == 0) { |
|
472 |
readBlocks(); |
|
473 |
} else if (((String) grp.data).compareTo("ENTITIES") == 0) { |
|
474 |
readEntities(); |
|
475 |
} else if (((String) grp.data).compareTo("OBJECTS") == 0) { |
|
476 |
readAnySection(); |
|
477 |
} else { |
|
478 |
logger.debug("DxfRead: Seccion " + grp.data); |
|
479 |
readAnySection(); |
|
480 |
} |
|
481 |
} else { |
|
482 |
logger.debug("Dxf: Codigo/Seccion desconocidos" + grp); |
|
483 |
} |
|
484 |
if (grp.equals(0, "EOF")) { |
|
485 |
break; |
Also available in: Unified diff