Revision 462

View differences:

org.gvsig.gpe/library/tags/org.gvsig.gpe-2.1.12/org.gvsig.gpe.app/pom.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2

  
3
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4
  <modelVersion>4.0.0</modelVersion>
5
  <artifactId>org.gvsig.gpe.app</artifactId>
6
  <description>Adds support for some vector formats (GML, KML)</description>
7
  <packaging>pom</packaging>
8
  
9
  
10
  <parent>
11
      <groupId>org.gvsig</groupId>
12
      <artifactId>org.gvsig.gpe</artifactId>
13
      <version>2.1.12</version>
14
  </parent>
15
    
16
  <modules>
17
    <module>org.gvsig.gpe.app.mainplugin</module>
18
  </modules>
19
</project>
org.gvsig.gpe/library/tags/org.gvsig.gpe-2.1.12/org.gvsig.gpe.app/org.gvsig.gpe.app.mainplugin/buildNumber.properties
1
#Fri Oct 09 10:16:57 CEST 2015
2
buildNumber=2113
org.gvsig.gpe/library/tags/org.gvsig.gpe-2.1.12/org.gvsig.gpe.app/org.gvsig.gpe.app.mainplugin/src/main/resources-plugin/i18n/text.properties
1
gpe_preferences_window=Gml Persistence Engine
2
gpe_preferences_window_other=Otros
3
gpe_preferences_window_xmlschema=XML Schema
4
gpe_preferences_window_xml=XML
5
gpe_preferences_window_coordinates=Coordenadas
6
gpe_xmlVersion=Versi?n de XML
7
gpe_xmlEncoding=Codificaci?n
8
gpe_defaultBlancSpace=Espacio en blanco para la etiquetas
9
gpe_namespacePrefix=Prefijo del Namespace
10
gpe_namespaceURI=Namespace
11
gpe_schemaName=Nombre del esquema por defecto
12
gpe_coordinates=S?mbolo decimal
13
gpe_coordinatesSeparator=Separador entre coordenadas
14
gpe_tuplesSeparator=Separador entre pares de coordenadas
15
gpe_decimalDigits=N?mero de decimales
16
gpe_exporting=Exportando capa
17
gpe_select_version=Selecciona la versi?n 
18
gpe_select_format=Selecciona el formato
19
gpe_select_writer=Selecciona el writer
20
gpe_select_schema=Selecciona el XML schema
21
gpe_create_default_schema=Crear un esquema por defecto
22
gpe_select_file=Seleciona el fichero
23
gpe_select_writer_window=Exportar a fichero
24
gpe_gvsig_dont_support_multilayer=La actual versi?n de gvSIG no soporta multicapa.\ Todas las geometr\u00edas se cargar\u00e1n en la misma capa. 
org.gvsig.gpe/library/tags/org.gvsig.gpe-2.1.12/org.gvsig.gpe.app/org.gvsig.gpe.app.mainplugin/src/main/resources-plugin/i18n/text_en.properties
1
gpe_preferences_window=Gml Persistence Engine
2
gpe_preferences_window_other=Others
3
gpe_preferences_window_xmlschema=XML Schema
4
gpe_preferences_window_xml=XML
5
gpe_preferences_window_coordinates=Coordinates
6
gpe_xmlVersion=XML version
7
gpe_xmlEncoding=XML Encoding
8
gpe_defaultBlancSpace=Blank space for the label names
9
gpe_namespacePrefix=Namespace prefix
10
gpe_namespaceURI=Namespace
11
gpe_schemaName=Default namespace
12
gpe_coordinates=Decimal symbol
13
gpe_coordinatesSeparator=Separator between coordinates
14
gpe_tuplesSeparator=Separator between a pair of coordinates
15
gpe_decimalDigits=Decimal number
16
gpe_exporting=Exporting a layer
17
gpe_select_version=Select the version 
18
gpe_select_format=Select the format
19
gpe_select_writer=Select a writer
20
gpe_select_schema=Select a schema
21
gpe_create_default_schema=Create a default schema
22
gpe_select_file=Select the file
23
gpe_select_writer_window=Export to file
24
gpe_gvsig_dont_support_multilayer=Current gvSIG version doesnt support multilayer.\All the geometries have been loaded on the same layer.
org.gvsig.gpe/library/tags/org.gvsig.gpe-2.1.12/org.gvsig.gpe.app/org.gvsig.gpe.app.mainplugin/src/main/resources-plugin/config.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<plugin-config>
3

  
4
	<depends plugin-name="org.gvsig.app.mainplugin" />
5
	<depends plugin-name="org.gvsig.exportto.app.mainplugin" />
6
	
7
	<libraries library-dir="lib"/>
8
	<resourceBundle name="text"/>
9
	<extensions>		
10
		<extension class-name="org.gvsig.gpe.GPELibraryExtension"
11
			description=""
12
			active="true"
13
			priority="1">			
14
		</extension>
15
		<!-- 	
16
		<extension class-name="org.gvsig.gpe.GPEWriterExtension"
17
			description="Support for writing"
18
			active="true">
19
			<menu text="Capa/export_to/GML" action-command="GML"/>
20
			<menu text="Capa/export_to/KML" action-command="KML"/>
21
		</extension>
22
		<extension class-name="org.gvsig.gpe.AboutGPEExtension"
23
                description="Extension to add about panel."
24
                active="true"
25
                priority="1">
26
		</extension>
27
		-->    			
28
	</extensions>
29
</plugin-config>
org.gvsig.gpe/library/tags/org.gvsig.gpe-2.1.12/org.gvsig.gpe.app/org.gvsig.gpe.app.mainplugin/src/main/resources/META-INF/services/org.gvsig.tools.library.Library
1
org.gvsig.fmap.dal.store.gpe.DALGPELibrary
org.gvsig.gpe/library/tags/org.gvsig.gpe-2.1.12/org.gvsig.gpe.app/org.gvsig.gpe.app.mainplugin/src/main/resources/org/gvsig/fmap/dal/store/gpe/GPEMetadata.xml
1
<?xml version="1.0"?>
2
<!--
3
Definitions of metadata fields for a gpe file.  
4
 -->
5
<definitions>
6
  <version>1.0.0</version>
7
  <classes>
8
    
9
    <class name="GPE" namespace="Metadata">
10
      <extends>
11
       <class namespace="Metadata" name="SpatialProvider"/>
12
      </extends>
13
      <description>Metadata of a GPE store</description>
14
      <fields>
15
      </fields>
16
    </class>
17

  
18
  </classes>
19
</definitions>  
org.gvsig.gpe/library/tags/org.gvsig.gpe-2.1.12/org.gvsig.gpe.app/org.gvsig.gpe.app.mainplugin/src/main/resources/org/gvsig/fmap/dal/store/gpe/GPEParameters.xml
1
<?xml version= "1.0 "?>
2
<definitions>
3
  <version>1.0.0</version>
4
  <classes>
5
    <class name="GPEStoreParameters">
6
       <extends>
7
       <class namespace="dal" name="ProviderParameters"/>
8
      </extends>
9
      <description>Store the parameters need to open a GPE supported file</description>
10
      <fields>
11
        <field name="File" type="file" mandatory="true" group="Basic">
12
          <description>GPE supported file</description>
13
        </field>
14
        <field name="CRS" type="crs" mandatory="true" group="Basic">
15
          <description>The coordinate reference system used in this GPE supported file</description>
16
        </field>
17
        <field name="useAxisOrderYX" label="Use axis order YX" defaultValue="false" type="Boolean" mandatory="false" group="Basic">
18
          <description>If set use axis order XY</description>
19
        </field>
20
      </fields>
21
    </class>
22
  </classes>
23
</definitions>  
org.gvsig.gpe/library/tags/org.gvsig.gpe-2.1.12/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*</include>
57
        <include>org.gvsig:org.gvsig.gpe.prov*</include>
58
        <include>org.gvsig:org.gvsig.xmlpull*</include>
59
        <include>org.gvsig:org.gvsig.gpe.exportto*</include>
60
        <include>org.gvsig:org.gvsig.xmlschema*</include>
61
        <include>stax:stax</include>
62
      </includes>
63
    </dependencySet>
64
  </dependencySets>
65

  
66
</assembly>
67

  
org.gvsig.gpe/library/tags/org.gvsig.gpe-2.1.12/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.12/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.12/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.12/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.12/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.12/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.12/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.12/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.12/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.12/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.12/org.gvsig.gpe.app/org.gvsig.gpe.app.mainplugin/src/main/java/org/gvsig/fmap/dal/store/gpe/GPEStoreProvider.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
import java.util.Map;
32

  
33
import org.cresques.cts.IProjection;
34
import org.slf4j.Logger;
35
import org.slf4j.LoggerFactory;
36

  
37
import org.gvsig.fmap.dal.DALLocator;
38
import org.gvsig.fmap.dal.DataManager;
39
import org.gvsig.fmap.dal.DataServerExplorer;
40
import org.gvsig.fmap.dal.DataStore;
41
import org.gvsig.fmap.dal.DataStoreParameters;
42
import org.gvsig.fmap.dal.DataTypes;
43
import org.gvsig.fmap.dal.FileHelper;
44
import org.gvsig.fmap.dal.exception.DataException;
45
import org.gvsig.fmap.dal.exception.InitializeException;
46
import org.gvsig.fmap.dal.exception.OpenException;
47
import org.gvsig.fmap.dal.exception.ReadException;
48
import org.gvsig.fmap.dal.exception.ValidateDataParametersException;
49
import org.gvsig.fmap.dal.feature.FeatureQuery;
50
import org.gvsig.fmap.dal.feature.FeatureType;
51
import org.gvsig.fmap.dal.feature.spi.AbstractFeatureStoreProvider;
52
import org.gvsig.fmap.dal.feature.spi.FeatureProvider;
53
import org.gvsig.fmap.dal.feature.spi.FeatureReferenceProviderServices;
54
import org.gvsig.fmap.dal.feature.spi.FeatureSetProvider;
55
import org.gvsig.fmap.dal.resource.exception.ResourceExecuteException;
56
import org.gvsig.fmap.dal.resource.file.FileResource;
57
import org.gvsig.fmap.dal.resource.spi.ResourceConsumer;
58
import org.gvsig.fmap.dal.resource.spi.ResourceProvider;
59
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorer;
60
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorerParameters;
61
import org.gvsig.fmap.dal.spi.DataStoreProviderServices;
62
import org.gvsig.fmap.dal.store.gpe.handlers.FmapContentHandler;
63
import org.gvsig.fmap.dal.store.gpe.handlers.FmapErrorHandler;
64
import org.gvsig.fmap.geom.Geometry.TYPES;
65
import org.gvsig.fmap.geom.primitive.Envelope;
66
import org.gvsig.gpe.lib.api.GPELocator;
67
import org.gvsig.gpe.lib.api.GPEManager;
68
import org.gvsig.tools.dynobject.DynObject;
69
import org.gvsig.tools.dynobject.exception.DynFieldNotFoundException;
70
import org.gvsig.xmlschema.lib.api.XMLSchemaLocator;
71
import org.gvsig.xmlschema.lib.api.XMLSchemaManager;
72

  
73
/**
74
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
75
 */
76
public class GPEStoreProvider extends AbstractFeatureStoreProvider implements
77
ResourceConsumer {
78
    public static final String NAME = "GPE";
79
    public static final String DESCRIPTION = "GPE file";
80
    public static final String METADATA_DEFINITION_NAME = NAME;
81
    
82
    private static Logger logger = LoggerFactory.getLogger(GPEStoreProvider.class);
83

  
84
    protected File m_Fich;
85
    protected boolean isOpen = false;
86
    //private GPEStoreParameters gpeParams;
87
    private ResourceProvider gpeResource;
88

  
89
    //Managers to manage the parsing process
90
    protected GPEManager gpeManager = null;
91
    protected XMLSchemaManager xmlSchemaManager = null;
92

  
93
    //The content handler and the error handler
94
    protected FmapContentHandler contentHandler;
95
    protected FmapErrorHandler errorHandler;
96

  
97
    public GPEStoreProvider(DataStoreParameters params,
98
        DataStoreProviderServices storeServices)
99
    throws InitializeException {
100
        this(params, storeServices, FileHelper
101
            .newMetadataContainer(METADATA_DEFINITION_NAME));
102
    }   
103

  
104
    protected GPEStoreProvider(DataStoreParameters params,
105
        DataStoreProviderServices storeServices, DynObject metadata)
106
    throws InitializeException {
107

  
108
        super(params, storeServices, metadata);
109

  
110
        this.setDynValue("Envelope", params.getDynValue("Envelope"));
111

  
112
        gpeManager = GPELocator.getGPEManager();
113
        xmlSchemaManager = XMLSchemaLocator.getXMLSchemaManager();		
114

  
115
        retrieveFile();
116
        gpeResource = this.createResource(FileResource.NAME,
117
            new Object[] { m_Fich.getAbsolutePath() });
118
        gpeResource.addConsumer(this);
119
        this.initFeatureType();
120
    }
121

  
122
    protected void retrieveFile() throws InitializeException{
123
        m_Fich = getGPEParameters().getFile();
124
    }
125

  
126
    protected void initFeatureType() throws InitializeException {
127
        try {
128

  
129
            this.open();
130
        } catch (DataException e) {
131
            throw new InitializeException(this.getProviderName(), e);
132
        }
133
    }
134

  
135
    private GPEStoreParameters getGPEParameters() {
136
        return (GPEStoreParameters) this.getParameters();
137
    }
138

  
139
    public Object getDynValue(String name) throws DynFieldNotFoundException {
140
        if (DataStore.METADATA_CRS.equalsIgnoreCase(name)) {
141
            IProjection resp = this.getSRS();
142
            if (resp != null) {
143
                return resp;
144
            }
145
        }
146
        return super.getDynValue(name);
147
    }
148
    
149
    /* (non-Javadoc)
150
     * @see org.gvsig.fmap.dal.resource.spi.ResourceConsumer#closeResourceRequested(org.gvsig.fmap.dal.resource.spi.ResourceProvider)
151
     */
152
    public boolean closeResourceRequested(ResourceProvider resource) {
153
        // TODO Auto-generated method stub
154
        return false;
155
    }
156

  
157
    /* (non-Javadoc)
158
     * @see org.gvsig.fmap.dal.resource.spi.ResourceConsumer#resourceChanged(org.gvsig.fmap.dal.resource.spi.ResourceProvider)
159
     */
160
    public void resourceChanged(ResourceProvider resource) {
161
        // TODO Auto-generated method stub
162

  
163
    }
164

  
165
    /* (non-Javadoc)
166
     * @see org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider#canWriteGeometry(int)
167
     */
168
    public boolean canWriteGeometry(int geometryType, int geometrySubtype)
169
    throws DataException {
170
        // TODO Auto-generated method stub
171
        return false;
172
    }
173

  
174
    /* (non-Javadoc)
175
     * @see org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider#createNewOID()
176
     */
177
    public Object createNewOID() {
178
        return contentHandler.createNewOID();
179
    }
180

  
181
    /* (non-Javadoc)
182
     * @see org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider#createSet(org.gvsig.fmap.dal.feature.FeatureQuery)
183
     */
184
    public FeatureSetProvider createSet(FeatureQuery query)
185
    throws DataException {
186
        return new GPESetProvider(this, query);
187
    }
188

  
189
    protected FeatureProvider internalGetFeatureProviderByReference(
190
        FeatureReferenceProviderServices reference) throws DataException {
191
        return internalGetFeatureProviderByReference(reference,
192
            this
193
            .getFeatureStore()
194
            .getDefaultFeatureType());
195
    }
196

  
197
    public FeatureProvider internalGetFeatureProviderByReference(
198
        FeatureReferenceProviderServices reference, FeatureType featureType)
199
    throws DataException {
200
        Map featureSet = contentHandler.getFeatureSet();
201
        if (featureSet.containsKey(reference.getOID())){
202
            return (FeatureProvider)featureSet.get(reference.getOID());
203
        }
204
        return null;
205
    }
206

  
207
    FeatureProvider getFeatureProviderByIndex(Long index, FeatureType fType)
208
    throws DataException {
209
        Map featureSet = contentHandler.getFeatureSet();
210
        if (featureSet.containsKey(index)){
211
            return (FeatureProvider)featureSet.get(index);
212
        }        
213
        return null;
214
    }
215

  
216
    public void resourcesBegin() throws ResourceExecuteException {
217
        // Nothing to do
218
    }
219

  
220
    public void resourcesEnd() {
221
        // Nothing to do
222
    }
223

  
224
    /* (non-Javadoc)
225
     * @see org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider#getFeatureReferenceOIDType()
226
     */
227
    public int getOIDType() {
228
        return DataTypes.STRING;
229
    }
230

  
231
    /* (non-Javadoc)
232
     * @see org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider#getName()
233
     */
234
    public String getProviderName() {
235
        return NAME;
236
    }
237

  
238
    /* (non-Javadoc)
239
     * @see org.gvsig.fmap.dal.spi.DataStoreProvider#getSourceId()
240
     */
241
    public Object getSourceId() {
242
        return getGPEParameters().getFile();
243
    }
244

  
245
    public String getName() {
246
        String name = this.getGPEParameters().getFile().getName();
247
        int n = name.lastIndexOf(".");
248
        if( n<1 ) {
249
            return name;
250
        }
251
        return name.substring(0, n);
252
    }
253

  
254
    public String getFullName() {
255
        return this.getGPEParameters().getFile().getAbsolutePath();
256
    }
257

  
258
    /* (non-Javadoc)
259
     * @see org.gvsig.fmap.dal.spi.DataStoreProvider#open()
260
     */
261
    public void open() throws OpenException {
262
        if (isOpen) {
263
            return;
264
        }
265
        try {
266
            errorHandler = new FmapErrorHandler();
267
            contentHandler = new FmapContentHandler(errorHandler,
268
                getStoreServices(), this, m_Fich,
269
                getSRS(),
270
                getGeometryType(),
271
                getGPEParameters().getUseAxisOrderYX()
272
            );
273
            if (getStoreServices().getDefaultFeatureType() != null){
274
                contentHandler.setFeatureType(getStoreServices().getDefaultFeatureType().getEditable());
275
            }
276
            contentHandler.setEnvelope((Envelope)getDynValue("Envelope"));
277
            isOpen = true;
278
            gpeManager.parse(contentHandler, errorHandler, m_Fich.toURI());			
279
        } catch (Exception e) {
280
            throw new OpenException("Imposible create a parser",e);
281
        }
282
    }
283

  
284
    protected IProjection getSRS(){
285
        return getGPEParameters().getCRS();
286
    }	
287

  
288
    protected int getGeometryType() {
289
        return TYPES.GEOMETRY;
290
    }
291

  
292
    /* (non-Javadoc)
293
     * @see org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider#createSet(org.gvsig.fmap.dal.feature.FeatureQuery, org.gvsig.fmap.dal.feature.FeatureType)
294
     */
295
    public FeatureSetProvider createSet(FeatureQuery query,
296
        FeatureType featureType) throws DataException {
297
        return new GPESetProvider(this, query, featureType);
298
    }
299

  
300
    public long getFeatureCount() throws DataException {		
301
        return contentHandler.getFeaturesCount();
302
    }
303

  
304
    /* (non-Javadoc)
305
     * @see org.gvsig.fmap.dal.feature.spi.AbstractFeatureStoreProvider#getEnvelope()
306
     */
307
    public Envelope getEnvelope() throws DataException {
308
        this.open();
309
        return (Envelope) this.getDynValue("Envelope");
310
    }
311

  
312
    public void setEnvelope(Envelope envelope) {
313
        this.setDynValue("Envelope", envelope);
314
    }
315

  
316
    public ResourceProvider getResource() {
317
        return gpeResource;
318
    }
319

  
320
    public DataServerExplorer getExplorer() throws ReadException,
321
    ValidateDataParametersException {
322
        DataManager manager = DALLocator.getDataManager();
323
        FilesystemServerExplorerParameters params;
324
        try {
325
            params = (FilesystemServerExplorerParameters) manager
326
            .createServerExplorerParameters(FilesystemServerExplorer.NAME);
327
            params.setRoot(this.getGPEParameters().getFile().getParent());
328
            return manager.createServerExplorer(params);
329
        } catch (DataException e) {
330
            throw new ReadException(this.getProviderName(), e);
331
        } catch (ValidateDataParametersException e) {
332
            // TODO Auto-generated catch block
333
            throw new ReadException(this.getProviderName(), e);
334
        }
335
    }
336

  
337
    /**
338
     * @return the contentHandler
339
     */
340
    public FmapContentHandler getContentHandler() {
341
        return contentHandler;
342
    }
343

  
344
    /**
345
     * @return the errorHandler
346
     */
347
    public FmapErrorHandler getErrorHandler() {
348
        return errorHandler;
349
    }
350

  
351
}
org.gvsig.gpe/library/tags/org.gvsig.gpe-2.1.12/org.gvsig.gpe.app/org.gvsig.gpe.app.mainplugin/src/main/java/org/gvsig/fmap/dal/store/gpe/GPEStoreParameters.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
import org.apache.commons.lang3.BooleanUtils;
32

  
33
import org.cresques.cts.IProjection;
34
import org.gvsig.fmap.dal.DataStoreParameters;
35
import org.gvsig.fmap.dal.FileHelper;
36
import org.gvsig.fmap.dal.feature.EditableFeatureType;
37
import org.gvsig.fmap.dal.feature.FeatureType;
38
import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters;
39
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemStoreParameters;
40
import org.gvsig.fmap.dal.spi.AbstractDataParameters;
41
import org.gvsig.fmap.dal.spi.DataStoreProviderServices;
42
import org.gvsig.fmap.geom.primitive.Envelope;
43
import org.gvsig.tools.dynobject.DelegatedDynObject;
44
import org.gvsig.tools.dynobject.DynStruct;
45

  
46
/**
47
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
48
 */
49
public class GPEStoreParameters extends AbstractDataParameters implements
50
DataStoreParameters, FilesystemStoreParameters,
51
NewFeatureStoreParameters {
52

  
53
    public static final String PARAMETERS_DEFINITION_NAME = "GPEStoreParameters";
54

  
55
    private static final String FILE_PARAMETER_NAME = "File";
56
    private static final String CRS_PARAMETER_NAME = "CRS";
57
    private static final String ENVELOPE_PARAMETER_NAME = "Envelope";
58
    private static final String FEATURETYPE_PARAMETER_NAME = "FeatureType";
59

  
60
    private DelegatedDynObject parameters;
61

  
62
    public GPEStoreParameters() {
63
        this(PARAMETERS_DEFINITION_NAME);
64
    }
65

  
66
    protected GPEStoreParameters(String parametersDefinitionName) {
67
        this(parametersDefinitionName, GPEStoreProvider.NAME);
68
    }
69

  
70
    public GPEStoreParameters(String parametersDefinitionName, String name) {
71
        super();
72
        this.parameters = (DelegatedDynObject) FileHelper.newParameters(parametersDefinitionName);
73
        this.setDynValue(DataStoreProviderServices.PROVIDER_PARAMTER_NAME, name);       
74
    }
75

  
76
    protected static void registerParametersDefinition(){ 
77
        DynStruct dynStruct = FileHelper.registerParametersDefinition(
78
            GPEStoreParameters.PARAMETERS_DEFINITION_NAME,
79
            GPEStoreParameters.class, "GPEParameters.xml");
80
        
81
        dynStruct.addDynFieldObject(ENVELOPE_PARAMETER_NAME).
82
        setClassOfValue(Envelope.class).setMandatory(false);
83

  
84
        dynStruct.addDynFieldObject(FEATURETYPE_PARAMETER_NAME).
85
        setClassOfValue(FeatureType.class).setMandatory(false);
86
    }
87

  
88
    protected DelegatedDynObject getDelegatedDynObject() {
89
        return parameters;
90
    }
91

  
92
    public String getDataStoreName() {
93
        return GPEStoreProvider.NAME;
94
    }
95

  
96
    public String getDescription() {
97
        return GPEStoreProvider.DESCRIPTION;
98
    }
99

  
100
    public boolean isValid() {
101
        return (this.getFile() != null);
102
    }
103

  
104
    public File getFile() {
105
        return (File) this.getDynValue(FILE_PARAMETER_NAME);
106
    }
107

  
108
    public void setFile(File file) {
109
        this.setDynValue(FILE_PARAMETER_NAME, file);
110
    }	
111

  
112
    public String getFileName() {
113
        return this.getFile().getAbsolutePath();
114
    }
115

  
116
    public void setFileName(String fileName) {
117
        this.setDynValue(FILE_PARAMETER_NAME, fileName);
118
    }
119

  
120
    public IProjection getCRS() {
121
        return (IProjection) this.getDynValue(CRS_PARAMETER_NAME);
122
    }
123

  
124
    public void setCRS(IProjection srs) {
125
        this.setDynValue(CRS_PARAMETER_NAME, srs);
126
    }
127

  
128
    public void setCRS(String srs) {
129
        this.setDynValue(CRS_PARAMETER_NAME, srs);
130
    }
131

  
132
    public Envelope getEnvelope() {
133
        return (Envelope) this.getDynValue(ENVELOPE_PARAMETER_NAME);
134
    }
135

  
136
    public void setEnvelope(Envelope envelope) {
137
        this.setDynValue(ENVELOPE_PARAMETER_NAME, envelope);
138
    }
139
    
140
    public void setDynValue(String name, Object val) {
141
    	super.setDynValue(name, val);
142
    }
143

  
144
    public boolean getUseAxisOrderYX()  {
145
        boolean x = BooleanUtils.isTrue((Boolean) this.getDynValue("useAxisOrderYX"));
146
        return x;
147
    }
148
    
149
	public EditableFeatureType getDefaultFeatureType() {
150
		return (EditableFeatureType) this.getDynValue(FEATURETYPE_PARAMETER_NAME);
151
	}
152

  
153
	public void setDefaultFeatureType(FeatureType featureType) {
154
		this.setDynValue(FEATURETYPE_PARAMETER_NAME, featureType);
155
	}
156
}
org.gvsig.gpe/library/tags/org.gvsig.gpe-2.1.12/org.gvsig.gpe.app/org.gvsig.gpe.app.mainplugin/src/main/java/org/gvsig/fmap/dal/store/gpe/handlers/FmapErrorHandler.java
1
package org.gvsig.fmap.dal.store.gpe.handlers;
2

  
3
import org.gvsig.gpe.lib.impl.parser.GPEErrorHandler;
4

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

  
56
}
org.gvsig.gpe/library/tags/org.gvsig.gpe-2.1.12/org.gvsig.gpe.app/org.gvsig.gpe.app.mainplugin/src/main/java/org/gvsig/fmap/dal/store/gpe/handlers/FmapContentHandler.java
1
package org.gvsig.fmap.dal.store.gpe.handlers;
2

  
3
import java.io.File;
4
import java.io.IOException;
5
import java.util.ArrayList;
6
import java.util.HashMap;
7
import java.util.Iterator;
8
import java.util.List;
9
import java.util.Map;
10

  
11
import org.cresques.cts.IProjection;
12
import org.gvsig.fmap.dal.DataTypes;
13
import org.gvsig.fmap.dal.feature.EditableFeatureAttributeDescriptor;
14
import org.gvsig.fmap.dal.feature.EditableFeatureType;
15
import org.gvsig.fmap.dal.feature.Feature;
16
import org.gvsig.fmap.dal.feature.FeatureType;
17
import org.gvsig.fmap.dal.feature.spi.DefaultFeatureProvider;
18
import org.gvsig.fmap.dal.feature.spi.FeatureProvider;
19
import org.gvsig.fmap.dal.feature.spi.FeatureStoreProviderServices;
20
import org.gvsig.fmap.dal.store.gpe.GPEStoreProvider;
21
import org.gvsig.fmap.dal.store.gpe.model.GPEElement;
22
import org.gvsig.fmap.dal.store.gpe.model.GPEFeature;
23
import org.gvsig.fmap.geom.Geometry;
24
import org.gvsig.fmap.geom.Geometry.SUBTYPES;
25
import org.gvsig.fmap.geom.Geometry.TYPES;
26
import org.gvsig.fmap.geom.GeometryLocator;
27
import org.gvsig.fmap.geom.GeometryManager;
28
import org.gvsig.fmap.geom.aggregate.MultiCurve;
29
import org.gvsig.fmap.geom.aggregate.MultiPoint;
30
import org.gvsig.fmap.geom.aggregate.MultiPrimitive;
31
import org.gvsig.fmap.geom.aggregate.MultiSurface;
32
import org.gvsig.fmap.geom.exception.CreateEnvelopeException;
33
import org.gvsig.fmap.geom.exception.CreateGeometryException;
34
import org.gvsig.fmap.geom.primitive.Curve;
35
import org.gvsig.fmap.geom.primitive.Envelope;
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff