Revision 11171
trunk/libraries/libGPE-KML/src/org/gvsig/gpe/kml/GPEKmlParser.java | ||
---|---|---|
13 | 13 |
|
14 | 14 |
import org.gvsig.gpe.GPEContentHandler; |
15 | 15 |
import org.gvsig.gpe.GPEErrorHandler; |
16 |
import org.gvsig.gpe.GPEParser; |
|
17 | 16 |
import org.gvsig.gpe.kml.exceptions.KmlException; |
18 | 17 |
import org.gvsig.gpe.kml.writer.GPEKmlWriterHandler; |
19 |
import org.gvsig.gpe.writer.IGPEWriterHandler;
|
|
18 |
import org.gvsig.gpe.writer.GPEWriterHandler; |
|
20 | 19 |
import org.gvsig.gpe.xml.GPEXmlParser; |
21 | 20 |
|
22 | 21 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
... | ... | |
63 | 62 |
* |
64 | 63 |
* $Id$ |
65 | 64 |
* $Log$ |
66 |
* Revision 1.1 2007-04-12 10:21:52 jorpiell |
|
65 |
* Revision 1.2 2007-04-12 17:06:43 jorpiell |
|
66 |
* First GML writing tests |
|
67 |
* |
|
68 |
* Revision 1.1 2007/04/12 10:21:52 jorpiell |
|
67 | 69 |
* Add the writers |
68 | 70 |
* |
69 | 71 |
* |
... | ... | |
104 | 106 |
* (non-Javadoc) |
105 | 107 |
* @see org.gvsig.gpe.GPEParser#getWriter(java.lang.String, java.lang.String) |
106 | 108 |
*/ |
107 |
public IGPEWriterHandler getWriter(String format, File file) throws IOException {
|
|
108 |
return new GPEKmlWriterHandler(format,file); |
|
109 |
public GPEWriterHandler getWriter(String format, File file) throws IOException { |
|
110 |
return new GPEKmlWriterHandler(format,file,getErrorHandler());
|
|
109 | 111 |
} |
110 | 112 |
|
111 | 113 |
|
trunk/libraries/libGPE-KML/src/org/gvsig/gpe/kml/writer/GPEKmlWriterHandler.java | ||
---|---|---|
9 | 9 |
import java.io.OutputStream; |
10 | 10 |
import java.io.Writer; |
11 | 11 |
|
12 |
import org.gvsig.gpe.GPEErrorHandler; |
|
12 | 13 |
import org.gvsig.gpe.writer.GPEWriterHandler; |
13 | 14 |
import org.gvsig.gpe.xml.writer.GPEXmlWriterHandler; |
14 | 15 |
|
... | ... | |
56 | 57 |
* |
57 | 58 |
* $Id$ |
58 | 59 |
* $Log$ |
59 |
* Revision 1.1 2007-04-12 10:21:52 jorpiell |
|
60 |
* Revision 1.2 2007-04-12 17:06:43 jorpiell |
|
61 |
* First GML writing tests |
|
62 |
* |
|
63 |
* Revision 1.1 2007/04/12 10:21:52 jorpiell |
|
60 | 64 |
* Add the writers |
61 | 65 |
* |
62 | 66 |
* |
... | ... | |
66 | 70 |
*/ |
67 | 71 |
public class GPEKmlWriterHandler extends GPEXmlWriterHandler{ |
68 | 72 |
|
69 |
public GPEKmlWriterHandler(String format, File file) throws IOException { |
|
70 |
super(format, file); |
|
73 |
public GPEKmlWriterHandler(String format, File file, GPEErrorHandler errorHandler) throws IOException {
|
|
74 |
super(format, file, errorHandler);
|
|
71 | 75 |
} |
72 | 76 |
|
73 | 77 |
/* |
trunk/libraries/libGPE/src/org/gvsig/gpe/IGPEContentHandler.java | ||
---|---|---|
45 | 45 |
* |
46 | 46 |
* $Id$ |
47 | 47 |
* $Log$ |
48 |
* Revision 1.4 2007-04-11 13:04:51 jorpiell |
|
48 |
* Revision 1.5 2007-04-12 17:06:42 jorpiell |
|
49 |
* First GML writing tests |
|
50 |
* |
|
51 |
* Revision 1.4 2007/04/11 13:04:51 jorpiell |
|
49 | 52 |
* Add the srs param to the addLayer method |
50 | 53 |
* |
51 | 54 |
* Revision 1.3 2007/04/11 08:46:20 csanchez |
... | ... | |
68 | 71 |
|
69 | 72 |
public void endLayer(Object layer); |
70 | 73 |
|
74 |
public Object startFeature(String name, String id); |
|
75 |
|
|
76 |
public void endFeature(Object feature); |
|
77 |
|
|
71 | 78 |
public Object startElement(Object parent, String name, Object value, Object type); |
72 |
|
|
79 |
|
|
73 | 80 |
public void endElement(Object element); |
74 | 81 |
|
75 | 82 |
public Object startBbox(double[] x, double[] y, double[] z, String id, String srs); |
trunk/libraries/libGPE/src/org/gvsig/gpe/GPERegister.java | ||
---|---|---|
48 | 48 |
* |
49 | 49 |
* $Id$ |
50 | 50 |
* $Log$ |
51 |
* Revision 1.3 2007-04-11 11:10:27 jorpiell |
|
51 |
* Revision 1.4 2007-04-12 17:06:42 jorpiell |
|
52 |
* First GML writing tests |
|
53 |
* |
|
54 |
* Revision 1.3 2007/04/11 11:10:27 jorpiell |
|
52 | 55 |
* Cambiado el nombre de getDriver a GetParser |
53 | 56 |
* |
54 | 57 |
* Revision 1.2 2007/04/11 08:54:24 jorpiell |
... | ... | |
75 | 78 |
* Adds a new GPE parser |
76 | 79 |
* @param driver |
77 | 80 |
*/ |
78 |
private static void addGpeDriver(GPEParser parser){
|
|
81 |
public static void addGpeDriver(GPEParser parser){
|
|
79 | 82 |
parsers.add(parser); |
80 | 83 |
} |
81 | 84 |
|
... | ... | |
95 | 98 |
* @throws SecurityException |
96 | 99 |
* @throws IllegalArgumentException |
97 | 100 |
*/ |
98 |
private static void addGpeDriver(String className,
|
|
101 |
public static void addGpeDriver(String className,
|
|
99 | 102 |
GPEContentHandler contentHandler, |
100 | 103 |
GPEErrorHandler errorsHanlder) throws ClassNotFoundException, IllegalArgumentException, SecurityException, InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException{ |
101 | 104 |
Class [] args = {GPEContentHandler.class,GPEErrorHandler.class}; |
... | ... | |
117 | 120 |
* @return |
118 | 121 |
* true if the driver exists |
119 | 122 |
*/ |
120 |
private static boolean accept(File file){
|
|
123 |
public static boolean accept(File file){
|
|
121 | 124 |
for (int i=0 ; i<parsers.size() ; i++){ |
122 | 125 |
GPEParser parser = (GPEParser)parsers.get(i); |
123 | 126 |
if (parser.accept(file)){ |
... | ... | |
134 | 137 |
* @return |
135 | 138 |
* Null if the driver doesn't exist |
136 | 139 |
*/ |
137 |
private static GPEParser getParser(File file){
|
|
140 |
public static GPEParser getParser(File file){
|
|
138 | 141 |
for (int i=0 ; i<parsers.size() ; i++){ |
139 | 142 |
GPEParser parser = (GPEParser)parsers.get(i); |
140 | 143 |
if (parser.accept(file)){ |
trunk/libraries/libGPE/src/org/gvsig/gpe/GPEDefaults.java | ||
---|---|---|
2 | 2 |
|
3 | 3 |
import java.util.Properties; |
4 | 4 |
|
5 |
import org.apache.xml.utils.NameSpace; |
|
6 |
|
|
5 | 7 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
6 | 8 |
* |
7 | 9 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
... | ... | |
46 | 48 |
* |
47 | 49 |
* $Id$ |
48 | 50 |
* $Log$ |
49 |
* Revision 1.1 2007-04-12 11:39:20 jorpiell |
|
51 |
* Revision 1.2 2007-04-12 17:06:42 jorpiell |
|
52 |
* First GML writing tests |
|
53 |
* |
|
54 |
* Revision 1.1 2007/04/12 11:39:20 jorpiell |
|
50 | 55 |
* Add the GPEDefaults class |
51 | 56 |
* |
52 | 57 |
* |
... | ... | |
61 | 66 |
public static final String DECIMAL = "decimal"; |
62 | 67 |
public static final String COORDINATES_SEPARATOR = "coordinatesSeparator"; |
63 | 68 |
public static final String TUPLES_SEPARATOR = "tuplesSeparator"; |
69 |
public static final String NAMESPACE_PREFIX = "namespacePrefix"; |
|
70 |
public static final String NAMESPACE_URI= "namespaceURI"; |
|
71 |
public static final String XML_VERSION = "xmlVersion"; |
|
72 |
public static final String XML_ENCODING = "xmlEncoding"; |
|
64 | 73 |
|
65 | 74 |
static{ |
66 | 75 |
properties.put(DECIMAL, "."); |
67 | 76 |
properties.put(COORDINATES_SEPARATOR, ","); |
68 |
properties.put(TUPLES_SEPARATOR, " "); |
|
77 |
properties.put(TUPLES_SEPARATOR, " "); |
|
78 |
properties.put(NAMESPACE_PREFIX, "cit"); |
|
79 |
properties.put(NAMESPACE_URI, "http://www.gvsig.com/cit"); |
|
80 |
properties.put(XML_VERSION, "1.0"); |
|
81 |
properties.put(XML_ENCODING, "UTF-8"); |
|
69 | 82 |
} |
70 | 83 |
|
71 | 84 |
/** |
... | ... | |
74 | 87 |
* Property name |
75 | 88 |
* @return |
76 | 89 |
*/ |
77 |
public static Object getProperty(String key){ |
|
78 |
return properties.getProperty(key); |
|
90 |
public static String getProperty(String key){ |
|
91 |
Object obj = properties.getProperty(key); |
|
92 |
if (obj == null){ |
|
93 |
return null; |
|
94 |
} |
|
95 |
return (String)obj; |
|
79 | 96 |
} |
80 | 97 |
|
81 | 98 |
/** |
trunk/libraries/libGPE/src/org/gvsig/gpe/GPEErrorHandler.java | ||
---|---|---|
43 | 43 |
* |
44 | 44 |
* $Id$ |
45 | 45 |
* $Log$ |
46 |
* Revision 1.1 2007-04-11 08:46:21 csanchez |
|
46 |
* Revision 1.2 2007-04-12 17:06:42 jorpiell |
|
47 |
* First GML writing tests |
|
48 |
* |
|
49 |
* Revision 1.1 2007/04/11 08:46:21 csanchez |
|
47 | 50 |
* Actualizacion protoripo libGPE |
48 | 51 |
* |
49 | 52 |
* |
... | ... | |
78 | 81 |
return null; |
79 | 82 |
} |
80 | 83 |
|
84 |
public void addError(Throwable e) { |
|
85 |
// TODO Auto-generated method stub |
|
86 |
|
|
87 |
} |
|
88 |
|
|
81 | 89 |
} |
trunk/libraries/libGPE/src/org/gvsig/gpe/GPEContentHandler.java | ||
---|---|---|
43 | 43 |
* |
44 | 44 |
* $Id$ |
45 | 45 |
* $Log$ |
46 |
* Revision 1.2 2007-04-11 13:04:51 jorpiell |
|
46 |
* Revision 1.3 2007-04-12 17:06:42 jorpiell |
|
47 |
* First GML writing tests |
|
48 |
* |
|
49 |
* Revision 1.2 2007/04/11 13:04:51 jorpiell |
|
47 | 50 |
* Add the srs param to the addLayer method |
48 | 51 |
* |
49 | 52 |
* Revision 1.1 2007/04/11 08:46:21 csanchez |
... | ... | |
172 | 175 |
|
173 | 176 |
} |
174 | 177 |
|
178 |
public void endFeature(Object feature) { |
|
179 |
// TODO Auto-generated method stub |
|
180 |
|
|
181 |
} |
|
182 |
|
|
183 |
public Object startFeature(String name, String id) { |
|
184 |
// TODO Auto-generated method stub |
|
185 |
return null; |
|
186 |
} |
|
187 |
|
|
175 | 188 |
} |
trunk/libraries/libGPE/src/org/gvsig/gpe/GPEParser.java | ||
---|---|---|
3 | 3 |
import java.io.FileNotFoundException; |
4 | 4 |
import java.io.IOException; |
5 | 5 |
|
6 |
import org.gvsig.gpe.writer.IGPEWriterHandler;
|
|
6 |
import org.gvsig.gpe.writer.GPEWriterHandler; |
|
7 | 7 |
|
8 | 8 |
|
9 | 9 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
... | ... | |
50 | 50 |
* |
51 | 51 |
* $Id$ |
52 | 52 |
* $Log$ |
53 |
* Revision 1.4 2007-04-12 10:21:29 jorpiell |
|
53 |
* Revision 1.5 2007-04-12 17:06:42 jorpiell |
|
54 |
* First GML writing tests |
|
55 |
* |
|
56 |
* Revision 1.4 2007/04/12 10:21:29 jorpiell |
|
54 | 57 |
* Add the getWriter() method |
55 | 58 |
* |
56 | 59 |
* Revision 1.3 2007/04/11 11:18:15 csanchez |
... | ... | |
167 | 170 |
* @throws FileNotFoundException |
168 | 171 |
* If the file doesn't exist |
169 | 172 |
*/ |
170 |
public abstract IGPEWriterHandler getWriter(String format,File file) throws IOException ;
|
|
173 |
public abstract GPEWriterHandler getWriter(String format,File file) throws IOException ; |
|
171 | 174 |
|
172 | 175 |
/** |
173 | 176 |
* @return the contentHandler |
trunk/libraries/libGPE/src/org/gvsig/gpe/IGPEErrorHandler.java | ||
---|---|---|
43 | 43 |
* |
44 | 44 |
* $Id$ |
45 | 45 |
* $Log$ |
46 |
* Revision 1.1 2007-04-11 08:46:21 csanchez |
|
46 |
* Revision 1.2 2007-04-12 17:06:42 jorpiell |
|
47 |
* First GML writing tests |
|
48 |
* |
|
49 |
* Revision 1.1 2007/04/11 08:46:21 csanchez |
|
47 | 50 |
* Actualizacion protoripo libGPE |
48 | 51 |
* |
49 | 52 |
* |
... | ... | |
63 | 66 |
|
64 | 67 |
public Object badFeature(String error, Object feature); |
65 | 68 |
|
69 |
public void addError(Throwable e); |
|
70 |
|
|
66 | 71 |
} |
trunk/libraries/libGPE/src/org/gvsig/gpe/writer/GPEWriterHandler.java | ||
---|---|---|
2 | 2 |
|
3 | 3 |
import java.io.File; |
4 | 4 |
|
5 |
import org.gvsig.gpe.GPEErrorHandler; |
|
6 |
import org.gvsig.gpe.IGPEContentHandler; |
|
7 |
import org.xml.sax.ErrorHandler; |
|
8 |
|
|
5 | 9 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
6 | 10 |
* |
7 | 11 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
... | ... | |
46 | 50 |
* |
47 | 51 |
* $Id$ |
48 | 52 |
* $Log$ |
49 |
* Revision 1.1 2007-04-12 10:20:40 jorpiell |
|
53 |
* Revision 1.2 2007-04-12 17:06:42 jorpiell |
|
54 |
* First GML writing tests |
|
55 |
* |
|
56 |
* Revision 1.1 2007/04/12 10:20:40 jorpiell |
|
50 | 57 |
* Add the writer |
51 | 58 |
* |
52 | 59 |
* |
... | ... | |
57 | 64 |
public abstract class GPEWriterHandler implements IGPEWriterHandler{ |
58 | 65 |
private String format = null; |
59 | 66 |
private File file = null; |
67 |
private GPEErrorHandler errorHandler = null; |
|
60 | 68 |
|
61 |
public GPEWriterHandler(String format,File file){ |
|
69 |
public GPEWriterHandler(String format,File file,GPEErrorHandler errorHandler){
|
|
62 | 70 |
this.format = format; |
63 | 71 |
this.file = file; |
72 |
this.errorHandler = errorHandler; |
|
73 |
} |
|
74 |
|
|
75 |
/** |
|
76 |
* @return the errorHandler |
|
77 |
*/ |
|
78 |
public GPEErrorHandler getErrorHandler() { |
|
79 |
return errorHandler; |
|
64 | 80 |
} |
65 |
|
|
81 |
|
|
66 | 82 |
public void close() { |
67 | 83 |
// TODO Auto-generated method stub |
68 | 84 |
|
69 | 85 |
} |
70 | 86 |
|
71 |
public void initialize() {
|
|
87 |
public void endBbox() {
|
|
72 | 88 |
// TODO Auto-generated method stub |
73 | 89 |
|
74 | 90 |
} |
75 |
|
|
76 |
public void addBbox(String id, double[] x, double[] y, double[] z, String srs) {
|
|
91 |
|
|
92 |
public void endElement() {
|
|
77 | 93 |
// TODO Auto-generated method stub |
78 | 94 |
|
79 | 95 |
} |
80 | 96 |
|
81 |
public void addElement(String name, Object value, String type) {
|
|
97 |
public void endInnerBoundary() {
|
|
82 | 98 |
// TODO Auto-generated method stub |
83 | 99 |
|
84 | 100 |
} |
85 | 101 |
|
86 |
public void addInnerBoundary(String id, double[] x, double[] y, double[] z, String srs) {
|
|
102 |
public void endLayer() {
|
|
87 | 103 |
// TODO Auto-generated method stub |
88 | 104 |
|
89 | 105 |
} |
90 | 106 |
|
91 |
public void addLayer(String id, String name, String description, String srs) {
|
|
107 |
public void endLineString() {
|
|
92 | 108 |
// TODO Auto-generated method stub |
93 | 109 |
|
94 | 110 |
} |
95 | 111 |
|
96 |
public void addLineString(String id, double[] x, double[] y, double[] z, String srs) {
|
|
112 |
public void endLinearRing() {
|
|
97 | 113 |
// TODO Auto-generated method stub |
98 | 114 |
|
99 | 115 |
} |
100 | 116 |
|
101 |
public void addLinearRing(String id, double[] x, double[] y, double[] z, String srs) {
|
|
117 |
public void endOuterBoundary() {
|
|
102 | 118 |
// TODO Auto-generated method stub |
103 | 119 |
|
104 | 120 |
} |
105 | 121 |
|
106 |
public void addOuterBoundary(String id, double[] x, double[] y, double[] z, String srs) {
|
|
122 |
public void endPoint() {
|
|
107 | 123 |
// TODO Auto-generated method stub |
108 | 124 |
|
109 | 125 |
} |
110 | 126 |
|
111 |
public void addPoint(String id, double x, double y, double z, String srs) {
|
|
127 |
public void endPolygon() {
|
|
112 | 128 |
// TODO Auto-generated method stub |
113 | 129 |
|
114 | 130 |
} |
115 | 131 |
|
116 |
public void addPolygon(String id, double[] x, double[] y, double[] z, String srs) {
|
|
132 |
public void initialize() {
|
|
117 | 133 |
// TODO Auto-generated method stub |
118 | 134 |
|
119 | 135 |
} |
120 | 136 |
|
121 |
public void endBbox() {
|
|
137 |
public void startBbox(String id, double[] x, double[] y, double[] z, String srs) {
|
|
122 | 138 |
// TODO Auto-generated method stub |
123 | 139 |
|
124 | 140 |
} |
125 | 141 |
|
126 |
public void endElement() {
|
|
142 |
public void startElement(String name, Object value, Object type) {
|
|
127 | 143 |
// TODO Auto-generated method stub |
128 | 144 |
|
129 | 145 |
} |
130 | 146 |
|
131 |
public void endInnerBoundary() {
|
|
147 |
public void startInnerBoundary(String id, double[] x, double[] y, double[] z, String srs) {
|
|
132 | 148 |
// TODO Auto-generated method stub |
133 | 149 |
|
134 | 150 |
} |
135 | 151 |
|
136 |
public void endLayer() {
|
|
152 |
public void startLayer(String id, String name, String description, String srs) {
|
|
137 | 153 |
// TODO Auto-generated method stub |
138 | 154 |
|
139 | 155 |
} |
140 | 156 |
|
141 |
public void endLineString() {
|
|
157 |
public void startLineString(String id, double[] x, double[] y, double[] z, String srs) {
|
|
142 | 158 |
// TODO Auto-generated method stub |
143 | 159 |
|
144 | 160 |
} |
145 | 161 |
|
146 |
public void endLinearRing() {
|
|
162 |
public void startLinearRing(String id, double[] x, double[] y, double[] z, String srs) {
|
|
147 | 163 |
// TODO Auto-generated method stub |
148 | 164 |
|
149 | 165 |
} |
150 | 166 |
|
151 |
public void endOuterBoundary() {
|
|
167 |
public void startOuterBoundary(String id, double[] x, double[] y, double[] z, String srs) {
|
|
152 | 168 |
// TODO Auto-generated method stub |
153 | 169 |
|
154 | 170 |
} |
155 | 171 |
|
156 |
public void endPoint() {
|
|
172 |
public void startPoint(String id, double x, double y, double z, String srs) {
|
|
157 | 173 |
// TODO Auto-generated method stub |
158 | 174 |
|
159 | 175 |
} |
160 | 176 |
|
161 |
public void endPolygon() {
|
|
177 |
public void startPolygon(String id, double[] x, double[] y, double[] z, String srs) {
|
|
162 | 178 |
// TODO Auto-generated method stub |
163 | 179 |
|
164 | 180 |
} |
165 | 181 |
|
182 |
public void endFeature() { |
|
183 |
// TODO Auto-generated method stub |
|
184 |
|
|
185 |
} |
|
186 |
|
|
187 |
public void startFeature(String name, String id) { |
|
188 |
// TODO Auto-generated method stub |
|
189 |
|
|
190 |
} |
|
191 |
|
|
166 | 192 |
/** |
167 | 193 |
* @return the file |
168 | 194 |
*/ |
trunk/libraries/libGPE/src/org/gvsig/gpe/writer/IGPEWriterHandler.java | ||
---|---|---|
43 | 43 |
* |
44 | 44 |
* $Id$ |
45 | 45 |
* $Log$ |
46 |
* Revision 1.1 2007-04-12 10:20:40 jorpiell |
|
46 |
* Revision 1.2 2007-04-12 17:06:42 jorpiell |
|
47 |
* First GML writing tests |
|
48 |
* |
|
49 |
* Revision 1.1 2007/04/12 10:20:40 jorpiell |
|
47 | 50 |
* Add the writer |
48 | 51 |
* |
49 | 52 |
* |
... | ... | |
57 | 60 |
|
58 | 61 |
public void close(); |
59 | 62 |
|
60 |
public void addLayer(String id,String name,String description,String srs);
|
|
63 |
public void startLayer(String id,String name,String description,String srs);
|
|
61 | 64 |
|
62 | 65 |
public void endLayer(); |
63 | 66 |
|
64 |
public void addBbox(String id,double[] x, double[] y, double[] z,String srs);
|
|
67 |
public void startBbox(String id,double[] x, double[] y, double[] z,String srs);
|
|
65 | 68 |
|
66 | 69 |
public void endBbox(); |
67 | 70 |
|
68 |
public void addElement(String name, Object value, String type);
|
|
71 |
public void startElement(String name, Object value, Object type);
|
|
69 | 72 |
|
70 | 73 |
public void endElement(); |
71 | 74 |
|
72 |
public void addPoint(String id,double x, double y, double z, String srs);
|
|
75 |
public void startFeature(String name, String id);
|
|
73 | 76 |
|
77 |
public void endFeature(); |
|
78 |
|
|
79 |
public void startPoint(String id,double x, double y, double z, String srs); |
|
80 |
|
|
74 | 81 |
public void endPoint(); |
75 | 82 |
|
76 |
public void addLineString(String id,double[] x, double[] y, double[] z, String srs);
|
|
83 |
public void startLineString(String id,double[] x, double[] y, double[] z, String srs);
|
|
77 | 84 |
|
78 | 85 |
public void endLineString(); |
79 | 86 |
|
80 |
public void addLinearRing(String id,double[] x, double[] y, double[] z, String srs);
|
|
87 |
public void startLinearRing(String id,double[] x, double[] y, double[] z, String srs);
|
|
81 | 88 |
|
82 | 89 |
public void endLinearRing(); |
83 | 90 |
|
84 |
public void addPolygon(String id,double[] x, double[] y, double[] z, String srs);
|
|
91 |
public void startPolygon(String id,double[] x, double[] y, double[] z, String srs);
|
|
85 | 92 |
|
86 | 93 |
public void endPolygon(); |
87 | 94 |
|
88 |
public void addInnerBoundary(String id,double[] x, double[] y, double[] z, String srs);
|
|
95 |
public void startInnerBoundary(String id,double[] x, double[] y, double[] z, String srs);
|
|
89 | 96 |
|
90 | 97 |
public void endInnerBoundary(); |
91 | 98 |
|
92 |
public void addOuterBoundary(String id,double[] x, double[] y, double[] z, String srs);
|
|
99 |
public void startOuterBoundary(String id,double[] x, double[] y, double[] z, String srs);
|
|
93 | 100 |
|
94 | 101 |
public void endOuterBoundary(); |
95 | 102 |
|
trunk/libraries/libGPE/.classpath | ||
---|---|---|
1 | 1 |
<?xml version="1.0" encoding="UTF-8"?> |
2 | 2 |
<classpath> |
3 | 3 |
<classpathentry kind="src" path="src"/> |
4 |
<classpathentry kind="src" path="src-test"/> |
|
4 | 5 |
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> |
5 | 6 |
<classpathentry kind="output" path="bin"/> |
6 | 7 |
</classpath> |
trunk/libraries/libGPE/src-test/org/gvsig/gpe/GPEErrorHandlerTest.java | ||
---|---|---|
1 |
package org.gvsig.gpe; |
|
2 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
3 |
* |
|
4 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
19 |
* |
|
20 |
* For more information, contact: |
|
21 |
* |
|
22 |
* Generalitat Valenciana |
|
23 |
* Conselleria d'Infraestructures i Transport |
|
24 |
* Av. Blasco Ib??ez, 50 |
|
25 |
* 46010 VALENCIA |
|
26 |
* SPAIN |
|
27 |
* |
|
28 |
* +34 963862235 |
|
29 |
* gvsig@gva.es |
|
30 |
* www.gvsig.gva.es |
|
31 |
* |
|
32 |
* or |
|
33 |
* |
|
34 |
* IVER T.I. S.A |
|
35 |
* Salamanca 50 |
|
36 |
* 46005 Valencia |
|
37 |
* Spain |
|
38 |
* |
|
39 |
* +34 963163400 |
|
40 |
* dac@iver.es |
|
41 |
*/ |
|
42 |
/* CVS MESSAGES: |
|
43 |
* |
|
44 |
* $Id$ |
|
45 |
* $Log$ |
|
46 |
* Revision 1.1 2007-04-12 17:06:42 jorpiell |
|
47 |
* First GML writing tests |
|
48 |
* |
|
49 |
* |
|
50 |
*/ |
|
51 |
/** |
|
52 |
* @author Jorge Piera LLodr? (jorge.piera@iver.es) |
|
53 |
*/ |
|
54 |
public class GPEErrorHandlerTest extends GPEErrorHandler{ |
|
55 |
|
|
56 |
} |
|
0 | 57 |
trunk/libraries/libGPE/src-test/org/gvsig/gpe/GPEContentHandlerTest.java | ||
---|---|---|
1 |
package org.gvsig.gpe; |
|
2 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
3 |
* |
|
4 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
19 |
* |
|
20 |
* For more information, contact: |
|
21 |
* |
|
22 |
* Generalitat Valenciana |
|
23 |
* Conselleria d'Infraestructures i Transport |
|
24 |
* Av. Blasco Ib??ez, 50 |
|
25 |
* 46010 VALENCIA |
|
26 |
* SPAIN |
|
27 |
* |
|
28 |
* +34 963862235 |
|
29 |
* gvsig@gva.es |
|
30 |
* www.gvsig.gva.es |
|
31 |
* |
|
32 |
* or |
|
33 |
* |
|
34 |
* IVER T.I. S.A |
|
35 |
* Salamanca 50 |
|
36 |
* 46005 Valencia |
|
37 |
* Spain |
|
38 |
* |
|
39 |
* +34 963163400 |
|
40 |
* dac@iver.es |
|
41 |
*/ |
|
42 |
/* CVS MESSAGES: |
|
43 |
* |
|
44 |
* $Id$ |
|
45 |
* $Log$ |
|
46 |
* Revision 1.1 2007-04-12 17:06:42 jorpiell |
|
47 |
* First GML writing tests |
|
48 |
* |
|
49 |
* |
|
50 |
*/ |
|
51 |
/** |
|
52 |
* @author Jorge Piera LLodr? (jorge.piera@iver.es) |
|
53 |
*/ |
|
54 |
public class GPEContentHandlerTest extends GPEContentHandler{ |
|
55 |
|
|
56 |
|
|
57 |
} |
|
0 | 58 |
trunk/libraries/libGPE-GML/src-test/org/gvsig/gpe/gml/GMLReaderTest.java | ||
---|---|---|
1 |
package org.gvsig.gpe.gml; |
|
2 |
|
|
3 |
import java.awt.geom.Rectangle2D; |
|
4 |
import java.io.File; |
|
5 |
import java.io.IOException; |
|
6 |
import java.util.ArrayList; |
|
7 |
import java.util.Hashtable; |
|
8 |
import java.util.Iterator; |
|
9 |
import java.util.Map; |
|
10 |
import java.util.Set; |
|
11 |
|
|
12 |
import org.gvsig.gpe.gml.factories.GeometriesFactory; |
|
13 |
import org.gvsig.gpe.gml.factories.IGeometriesFactory; |
|
14 |
import org.gvsig.gpe.gml.factories.XMLElementsFactory; |
|
15 |
import org.gvsig.gpe.gml.factories.XMLSchemasFactory; |
|
16 |
import org.gvsig.gpe.gml.factories.XMLTypesFactory; |
|
17 |
import org.gvsig.gpe.gml.v2.GMLSimpleFeature_v2; |
|
18 |
import org.xmlpull.v1.XmlPullParserException; |
|
19 |
|
|
20 |
import junit.framework.TestCase; |
|
21 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
22 |
* |
|
23 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
24 |
* |
|
25 |
* This program is free software; you can redistribute it and/or |
|
26 |
* modify it under the terms of the GNU General Public License |
|
27 |
* as published by the Free Software Foundation; either version 2 |
|
28 |
* of the License, or (at your option) any later version. |
|
29 |
* |
|
30 |
* This program is distributed in the hope that it will be useful, |
|
31 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
32 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
33 |
* GNU General Public License for more details. |
|
34 |
* |
|
35 |
* You should have received a copy of the GNU General Public License |
|
36 |
* along with this program; if not, write to the Free Software |
|
37 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
38 |
* |
|
39 |
* For more information, contact: |
|
40 |
* |
|
41 |
* Generalitat Valenciana |
|
42 |
* Conselleria d'Infraestructures i Transport |
|
43 |
* Av. Blasco Ib??ez, 50 |
|
44 |
* 46010 VALENCIA |
|
45 |
* SPAIN |
|
46 |
* |
|
47 |
* +34 963862235 |
|
48 |
* gvsig@gva.es |
|
49 |
* www.gvsig.gva.es |
|
50 |
* |
|
51 |
* or |
|
52 |
* |
|
53 |
* IVER T.I. S.A |
|
54 |
* Salamanca 50 |
|
55 |
* 46005 Valencia |
|
56 |
* Spain |
|
57 |
* |
|
58 |
* +34 963163400 |
|
59 |
* dac@iver.es |
|
60 |
*/ |
|
61 |
/* CVS MESSAGES: |
|
62 |
* |
|
63 |
* $Id$ |
|
64 |
* $Log$ |
|
65 |
* Revision 1.1 2007-03-07 11:53:43 jorpiell |
|
66 |
* Añadidos los tests |
|
67 |
* |
|
68 |
* Revision 1.8 2006/12/29 17:54:48 jorpiell |
|
69 |
* Se tienen en cuenta los simpleTypes y los choices, adem?s de los atributos multiples |
|
70 |
* |
|
71 |
* Revision 1.7 2006/12/26 19:20:52 jorpiell |
|
72 |
* Se ha a?adido un nuevo fichero al test |
|
73 |
* |
|
74 |
* Revision 1.6 2006/12/22 11:25:44 csanchez |
|
75 |
* Nuevo parser GML 2.x para gml's sin esquema |
|
76 |
* |
|
77 |
* Revision 1.5 2006/10/11 08:48:49 jorpiell |
|
78 |
* Test actualizado |
|
79 |
* |
|
80 |
* Revision 1.4 2006/10/10 12:52:28 jorpiell |
|
81 |
* Soporte para features complejas. |
|
82 |
* |
|
83 |
* Revision 1.3 2006/10/02 08:33:49 jorpiell |
|
84 |
* Cambios del 10 copiados al head |
|
85 |
* |
|
86 |
* Revision 1.1.2.2 2006/09/25 11:35:15 jorpiell |
|
87 |
* Se tienen en cuanta tablas a distintos niveles. En caso de anidamiento se cogen los resultados de la primera tabla que aparezca. |
|
88 |
* |
|
89 |
* Revision 1.1.2.1 2006/09/19 12:23:15 jorpiell |
|
90 |
* Ya no se depende de geotools |
|
91 |
* |
|
92 |
* Revision 1.2 2006/09/18 12:08:55 jorpiell |
|
93 |
* Se han hecho algunas modificaciones que necesitaba el WFS |
|
94 |
* |
|
95 |
* Revision 1.1 2006/08/10 12:00:49 jorpiell |
|
96 |
* Primer commit del driver de Gml |
|
97 |
* |
|
98 |
* |
|
99 |
*/ |
|
100 |
/** |
|
101 |
* @author Jorge Piera Llodr? (piera_jor@gva.es) |
|
102 |
* @author Carlos S?nchez Peri??n (sanchez_carper@gva.es) |
|
103 |
*/ |
|
104 |
public class GMLReaderTest extends TestCase { |
|
105 |
private static String gmlFileWFS = "testdata/gml/WFS-dmsolutionsGetFeature.xml"; |
|
106 |
private static String gmlFileWFSDuplicados = "testdata/gml/WFS-AtlasAvesGetFeature.xml"; |
|
107 |
private static String gmlFilePoints = "testdata/gml/GML-points.gml"; |
|
108 |
private static String gmlFileLines = "testdata/gml/GML-lines.gml"; |
|
109 |
private static String gmlFilePolygons = "testdata/gml/GML-polygons.gml"; |
|
110 |
private static String gmlNomenclatorIdee = "testdata/gml/GMLNomenclatorIdee.gml"; |
|
111 |
private static String gmlNoSchema="testdata/gml/GMLNomenclatorIdeeWithoutSchema.gml"; |
|
112 |
private IGeometriesFactory factory = new GeometriesFactory(); |
|
113 |
|
|
114 |
public void testWFS() throws Exception{ |
|
115 |
assertEquals(parseFile(gmlFileWFS),495);// |
|
116 |
} |
|
117 |
|
|
118 |
public void testWFSDuplicados() throws Exception{ |
|
119 |
assertEquals(parseFile(gmlFileWFSDuplicados),199); |
|
120 |
} |
|
121 |
|
|
122 |
public void testParsePoints() throws Exception{ |
|
123 |
assertEquals(parseFile(gmlFilePoints),25); |
|
124 |
} |
|
125 |
|
|
126 |
public void testParseLines() throws Exception{ |
|
127 |
assertEquals(parseFile(gmlFileLines),10); |
|
128 |
} |
|
129 |
|
|
130 |
public void testParsePolygons() throws Exception{ |
|
131 |
assertEquals(parseFile(gmlFilePolygons),3); |
|
132 |
} |
|
133 |
|
|
134 |
public void testNomenclatorIdee() throws Exception{ |
|
135 |
assertEquals(parseFile(gmlNomenclatorIdee),1); |
|
136 |
} |
|
137 |
|
|
138 |
public void testParseNoSchema() throws Exception{ |
|
139 |
assertEquals(parseFile(gmlNoSchema),1); |
|
140 |
} |
|
141 |
|
|
142 |
public int parseFile(String file) throws Exception{ |
|
143 |
//Creamos un nuevo lector de GML, parseando los schemas y creando la tabla hash |
|
144 |
//con la estructura de tipos que necesitamos |
|
145 |
GMLReader reader = new GMLReader(new File(file),factory); |
|
146 |
|
|
147 |
//Estas son las coordenadas de referencia en el plano |
|
148 |
//donde se dibujar?n las geometrias, hace referencia al <coordinates> |
|
149 |
Rectangle2D extent = reader.getExtent(); |
|
150 |
|
|
151 |
IGMLFeaturesIterator iterator = reader.getFeaturesIterator(); |
|
152 |
|
|
153 |
System.out.println("******* PARSEANDO ESQUEMA XML : \n"); |
|
154 |
System.out.println("******* VERSION GML "+reader.getVersion()); |
|
155 |
System.out.println("******* Espacio de Nombres por defecto : "+reader.getTargetNamespace()); |
|
156 |
XMLElementsFactory.printEntities(); |
|
157 |
XMLTypesFactory.printTypes(); |
|
158 |
XMLSchemasFactory.printSchemas(); |
|
159 |
|
|
160 |
int i=0; |
|
161 |
while (iterator.hasNext()){ |
|
162 |
System.out.println("********* FEATURE NUMBER " + i + " ***********"); |
|
163 |
GMLSimpleFeature_v2 feature = (GMLSimpleFeature_v2) iterator.next(); |
|
164 |
Map values = feature.getValues(); |
|
165 |
Set keys = values.keySet(); |
|
166 |
Iterator it = keys.iterator(); |
|
167 |
System.out.println("********* DATOS QUE CONTIENE: ************\n" + feature.getGeom()); |
|
168 |
while (it.hasNext()){ |
|
169 |
String key = (String)it.next(); |
|
170 |
Object value = values.get(key); |
|
171 |
if (value instanceof ArrayList){ |
|
172 |
printArrayList(key,(ArrayList)value,1); |
|
173 |
}else if(value instanceof Hashtable){ |
|
174 |
printComplexType((Hashtable)value,1); |
|
175 |
}else{ |
|
176 |
System.out.print(key + ": "); |
|
177 |
System.out.println(value); |
|
178 |
} |
|
179 |
} |
|
180 |
i++; |
|
181 |
} |
|
182 |
System.out.println("NUM FEATURES: " + i); |
|
183 |
return i; |
|
184 |
} |
|
185 |
|
|
186 |
private void printComplexType(Map values,int level){ |
|
187 |
String tab = ""; |
|
188 |
for (int i=0 ; i<level ; i++){ |
|
189 |
tab = tab + "\t"; |
|
190 |
} |
|
191 |
level++; |
|
192 |
Set keys = values.keySet(); |
|
193 |
Iterator it = keys.iterator(); |
|
194 |
while (it.hasNext()){ |
|
195 |
String key = (String)it.next(); |
|
196 |
Object value = values.get(key); |
|
197 |
if (value instanceof ArrayList){ |
|
198 |
ArrayList lValues = (ArrayList)value; |
|
199 |
printArrayList(key,lValues,level); |
|
200 |
}else if(value instanceof Hashtable){ |
|
201 |
printComplexType((Hashtable)value,level); |
|
202 |
}else{ |
|
203 |
System.out.print(tab + key + ": "); |
|
204 |
System.out.print(value + "\n"); |
|
205 |
} |
|
206 |
} |
|
207 |
} |
|
208 |
|
|
209 |
private void printArrayList(String name,ArrayList al, int level){ |
|
210 |
String tab = ""; |
|
211 |
int myLevel = level - 1; |
|
212 |
for (int i=0 ; i<myLevel ; i++){ |
|
213 |
tab = tab + "\t"; |
|
214 |
} |
|
215 |
System.out.println(tab + name + ": HAY " + al.size() + " OCURRENCIAS DEL ATRIBUTO " + name); |
|
216 |
for (int k=0 ; k<al.size() ; k++){ |
|
217 |
System.out.print(tab + "\t" + "OCURRENCIA NUMERO " + (k+1) + "\n"); |
|
218 |
Object oc = al.get(k); |
|
219 |
if (oc instanceof ArrayList){ |
|
220 |
System.out.print("VECTOR"); |
|
221 |
}else if(oc instanceof Hashtable){ |
|
222 |
printComplexType((Hashtable)oc,level); |
|
223 |
}else{ |
|
224 |
System.out.print(tab + "\t" + oc + "\n"); |
|
225 |
} |
|
226 |
} |
|
227 |
} |
|
228 |
} |
trunk/libraries/libGPE-GML/src-test/org/gvsig/gpe/gml/writers/GMLWritePointsLayerTest.java | ||
---|---|---|
1 |
package org.gvsig.gpe.gml.writers; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
import java.io.IOException; |
|
5 |
|
|
6 |
import junit.framework.TestCase; |
|
7 |
|
|
8 |
import org.gvsig.gpe.GPEErrorHandlerTest; |
|
9 |
import org.gvsig.gpe.gml.writer.GPEGmlWriterHandler; |
|
10 |
|
|
11 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
12 |
* |
|
13 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
14 |
* |
|
15 |
* This program is free software; you can redistribute it and/or |
|
16 |
* modify it under the terms of the GNU General Public License |
|
17 |
* as published by the Free Software Foundation; either version 2 |
|
18 |
* of the License, or (at your option) any later version. |
|
19 |
* |
|
20 |
* This program is distributed in the hope that it will be useful, |
|
21 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
22 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
23 |
* GNU General Public License for more details. |
|
24 |
* |
|
25 |
* You should have received a copy of the GNU General Public License |
|
26 |
* along with this program; if not, write to the Free Software |
|
27 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
28 |
* |
|
29 |
* For more information, contact: |
|
30 |
* |
|
31 |
* Generalitat Valenciana |
|
32 |
* Conselleria d'Infraestructures i Transport |
|
33 |
* Av. Blasco Ib??ez, 50 |
|
34 |
* 46010 VALENCIA |
|
35 |
* SPAIN |
|
36 |
* |
|
37 |
* +34 963862235 |
|
38 |
* gvsig@gva.es |
|
39 |
* www.gvsig.gva.es |
|
40 |
* |
|
41 |
* or |
|
42 |
* |
|
43 |
* IVER T.I. S.A |
|
44 |
* Salamanca 50 |
|
45 |
* 46005 Valencia |
|
46 |
* Spain |
|
47 |
* |
|
48 |
* +34 963163400 |
|
49 |
* dac@iver.es |
|
50 |
*/ |
|
51 |
/* CVS MESSAGES: |
|
52 |
* |
|
53 |
* $Id$ |
|
54 |
* $Log$ |
|
55 |
* Revision 1.1 2007-04-12 17:06:44 jorpiell |
|
56 |
* First GML writing tests |
|
57 |
* |
|
58 |
* |
|
59 |
*/ |
|
60 |
/** |
|
61 |
* @author Jorge Piera LLodr? (jorge.piera@iver.es) |
|
62 |
*/ |
|
63 |
public class GMLWritePointsLayerTest extends GMLWriteBaseTest{ |
|
64 |
|
|
65 |
public void test1() throws IOException{ |
|
66 |
GPEGmlWriterHandler writer = new GPEGmlWriterHandler("GML", |
|
67 |
new File("testdata/tmp/points.gml"), |
|
68 |
new GPEErrorHandlerTest()); |
|
69 |
writer.initialize(); |
|
70 |
writer.startLayer("1", "Points Header", "Points layer test", "23030"); |
|
71 |
writer.startBbox("bbox", generateRandomBBox(), |
|
72 |
generateRandomBBox(), |
|
73 |
generateRandomBBox(), |
|
74 |
"23030"); |
|
75 |
writer.endBbox(); |
|
76 |
writer.startFeature("New York","1"); |
|
77 |
writer.startElement("POPULATION", new Integer("300000"), Integer.class); |
|
78 |
writer.endElement(); |
|
79 |
writer.startPoint("p1", 2, 2, 2, "EPSG:23030"); |
|
80 |
writer.endPoint(); |
|
81 |
writer.endFeature(); |
|
82 |
writer.startFeature("Los Angeles","2"); |
|
83 |
writer.startElement("POPULATION", new Integer("400000"), Integer.class); |
|
84 |
writer.endElement(); |
|
85 |
writer.startPoint("p1", 1, 1, 1, "EPSG:23030"); |
|
86 |
writer.endPoint(); |
|
87 |
writer.endFeature(); |
|
88 |
writer.endLayer(); |
|
89 |
writer.close(); |
|
90 |
} |
|
91 |
} |
|
0 | 92 |
trunk/libraries/libGPE-GML/src-test/org/gvsig/gpe/gml/writers/GMLWriteBaseTest.java | ||
---|---|---|
1 |
package org.gvsig.gpe.gml.writers; |
|
2 |
|
|
3 |
import junit.framework.TestCase; |
|
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 |
* Revision 1.1 2007-04-12 17:06:44 jorpiell |
|
50 |
* First GML writing tests |
|
51 |
* |
|
52 |
* |
|
53 |
*/ |
|
54 |
/** |
|
55 |
* @author Jorge Piera LLodr? (jorge.piera@iver.es) |
|
56 |
*/ |
|
57 |
public abstract class GMLWriteBaseTest extends TestCase{ |
|
58 |
|
|
59 |
protected double[] generateRandomCoordinates(){ |
|
60 |
double[] coord = new double[10]; |
|
61 |
for (int i=0 ; i<coord.length ; i++){ |
|
62 |
coord[i] = Math.random(); |
|
63 |
} |
|
64 |
return coord; |
|
65 |
} |
|
66 |
|
|
67 |
protected double[] generateRandomBBox(){ |
|
68 |
double[] coord = new double[2]; |
|
69 |
for (int i=0 ; i<coord.length ; i++){ |
|
70 |
coord[i] = Math.random(); |
|
71 |
} |
|
72 |
return coord; |
|
73 |
} |
|
74 |
} |
|
0 | 75 |
trunk/libraries/libGPE-GML/src-test/org/gvsig/gpe/gml/writers/GMLWriteLineStringLayerTest.java | ||
---|---|---|
1 |
package org.gvsig.gpe.gml.writers; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
import java.io.IOException; |
|
5 |
|
|
6 |
import junit.framework.TestCase; |
|
7 |
|
|
8 |
import org.gvsig.gpe.GPEErrorHandlerTest; |
|
9 |
import org.gvsig.gpe.gml.writer.GPEGmlWriterHandler; |
|
10 |
|
|
11 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
12 |
* |
|
13 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
14 |
* |
|
15 |
* This program is free software; you can redistribute it and/or |
|
16 |
* modify it under the terms of the GNU General Public License |
|
17 |
* as published by the Free Software Foundation; either version 2 |
|
18 |
* of the License, or (at your option) any later version. |
|
19 |
* |
|
20 |
* This program is distributed in the hope that it will be useful, |
|
21 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
22 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
23 |
* GNU General Public License for more details. |
|
24 |
* |
|
25 |
* You should have received a copy of the GNU General Public License |
|
26 |
* along with this program; if not, write to the Free Software |
|
27 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
28 |
* |
|
29 |
* For more information, contact: |
|
30 |
* |
|
31 |
* Generalitat Valenciana |
|
32 |
* Conselleria d'Infraestructures i Transport |
|
33 |
* Av. Blasco Ib??ez, 50 |
|
34 |
* 46010 VALENCIA |
|
35 |
* SPAIN |
|
36 |
* |
|
37 |
* +34 963862235 |
|
38 |
* gvsig@gva.es |
|
39 |
* www.gvsig.gva.es |
|
40 |
* |
|
41 |
* or |
|
42 |
* |
|
43 |
* IVER T.I. S.A |
|
44 |
* Salamanca 50 |
|
45 |
* 46005 Valencia |
|
46 |
* Spain |
|
47 |
* |
|
48 |
* +34 963163400 |
|
49 |
* dac@iver.es |
|
50 |
*/ |
|
51 |
/* CVS MESSAGES: |
|
52 |
* |
|
53 |
* $Id$ |
|
54 |
* $Log$ |
|
55 |
* Revision 1.1 2007-04-12 17:06:44 jorpiell |
|
56 |
* First GML writing tests |
|
57 |
* |
|
58 |
* |
|
59 |
*/ |
|
60 |
/** |
|
61 |
* @author Jorge Piera LLodr? (jorge.piera@iver.es) |
|
62 |
*/ |
|
63 |
public class GMLWriteLineStringLayerTest extends GMLWriteBaseTest { |
|
64 |
public void test1() throws IOException{ |
|
65 |
GPEGmlWriterHandler writer = new GPEGmlWriterHandler("GML", |
|
66 |
new File("testdata/tmp/lineStrings.gml"), |
|
67 |
new GPEErrorHandlerTest()); |
|
68 |
writer.initialize(); |
|
69 |
writer.startLayer("1", "Rivers", "Line string layer test", "23030"); |
|
70 |
writer.startBbox("bbox", generateRandomBBox(), |
|
71 |
generateRandomBBox(), |
|
72 |
generateRandomBBox(), |
|
73 |
"23030"); |
|
74 |
writer.endBbox(); |
|
75 |
writer.startFeature("Turia","1"); |
|
76 |
writer.startElement("LENGHT", new Integer("150"), Integer.class); |
|
77 |
writer.endElement(); |
|
78 |
writer.startLineString("p1", generateRandomCoordinates(), |
|
79 |
generateRandomCoordinates(), |
|
80 |
generateRandomCoordinates(), "EPSG:23030"); |
|
81 |
writer.endLineString(); |
|
82 |
writer.endFeature(); |
|
83 |
writer.startFeature("Ebro","2"); |
|
84 |
writer.startElement("LENGHT", new Integer("300"), Integer.class); |
|
85 |
writer.endElement(); |
|
86 |
writer.startLineString("p1", generateRandomCoordinates(), |
|
87 |
generateRandomCoordinates(), |
|
88 |
generateRandomCoordinates(), "EPSG:23030"); |
|
89 |
writer.endLineString(); |
|
90 |
writer.endFeature(); |
|
91 |
writer.endLayer(); |
|
92 |
writer.close(); |
|
93 |
} |
|
94 |
|
|
95 |
} |
|
0 | 96 |
trunk/libraries/libGPE-GML/src-test/org/gvsig/gpe/gml/writers/GMLWriteLayerHeaderTest.java | ||
---|---|---|
1 |
package org.gvsig.gpe.gml.writers; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
import java.io.IOException; |
|
5 |
|
|
6 |
import org.gvsig.gpe.GPEErrorHandlerTest; |
|
7 |
import org.gvsig.gpe.GPERegister; |
|
8 |
import org.gvsig.gpe.gml.writer.GPEGmlWriterHandler; |
|
9 |
|
|
10 |
import junit.framework.TestCase; |
|
11 |
|
|
12 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
13 |
* |
|
14 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
15 |
* |
|
16 |
* This program is free software; you can redistribute it and/or |
|
17 |
* modify it under the terms of the GNU General Public License |
|
18 |
* as published by the Free Software Foundation; either version 2 |
|
19 |
* of the License, or (at your option) any later version. |
|
20 |
* |
|
21 |
* This program is distributed in the hope that it will be useful, |
|
22 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
23 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
24 |
* GNU General Public License for more details. |
|
25 |
* |
|
26 |
* You should have received a copy of the GNU General Public License |
|
27 |
* along with this program; if not, write to the Free Software |
|
28 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
29 |
* |
|
30 |
* For more information, contact: |
|
31 |
* |
|
32 |
* Generalitat Valenciana |
|
33 |
* Conselleria d'Infraestructures i Transport |
|
34 |
* Av. Blasco Ib??ez, 50 |
|
35 |
* 46010 VALENCIA |
|
36 |
* SPAIN |
|
37 |
* |
|
38 |
* +34 963862235 |
|
39 |
* gvsig@gva.es |
|
40 |
* www.gvsig.gva.es |
|
41 |
* |
|
42 |
* or |
|
43 |
* |
|
44 |
* IVER T.I. S.A |
|
45 |
* Salamanca 50 |
|
46 |
* 46005 Valencia |
|
47 |
* Spain |
|
48 |
* |
|
49 |
* +34 963163400 |
|
50 |
* dac@iver.es |
|
51 |
*/ |
|
52 |
/* CVS MESSAGES: |
|
53 |
* |
|
54 |
* $Id$ |
|
55 |
* $Log$ |
|
56 |
* Revision 1.1 2007-04-12 17:06:44 jorpiell |
|
57 |
* First GML writing tests |
|
58 |
* |
|
59 |
* |
|
60 |
*/ |
|
61 |
/** |
|
62 |
* @author Jorge Piera LLodr? (jorge.piera@iver.es) |
|
63 |
*/ |
|
64 |
public class GMLWriteLayerHeaderTest extends GMLWriteBaseTest { |
|
65 |
|
|
66 |
public void test1() throws IOException{ |
|
67 |
GPEGmlWriterHandler writer = new GPEGmlWriterHandler("GML", |
|
68 |
new File("testdata/tmp/header.gml"), |
|
69 |
new GPEErrorHandlerTest()); |
|
70 |
writer.initialize(); |
|
71 |
writer.startLayer("1", "Layer Header", "Layer header test", "23030"); |
|
72 |
writer.startBbox("bbox", generateRandomBBox(), |
|
73 |
generateRandomBBox(), |
|
74 |
generateRandomBBox(), |
|
75 |
"23030"); |
|
76 |
writer.endBbox(); |
|
77 |
writer.endLayer(); |
|
78 |
writer.close(); |
|
79 |
} |
|
80 |
} |
|
0 | 81 |
trunk/libraries/libGPE-GML/src/org/gvsig/gpe/gml/GMLProjectionFactory.java | ||
---|---|---|
43 | 43 |
* |
44 | 44 |
* $Id$ |
45 | 45 |
* $Log$ |
46 |
* Revision 1.1 2007-04-12 10:23:41 jorpiell |
|
46 |
* Revision 1.2 2007-04-12 17:06:44 jorpiell |
|
47 |
* First GML writing tests |
|
48 |
* |
|
49 |
* Revision 1.1 2007/04/12 10:23:41 jorpiell |
|
47 | 50 |
* Add some writers and the GPEXml parser |
48 | 51 |
* |
49 | 52 |
* |
... | ... | |
63 | 66 |
if (parts[0].compareTo(GMLTags.GML_SRS_EPSG) == 0){ |
64 | 67 |
return "http://www.opengis.net/gml/srs/epsg.xml#" + parts[1]; |
65 | 68 |
} |
69 |
}else if(parts.length == 1){ |
|
70 |
//If the EPSG prefix is not found we write it |
|
71 |
return "http://www.opengis.net/gml/srs/epsg.xml#" + parts[0]; |
|
66 | 72 |
} |
67 | 73 |
} |
68 |
return null;
|
|
74 |
return "unknown";
|
|
69 | 75 |
} |
70 | 76 |
} |
trunk/libraries/libGPE-GML/src/org/gvsig/gpe/gml/writer/features/FeatureMemberWriter.java | ||
---|---|---|
1 |
package org.gvsig.gpe.gml.writer.features; |
|
2 |
|
|
3 |
import java.io.IOException; |
|
4 |
import java.io.Writer; |
|
5 |
|
|
6 |
import org.gvsig.gpe.GPEDefaults; |
|
7 |
import org.gvsig.gpe.gml.GMLTags; |
|
8 |
import org.gvsig.gpe.gml.writer.geometries.BoxWriter; |
|
9 |
|
|
10 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
11 |
* |
|
12 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
13 |
* |
|
14 |
* This program is free software; you can redistribute it and/or |
|
15 |
* modify it under the terms of the GNU General Public License |
|
16 |
* as published by the Free Software Foundation; either version 2 |
|
17 |
* of the License, or (at your option) any later version. |
|
18 |
* |
|
19 |
* This program is distributed in the hope that it will be useful, |
|
20 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
21 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
22 |
* GNU General Public License for more details. |
|
23 |
* |
|
24 |
* You should have received a copy of the GNU General Public License |
|
25 |
* along with this program; if not, write to the Free Software |
|
26 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
27 |
* |
|
28 |
* For more information, contact: |
|
29 |
* |
|
30 |
* Generalitat Valenciana |
|
31 |
* Conselleria d'Infraestructures i Transport |
|
32 |
* Av. Blasco Ib??ez, 50 |
|
33 |
* 46010 VALENCIA |
|
34 |
* SPAIN |
|
35 |
* |
|
36 |
* +34 963862235 |
|
37 |
* gvsig@gva.es |
|
38 |
* www.gvsig.gva.es |
|
39 |
* |
|
40 |
* or |
|
41 |
* |
|
42 |
* IVER T.I. S.A |
|
43 |
* Salamanca 50 |
|
44 |
* 46005 Valencia |
|
45 |
* Spain |
|
46 |
* |
|
47 |
* +34 963163400 |
|
48 |
* dac@iver.es |
|
49 |
*/ |
|
50 |
/* CVS MESSAGES: |
|
51 |
* |
|
52 |
* $Id$ |
|
53 |
* $Log$ |
|
54 |
* Revision 1.1 2007-04-12 17:06:44 jorpiell |
|
55 |
* First GML writing tests |
|
56 |
* |
|
57 |
* |
|
58 |
*/ |
|
59 |
/** |
|
60 |
* @author Jorge Piera LLodr? (jorge.piera@iver.es) |
|
61 |
*/ |
|
62 |
public class FeatureMemberWriter { |
|
63 |
private static String targetNamespace = null; |
|
64 |
|
|
65 |
public static void start(Writer writer,String name, String namespace, String id) throws IOException{ |
|
66 |
writer.write("\n"); |
|
67 |
writer.write("<" + GMLTags.GML_NAMESPACE + ":" + GMLTags.GML_FEATUREMEMBER + ">"); |
|
68 |
writer.write("\n"); |
|
69 |
writer.write("<" + namespace + name); |
|
70 |
if (id != null){ |
|
71 |
writer.write(" gid=" + id); |
|
72 |
} |
|
73 |
writer.write(">"); |
|
74 |
} |
|
75 |
|
|
76 |
public static void end(Writer writer,String name,String namespace) throws IOException{ |
|
77 |
writer.write("\n"); |
|
78 |
writer.write("</" + namespace + name + ">"); |
|
79 |
writer.write("\n"); |
|
80 |
writer.write("</" + GMLTags.GML_NAMESPACE + ":" + GMLTags.GML_FEATUREMEMBER + ">"); |
|
81 |
} |
|
82 |
|
|
83 |
|
|
84 |
} |
|
0 | 85 |
trunk/libraries/libGPE-GML/src/org/gvsig/gpe/gml/writer/features/ElementWriter.java | ||
---|---|---|
1 |
package org.gvsig.gpe.gml.writer.features; |
|
2 |
|
|
3 |
import java.io.IOException; |
|
4 |
import java.io.Writer; |
|
5 |
|
|
6 |
import org.gvsig.gpe.GPEDefaults; |
|
7 |
import org.gvsig.gpe.gml.GMLTags; |
|
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 |
Also available in: Unified diff