Revision 1278

View differences:

org.gvsig.dgn/tags/org.gvsig.dgn-2.0.260/org.gvsig.dgn.app/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
  <artifactId>org.gvsig.dgn.app</artifactId>
5
  <packaging>pom</packaging>
6
  <name>${project.artifactId}</name>
7
  <parent>
8
      <groupId>org.gvsig</groupId>
9
      <artifactId>org.gvsig.dgn</artifactId>
10
      <version>2.0.260</version>
11
  </parent>
12

  
13
  <modules>
14
    <module>org.gvsig.dgn.app.mainplugin</module>
15
  </modules>
16

  
17

  
18
</project>
org.gvsig.dgn/tags/org.gvsig.dgn-2.0.260/org.gvsig.dgn.app/org.gvsig.dgn.app.mainplugin/buildNumber.properties
1
#Mon Aug 28 17:08:47 CEST 2023
2
buildNumber=2319
org.gvsig.dgn/tags/org.gvsig.dgn-2.0.260/org.gvsig.dgn.app/org.gvsig.dgn.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
  <resourceBundle name="text"/>
6
  <extensions>
7
     <extension class-name="org.gvsig.andami.LibraryExtension" active="false"/>
8
  </extensions>
9
</plugin-config>
org.gvsig.dgn/tags/org.gvsig.dgn-2.0.260/org.gvsig.dgn.app/org.gvsig.dgn.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.dgn.provider.legend</include>
32
        <include>org.gvsig:org.gvsig.dgn.provider</include>
33
      </includes>
34
    </dependencySet>
35
  </dependencySets>
36

  
37
</assembly>
org.gvsig.dgn/tags/org.gvsig.dgn-2.0.260/org.gvsig.dgn.app/org.gvsig.dgn.app.mainplugin/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
  <artifactId>org.gvsig.dgn.app.mainplugin</artifactId>
5
  <packaging>jar</packaging>
6
  <name>${project.artifactId}</name>
7
  <description>DGN file format support</description>
8
  <parent>
9
      <groupId>org.gvsig</groupId>
10
      <artifactId>org.gvsig.dgn.app</artifactId>
11
      <version>2.0.260</version>
12
  </parent>
13

  
14
  <dependencies>
15
    <dependency>
16
        <groupId>org.gvsig</groupId>
17
        <artifactId>org.gvsig.tools.lib</artifactId>
18
        <scope>compile</scope>
19
    </dependency>
20
    <dependency>
21
        <groupId>org.gvsig</groupId>
22
        <artifactId>org.gvsig.andami</artifactId>
23
        <scope>compile</scope>
24
    </dependency>
25
    <dependency>
26
        <groupId>org.gvsig</groupId>
27
        <artifactId>org.gvsig.dgn.provider</artifactId>
28
        <scope>compile</scope>
29
    </dependency>
30
    <dependency>
31
        <groupId>org.gvsig</groupId>
32
        <artifactId>org.gvsig.dgn.provider.legend</artifactId>
33
        <scope>compile</scope>
34
    </dependency>
35

  
36
  </dependencies>
37
  
38
    <properties>
39
        <!-- Package info property values -->
40
        <!-- Default values in org.gvsig.desktop -->
41
        <gvsig.package.info.name>Formats: DGN file format support</gvsig.package.info.name>
42
        <gvsig.package.info.state>testing</gvsig.package.info.state>
43
        <gvsig.package.info.official>true</gvsig.package.info.official>
44
        <gvsig.package.info.dependencies>required: org.gvsig.app.mainplugin -ge 2.1.0-A</gvsig.package.info.dependencies>
45
        <gvsig.package.info.categories>Formats,Vector</gvsig.package.info.categories>
46
        <gvsig.package.info.poolURL>https://devel.gvsig.org/download/projects/gvsig-dgn/pool/</gvsig.package.info.poolURL>
47
    </properties>
48
  
49
</project>
0 50

  
org.gvsig.dgn/tags/org.gvsig.dgn-2.0.260/org.gvsig.dgn.provider.legend/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
  <artifactId>org.gvsig.dgn.provider.legend</artifactId>
5
  <packaging>jar</packaging>
6
  <name>${project.artifactId}</name>
7
  <description>DAL provider for DGN files</description>
8
  <parent>
9
      <groupId>org.gvsig</groupId>
10
      <artifactId>org.gvsig.dgn</artifactId>
11
      <version>2.0.260</version>
12
  </parent>
13

  
14
  <dependencies>
15

  
16
    <dependency>
17
      <groupId>org.gvsig</groupId>
18
      <artifactId>org.gvsig.dgn.provider</artifactId>
19
      <scope>compile</scope>
20
    </dependency>
21

  
22
    <dependency>
23
      <groupId>commons-io</groupId>
24
      <artifactId>commons-io</artifactId>
25
      <scope>compile</scope>
26
    </dependency>
27

  
28
    <dependency>
29
        <groupId>org.gvsig</groupId>
30
        <artifactId>org.gvsig.tools.lib</artifactId>
31
        <scope>compile</scope>
32
    </dependency>
33
    <dependency>
34
        <groupId>org.gvsig</groupId>
35
        <artifactId>org.gvsig.projection.api</artifactId>
36
        <scope>compile</scope>
37
    </dependency>
38
    <dependency>
39
        <groupId>org.gvsig</groupId>
40
        <artifactId>org.gvsig.fmap.dal.api</artifactId>
41
        <scope>compile</scope>
42
    </dependency>
43
    <dependency>
44
        <groupId>org.gvsig</groupId>
45
        <artifactId>org.gvsig.fmap.dal.spi</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
    <dependency>
54
        <groupId>org.gvsig</groupId>
55
        <artifactId>org.gvsig.fmap.geometry.api</artifactId>
56
        <scope>compile</scope>
57
    </dependency>
58
    <dependency>
59
        <groupId>org.gvsig</groupId>
60
        <artifactId>org.gvsig.fmap.mapcontext.api</artifactId>
61
        <scope>compile</scope>
62
    </dependency>
63

  
64
    <dependency>
65
        <groupId>org.gvsig</groupId>
66
        <artifactId>org.gvsig.symbology.lib.api</artifactId>
67
        <scope>compile</scope>
68
    </dependency>
69
    <dependency>
70
        <groupId>org.gvsig</groupId>
71
        <artifactId>org.gvsig.timesupport.lib.api</artifactId>
72
        <scope>compile</scope>
73
    </dependency>  
74
    <dependency>
75
      <groupId>org.gvsig</groupId>
76
      <artifactId>org.gvsig.utils</artifactId>
77
      <scope>compile</scope>
78
    </dependency>
79

  
80

  
81
    <!-- TESTS -->
82
    <dependency>
83
      <groupId>org.gvsig</groupId>
84
      <artifactId>org.gvsig.tools.lib</artifactId>
85
      <type>test-jar</type>
86
      <scope>test</scope>
87
    </dependency>
88
    <dependency>
89
      <groupId>org.gvsig</groupId>
90
      <artifactId>org.gvsig.compat.se</artifactId>
91
      <scope>test</scope>
92
    </dependency>
93
    <dependency>
94
      <groupId>org.gvsig</groupId>
95
      <artifactId>org.gvsig.fmap.dal.impl</artifactId>
96
      <scope>test</scope>
97
    </dependency>
98
    <!--
99
    <dependency>
100
      <groupId>org.gvsig</groupId>
101
      <artifactId>org.gvsig.fmap.geometry.generalpath</artifactId>
102
      <scope>test</scope>
103
    </dependency>
104
    -->
105
    <dependency>
106
      <groupId>org.gvsig</groupId>
107
      <artifactId>org.gvsig.projection.cresques.impl</artifactId>
108
      <scope>test</scope>
109
    </dependency>
110
    <dependency>
111
      <groupId>org.gvsig</groupId>
112
      <artifactId>org.gvsig.timesupport.lib.impl</artifactId>
113
      <scope>test</scope>
114
    </dependency>   
115

  
116

  
117
  </dependencies>
118

  
119
</project>
org.gvsig.dgn/tags/org.gvsig.dgn-2.0.260/org.gvsig.dgn.provider.legend/src/main/java/org/gvsig/fmap/dal/store/dgn/legend/DGNGetLabeling.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.fmap.dal.store.dgn.legend;
29

  
30
import org.gvsig.fmap.dal.exception.OpenException;
31
import org.gvsig.fmap.dal.store.dgn.DGNStoreProvider;
32
import org.gvsig.fmap.dal.store.dgn.LegendBuilder;
33
import org.gvsig.tools.ToolsLocator;
34
import org.gvsig.tools.dynobject.AbstractDynMethod;
35
import org.gvsig.tools.dynobject.DynClass;
36
import org.gvsig.tools.dynobject.DynObject;
37
import org.gvsig.tools.dynobject.DynObjectManager;
38
import org.gvsig.tools.dynobject.exception.DynMethodException;
39
import org.gvsig.tools.dynobject.exception.DynMethodNotSupportedException;
40

  
41
public class DGNGetLabeling extends AbstractDynMethod {
42
	private static int code = DynObjectManager.NULLCODE;
43

  
44
	static void register(DynClass DGNDynClass) {
45
		if (code != DynObjectManager.NULLCODE) {
46
			return;
47
		}
48
		code = ToolsLocator.getDynObjectManager().registerDynMethod(
49
			DGNDynClass, 
50
			new DGNGetLabeling()
51
		);
52

  
53
	}
54
        
55
        public DGNGetLabeling() {
56
            super(LegendBuilder.DYNMETHOD_GETLABELING_NAME,"DGN Labeling");
57
        }
58
        
59
        @Override
60
	public int getCode() throws DynMethodNotSupportedException {
61
		return code;
62
	}
63

  
64
        @Override
65
	public Object invoke(DynObject self, Object[] args)
66
			throws DynMethodException {
67
		try {
68
			return ((DGNStoreProvider) self).getLabeling();
69
		} catch (OpenException e) {
70
			//FIXME
71
			throw new RuntimeException(e);
72
		}
73
	}
74

  
75
}
org.gvsig.dgn/tags/org.gvsig.dgn-2.0.260/org.gvsig.dgn.provider.legend/src/main/java/org/gvsig/fmap/dal/store/dgn/legend/DGNGetLegend.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.fmap.dal.store.dgn.legend;
29

  
30
import org.gvsig.fmap.dal.exception.OpenException;
31
import org.gvsig.fmap.dal.store.dgn.DGNStoreProvider;
32
import org.gvsig.fmap.dal.store.dgn.LegendBuilder;
33
import org.gvsig.tools.ToolsLocator;
34
import org.gvsig.tools.dynobject.AbstractDynMethod;
35
import org.gvsig.tools.dynobject.DynClass;
36
import org.gvsig.tools.dynobject.DynObject;
37
import org.gvsig.tools.dynobject.DynObjectManager;
38
import org.gvsig.tools.dynobject.exception.DynMethodException;
39
import org.gvsig.tools.dynobject.exception.DynMethodNotSupportedException;
40

  
41
public class DGNGetLegend extends AbstractDynMethod {
42
	private static int code = DynObjectManager.NULLCODE;
43

  
44
	static void register(DynClass DGNDynClass) {
45
		if (code != DynObjectManager.NULLCODE) {
46
			return;
47
		}
48
		code = ToolsLocator.getDynObjectManager().registerDynMethod(
49
			DGNDynClass, 
50
			new DGNGetLegend()
51
		);
52

  
53
	}
54
        
55
        public DGNGetLegend() {
56
            super(LegendBuilder.DYNMETHOD_GETLEGEND_NAME,"DGN Legend");
57
        }
58
        
59
        @Override
60
	public int getCode() throws DynMethodNotSupportedException {
61
		return code;
62
	}
63

  
64
        @Override
65
	public Object invoke(DynObject self, Object[] args)
66
			throws DynMethodException {
67
		try {
68
			return ((DGNStoreProvider) self).getLegend();
69
		} catch (OpenException e) {
70
			throw new RuntimeException(e);
71
		}
72
	}
73

  
74
}
org.gvsig.dgn/tags/org.gvsig.dgn-2.0.260/org.gvsig.dgn.provider.legend/src/main/java/org/gvsig/fmap/dal/store/dgn/legend/DGNLegendLibrary.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.fmap.dal.store.dgn.legend;
32

  
33
import org.gvsig.fmap.dal.DALLibrary;
34
import org.gvsig.fmap.dal.store.dgn.DGNLibrary;
35
import org.gvsig.fmap.dal.store.dgn.DGNStoreProvider;
36
import org.gvsig.metadata.MetadataLibrary;
37
import org.gvsig.metadata.MetadataLocator;
38
import org.gvsig.tools.dynobject.DynClass;
39
import org.gvsig.tools.library.AbstractLibrary;
40
import org.gvsig.tools.library.LibraryException;
41

  
42
/**
43
 * @author jmvivo
44
 *
45
 */
46
public class DGNLegendLibrary extends AbstractLibrary {
47

  
48
    @Override
49
    public void doRegistration() {
50
        registerAsServiceOf(DALLibrary.class);
51
        require(DGNLibrary.class);
52
        require(MetadataLibrary.class);
53
    }
54

  
55
	@Override
56
	protected void doInitialize() throws LibraryException {
57
	}
58

  
59
	@Override
60
	protected void doPostInitialize() throws LibraryException {
61
		DynClass metadataDefinition = (DynClass) MetadataLocator.getMetadataManager()
62
			.getDefinition(DGNStoreProvider.METADATA_DEFINITION_NAME);
63
		DGNGetLegendBuilder.register(metadataDefinition);
64
		DGNGetLegend.register(metadataDefinition);
65
		DGNGetLabeling.register(metadataDefinition);
66
	}
67
}
org.gvsig.dgn/tags/org.gvsig.dgn-2.0.260/org.gvsig.dgn.provider.legend/src/main/java/org/gvsig/fmap/dal/store/dgn/legend/DGNGetLegendBuilder.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.fmap.dal.store.dgn.legend;
29

  
30
import org.gvsig.fmap.dal.store.dgn.LegendBuilder;
31
import org.gvsig.tools.ToolsLocator;
32
import org.gvsig.tools.dynobject.AbstractDynMethod;
33
import org.gvsig.tools.dynobject.DynClass;
34
import org.gvsig.tools.dynobject.DynObject;
35
import org.gvsig.tools.dynobject.DynObjectManager;
36
import org.gvsig.tools.dynobject.exception.DynMethodException;
37
import org.gvsig.tools.dynobject.exception.DynMethodNotSupportedException;
38

  
39
public class DGNGetLegendBuilder extends AbstractDynMethod {
40
	private static int code = DynObjectManager.NULLCODE;
41

  
42
	static void register(DynClass DGNDynClass) {
43
		if (code != DynObjectManager.NULLCODE) {
44
			return;
45
		}
46
		code = ToolsLocator.getDynObjectManager().registerDynMethod(
47
			DGNDynClass, 
48
			new DGNGetLegendBuilder()
49
		);
50

  
51
	}
52
	
53
        public DGNGetLegendBuilder() {
54
            super(LegendBuilder.DYNMETHOD_BUILDER_NAME,"DGN LegendBuilder creator");
55
        }
56
        
57
        @Override
58
	public int getCode() throws DynMethodNotSupportedException {
59
		return code;
60
	}
61

  
62
        @Override
63
	public Object invoke(DynObject self, Object[] args)
64
			throws DynMethodException {
65
		return new DGNLegendBuilder();
66
	}
67

  
68
}
org.gvsig.dgn/tags/org.gvsig.dgn-2.0.260/org.gvsig.dgn.provider.legend/src/main/java/org/gvsig/fmap/dal/store/dgn/legend/DGNLegendBuilder.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.fmap.dal.store.dgn.legend;
29

  
30
import java.awt.Color;
31

  
32
import org.gvsig.fmap.dal.DataTypes;
33
import org.gvsig.fmap.dal.feature.spi.FeatureProvider;
34
import org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider;
35
import org.gvsig.fmap.dal.store.dgn.DGNStoreProvider;
36
import org.gvsig.fmap.dal.store.dgn.LegendBuilder;
37
import org.gvsig.fmap.dal.store.dgn.lib.DGNReader;
38
import org.gvsig.fmap.geom.Geometry;
39
import org.gvsig.fmap.mapcontext.MapContextLocator;
40
import org.gvsig.fmap.mapcontext.MapContextManager;
41
import org.gvsig.fmap.mapcontext.rendering.legend.IVectorialUniqueValueLegend;
42
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
43
import org.gvsig.symbology.SymbologyLocator;
44
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.styling.IAttrInTableLabelingStrategy;
45
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.fill.IFillSymbol;
46
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.line.ILineSymbol;
47
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.marker.IMarkerSymbol;
48

  
49
public class DGNLegendBuilder implements LegendBuilder {
50

  
51
	private MapContextManager mapContextManager = MapContextLocator
52
			.getMapContextManager();
53

  
54
	private IVectorialUniqueValueLegend defaultLegend = null;
55
	private IAttrInTableLabelingStrategy labelingStragegy = null;
56

  
57
	public void begin() {
58
		// Nothing to do
59
	}
60

  
61
	public void end() {
62
		// Nothing to do
63
	}
64

  
65
	public Object getLegend() {
66
		return defaultLegend;
67
	}
68

  
69
	public LegendBuilder initialize(FeatureStoreProvider store) {
70
		defaultLegend = (IVectorialUniqueValueLegend) mapContextManager.createLegend(
71
						IVectorialUniqueValueLegend.LEGEND_NAME);
72
		defaultLegend.setShapeType(Geometry.TYPES.GEOMETRY);
73
		defaultLegend
74
				.setClassifyingFieldNames(new String[] { DGNStoreProvider.NAME_FIELD_COLOR });
75
		defaultLegend.setClassifyingFieldTypes(new int[] { DataTypes.INT });
76

  
77
		ISymbol myDefaultSymbol =
78
				mapContextManager.getSymbolManager()
79
				.createSymbol(Geometry.TYPES.GEOMETRY);
80

  
81
		defaultLegend.setDefaultSymbol(myDefaultSymbol);
82

  
83
		labelingStragegy = SymbologyLocator.getSymbologyManager().createAttrInTableLabelingStrategy();
84
		labelingStragegy.setTextField(DGNStoreProvider.NAME_FIELD_TEXT);
85
		labelingStragegy
86
				.setRotationField(DGNStoreProvider.NAME_FIELD_ROTATIONTEXT);
87
		labelingStragegy.setHeightField(DGNStoreProvider.NAME_FIELD_HEIGHTTEXT);
88
		labelingStragegy.setUnit(1); // MapContext.NAMES[1] (meters)
89
		return this;
90
	}
91

  
92
	public void process(FeatureProvider feature, DGNReader dgnReader) {
93
		Integer clave = (Integer) feature.get("Color");
94
		if (clave == null) {
95
			return;
96
		}
97

  
98
		defaultLegend.useDefaultSymbol(false);
99
		if (defaultLegend.getSymbolByValue(clave) == null) {
100
			ISymbol theSymbol;
101
			Color color = dgnReader.DGNLookupColor(clave.intValue());
102
                        if( color == null ) {
103
                            color = Color.BLACK;
104
                        }
105
			theSymbol = mapContextManager.getSymbolManager().createSymbol(
106
					Geometry.TYPES.GEOMETRY, color);
107

  
108
			theSymbol.setDescription(clave.toString());
109

  
110
			if (theSymbol instanceof IMarkerSymbol) {
111
				((IMarkerSymbol) theSymbol).setSize(1);
112
			}
113

  
114
			if (theSymbol instanceof ILineSymbol) {
115
				ILineSymbol lineSymbol = (ILineSymbol) theSymbol;
116
				lineSymbol.setLineWidth(1);
117
				lineSymbol.setLineColor(color);
118
			}
119

  
120
			if (theSymbol instanceof IFillSymbol) {
121
				IFillSymbol fillSymbol = (IFillSymbol) theSymbol;
122
				fillSymbol.getOutline().setLineColor(color);
123
				fillSymbol.getOutline().setLineWidth(1);
124
				fillSymbol.setFillColor(null);
125
			}
126
			if (theSymbol != null) {
127
				defaultLegend.addSymbol(clave, theSymbol);
128
			}
129
		}
130
        defaultLegend.useDefaultSymbol(true);
131
	}
132

  
133
	public Object getLabeling() {
134
		return labelingStragegy;
135
	}
136

  
137

  
138
}
0 139

  
org.gvsig.dgn/tags/org.gvsig.dgn-2.0.260/org.gvsig.dgn.provider/src/main/java/org/gvsig/fmap/dal/store/dgn/PostProcessGroupOperation.java
1
package org.gvsig.fmap.dal.store.dgn;
2

  
3
import java.util.ArrayList;
4
import java.util.HashMap;
5
import java.util.Iterator;
6
import java.util.List;
7
import java.util.Map;
8
import org.gvsig.fmap.dal.feature.FeatureType;
9
import org.gvsig.fmap.dal.feature.spi.FeatureProvider;
10
import static org.gvsig.fmap.dal.store.dgn.DGNStoreProvider.GROUP_GEOMETRIES_CONVEXHULL;
11
import static org.gvsig.fmap.dal.store.dgn.DGNStoreProvider.GROUP_GEOMETRIES_INTERSECTION;
12
import static org.gvsig.fmap.dal.store.dgn.DGNStoreProvider.GROUP_GEOMETRIES_NONE;
13
import static org.gvsig.fmap.dal.store.dgn.DGNStoreProvider.GROUP_GEOMETRIES_TOLINES;
14
import static org.gvsig.fmap.dal.store.dgn.DGNStoreProvider.GROUP_GEOMETRIES_TOPOINTS;
15
import static org.gvsig.fmap.dal.store.dgn.DGNStoreProvider.GROUP_GEOMETRIES_TOPOLYGONS;
16
import static org.gvsig.fmap.dal.store.dgn.DGNStoreProvider.GROUP_GEOMETRIES_TOPOLYGONS_FIX;
17
import static org.gvsig.fmap.dal.store.dgn.DGNStoreProvider.GROUP_GEOMETRIES_UNION;
18
import org.gvsig.fmap.dal.store.dgn.lib.DGNReader;
19
import org.gvsig.fmap.geom.Geometry;
20
import org.gvsig.fmap.geom.GeometryLocator;
21
import org.gvsig.fmap.geom.GeometryManager;
22
import org.gvsig.fmap.geom.aggregate.Aggregate;
23
import org.gvsig.fmap.geom.aggregate.MultiLine;
24
import org.gvsig.fmap.geom.aggregate.MultiPolygon;
25
import org.gvsig.fmap.geom.aggregate.MultiPrimitive;
26
import org.gvsig.fmap.geom.exception.CreateGeometryException;
27
import org.gvsig.fmap.geom.primitive.Curve;
28
import org.gvsig.fmap.geom.primitive.Envelope;
29
import org.gvsig.fmap.geom.primitive.Line;
30
import org.gvsig.fmap.geom.primitive.Point;
31
import org.gvsig.fmap.geom.primitive.Polygon;
32
import org.gvsig.fmap.geom.primitive.Primitive;
33
import org.gvsig.fmap.geom.primitive.Surface;
34
import org.gvsig.tools.logger.FilteredLogger;
35
import org.slf4j.Logger;
36
import org.slf4j.LoggerFactory;
37

  
38
public class PostProcessGroupOperation {
39

  
40
    private static final Logger logger = LoggerFactory.getLogger(PostProcessGroupOperation.class);
41

  
42
    private int groupByFieldIndex = -1;
43
    private Map<Object, FeatureProvider> groupedFeatures = null;
44
    private GeometryManager geomManager = null;
45
    private int ID_FIELD_GEOMETRY = -1;
46
    private int MAX_FIELD_ID = -1;
47
    private int groupGeometriesOperation = -1;
48
    private Envelope envelope = null;
49

  
50
    public PostProcessGroupOperation(FeatureType featureType, String groupfield, int groupGeometriesOperation) {
51
        this.groupByFieldIndex = featureType.getIndex(groupfield);
52
        if (groupByFieldIndex < 0) {
53
            throw new IllegalArgumentException("Can't group by field '" + groupfield + ", the field don't exists.");
54
        }
55
        this.geomManager = GeometryLocator.getGeometryManager();
56
        this.ID_FIELD_GEOMETRY = featureType.getDefaultGeometryAttribute().getIndex();
57
        this.MAX_FIELD_ID = featureType.size() - 1;
58
        this.groupGeometriesOperation = groupGeometriesOperation;
59
    }
60

  
61
    public void add(FeatureProvider data) {
62
        if (groupedFeatures == null) {
63
            groupedFeatures = new HashMap<Object, FeatureProvider>();
64
        }
65
        Object groupbyValue = data.get(groupByFieldIndex);
66
        FeatureProvider group = groupedFeatures.get(groupbyValue);
67
        if (group == null) {
68
            groupedFeatures.put(groupbyValue, data);
69
            MultiPrimitive multi = getMultiPrimitive((Geometry) data.get(ID_FIELD_GEOMETRY));
70
            if (multi == null) {
71
                data.set(ID_FIELD_GEOMETRY, null);
72
            } else {
73
                data.set(ID_FIELD_GEOMETRY, multi);
74
            }
75
            return;
76
        }
77
        for (int i = 0; i <= MAX_FIELD_ID; i++) {
78
            Object value = group.get(i);
79
            if (i == ID_FIELD_GEOMETRY) {
80
                Geometry newgeom = (Geometry) data.get(i);
81
                if (newgeom != null) {
82
                    if (value == null) {
83
                        group.set(ID_FIELD_GEOMETRY, getMultiPrimitive(newgeom));
84
                    } else {
85
                        try {
86
                            ((MultiPrimitive) value).addPrimitive((Primitive) newgeom);
87
                        } catch (Exception ex) {
88
                            logger.warn("Can't group geoemtry '" + newgeom.toString() + "' in '" + value.toString() + "'.", ex);
89
                        }
90
                    }
91
                }
92
            } else if (value == null) {
93
                group.set(i, data.get(i));
94
            } else if (value instanceof String) {
95
                String s = (String) value;
96
                if (s.trim().length() == 0) {
97
                    group.set(i, data.get(i));
98
                }
99
            }
100
        }
101

  
102
    }
103

  
104
    private MultiPrimitive getMultiPrimitive(Geometry geom) {
105
        if (geom == null) {
106
            return null;
107
        }
108
        if (geom instanceof MultiPrimitive) {
109
            return (MultiPrimitive) geom;
110
        }
111
        MultiPrimitive multi = null;
112
        try {
113
            if (geom instanceof Point) {
114
                multi = (MultiPrimitive) geomManager.create(
115
                        Geometry.TYPES.MULTIPOINT,
116
                        geom.getGeometryType().getSubType()
117
                );
118
            } else if (geom instanceof Curve) {
119
                multi = (MultiPrimitive) geomManager.create(
120
                        Geometry.TYPES.MULTICURVE,
121
                        geom.getGeometryType().getSubType()
122
                );
123
            } else if (geom instanceof Surface) {
124
                multi = (MultiPrimitive) geomManager.create(
125
                        Geometry.TYPES.MULTISURFACE,
126
                        geom.getGeometryType().getSubType()
127
                );
128
            }
129
            if (multi != null) {
130
                multi.addPrimitive((Primitive) geom);
131
            }
132
        } catch (CreateGeometryException ex) {
133
            logger.warn("Can't create multi-geometry to group", ex);
134
        }
135
        return multi;
136
    }
137

  
138
    public List<FeatureProvider> getRows() {
139
        if (this.groupGeometriesOperation < 0) {
140
            Iterator<FeatureProvider> rowsIterator = this.groupedFeatures.values().iterator();
141
            while( rowsIterator.hasNext() ) {
142
                FeatureProvider feature = rowsIterator.next();
143
                Geometry geometry = feature.getDefaultGeometry();
144
                if (geometry != null) {
145
                    if (this.envelope == null) {
146
                        this.envelope = geometry.getEnvelope();
147
                    } else {
148
                        this.envelope.add(geometry.getEnvelope());
149
                    }
150
                }
151
            }
152
            return (List<FeatureProvider>) this.groupedFeatures.values();
153
        }
154

  
155
        List<FeatureProvider> result = new ArrayList<FeatureProvider>();
156
        
157
        FilteredLogger log = new FilteredLogger(logger, "ConsolideGroupBy", 10);
158

  
159
        Iterator<Map.Entry<Object, FeatureProvider>> it = groupedFeatures.entrySet().iterator();
160
        while (it.hasNext()) {
161
            Map.Entry<Object, FeatureProvider> entry = it.next();
162
            String groupValue = "<null>";
163
            if (entry.getKey() != null) {
164
                groupValue = entry.getKey().toString();
165
            }
166
            try {
167
                FeatureProvider data = entry.getValue();
168
                Geometry geometry = data.getDefaultGeometry();
169
                if (geometry != null) {
170
                    switch (this.groupGeometriesOperation) {
171
                        case GROUP_GEOMETRIES_NONE:
172
                            break;
173
                        case GROUP_GEOMETRIES_CONVEXHULL:
174
                            try {
175
                                geometry = geometry.convexHull();
176
                                data.set(ID_FIELD_GEOMETRY, geometry);
177
                            } catch (Exception ex) {
178
                                log.warn("Can't create convex-hull with geometries of the group '" + groupValue + "'.", ex);
179
                            }
180
                            break;
181
                        case GROUP_GEOMETRIES_UNION:
182
                            if (geometry instanceof Aggregate) {
183
                                try {
184
                                    geometry = ((Aggregate) geometry).union();
185
                                    data.set(ID_FIELD_GEOMETRY, geometry);
186
                                } catch (Exception ex) {
187
                                    log.warn("Can't create a union with geometries of the group '" + groupValue + "'.", ex);
188
                                }
189
                            }
190
                            break;
191
                        case GROUP_GEOMETRIES_INTERSECTION:
192
                            if (geometry instanceof Aggregate) {
193
                                try {
194
                                    geometry = ((Aggregate) geometry).intersection();
195
                                    data.set(ID_FIELD_GEOMETRY, geometry);
196
                                } catch (Exception ex) {
197
                                    log.warn("Can't create a intersection with geometries of the group '" + groupValue + "'.", ex);
198
                                }
199
                            }
200
                            break;
201

  
202
                        case GROUP_GEOMETRIES_TOPOINTS:
203
                            try {
204
                                if (geometry instanceof Line) {
205
                                    geometry = ((Line) geometry).toPoints();
206
                                    data.set(ID_FIELD_GEOMETRY, geometry);
207

  
208
                                } else if (geometry instanceof Polygon) {
209
                                    geometry = ((Polygon) geometry).toPoints();
210
                                    data.set(ID_FIELD_GEOMETRY, geometry);
211

  
212
                                } else if (geometry instanceof Point) {
213
                                    geometry = ((Point) geometry).toPoints();
214
                                    data.set(ID_FIELD_GEOMETRY, geometry);
215

  
216
                                } else if (geometry instanceof MultiLine) {
217
                                    geometry = ((MultiLine) geometry).toPoints();
218
                                    data.set(ID_FIELD_GEOMETRY, geometry);
219

  
220
                                } else if (geometry instanceof MultiPolygon) {
221
                                    geometry = ((MultiPolygon) geometry).toPoints();
222
                                    data.set(ID_FIELD_GEOMETRY, geometry);
223

  
224
                                }
225
                            } catch (Exception ex) {
226
                                log.warn("Can't convert to points the geometries of the group '" + groupValue + "'.", ex);
227
                            }
228
                            break;
229

  
230
                        case GROUP_GEOMETRIES_TOLINES:
231
                            try {
232
                                if (geometry instanceof Polygon) {
233
                                    geometry = ((Polygon) geometry).toLines();
234
                                    data.set(ID_FIELD_GEOMETRY, geometry);
235

  
236
                                } else if (geometry instanceof MultiPolygon) {
237
                                    geometry = ((MultiPolygon) geometry).toLines();
238
                                    data.set(ID_FIELD_GEOMETRY, geometry);
239

  
240
                                }
241
                            } catch (Exception ex) {
242
                                log.warn("Can't convert to lines the geometries of the group '" + groupValue + "'.", ex);
243
                            }
244
                            break;
245

  
246
                        case GROUP_GEOMETRIES_TOPOLYGONS:
247
                            try {
248
                                if (geometry instanceof Line) {
249
                                    geometry = ((Line) geometry).toPolygons();
250
                                    data.set(ID_FIELD_GEOMETRY, geometry);
251

  
252
                                } else if (geometry instanceof MultiLine) {
253
                                    geometry = ((MultiLine) geometry).toPolygons();
254
                                    data.set(ID_FIELD_GEOMETRY, geometry);
255

  
256
                                } else {
257
                                    geometry = null;
258
                                    data.set(ID_FIELD_GEOMETRY, geometry);
259
                                }
260
                            } catch (Exception ex) {
261
                                log.warn("Can't convert to polygons the geometries of the group '" + groupValue + "'.", ex);
262
                            }
263
                            break;
264

  
265
                        case GROUP_GEOMETRIES_TOPOLYGONS_FIX:
266
                            try {
267
                                if (geometry instanceof Line) {
268
                                    geometry = ((Line) geometry).toPolygons();
269
                                    geometry = geometry.buffer(0);
270
                                    data.set(ID_FIELD_GEOMETRY, geometry);
271

  
272
                                } else if (geometry instanceof MultiLine) {
273
                                    geometry = ((MultiLine) geometry).toPolygons();
274
                                    geometry = geometry.buffer(0);
275
                                    data.set(ID_FIELD_GEOMETRY, geometry);
276

  
277
                                } else {
278
                                    geometry = null;
279
                                    data.set(ID_FIELD_GEOMETRY, geometry);
280
                                }
281
                            } catch (Exception ex) {
282
                                log.warn("Can't convert to polygons the geometries of the group '" + groupValue + "'.", ex);
283
                            }
284
                            break;
285
                    }
286
                    if (geometry != null) {
287
                        if (this.envelope == null) {
288
                            this.envelope = geometry.getEnvelope();
289
                        } else {
290
                            this.envelope.add(geometry.getEnvelope());
291
                        }
292
                    }
293
                }
294
                result.add(data);
295
            } catch (Exception ex) {
296
                log.warn("Problem adding data from group '" + groupValue + "'.", ex);
297
            }
298
        }
299
        return result;
300
    }
301

  
302
    public Envelope getEnvelope() {
303
        if( this.envelope == null ) {
304
            
305
        }
306
        return this.envelope;
307
    }
308

  
309
}
org.gvsig.dgn/tags/org.gvsig.dgn-2.0.260/org.gvsig.dgn.provider/src/main/java/org/gvsig/fmap/dal/store/dgn/PostProcessFeatures.java
1
package org.gvsig.fmap.dal.store.dgn;
2

  
3
import java.util.ArrayList;
4
import java.util.Collections;
5
import java.util.Comparator;
6
import java.util.Iterator;
7
import java.util.List;
8
import org.gvsig.fmap.dal.feature.FeatureType;
9
import org.gvsig.fmap.dal.feature.spi.FeatureProvider;
10
import org.gvsig.fmap.dal.store.dgn.DGNStoreProvider.TimeCounter;
11
import org.gvsig.fmap.geom.Geometry;
12
import org.gvsig.fmap.geom.GeometryLocator;
13
import org.gvsig.fmap.geom.GeometryManager;
14
import org.gvsig.fmap.geom.exception.CreateEnvelopeException;
15
import org.gvsig.fmap.geom.primitive.Envelope;
16
import org.slf4j.Logger;
17
import org.slf4j.LoggerFactory;
18

  
19
public class PostProcessFeatures {
20

  
21
    private static final Logger logger = LoggerFactory.getLogger(PostProcessFeatures.class);
22

  
23
    private final FeatureType featureType;
24
    private final DGNOpenStoreParameters parameters;
25
    private Envelope envelope;
26
    private final int geomSubtype;
27
    private PostProcessFilterOperation filter = null;
28

  
29
    public PostProcessFeatures(DGNOpenStoreParameters parameters, FeatureType featureType) {
30
        this.featureType = featureType;
31
        this.parameters = parameters;
32
        if (parameters.ignoreZs()) {
33
            this.geomSubtype = Geometry.SUBTYPES.GEOM2D;
34
        } else {
35
            this.geomSubtype = featureType.getDefaultGeometryAttribute().getGeomType().getSubType();
36
        }
37
    }
38

  
39
    private DGNOpenStoreParameters getDGNParameters() {
40
        return this.parameters;
41
    }
42

  
43
    private PostProcessFilterOperation getFilter() {
44
        if (this.filter == null) {
45
            this.filter = new PostProcessFilterOperation(
46
                    getDGNParameters(),
47
                    featureType
48
            );
49
        }
50
        return this.filter;
51
    }
52

  
53
    public List<FeatureProvider> apply(List<FeatureProvider> rows) throws CreateEnvelopeException {
54

  
55
        TimeCounter tc_total = new TimeCounter();
56
        TimeCounter tc_accept = new TimeCounter();
57

  
58
        PostProcessFilterOperation filter = this.getFilter();
59

  
60
        List<FeatureProvider> result = null;
61

  
62
        Iterator<FeatureProvider> rowsIterator = rows.iterator();
63

  
64
        int rowCount = 0;
65
        int rowFitereds = 0;
66
        if (parameters.getGroupBy() == null) {
67
            GeometryManager geomManager = GeometryLocator.getGeometryManager();
68
            this.envelope = geomManager.createEnvelope(this.geomSubtype);
69

  
70
            tc_total.start();
71
            result = new ArrayList<FeatureProvider>();
72
            while (rowsIterator.hasNext()) {
73
                FeatureProvider feature = rowsIterator.next();
74
                rowCount++;
75

  
76
                tc_accept.start();
77
                boolean accept = filter.accept(feature);
78
                tc_accept.stop();
79

  
80
                if (!accept) {
81
                    continue;
82
                }
83
                rowFitereds++;
84
                Geometry geom = feature.getDefaultGeometry();
85
                if (geom != null) {
86
                    this.envelope.add(geom.getEnvelope());
87
                }
88
                result.add(feature);
89
            }
90
            tc_total.stop();
91
            tc_accept.log("Accepts time filter");
92
            tc_total.log("Total time filer, rows input "+rowCount+", output "+rowFitereds );
93

  
94
        } else {
95
            tc_total.start();
96

  
97
            PostProcessGroupOperation groupOperation = new PostProcessGroupOperation(
98
                    this.featureType,
99
                    parameters.getGroupBy(),
100
                    parameters.getGroupGeometriesOperation()
101
            );
102
            while (rowsIterator.hasNext()) {
103
                FeatureProvider feature = rowsIterator.next();
104
                rowCount++;
105

  
106
                tc_accept.start();
107
                boolean accept = filter.accept(feature);
108
                tc_accept.stop();
109

  
110
                if (!accept) {
111
                    continue;
112
                }
113
                rowFitereds++;
114
                groupOperation.add(feature);
115
            }
116
            result = groupOperation.getRows();
117
            this.envelope = groupOperation.getEnvelope();
118

  
119
            tc_total.stop();
120
            tc_accept.log("Accepts time filter+group");
121
            tc_total.log("Total time filer+group, rows input "+rowCount+", output "+rowFitereds );
122
        }
123

  
124
        if (parameters.sortByGeometryType()) {
125
            this.sortRows(result);
126
        }
127
        return result;
128
    }
129

  
130
    public Envelope getEnvelope() {
131
        return this.envelope;
132
    }
133

  
134
    private void sortRows(List<FeatureProvider> rows) {
135
        TimeCounter tc = new TimeCounter();
136
        tc.start();
137
        Collections.sort(rows, new Comparator<FeatureProvider>() {
138
            public int compare(FeatureProvider o1, FeatureProvider o2) {
139
                Geometry g1 = o1.getDefaultGeometry();
140
                Geometry g2 = o2.getDefaultGeometry();
141
                if (g1 == null) {
142
                    if (g2 == null) {
143
                        return 0;
144
                    } else {
145
                        return -1;
146
                    }
147
                } else if (g2 == null) {
148
                    return 1;
149
                }
150
                return g2.getType() - g1.getType();
151
            }
152
        });
153
        tc.stop();
154
        tc.log("sort data, rows "+rows.size());
155
    }
156

  
157
    public boolean hasOperations() {
158
        PostProcessFilterOperation filter = this.getFilter();
159
        if (filter.hasFilter()) {
160
            return true;
161
        }
162
        if (parameters.getGroupBy() != null) {
163
            return true;
164
        }
165
        return false;
166
    }
167

  
168
}
org.gvsig.dgn/tags/org.gvsig.dgn-2.0.260/org.gvsig.dgn.provider/src/main/java/org/gvsig/fmap/dal/store/dgn/LegendBuilder.java
1
package org.gvsig.fmap.dal.store.dgn;
2

  
3
import org.gvsig.fmap.dal.feature.spi.FeatureProvider;
4
import org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider;
5
import org.gvsig.fmap.dal.store.dgn.lib.DGNReader;
6

  
7

  
8
public interface LegendBuilder {
9

  
10
	final public static String DYNMETHOD_BUILDER_NAME = "getLegendBuilder";
11
	final public static String DYNMETHOD_GETLEGEND_NAME = "getLegend";
12
	final public static String DYNMETHOD_GETLABELING_NAME = "getLabeling";
13

  
14
	public LegendBuilder initialize(FeatureStoreProvider store);
15

  
16
	public void begin();
17

  
18
	public void process(FeatureProvider feature, DGNReader dgnReader);
19

  
20
	public void end();
21

  
22
	public Object getLegend();
23
	public Object getLabeling();
24

  
25
}
org.gvsig.dgn/tags/org.gvsig.dgn-2.0.260/org.gvsig.dgn.provider/src/main/java/org/gvsig/fmap/dal/store/dgn/lib/DGNElemGroup.java
1
/*
2
 * Created on 07-jul-2004
3
 *
4
 * TODO To change the template for this generated file go to
5
 * Window - Preferences - Java - Code Generation - Code and Comments
6
 */
7
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
8
 *
9
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
10
 *
11
 * This program is free software; you can redistribute it and/or
12
 * modify it under the terms of the GNU General Public License
13
 * as published by the Free Software Foundation; either version 2
14
 * of the License, or (at your option) any later version.
15
 *
16
 * This program is distributed in the hope that it will be useful,
17
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
 * GNU General Public License for more details.
20
 *
21
 * You should have received a copy of the GNU General Public License
22
 * along with this program; if not, write to the Free Software
23
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
24
 *
25
 */
26
package org.gvsig.fmap.dal.store.dgn.lib;
27

  
28
/**
29
 * Clase utilizada para guardar un elemento de tipo Group.
30
 *
31
 * @author FJP
32
 */
33
public class DGNElemGroup extends DGNElemCore {
34
	/*                 typedef struct
35
	   {
36
	   Elm_hdr ehdr; // element header
37
	   Disp_hdr dhdr; // display header
38
	   short file_chars; // no. of chars. in file spec
39
	   char file_spec[65] //file specification
40
	   byte file_num; // file number
41
	   Fb_opts fb_opts; // file builder options mask
42
	   Fd_opts fd_opts; // file displayer options mask
43
	   byte disp_flags[16]; // display flags
44
	   short lev_flags[8][4]; // level on/off flags
45
	   long ref_org[3]; // origin in ref file uors
46
	   double trns_mtrx[9]; // transformation matrix
47
	   double cnvrs_fact; // conversion factor
48
	   Group Data Elements (Type 5)
49
	   long mast_org[3]; // origin in master file uors
50
	   short log_chars; // characters in logical name
51
	   char log_name[22]; // logical name (padded)
52
	   short desc_chars; // characters in description
53
	   char description[42]; /* description (padded)
54
	   short lev_sym_mask; // level symbology enable mask
55
	   short lev_sym[63]; // level symbology descriptor
56
	   long z_delta; // Z-direction delta
57
	   short clip_vertices; // clipping vertices
58
	   Point2d clip_poly[1]; // clipping polygon
59
	   } Ref_file_type5; */
60

  
61
	public DGNPoint origin = new DGNPoint(); /*!< Origin of ellipse */
62
	public double primary_axis;
63

  
64
	//=new double[4];	/*!< Primary axis length */
65
	public double secondary_axis;
66

  
67
	//=new double[4]; /*!< Secondary axis length */
68
	public double rotation; /*!< Counterclockwise rotation in degrees */
69
	public double[] quat = new double[4]; //4
70
	public double startang;
71

  
72
	/*!< Start angle (degrees counterclockwise of primary axis) */
73
	public double sweepang; /*!< Sweep angle (degrees) */
74
        
75
        public DGNElemGroup(DGNReader dgnreader) {
76
            super(dgnreader);
77
        }
78
}
org.gvsig.dgn/tags/org.gvsig.dgn-2.0.260/org.gvsig.dgn.provider/src/main/java/org/gvsig/fmap/dal/store/dgn/lib/DGNReader.java
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
5
 *
6
 * This program is free software; you can redistribute it and/or modify it under
7
 * the terms of the GNU General Public License as published by the Free Software
8
 * Foundation; either version 3 of the License, or (at your option) any later
9
 * version.
10
 *
11
 * This program is distributed in the hope that it will be useful, but WITHOUT
12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14
 * details.
15
 *
16
 * You should have received a copy of the GNU General Public License along with
17
 * this program; if not, write to the Free Software Foundation, Inc., 51
18
 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
 *
20
 * For any additional information, do not hesitate to contact us at info AT
21
 * gvsig.com, or visit our website www.gvsig.com.
22
 */
23
package org.gvsig.fmap.dal.store.dgn.lib;
24

  
25
import java.awt.Color;
26
import java.awt.geom.Rectangle2D;
27
import java.io.FileInputStream;
28
import java.io.FileNotFoundException;
29
import java.nio.ByteBuffer;
30
import java.nio.ByteOrder;
31
import java.nio.MappedByteBuffer;
32
import java.nio.channels.FileChannel;
33
import java.text.MessageFormat;
34
import java.util.ArrayList;
35
import java.util.Formatter;
36
import java.util.Iterator;
37
import java.util.LinkedHashMap;
38
import java.util.List;
39
import java.util.Map;
40
import java.util.regex.Pattern;
41

  
42
import org.gvsig.fmap.dal.exception.DataException;
43
import org.gvsig.fmap.dal.exception.ReadException;
44
import org.slf4j.Logger;
45
import org.slf4j.LoggerFactory;
46

  
47
/**
48
 * Clase dedicada a leer del fichero DGN.
49
 *
50
 */
51
public class DGNReader {
52

  
53
    private static Logger logger = LoggerFactory.getLogger(DGNReader.class);
54
    static int[][] abyDefaultPCT = {{255, 255, 255}, {0, 0, 255},
55
    {0, 255, 0}, {255, 0, 0}, {255, 255, 0}, {255, 0, 255},
56
    {255, 127, 0}, {0, 255, 255}, {64, 64, 64},
57
    {192, 192, 192}, {254, 0, 96}, {160, 224, 0},
58
    {0, 254, 160}, {128, 0, 160}, {176, 176, 176},
59
    {0, 240, 240}, {240, 240, 240}, {0, 0, 240}, {0, 240, 0},
60
    {240, 0, 0}, {240, 240, 0}, {240, 0, 240}, {240, 122, 0},
61
    {0, 240, 240}, {240, 240, 240}, {0, 0, 240}, {0, 240, 0},
62
    {240, 0, 0}, {240, 240, 0}, {240, 0, 240}, {240, 122, 0},
63
    {0, 225, 225}, {225, 225, 225}, {0, 0, 225}, {0, 225, 0},
64
    {225, 0, 0}, {225, 225, 0}, {225, 0, 225}, {225, 117, 0},
65
    {0, 225, 225}, {225, 225, 225}, {0, 0, 225}, {0, 225, 0},
66
    {225, 0, 0}, {225, 225, 0}, {225, 0, 225}, {225, 117, 0},
67
    {0, 210, 210}, {210, 210, 210}, {0, 0, 210}, {0, 210, 0},
68
    {210, 0, 0}, {210, 210, 0}, {210, 0, 210}, {210, 112, 0},
69
    {0, 210, 210}, {210, 210, 210}, {0, 0, 210}, {0, 210, 0},
70
    {210, 0, 0}, {210, 210, 0}, {210, 0, 210}, {210, 112, 0},
71
    {0, 195, 195}, {195, 195, 195}, {0, 0, 195}, {0, 195, 0},
72
    {195, 0, 0}, {195, 195, 0}, {195, 0, 195}, {195, 107, 0},
73
    {0, 195, 195}, {195, 195, 195}, {0, 0, 195}, {0, 195, 0},
74
    {195, 0, 0}, {195, 195, 0}, {195, 0, 195}, {195, 107, 0},
75
    {0, 180, 180}, {180, 180, 180}, {0, 0, 180}, {0, 180, 0},
76
    {180, 0, 0}, {180, 180, 0}, {180, 0, 180}, {180, 102, 0},
77
    {0, 180, 180}, {180, 180, 180}, {0, 0, 180}, {0, 180, 0},
78
    {180, 0, 0}, {180, 180, 0}, {180, 0, 180}, {180, 102, 0},
79
    {0, 165, 165}, {165, 165, 165}, {0, 0, 165}, {0, 165, 0},
80
    {165, 0, 0}, {165, 165, 0}, {165, 0, 165}, {165, 97, 0},
81
    {0, 165, 165}, {165, 165, 165}, {0, 0, 165}, {0, 165, 0},
82
    {165, 0, 0}, {165, 165, 0}, {165, 0, 165}, {165, 97, 0},
83
    {0, 150, 150}, {150, 150, 150}, {0, 0, 150}, {0, 150, 0},
84
    {150, 0, 0}, {150, 150, 0}, {150, 0, 150}, {150, 92, 0},
85
    {0, 150, 150}, {150, 150, 150}, {0, 0, 150}, {0, 150, 0},
86
    {150, 0, 0}, {150, 150, 0}, {150, 0, 150}, {150, 92, 0},
87
    {0, 135, 135}, {135, 135, 135}, {0, 0, 135}, {0, 135, 0},
88
    {135, 0, 0}, {135, 135, 0}, {135, 0, 135}, {135, 87, 0},
89
    {0, 135, 135}, {135, 135, 135}, {0, 0, 135}, {0, 135, 0},
90
    {135, 0, 0}, {135, 135, 0}, {135, 0, 135}, {135, 87, 0},
91
    {0, 120, 120}, {120, 120, 120}, {0, 0, 120}, {0, 120, 0},
92
    {120, 0, 0}, {120, 120, 0}, {120, 0, 120}, {120, 82, 0},
93
    {0, 120, 120}, {120, 120, 120}, {0, 0, 120}, {0, 120, 0},
94
    {120, 0, 0}, {120, 120, 0}, {120, 0, 120}, {120, 82, 0},
95
    {0, 105, 105}, {105, 105, 105}, {0, 0, 105}, {0, 105, 0},
96
    {105, 0, 0}, {105, 105, 0}, {105, 0, 105}, {105, 77, 0},
97
    {0, 105, 105}, {105, 105, 105}, {0, 0, 105}, {0, 105, 0},
98
    {105, 0, 0}, {105, 105, 0}, {105, 0, 105}, {105, 77, 0},
99
    {0, 90, 90}, {90, 90, 90}, {0, 0, 90}, {0, 90, 0},
100
    {90, 0, 0}, {90, 90, 0}, {90, 0, 90}, {90, 72, 0},
101
    {0, 90, 90}, {90, 90, 90}, {0, 0, 90}, {0, 90, 0},
102
    {90, 0, 0}, {90, 90, 0}, {90, 0, 90}, {90, 72, 0},
103
    {0, 75, 75}, {75, 75, 75}, {0, 0, 75}, {0, 75, 0},
104
    {75, 0, 0}, {75, 75, 0}, {75, 0, 75}, {75, 67, 0},
105
    {0, 75, 75}, {75, 75, 75}, {0, 0, 75}, {0, 75, 0},
106
    {75, 0, 0}, {75, 75, 0}, {75, 0, 75}, {75, 67, 0},
107
    {0, 60, 60}, {60, 60, 60}, {0, 0, 60}, {0, 60, 0},
108
    {60, 0, 0}, {60, 60, 0}, {60, 0, 60}, {60, 62, 0},
109
    {0, 60, 60}, {60, 60, 60}, {0, 0, 60}, {0, 60, 0},
110
    {60, 0, 0}, {60, 60, 0}, {60, 0, 60}, {60, 62, 0},
111
    {0, 45, 45}, {45, 45, 45}, {0, 0, 45}, {0, 45, 0},
112
    {45, 0, 0}, {45, 45, 0}, {45, 0, 45}, {45, 57, 0},
113
    {0, 45, 45}, {45, 45, 45}, {0, 0, 45}, {0, 45, 0},
114
    {45, 0, 0}, {45, 45, 0}, {45, 0, 45}, {45, 57, 0},
115
    {0, 30, 30}, {30, 30, 30}, {0, 0, 30}, {0, 30, 0},
116
    {30, 0, 0}, {30, 30, 0}, {30, 0, 30}, {30, 52, 0},
117
    {0, 30, 30}, {30, 30, 30}, {0, 0, 30}, {0, 30, 0},
118
    {30, 0, 0}, {30, 30, 0}, {30, 0, 30}, {192, 192, 192},
119
    {28, 0, 100}};
120
    private int LSB;
121
    private FileInputStream fin;
122

  
123
    // private LEDataInputStream input;
124
    private MappedByteBuffer bb;
125
    private int FALSE = 0;
126
    private int TRUE = 1;
127
    private DGNElemCore elemento;
128
    private DGNInfo info; // Contiene el path y otras cosas
129
    private Rectangle2D.Double m_BoundingBox;
130
    private DGNElemColorTable m_colorTable;
131

  
132
    private boolean logErrors = false;
133

  
134
    public DGNReader(String pathFich) throws DataException {
135
        this(pathFich, false);
136
    }
137

  
138
    public DGNReader(String pathFich, boolean logErrors) throws DataException {
139
        this.logErrors = logErrors;
140

  
141
        info = new DGNInfo();
142

  
143
        DGNElemCore elemento = new DGNElemCore(this);
144
        int iArg;
145
        int bReportExtents = 0;
146
        byte[] achRaw = new byte[64];
147
        achRaw[63] = 1;
148

  
149
        double dfSFXMin = 0.0;
150
        double dfSFXMax = 0.0;
151
        double dfSFYMin = 0.0;
152
        double dfSFYMax = 0.0;
153

  
154
        info.fp = pathFich;
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff