Revision 1078

View differences:

org.gvsig.gpe/library/tags/org.gvsig.gpe-2.1.104/pom.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3
  <modelVersion>4.0.0</modelVersion>
4
  <artifactId>org.gvsig.gpe</artifactId>
5
  <packaging>pom</packaging>
6
  <version>2.1.104</version>
7
  <description>Generic Persistence Engine</description>
8
  <url>http://devel.gvsig.org/sites/org.gvsig.gpe/${project.version}</url>
9
  <name>${project.artifactId}</name>
10

  
11
  <parent>
12
      <groupId>org.gvsig</groupId>
13
      <artifactId>org.gvsig.desktop</artifactId>
14
      <version>2.0.275</version>
15
  </parent>
16

  
17
    <scm>
18
        <connection>scm:svn:https://devel.gvsig.org/svn/gvsig-gpe/org.gvsig.gpe/library/tags/org.gvsig.gpe-2.1.104</connection>
19
        <developerConnection>scm:svn:https://devel.gvsig.org/svn/gvsig-gpe/org.gvsig.gpe/library/tags/org.gvsig.gpe-2.1.104</developerConnection>
20
        <url>https://devel.gvsig.org/redmine/projects/gvsig-gpe/repository/show/org.gvsig.gpe/library/tags/org.gvsig.gpe-2.1.104</url>
21
    </scm>
22
    <repositories>
23
      <repository>
24
        <id>gvsig-public-http-repository</id>
25
        <name>gvSIG maven public HTTP repository</name>
26
        <url>http://devel.gvsig.org/m2repo/j2se</url>
27
        <releases>
28
          <enabled>true</enabled>
29
          <updatePolicy>daily</updatePolicy>
30
          <checksumPolicy>warn</checksumPolicy>
31
        </releases>
32
        <snapshots>
33
          <enabled>true</enabled>
34
          <updatePolicy>daily</updatePolicy>
35
          <checksumPolicy>warn</checksumPolicy>
36
        </snapshots>
37
      </repository>
38
    </repositories>
39

  
40
  <build>
41
    <plugins>
42
      <plugin>
43
        <groupId>org.apache.maven.plugins</groupId>
44
        <artifactId>maven-release-plugin</artifactId>
45
        <configuration>
46
          <tagBase>https://devel.gvsig.org/svn/gvsig-gpe/org.gvsig.gpe/library/tags</tagBase>
47
          <goals>deploy</goals>
48
        </configuration>
49
      </plugin>
50
    </plugins>
51
  </build>
52

  
53
  <dependencyManagement>
54
    <dependencies>
55
      <!-- Self-deps -->
56

  
57
      <dependency>
58
        <groupId>org.gvsig</groupId>
59
        <artifactId>org.gvsig.gpe.lib.api</artifactId>
60
        <version>2.1.104</version>
61
      </dependency>
62
      <dependency>
63
        <groupId>org.gvsig</groupId>
64
        <artifactId>org.gvsig.gpe.lib.spi</artifactId>
65
        <version>2.1.104</version>
66
      </dependency>
67
      <dependency>
68
        <groupId>org.gvsig</groupId>
69
        <artifactId>org.gvsig.gpe.lib.impl</artifactId>
70
        <version>2.1.104</version>
71
      </dependency>
72
      <dependency>
73
        <groupId>org.gvsig</groupId>
74
        <artifactId>org.gvsig.gpe.prov.xml</artifactId>
75
        <version>2.1.104</version>
76
      </dependency>
77
      <dependency>
78
        <groupId>org.gvsig</groupId>
79
        <artifactId>org.gvsig.gpe.lib.impl</artifactId>
80
        <version>2.1.104</version>
81
        <classifier>tests</classifier>
82
      </dependency>
83
    <dependency>
84
      <groupId>org.gvsig</groupId>
85
      <artifactId>org.gvsig.gpe.exportto.kml</artifactId>
86
      <version>2.1.104</version>
87
    </dependency>
88
    <dependency>
89
      <groupId>org.gvsig</groupId>
90
      <artifactId>org.gvsig.gpe.exportto.generic</artifactId>
91
      <version>2.1.104</version>
92
    </dependency>
93
    <dependency>
94
      <groupId>org.gvsig</groupId>
95
      <artifactId>org.gvsig.gpe.prov.gml</artifactId>
96
      <version>2.1.104</version>
97
    </dependency>
98
    <dependency>
99
      <groupId>org.gvsig</groupId>
100
      <artifactId>org.gvsig.gpe.prov.kml</artifactId>
101
      <version>2.1.104</version>
102
    </dependency>
103
    <dependency>
104
      <groupId>org.gvsig</groupId>
105
      <artifactId>org.gvsig.gpe.app.mainplugin</artifactId>
106
      <version>2.1.80-SNAPSHOT</version>
107
    </dependency>
108

  
109

  
110
    <!-- SCHEMA/PULL LIBS -->
111
    <dependency>
112
        <groupId>org.gvsig</groupId>
113
        <artifactId>org.gvsig.xmlschema</artifactId>
114
        <version>${org.gvsig.xmlschema.version}</version>
115
        <type>pom</type>
116
        <scope>import</scope>
117
        <exclusions>
118
            <exclusion> 
119
                <groupId>org.gvsig</groupId>
120
                <artifactId>org.gvsig.tools.lib</artifactId>
121
            </exclusion>
122
        </exclusions> 
123
    </dependency>
124
    <dependency>
125
        <groupId>org.gvsig</groupId>
126
        <artifactId>org.gvsig.xmlpull</artifactId>
127
        <version>${org.gvsig.xmlpull.version}</version>
128
        <type>pom</type>
129
        <scope>import</scope>
130
        <exclusions>
131
            <exclusion> 
132
                <groupId>org.gvsig</groupId>
133
                <artifactId>org.gvsig.tools.lib</artifactId>
134
            </exclusion>
135
        </exclusions> 
136
    </dependency>
137

  
138
    <!-- TODO: Remove those entries when updated in libGPE (?) -->
139

  
140
    <dependency>
141
      <groupId>stax</groupId>
142
      <artifactId>stax-api</artifactId>
143
      <version>1.0.1</version>
144
    </dependency>
145
    <dependency>
146
      <groupId>stax</groupId>
147
      <artifactId>stax</artifactId>
148
      <version>1.2.0</version>
149
    </dependency>
150

  
151
    </dependencies>
152
  </dependencyManagement>
153

  
154
  <properties>
155
      <org.gvsig.xmlschema.version>2.0.23</org.gvsig.xmlschema.version>
156
      <org.gvsig.xmlpull.version>2.0.15</org.gvsig.xmlpull.version>
157
  </properties>  
158

  
159
  <modules>
160
    <module>org.gvsig.gpe.app</module>
161
    <module>org.gvsig.gpe.lib</module>
162
    <module>org.gvsig.gpe.prov</module>
163
    
164
    <module>org.gvsig.gpe.exportto</module>
165
    
166
  </modules>
167
</project>
168

  
0 169

  
org.gvsig.gpe/library/tags/org.gvsig.gpe-2.1.104/org.gvsig.gpe.app/org.gvsig.gpe.app.mainplugin/src/main/assembly/gvsig-plugin-package.xml
1
<!--
2

  
3
    gvSIG. Desktop Geographic Information System.
4

  
5
    Copyright (C) 2007-2013 gvSIG Association.
6

  
7
    This program is free software; you can redistribute it and/or
8
    modify it under the terms of the GNU General Public License
9
    as published by the Free Software Foundation; either version 3
10
    of the License, or (at your option) any later version.
11

  
12
    This program is distributed in the hope that it will be useful,
13
    but WITHOUT ANY WARRANTY; without even the implied warranty of
14
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
    GNU General Public License for more details.
16

  
17
    You should have received a copy of the GNU General Public License
18
    along with this program; if not, write to the Free Software
19
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20
    MA  02110-1301, USA.
21

  
22
    For any additional information, do not hesitate to contact us
23
    at info AT gvsig.com, or visit our website www.gvsig.com.
24

  
25
-->
26
<assembly>
27
  <id>gvsig-plugin-package</id>
28
  <formats>
29
    <format>zip</format>
30
  </formats>
31
  <baseDirectory>${project.artifactId}</baseDirectory>
32
  <includeBaseDirectory>true</includeBaseDirectory>
33
  <files>
34
    <file>
35
      <source>target/${project.artifactId}-${project.version}.jar</source>
36
      <outputDirectory>lib</outputDirectory>
37
    </file>
38
    <file>
39
      <source>target/package.info</source>
40
    </file>
41
  </files>
42

  
43
  <fileSets>
44
    <fileSet>
45
      <directory>src/main/resources-plugin</directory>
46
      <outputDirectory>.</outputDirectory>
47
    </fileSet>
48
  </fileSets>
49

  
50
  <dependencySets>
51
    <dependencySet>
52
      <useProjectArtifact>false</useProjectArtifact>
53
      <useTransitiveDependencies>false</useTransitiveDependencies>
54
      <outputDirectory>lib</outputDirectory>
55
      <includes>
56
    	<include>org.gvsig:org.gvsig.gpe.lib.api</include>
57
    	<include>org.gvsig:org.gvsig.gpe.lib.spi</include>
58
    	<include>org.gvsig:org.gvsig.gpe.lib.impl</include>
59
        <include>org.gvsig:org.gvsig.gpe.prov.xml</include>
60
        <include>org.gvsig:org.gvsig.gpe.prov.gml</include>
61
        <include>org.gvsig:org.gvsig.gpe.prov.kml</include>
62
        <include>org.gvsig:org.gvsig.xmlpull.lib.api</include>
63
        <include>org.gvsig:org.gvsig.xmlpull.lib.spi</include>
64
        <include>org.gvsig:org.gvsig.xmlpull.lib.impl</include>
65
        <include>org.gvsig:org.gvsig.xmlpull.prov.stax</include>
66
        <include>org.gvsig:org.gvsig.xmlpull.prov.kxml</include>
67
        <include>org.gvsig:org.gvsig.xmlschema.lib.api</include>
68
        <include>org.gvsig:org.gvsig.xmlschema.lib.spi</include>
69
        <include>org.gvsig:org.gvsig.xmlschema.lib.impl</include>
70
        <include>org.gvsig:org.gvsig.xmlschema.prov.kxml</include>
71
        <include>stax:stax</include>
72
      </includes>
73
    </dependencySet>
74
  </dependencySets>
75

  
76
</assembly>
77

  
org.gvsig.gpe/library/tags/org.gvsig.gpe-2.1.104/org.gvsig.gpe.app/org.gvsig.gpe.app.mainplugin/src/main/java/org/gvsig/fmap/geom/operation/writegml2/MultiCurveWriteGml2Operation.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.gvsig.fmap.geom.operation.writegml2;
23

  
24
import org.gvsig.fmap.geom.Geometry;
25
import org.gvsig.fmap.geom.aggregate.MultiCurve;
26
import org.gvsig.fmap.geom.operation.GeometryOperationContext;
27
import org.gvsig.fmap.geom.operation.GeometryOperationException;
28

  
29

  
30
/**
31
 * @author gvSIG Team
32
 * @version $Id$
33
 *
34
 */
35
public class MultiCurveWriteGml2Operation extends WriteGml2Operation{
36
	
37
	public Object invoke(Geometry geom, GeometryOperationContext ctx) throws GeometryOperationException {
38
	    initializeParams(ctx);
39
        MultiCurve multiCurve = (MultiCurve)geom;
40
        
41
        writerHandler.startMultiLineString(id, srs);
42
        for (int i=0 ; i<multiCurve.getPrimitivesNumber() ; i++){
43
            writerHandler.startLineString(null, new OrientablePrimitiveCoordinateSequence(multiCurve.getCurveAt(i)), srs);
44
            writerHandler.endLineString();
45
        }        
46
        writerHandler.endMultiLineString();
47
        
48
        return null;
49
	}
50
}
org.gvsig.gpe/library/tags/org.gvsig.gpe-2.1.104/org.gvsig.gpe.app/org.gvsig.gpe.app.mainplugin/src/main/java/org/gvsig/fmap/geom/operation/writegml2/PointCoordinatesSequence.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.gvsig.fmap.geom.operation.writegml2;
23

  
24
import java.io.IOException;
25

  
26
import org.gvsig.fmap.geom.primitive.Point;
27
import org.gvsig.gpe.lib.api.parser.ICoordinateIterator;
28
import org.gvsig.gpe.lib.api.writer.ICoordinateSequence;
29

  
30

  
31
/**
32
 * @author gvSIG Team
33
 * @version $Id$
34
 *
35
 */
36
public class PointCoordinatesSequence implements ICoordinateSequence, ICoordinateIterator {
37
    private Point point = null; 
38
    private boolean hasNext = true;
39
    
40
    public PointCoordinatesSequence(Point point) {
41
        super();
42
        this.point = point;
43
    }
44

  
45
    public int getSize() {       
46
        return 1;
47
    }
48

  
49
    public ICoordinateIterator iterator() {
50
        return this;
51
    }
52

  
53
    public boolean hasNext() throws IOException {
54
        if (hasNext){
55
            hasNext = false;
56
            return true;
57
        }
58
        return false;
59
    }
60

  
61
    public int getDimension() {
62
        return point.getDimension();
63
    }
64

  
65
    public void next(double[] buffer) throws IOException {
66
        for (int i=0 ; i<point.getDimension() ; i++){  
67
            buffer[i] = point.getCoordinateAt(i);   
68
        }          
69
    }
70
}
org.gvsig.gpe/library/tags/org.gvsig.gpe-2.1.104/org.gvsig.gpe.app/org.gvsig.gpe.app.mainplugin/src/main/java/org/gvsig/fmap/geom/operation/writegml2/WriteGml2Operation.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.gvsig.fmap.geom.operation.writegml2;
23

  
24
import org.gvsig.fmap.geom.GeometryLocator;
25
import org.gvsig.fmap.geom.GeometryManager;
26
import org.gvsig.fmap.geom.operation.GeometryOperation;
27
import org.gvsig.fmap.geom.operation.GeometryOperationContext;
28
import org.gvsig.gpe.lib.api.writer.IGPEWriterHandler;
29

  
30

  
31
/**
32
 * @author gvSIG Team
33
 * @version $Id$
34
 *
35
 */
36
public abstract class WriteGml2Operation extends GeometryOperation {
37
    public static final String NAME = "writeGml2";
38
	protected static GeometryManager geomManager = GeometryLocator.getGeometryManager();
39
    public static final int CODE = geomManager.getGeometryOperationCode(NAME);	
40
	
41
    protected String id = null;
42
    protected IGPEWriterHandler writerHandler;
43
    protected String srs = null;
44
    
45
	public int getOperationIndex() {
46
		return CODE;
47
	}	
48
	
49
	protected void initializeParams(GeometryOperationContext geometryOperationContext){
50
	    writerHandler = (IGPEWriterHandler)geometryOperationContext.getAttribute(WriteGml2OperationContext.ATTRIBUTE_GPEWRITERHANDLER);
51
	    id = (String)geometryOperationContext.getAttribute(WriteGml2OperationContext.ATTRIBUTE_ID);
52
	    srs = (String)geometryOperationContext.getAttribute(WriteGml2OperationContext.ATTRIBUTE_SRS);
53
	}
54

  
55
}
org.gvsig.gpe/library/tags/org.gvsig.gpe-2.1.104/org.gvsig.gpe.app/org.gvsig.gpe.app.mainplugin/src/main/java/org/gvsig/fmap/geom/operation/writegml2/OrientablePrimitiveCoordinateSequence.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.gvsig.fmap.geom.operation.writegml2;
23

  
24
import java.awt.geom.PathIterator;
25
import java.io.IOException;
26

  
27
import org.gvsig.fmap.geom.primitive.GeneralPathX;
28
import org.gvsig.fmap.geom.primitive.OrientablePrimitive;
29
import org.gvsig.gpe.lib.api.parser.ICoordinateIterator;
30
import org.gvsig.gpe.lib.api.writer.ICoordinateSequence;
31

  
32

  
33
/**
34
 * @author gvSIG Team
35
 * @version $Id$
36
 *
37
 */
38
public class OrientablePrimitiveCoordinateSequence  implements ICoordinateSequence, ICoordinateIterator {
39
    private OrientablePrimitive orientablePrimitive; 
40
    private GeneralPathX generalPathX;
41
    private PathIterator pathIterator;  
42
        
43
    public OrientablePrimitiveCoordinateSequence(
44
        OrientablePrimitive orientablePrimitive) {
45
        super();
46
        this.orientablePrimitive = orientablePrimitive;
47
        this.generalPathX = orientablePrimitive.getGeneralPath();
48
        this.pathIterator = generalPathX.getPathIterator(null);
49
    }
50

  
51
    public boolean hasNext() throws IOException {
52
       return !pathIterator.isDone();
53
    }
54

  
55
    public int getDimension() {
56
        return orientablePrimitive.getDimension();
57
    }
58

  
59
    public void next(double[] buffer) throws IOException {        
60
        pathIterator.currentSegment(buffer);  
61
        pathIterator.next();   
62
    }
63

  
64
    public int getSize() {       
65
        return orientablePrimitive.getNumVertices();
66
    }
67

  
68
    public ICoordinateIterator iterator() {       
69
        return this;
70
    }
71

  
72
}
org.gvsig.gpe/library/tags/org.gvsig.gpe-2.1.104/org.gvsig.gpe.app/org.gvsig.gpe.app.mainplugin/src/main/java/org/gvsig/fmap/geom/operation/writegml2/MultiSurfaceWriteGml2Operation.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.gvsig.fmap.geom.operation.writegml2;
23

  
24
import org.gvsig.fmap.geom.Geometry;
25
import org.gvsig.fmap.geom.aggregate.MultiSurface;
26
import org.gvsig.fmap.geom.operation.GeometryOperationContext;
27
import org.gvsig.fmap.geom.operation.GeometryOperationException;
28

  
29

  
30
/**
31
 * @author gvSIG Team
32
 * @version $Id$
33
 *
34
 */
35
public class MultiSurfaceWriteGml2Operation extends WriteGml2Operation{
36
	
37
	public Object invoke(Geometry geom, GeometryOperationContext ctx) throws GeometryOperationException {
38
	    initializeParams(ctx);
39
        MultiSurface multiSurface = (MultiSurface)geom;
40
        
41
        writerHandler.startMultiPolygon(id, srs);
42
        for (int i=0 ; i<multiSurface.getPrimitivesNumber() ; i++){
43
            writerHandler.startPolygon(null, new OrientablePrimitiveCoordinateSequence(multiSurface.getSurfaceAt(i)), srs);
44
            writerHandler.endPolygon();
45
        }        
46
        writerHandler.endMultiPolygon();
47
        
48
        return null;
49
	}
50
}
org.gvsig.gpe/library/tags/org.gvsig.gpe-2.1.104/org.gvsig.gpe.app/org.gvsig.gpe.app.mainplugin/src/main/java/org/gvsig/fmap/geom/operation/writegml2/CurveWriteGml2Operation.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.gvsig.fmap.geom.operation.writegml2;
23

  
24
import org.gvsig.fmap.geom.Geometry;
25
import org.gvsig.fmap.geom.operation.GeometryOperationContext;
26
import org.gvsig.fmap.geom.operation.GeometryOperationException;
27
import org.gvsig.fmap.geom.primitive.Curve;
28

  
29

  
30
/**
31
 * @author gvSIG Team
32
 * @version $Id$
33
 *
34
 */
35
public class CurveWriteGml2Operation extends WriteGml2Operation{
36
	
37
	public Object invoke(Geometry geom, GeometryOperationContext ctx) throws GeometryOperationException {
38
	    initializeParams(ctx);
39
        Curve curve = (Curve)geom;
40
        
41
        writerHandler.startLineString(id, new OrientablePrimitiveCoordinateSequence(curve), srs);
42
        writerHandler.endLineString();
43
        
44
        return null;
45
	}
46
}
org.gvsig.gpe/library/tags/org.gvsig.gpe-2.1.104/org.gvsig.gpe.app/org.gvsig.gpe.app.mainplugin/src/main/java/org/gvsig/fmap/geom/operation/writegml2/MultiPointWriteGml2Operation.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.gvsig.fmap.geom.operation.writegml2;
23

  
24
import org.gvsig.fmap.geom.Geometry;
25
import org.gvsig.fmap.geom.aggregate.MultiPoint;
26
import org.gvsig.fmap.geom.operation.GeometryOperationContext;
27
import org.gvsig.fmap.geom.operation.GeometryOperationException;
28

  
29

  
30
/**
31
 * @author gvSIG Team
32
 * @version $Id$
33
 *
34
 */
35
public class MultiPointWriteGml2Operation extends WriteGml2Operation{
36
	
37
	public Object invoke(Geometry geom, GeometryOperationContext ctx) throws GeometryOperationException {
38
	    initializeParams(ctx);
39
        MultiPoint multiPoint = (MultiPoint)geom;
40
        
41
        writerHandler.startMultiPoint(id, srs);
42
        for (int i=0 ; i<multiPoint.getPrimitivesNumber() ; i++){
43
            writerHandler.startPoint(null, new PointCoordinatesSequence(multiPoint.getPointAt(i)), srs);
44
            writerHandler.endPoint();
45
        }        
46
        writerHandler.endMultiPoint();
47
        
48
        return null;
49
	}
50
}
org.gvsig.gpe/library/tags/org.gvsig.gpe-2.1.104/org.gvsig.gpe.app/org.gvsig.gpe.app.mainplugin/src/main/java/org/gvsig/fmap/geom/operation/writegml2/WriteGml2OperationContext.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.gvsig.fmap.geom.operation.writegml2;
23

  
24
import org.gvsig.fmap.geom.operation.GeometryOperationContext;
25
import org.gvsig.gpe.lib.api.writer.IGPEWriterHandler;
26

  
27

  
28
/**
29
 * @author gvSIG Team
30
 * @version $Id$
31
 *
32
 */
33
public class WriteGml2OperationContext extends GeometryOperationContext {
34
	public static final String ATTRIBUTE_GPEWRITERHANDLER = "writerHandler";
35
	public static final String ATTRIBUTE_SRS = "srs";
36
    public static final String ATTRIBUTE_ID = "id";
37
    
38
    /**
39
     * @return the srs
40
     */
41
    public String getSrs() {
42
        return (String) super.getAttribute(ATTRIBUTE_SRS);
43
    }
44
    
45
    /**
46
     * @param srs the srs to set
47
     */
48
    public void setSrs(String srs) {
49
        this.setAttribute(ATTRIBUTE_SRS, srs);
50
    }   
51
    
52
    /**
53
     * @return the Id
54
     */
55
    public String getId() {
56
        return (String) super.getAttribute(ATTRIBUTE_ID);
57
    }
58
    
59
    /**
60
     * @param id the id to set
61
     */
62
    public void setId(String id) {
63
        this.setAttribute(ATTRIBUTE_ID, id);
64
    }   
65
    
66
    /**
67
     * @return the writerHandler
68
     */
69
    public IGPEWriterHandler getWriterHandler() {
70
        return (IGPEWriterHandler) super.getAttribute(ATTRIBUTE_GPEWRITERHANDLER);
71
    }
72
    
73
    /**
74
     * @param writerHandler the writerHandler to set
75
     */
76
    public void setWriterHandler(IGPEWriterHandler writerHandler) {
77
        this.setAttribute(ATTRIBUTE_GPEWRITERHANDLER, writerHandler);
78
    } 	
79
}
80

  
org.gvsig.gpe/library/tags/org.gvsig.gpe-2.1.104/org.gvsig.gpe.app/org.gvsig.gpe.app.mainplugin/src/main/java/org/gvsig/fmap/geom/operation/writegml2/SurfaceWriteGml2Operation.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.gvsig.fmap.geom.operation.writegml2;
23

  
24
import org.gvsig.fmap.geom.Geometry;
25
import org.gvsig.fmap.geom.operation.GeometryOperationContext;
26
import org.gvsig.fmap.geom.operation.GeometryOperationException;
27
import org.gvsig.fmap.geom.primitive.Surface;
28

  
29

  
30
/**
31
 * @author gvSIG Team
32
 * @version $Id$
33
 *
34
 */
35
public class SurfaceWriteGml2Operation extends WriteGml2Operation{
36
	
37
	public Object invoke(Geometry geom, GeometryOperationContext ctx) throws GeometryOperationException {
38
	    initializeParams(ctx);
39
        Surface surface = (Surface)geom;
40
        
41
        writerHandler.startPolygon(id, new OrientablePrimitiveCoordinateSequence(surface), srs);
42
        writerHandler.endPolygon();
43
        
44
        return null;
45
	}
46
}
org.gvsig.gpe/library/tags/org.gvsig.gpe-2.1.104/org.gvsig.gpe.app/org.gvsig.gpe.app.mainplugin/src/main/java/org/gvsig/fmap/geom/operation/writegml2/PointWriteGml2Operation.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.gvsig.fmap.geom.operation.writegml2;
23

  
24
import org.gvsig.fmap.geom.Geometry;
25
import org.gvsig.fmap.geom.operation.GeometryOperationContext;
26
import org.gvsig.fmap.geom.operation.GeometryOperationException;
27
import org.gvsig.fmap.geom.primitive.Point;
28

  
29

  
30
/**
31
 * @author gvSIG Team
32
 * @version $Id$
33
 *
34
 */
35
public class PointWriteGml2Operation extends WriteGml2Operation{
36
	
37
	public Object invoke(Geometry geom, GeometryOperationContext ctx) throws GeometryOperationException {
38
	    initializeParams(ctx);
39
		Point point = (Point)geom;
40
				
41
		writerHandler.startPoint(id, new PointCoordinatesSequence(point), srs);
42
		writerHandler.endPoint();
43
		
44
		return null;
45
	}
46
}
org.gvsig.gpe/library/tags/org.gvsig.gpe-2.1.104/org.gvsig.gpe.app/org.gvsig.gpe.app.mainplugin/src/main/java/org/gvsig/fmap/dal/store/gpe/DALGPELibrary.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22

  
23
/*
24
 * AUTHORS (In addition to CIT):
25
 * 2009 {Iver T.I.}   {Task}
26
 */
27

  
28
package org.gvsig.fmap.dal.store.gpe;
29

  
30
import java.util.ArrayList;
31
import java.util.List;
32

  
33
import org.gvsig.fmap.dal.DALFileLibrary;
34
import org.gvsig.fmap.dal.DALFileLocator;
35
import org.gvsig.fmap.dal.DALLibrary;
36
import org.gvsig.fmap.dal.DALLocator;
37
import org.gvsig.fmap.dal.DataTypes;
38
import org.gvsig.fmap.dal.FileHelper;
39
import org.gvsig.fmap.dal.spi.DataManagerProviderServices;
40
import org.gvsig.fmap.geom.Geometry;
41
import org.gvsig.fmap.geom.GeometryLocator;
42
import org.gvsig.fmap.geom.GeometryManager;
43
import org.gvsig.fmap.geom.operation.writegml2.CurveWriteGml2Operation;
44
import org.gvsig.fmap.geom.operation.writegml2.MultiCurveWriteGml2Operation;
45
import org.gvsig.fmap.geom.operation.writegml2.MultiPointWriteGml2Operation;
46
import org.gvsig.fmap.geom.operation.writegml2.MultiSurfaceWriteGml2Operation;
47
import org.gvsig.fmap.geom.operation.writegml2.PointWriteGml2Operation;
48
import org.gvsig.fmap.geom.operation.writegml2.SurfaceWriteGml2Operation;
49
import org.gvsig.fmap.geom.operation.writegml2.WriteGml2Operation;
50
import org.gvsig.metadata.exceptions.MetadataException;
51
import org.gvsig.tools.library.AbstractLibrary;
52
import org.gvsig.tools.library.LibraryException;
53
import org.gvsig.tools.locator.ReferenceNotRegisteredException;
54
import org.gvsig.xmlschema.lib.api.XMLSchemaLocator;
55
import org.gvsig.xmlschema.lib.api.XMLSchemaManager;
56

  
57
/**
58
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
59
 */
60
public class DALGPELibrary extends AbstractLibrary {
61
	
62
    @Override
63
    public void doRegistration() {
64
        registerAsServiceOf(DALLibrary.class);
65
        require(DALFileLibrary.class);
66
    }
67

  
68
	protected void doInitialize() throws LibraryException {
69
		// Do nothing
70
	}
71

  
72
	protected void doPostInitialize() throws LibraryException {
73

  
74
		List exs = new ArrayList();
75

  
76
		GPEStoreParameters.registerParametersDefinition();
77
		
78
		try {
79
			FileHelper.registerMetadataDefinition(
80
					GPEStoreProvider.METADATA_DEFINITION_NAME,
81
					GPEStoreProvider.class, "GPEMetadata.xml");
82
		} catch (MetadataException e) {
83
			exs.add(e);
84
		}
85

  
86

  
87
		DataManagerProviderServices dataman = (DataManagerProviderServices) DALLocator
88
		.getDataManager();
89

  
90
		if (!dataman.getStoreProviders().contains(GPEStoreProvider.NAME)) {
91
			dataman.registerStoreProvider(GPEStoreProvider.NAME,
92
					GPEStoreProvider.class, GPEStoreParameters.class);
93
		}
94

  
95
		DALFileLocator.getFilesystemServerExplorerManager().registerProvider(
96
				GPEStoreProvider.NAME, GPEStoreProvider.DESCRIPTION,
97
				GPEFileSystemServerProvider.class);
98
		
99
		// Validate there is any implementation registered.
100
		XMLSchemaManager xmlSchemaManager = XMLSchemaLocator.getXMLSchemaManager();
101
		if (xmlSchemaManager == null) {
102
			exs.add(new ReferenceNotRegisteredException(
103
					XMLSchemaLocator.XMLSCHEMA_MANAGER_NAME, XMLSchemaLocator
104
							.getInstance()));
105
		}
106
		
107
		//Register the application types in gpe. GPE uses the DAL types like internal types
108
		xmlSchemaManager.registerAppDataType(DataTypes.UNKNOWN, DataTypes.UNKNOWN);
109
		xmlSchemaManager.registerAppDataType(DataTypes.BOOLEAN, DataTypes.BOOLEAN);
110
		xmlSchemaManager.registerAppDataType(DataTypes.BYTE, DataTypes.BYTE);
111
		xmlSchemaManager.registerAppDataType(DataTypes.CHAR, DataTypes.CHAR);
112
		xmlSchemaManager.registerAppDataType(DataTypes.INT, DataTypes.INT);
113
		xmlSchemaManager.registerAppDataType(DataTypes.LONG, DataTypes.LONG);
114
		xmlSchemaManager.registerAppDataType(DataTypes.FLOAT, DataTypes.FLOAT);
115
		xmlSchemaManager.registerAppDataType(DataTypes.DOUBLE, DataTypes.DOUBLE);
116
		xmlSchemaManager.registerAppDataType(DataTypes.STRING, DataTypes.STRING);
117
		xmlSchemaManager.registerAppDataType(DataTypes.DATE, DataTypes.DATE);
118
		xmlSchemaManager.registerAppDataType(DataTypes.TIME, DataTypes.TIME);
119
		xmlSchemaManager.registerAppDataType(DataTypes.TIMESTAMP, DataTypes.TIMESTAMP);
120
		xmlSchemaManager.registerAppDataType(DataTypes.GEOMETRY, DataTypes.GEOMETRY);
121
		xmlSchemaManager.registerAppDataType(DataTypes.OBJECT, DataTypes.OBJECT);
122
		xmlSchemaManager.registerAppDataType(DataTypes.DYNOBJECT, DataTypes.DYNOBJECT);
123
		xmlSchemaManager.registerAppDataType(DataTypes.CRS, DataTypes.CRS);		
124
		xmlSchemaManager.registerAppDataType(DataTypes.FILE, DataTypes.FILE);
125
		xmlSchemaManager.registerAppDataType(DataTypes.BYTEARRAY, DataTypes.BYTEARRAY);
126
		
127
		//Mapping between GPE types and the application types
128
		xmlSchemaManager.registerAppGeometryType(Geometry.TYPES.GEOMETRY, XMLSchemaManager.GEOMETRY);
129
		xmlSchemaManager.registerAppGeometryType(Geometry.TYPES.POINT, XMLSchemaManager.POINT);
130
		xmlSchemaManager.registerAppGeometryType(Geometry.TYPES.CURVE, XMLSchemaManager.LINESTRING);
131
		xmlSchemaManager.registerAppGeometryType(Geometry.TYPES.SURFACE, XMLSchemaManager.POLYGON);
132
		xmlSchemaManager.registerAppGeometryType(Geometry.TYPES.SOLID, XMLSchemaManager.SOLID);
133
		xmlSchemaManager.registerAppGeometryType(Geometry.TYPES.AGGREGATE, XMLSchemaManager.MULTIGEOMETRY);
134
		xmlSchemaManager.registerAppGeometryType(Geometry.TYPES.MULTIPOINT, XMLSchemaManager.MULTIPOINT);
135
		xmlSchemaManager.registerAppGeometryType(Geometry.TYPES.MULTICURVE, XMLSchemaManager.MULTILINESTRING);
136
		xmlSchemaManager.registerAppGeometryType(Geometry.TYPES.MULTISURFACE, XMLSchemaManager.MULTIPOLYGON);
137
		xmlSchemaManager.registerAppGeometryType(Geometry.TYPES.MULTISOLID, XMLSchemaManager.MULTISOLID);
138
	      
139
        //Operations
140
		GeometryManager geometryManager = GeometryLocator.getGeometryManager();        
141
        geometryManager.registerGeometryOperation(WriteGml2Operation.NAME, new PointWriteGml2Operation(), Geometry.TYPES.POINT);
142
        geometryManager.registerGeometryOperation(WriteGml2Operation.NAME, new CurveWriteGml2Operation(), Geometry.TYPES.CURVE);
143
        geometryManager.registerGeometryOperation(WriteGml2Operation.NAME, new SurfaceWriteGml2Operation(), Geometry.TYPES.SURFACE);
144
        geometryManager.registerGeometryOperation(WriteGml2Operation.NAME, new MultiPointWriteGml2Operation(), Geometry.TYPES.MULTIPOINT);
145
        geometryManager.registerGeometryOperation(WriteGml2Operation.NAME, new MultiCurveWriteGml2Operation(), Geometry.TYPES.MULTICURVE);
146
        geometryManager.registerGeometryOperation(WriteGml2Operation.NAME, new MultiSurfaceWriteGml2Operation(), Geometry.TYPES.MULTISURFACE);
147
        
148
		if (exs.size() > 0) {
149
			throw new LibraryException(this.getClass(), exs);
150
		}
151
	}
152

  
153
}
154

  
155

  
org.gvsig.gpe/library/tags/org.gvsig.gpe-2.1.104/org.gvsig.gpe.app/org.gvsig.gpe.app.mainplugin/src/main/java/org/gvsig/fmap/dal/store/gpe/exceptions/GPELayerException.java
1
package org.gvsig.fmap.dal.store.gpe.exceptions;
2

  
3
import java.util.HashMap;
4
import java.util.Map;
5

  
6
import org.gvsig.fmap.mapcontext.layers.FLayer;
7
import org.gvsig.tools.exception.BaseException;
8

  
9
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
10
 *
11
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
12
 *
13
 * This program is free software; you can redistribute it and/or
14
 * modify it under the terms of the GNU General Public License
15
 * as published by the Free Software Foundation; either version 2
16
 * of the License, or (at your option) any later version.
17
 *
18
 * This program is distributed in the hope that it will be useful,
19
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
 * GNU General Public License for more details.
22
 *
23
 * You should have received a copy of the GNU General Public License
24
 * along with this program; if not, write to the Free Software
25
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
26
 *
27
 * For more information, contact:
28
 *
29
 *  Generalitat Valenciana
30
 *   Conselleria d'Infraestructures i Transport
31
 *   Av. Blasco Ib??ez, 50
32
 *   46010 VALENCIA
33
 *   SPAIN
34
 *
35
 *      +34 963862235
36
 *   gvsig@gva.es
37
 *      www.gvsig.gva.es
38
 *
39
 *    or
40
 *
41
 *   IVER T.I. S.A
42
 *   Salamanca 50
43
 *   46005 Valencia
44
 *   Spain
45
 *
46
 *   +34 963163400
47
 *   dac@iver.es
48
 */
49
/* CVS MESSAGES:
50
 *
51
 * $Id$
52
 * $Log$
53
 *
54
 */
55
/**
56
 * Thrown when there is an unknown problem loading 
57
 * a GPE layer
58
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
59
 */
60
public class GPELayerException extends BaseException {
61
	private static final long serialVersionUID = -5810461892751191682L;
62
	private FLayer layer = null;
63
	
64
	public GPELayerException(FLayer layer, Throwable exception) {
65
		this.layer = layer;
66
		initialize();
67
		initCause(exception);
68
	}
69
	
70
	/**
71
	 * Initialize the properties
72
	 */
73
	private void initialize() {
74
		messageKey = "gpe_gvsig_load_layer_error";
75
		formatString = "Error loading the layer " +
76
				"%(layerName).";
77
	}
78
	
79
	/*
80
	 *  (non-Javadoc)
81
	 * @see org.gvsig.exceptions.BaseException#values()
82
	 */
83
	protected Map values() {
84
		HashMap params = new HashMap();
85
		params.put("layerName", layer.getName());
86
		return params;	
87
	}
88
	
89
}
org.gvsig.gpe/library/tags/org.gvsig.gpe-2.1.104/org.gvsig.gpe.app/org.gvsig.gpe.app.mainplugin/src/main/java/org/gvsig/fmap/dal/store/gpe/exceptions/NotExtentException.java
1
package org.gvsig.fmap.dal.store.gpe.exceptions;
2

  
3
import java.util.HashMap;
4
import java.util.Map;
5

  
6
import org.gvsig.fmap.mapcontext.layers.FLayer;
7
import org.gvsig.tools.exception.BaseException;
8

  
9
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
10
 *
11
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
12
 *
13
 * This program is free software; you can redistribute it and/or
14
 * modify it under the terms of the GNU General Public License
15
 * as published by the Free Software Foundation; either version 2
16
 * of the License, or (at your option) any later version.
17
 *
18
 * This program is distributed in the hope that it will be useful,
19
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
 * GNU General Public License for more details.
22
 *
23
 * You should have received a copy of the GNU General Public License
24
 * along with this program; if not, write to the Free Software
25
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
26
 *
27
 * For more information, contact:
28
 *
29
 *  Generalitat Valenciana
30
 *   Conselleria d'Infraestructures i Transport
31
 *   Av. Blasco Ib??ez, 50
32
 *   46010 VALENCIA
33
 *   SPAIN
34
 *
35
 *      +34 963862235
36
 *   gvsig@gva.es
37
 *      www.gvsig.gva.es
38
 *
39
 *    or
40
 *
41
 *   IVER T.I. S.A
42
 *   Salamanca 50
43
 *   46005 Valencia
44
 *   Spain
45
 *
46
 *   +34 963163400
47
 *   dac@iver.es
48
 */
49
/* CVS MESSAGES:
50
 *
51
 * $Id$
52
 * $Log$
53
 *
54
 */
55
/**
56
 * This exception is thrown when it is not possible
57
 * to calculate an extent for a layer  
58
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
59
 */
60
public class NotExtentException extends BaseException {
61
	private static final long serialVersionUID = 620553176638259949L;
62
	private FLayer layer = null;
63
	
64
	public NotExtentException(FLayer layer, Throwable exception) {
65
		this.layer = layer;
66
		initialize();
67
		initCause(exception);
68
	}
69
	
70
	/**
71
	 * Initialize the properties
72
	 */
73
	private void initialize() {
74
		messageKey = "gpe_calculate_extent_error";
75
		formatString = "Error calculating the extent " +
76
				"for the layer %(layerName).";
77
	}
78
	
79
	/*
80
	 *  (non-Javadoc)
81
	 * @see org.gvsig.exceptions.BaseException#values()
82
	 */
83
	protected Map values() {
84
		HashMap params = new HashMap();
85
		params.put("layerName", layer.getName());
86
		return params;	
87
	}
88
	
89
}
org.gvsig.gpe/library/tags/org.gvsig.gpe-2.1.104/org.gvsig.gpe.app/org.gvsig.gpe.app.mainplugin/src/main/java/org/gvsig/fmap/dal/store/gpe/exceptions/NotMultipleLayerWarning.java
1
package org.gvsig.fmap.dal.store.gpe.exceptions;
2

  
3
import java.util.HashMap;
4
import java.util.Map;
5

  
6
import org.gvsig.tools.exception.BaseException;
7

  
8
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
9
 *
10
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
11
 *
12
 * This program is free software; you can redistribute it and/or
13
 * modify it under the terms of the GNU General Public License
14
 * as published by the Free Software Foundation; either version 2
15
 * of the License, or (at your option) any later version.
16
 *
17
 * This program is distributed in the hope that it will be useful,
18
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
 * GNU General Public License for more details.
21
 *
22
 * You should have received a copy of the GNU General Public License
23
 * along with this program; if not, write to the Free Software
24
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
25
 *
26
 * For more information, contact:
27
 *
28
 *  Generalitat Valenciana
29
 *   Conselleria d'Infraestructures i Transport
30
 *   Av. Blasco Ib??ez, 50
31
 *   46010 VALENCIA
32
 *   SPAIN
33
 *
34
 *      +34 963862235
35
 *   gvsig@gva.es
36
 *      www.gvsig.gva.es
37
 *
38
 *    or
39
 *
40
 *   IVER T.I. S.A
41
 *   Salamanca 50
42
 *   46005 Valencia
43
 *   Spain
44
 *
45
 *   +34 963163400
46
 *   dac@iver.es
47
 */
48
/* CVS MESSAGES:
49
 *
50
 * $Id$
51
 * $Log$
52
 *
53
 */
54
/**
55
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
56
 */
57
public class NotMultipleLayerWarning extends BaseException {
58
	private static final long serialVersionUID = -3822382578296490537L;
59

  
60
	public NotMultipleLayerWarning() {		
61
		initialize();		
62
	}
63
	
64
	/**
65
	 * Initialize the properties
66
	 */
67
	private void initialize() {
68
		messageKey = "gpe_not_multiple_layer_warning";
69
		formatString = "This gvSIG version doesn't support " +
70
			"muliple layers.";
71
	}
72
	
73
	/*
74
	 *  (non-Javadoc)
75
	 * @see org.gvsig.exceptions.BaseException#values()
76
	 */
77
	protected Map values() {
78
		HashMap params = new HashMap();
79
		return params;	
80
	}
81
}
82
	
org.gvsig.gpe/library/tags/org.gvsig.gpe-2.1.104/org.gvsig.gpe.app/org.gvsig.gpe.app.mainplugin/src/main/java/org/gvsig/fmap/dal/store/gpe/GPEFileSystemServerProvider.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 * 
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 * 
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 * 
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
 * MA  02110-1301, USA.
20
 * 
21
 */
22

  
23
/*
24
 * AUTHORS (In addition to CIT):
25
 * 2009 {Iver T.I.}   {Task}
26
 */
27

  
28
package org.gvsig.fmap.dal.store.gpe;
29

  
30
import java.io.File;
31

  
32
import org.gvsig.fmap.dal.DALLocator;
33
import org.gvsig.fmap.dal.DataServerExplorer;
34
import org.gvsig.fmap.dal.DataStoreParameters;
35
import org.gvsig.fmap.dal.NewDataStoreParameters;
36
import org.gvsig.fmap.dal.exception.CreateException;
37
import org.gvsig.fmap.dal.exception.DataException;
38
import org.gvsig.fmap.dal.exception.RemoveException;
39
import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters;
40
import org.gvsig.fmap.dal.feature.exception.CreateGeometryException;
41
import org.gvsig.fmap.dal.resource.spi.ResourceConsumer;
42
import org.gvsig.fmap.dal.resource.spi.ResourceProvider;
43
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorer;
44
import org.gvsig.fmap.dal.serverexplorer.filesystem.impl.AbstractFilesystemServerExplorerProvider;
45
import org.gvsig.fmap.dal.serverexplorer.filesystem.spi.FilesystemServerExplorerProvider;
46
import org.gvsig.fmap.dal.serverexplorer.filesystem.spi.FilesystemServerExplorerProviderServices;
47
import org.gvsig.fmap.geom.Geometry;
48
import org.gvsig.fmap.geom.GeometryLocator;
49
import org.gvsig.fmap.geom.exception.CreateEnvelopeException;
50
import org.gvsig.fmap.geom.primitive.Envelope;
51
import org.gvsig.gpe.lib.api.GPELocator;
52
import org.gvsig.gpe.lib.api.GPEManager;
53
import org.gvsig.tools.locator.LocatorException;
54

  
55
/**
56
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
57
 */
58
public class GPEFileSystemServerProvider extends AbstractFilesystemServerExplorerProvider 
59
	implements FilesystemServerExplorerProvider, ResourceConsumer {
60
	protected FilesystemServerExplorerProviderServices serverExplorer;
61

  
62
	private static final GPEManager GPE_MANAGER = GPELocator.getGPEManager();
63
	
64
	public boolean canCreate() {
65
		// TODO Auto-generated method stub
66
		return false;
67
	}
68
	
69
	public int getMode() {
70
		return DataServerExplorer.MODE_FEATURE | DataServerExplorer.MODE_GEOMETRY;
71
	}
72

  
73
	public boolean canCreate(NewDataStoreParameters parameters) {
74
		return false;
75
	}
76

  
77
	public void create(NewDataStoreParameters parameters, boolean overwrite)
78
	throws CreateException {
79
		// TODO Auto-generated method stub
80

  
81
	}
82

  
83
	public NewDataStoreParameters getCreateParameters() throws DataException {
84
		
85
		GPEStoreParameters np = new GPEStoreParameters();
86
		Envelope env = null;
87
		try {
88
			env = GeometryLocator.getGeometryManager().createEnvelope(
89
					-180, -90, 180, 90, Geometry.SUBTYPES.GEOM2D);
90
		} catch (Exception e) {
91
			throw new CreateGeometryException(e);
92
		}
93
		np.setEnvelope(env);
94
		// =================================
95
		np.setDefaultFeatureType(this.serverExplorer
96
				.getServerExplorerProviderServices().createNewFeatureType());
97
		return np;
98
	}
99

  
100
	public void initialize(
101
			FilesystemServerExplorerProviderServices serverExplorer) {
102
		this.serverExplorer = serverExplorer;		
103
	}
104

  
105
	public void remove(DataStoreParameters parameters) throws RemoveException {
106
		// TODO Auto-generated method stub
107

  
108
	}
109

  
110
	public String getDataStoreProviderName() {
111
		return GPEStoreProvider.NAME;
112
	}
113

  
114
	public String getDescription() {
115
		return GPEStoreProvider.DESCRIPTION;
116
	}
117

  
118
	public boolean accept(File pathName) {
119
	    return GPE_MANAGER.accept(pathName.toURI());	   
120
	}
121

  
122
	public boolean closeResourceRequested(ResourceProvider resource) {
123
		// TODO Auto-generated method stub
124
		return false;
125
	}
126

  
127
	public void resourceChanged(ResourceProvider resource) {
128
		// TODO Auto-generated method stub
129

  
130
	}
131

  
132
}
133

  
org.gvsig.gpe/library/tags/org.gvsig.gpe-2.1.104/org.gvsig.gpe.app/org.gvsig.gpe.app.mainplugin/src/main/java/org/gvsig/fmap/dal/store/gpe/GPESetProvider.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 * 
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 * 
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 * 
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
 * MA  02110-1301, USA.
20
 * 
21
 */
22

  
23
/*
24
 * AUTHORS (In addition to CIT):
25
 * 2009 {Iver T.I.}   {Task}
26
 */
27

  
28
package org.gvsig.fmap.dal.store.gpe;
29

  
30
import java.util.HashMap;
31
import java.util.Iterator;
32

  
33
import org.gvsig.fmap.dal.exception.DataException;
34
import org.gvsig.fmap.dal.feature.FeatureQuery;
35
import org.gvsig.fmap.dal.feature.FeatureType;
36
import org.gvsig.fmap.dal.feature.spi.AbstractFeatureProviderIterator;
37
import org.gvsig.fmap.dal.feature.spi.AbstractFeatureSetProvider;
38
import org.gvsig.tools.exception.BaseException;
39

  
40
/**
41
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
42
 */
43
public class GPESetProvider extends AbstractFeatureSetProvider {
44

  
45
	public GPESetProvider(GPEStoreProvider store,
46
			FeatureQuery query) {
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff