Revision 11203
trunk/libraries/libGPE/src-test/org/gvsig/gpe/writers/GPEMultiPolygonLayerTest.java | ||
---|---|---|
1 |
package org.gvsig.gpe.writers; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
import java.io.IOException; |
|
5 |
|
|
6 |
import org.gvsig.gpe.GPEErrorHandler; |
|
7 |
|
|
8 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
9 |
* |
|
10 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
11 |
* |
|
12 |
* This program is free software; you can redistribute it and/or |
|
13 |
* modify it under the terms of the GNU General Public License |
|
14 |
* as published by the Free Software Foundation; either version 2 |
|
15 |
* of the License, or (at your option) any later version. |
|
16 |
* |
|
17 |
* This program is distributed in the hope that it will be useful, |
|
18 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
19 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
20 |
* GNU General Public License for more details. |
|
21 |
* |
|
22 |
* You should have received a copy of the GNU General Public License |
|
23 |
* along with this program; if not, write to the Free Software |
|
24 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
25 |
* |
|
26 |
* For more information, contact: |
|
27 |
* |
|
28 |
* Generalitat Valenciana |
|
29 |
* Conselleria d'Infraestructures i Transport |
|
30 |
* Av. Blasco Ib??ez, 50 |
|
31 |
* 46010 VALENCIA |
|
32 |
* SPAIN |
|
33 |
* |
|
34 |
* +34 963862235 |
|
35 |
* gvsig@gva.es |
|
36 |
* www.gvsig.gva.es |
|
37 |
* |
|
38 |
* or |
|
39 |
* |
|
40 |
* IVER T.I. S.A |
|
41 |
* Salamanca 50 |
|
42 |
* 46005 Valencia |
|
43 |
* Spain |
|
44 |
* |
|
45 |
* +34 963163400 |
|
46 |
* dac@iver.es |
|
47 |
*/ |
|
48 |
/* CVS MESSAGES: |
|
49 |
* |
|
50 |
* $Id$ |
|
51 |
* $Log$ |
|
52 |
* Revision 1.1 2007-04-13 13:14:55 jorpiell |
|
53 |
* Created the base tests and add some methods to the content handler |
|
54 |
* |
|
55 |
* |
|
56 |
*/ |
|
57 |
/** |
|
58 |
* @author Jorge Piera LLodr? (jorge.piera@iver.es) |
|
59 |
*/ |
|
60 |
public abstract class GPEMultiPolygonLayerTest extends GPEWriterBaseTest{ |
|
61 |
|
|
62 |
/* |
|
63 |
* (non-Javadoc) |
|
64 |
* @see org.gvsig.gpe.writers.GPEWriterBaseTest#readObjects() |
|
65 |
*/ |
|
66 |
public void readObjects() { |
|
67 |
// TODO Auto-generated method stub |
|
68 |
|
|
69 |
} |
|
70 |
|
|
71 |
/* |
|
72 |
* (non-Javadoc) |
|
73 |
* @see org.gvsig.gpe.writers.GPEWriterBaseTest#writeObjects() |
|
74 |
*/ |
|
75 |
public void writeObjects() { |
|
76 |
getHandler().initialize(); |
|
77 |
getHandler().startLayer("1", "Municipality", "Polygon layer test", "23030"); |
|
78 |
getHandler().startBbox("bbox", generateRandomBBox(), |
|
79 |
generateRandomBBox(), |
|
80 |
generateRandomBBox(), |
|
81 |
"23030"); |
|
82 |
getHandler().endBbox(); |
|
83 |
getHandler().startFeature("Valencia","f1"); |
|
84 |
getHandler().startElement("AREA", new Integer("200"), Integer.class); |
|
85 |
getHandler().endElement(); |
|
86 |
getHandler().startMultiPolygon("mp1", "EPSG:23030"); |
|
87 |
getHandler().startPolygon("p1", generateRandomLinearRing(), |
|
88 |
generateRandomLinearRing(), |
|
89 |
generateRandomLinearRing(), "EPSG:23030"); |
|
90 |
getHandler().startInnerBoundary("inner1", generateRandomLinearRing(), |
|
91 |
generateRandomLinearRing(), |
|
92 |
generateRandomLinearRing(), "EPSG:23030"); |
|
93 |
getHandler().endInnerBoundary(); |
|
94 |
getHandler().startInnerBoundary("inner2", generateRandomLinearRing(), |
|
95 |
generateRandomLinearRing(), |
|
96 |
generateRandomLinearRing(), "EPSG:23030"); |
|
97 |
getHandler().endInnerBoundary(); |
|
98 |
getHandler().endPolygon(); |
|
99 |
getHandler().startPolygon("p2", generateRandomLinearRing(), |
|
100 |
generateRandomLinearRing(), |
|
101 |
generateRandomLinearRing(), "EPSG:23030"); |
|
102 |
getHandler().endPolygon(); |
|
103 |
getHandler().endMultiPolygon(); |
|
104 |
getHandler().endFeature(); |
|
105 |
getHandler().endLayer(); |
|
106 |
getHandler().close(); |
|
107 |
} |
|
108 |
|
|
109 |
} |
|
0 | 110 |
trunk/libraries/libGPE/src-test/org/gvsig/gpe/writers/GPEMultiPointLayerTest.java | ||
---|---|---|
1 |
package org.gvsig.gpe.writers; |
|
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-13 13:14:55 jorpiell |
|
47 |
* Created the base tests and add some methods to the content handler |
|
48 |
* |
|
49 |
* |
|
50 |
*/ |
|
51 |
/** |
|
52 |
* @author Jorge Piera LLodr? (jorge.piera@iver.es) |
|
53 |
*/ |
|
54 |
public abstract class GPEMultiPointLayerTest extends GPEWriterBaseTest{ |
|
55 |
/* |
|
56 |
* (non-Javadoc) |
|
57 |
* @see org.gvsig.gpe.writers.GPEWriterBaseTest#readObjects() |
|
58 |
*/ |
|
59 |
public void readObjects() { |
|
60 |
// TODO Auto-generated method stub |
|
61 |
|
|
62 |
} |
|
63 |
|
|
64 |
/* |
|
65 |
* (non-Javadoc) |
|
66 |
* @see org.gvsig.gpe.writers.GPEWriterBaseTest#writeObjects() |
|
67 |
*/ |
|
68 |
public void writeObjects() { |
|
69 |
getHandler().initialize(); |
|
70 |
getHandler().startLayer("1", "Multi Points", "MultiPoints layer test", "23030"); |
|
71 |
getHandler().startBbox("bbox", generateRandomBBox(), |
|
72 |
generateRandomBBox(), |
|
73 |
generateRandomBBox(), |
|
74 |
"23030"); |
|
75 |
getHandler().endBbox(); |
|
76 |
getHandler().startFeature("Spain","f1"); |
|
77 |
getHandler().startElement("POPULATION", new Integer("300000"), Integer.class); |
|
78 |
getHandler().endElement(); |
|
79 |
getHandler().startMultiPoint("mp1", "EPSG:23030"); |
|
80 |
getHandler().startPoint("p1", 1, 1, 1, "EPSG:23030"); |
|
81 |
getHandler().endPoint(); |
|
82 |
getHandler().startPoint("p2", 2, 2, 2, "EPSG:23030"); |
|
83 |
getHandler().endPoint(); |
|
84 |
getHandler().startPoint("p3", 3, 3, 3, "EPSG:23030"); |
|
85 |
getHandler().endPoint(); |
|
86 |
getHandler().endMuliPoint(); |
|
87 |
getHandler().endFeature(); |
|
88 |
getHandler().startFeature("France","f2"); |
|
89 |
getHandler().startElement("POPULATION", new Integer("400000"), Integer.class); |
|
90 |
getHandler().endElement(); |
|
91 |
getHandler().startMultiPoint("mp2", "EPSG:23030"); |
|
92 |
getHandler().startPoint("p4", 4, 4, 4, "EPSG:23030"); |
|
93 |
getHandler().endPoint(); |
|
94 |
getHandler().startPoint("p5", 5, 5, 5, "EPSG:23030"); |
|
95 |
getHandler().endPoint(); |
|
96 |
getHandler().endMuliPoint(); |
|
97 |
getHandler().endFeature(); |
|
98 |
getHandler().endLayer(); |
|
99 |
getHandler().close(); |
|
100 |
} |
|
101 |
|
|
102 |
} |
|
0 | 103 |
trunk/libraries/libGPE/src-test/org/gvsig/gpe/writers/GPEMultiLineStringLayerTest.java | ||
---|---|---|
1 |
package org.gvsig.gpe.writers; |
|
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-13 13:14:55 jorpiell |
|
47 |
* Created the base tests and add some methods to the content handler |
|
48 |
* |
|
49 |
* |
|
50 |
*/ |
|
51 |
/** |
|
52 |
* @author Jorge Piera LLodr? (jorge.piera@iver.es) |
|
53 |
*/ |
|
54 |
public abstract class GPEMultiLineStringLayerTest extends GPEWriterBaseTest{ |
|
55 |
|
|
56 |
/* |
|
57 |
* (non-Javadoc) |
|
58 |
* @see org.gvsig.gpe.writers.GPEWriterBaseTest#readObjects() |
|
59 |
*/ |
|
60 |
public void readObjects() { |
|
61 |
// TODO Auto-generated method stub |
|
62 |
|
|
63 |
} |
|
64 |
|
|
65 |
/* |
|
66 |
* (non-Javadoc) |
|
67 |
* @see org.gvsig.gpe.writers.GPEWriterBaseTest#writeObjects() |
|
68 |
*/ |
|
69 |
public void writeObjects() { |
|
70 |
getHandler().initialize(); |
|
71 |
getHandler().startLayer("1", "Rivers", "Multi LineString layer test", "23030"); |
|
72 |
getHandler().startBbox("bbox", generateRandomBBox(), |
|
73 |
generateRandomBBox(), |
|
74 |
generateRandomBBox(), |
|
75 |
"23030"); |
|
76 |
getHandler().endBbox(); |
|
77 |
getHandler().startFeature("Spain Rivers","f1"); |
|
78 |
getHandler().startElement("NUMBER", new Integer("2"), Integer.class); |
|
79 |
getHandler().endElement(); |
|
80 |
getHandler().startMultiLineString("ml1", "EPSG:23030"); |
|
81 |
getHandler().startLineString("ls1", generateRandomCoordinates(), |
|
82 |
generateRandomCoordinates(), |
|
83 |
generateRandomCoordinates(), "EPSG:23030"); |
|
84 |
getHandler().endLineString(); |
|
85 |
getHandler().startLineString("ls2", generateRandomCoordinates(), |
|
86 |
generateRandomCoordinates(), |
|
87 |
generateRandomCoordinates(), "EPSG:23030"); |
|
88 |
getHandler().endLineString(); |
|
89 |
getHandler().endMultiLineString(); |
|
90 |
getHandler().endFeature(); |
|
91 |
getHandler().endLayer(); |
|
92 |
getHandler().close(); |
|
93 |
} |
|
94 |
|
|
95 |
} |
|
0 | 96 |
trunk/libraries/libGPE/src-test/org/gvsig/gpe/writers/GPEPolygonsLayerTest.java | ||
---|---|---|
49 | 49 |
* |
50 | 50 |
* $Id$ |
51 | 51 |
* $Log$ |
52 |
* Revision 1.1 2007-04-13 07:17:54 jorpiell |
|
52 |
* Revision 1.2 2007-04-13 13:14:55 jorpiell |
|
53 |
* Created the base tests and add some methods to the content handler |
|
54 |
* |
|
55 |
* Revision 1.1 2007/04/13 07:17:54 jorpiell |
|
53 | 56 |
* Add the writting tests for the simple geometries |
54 | 57 |
* |
55 | 58 |
* |
... | ... | |
86 | 89 |
getHandler().startPolygon("p1", generateRandomLinearRing(), |
87 | 90 |
generateRandomLinearRing(), |
88 | 91 |
generateRandomLinearRing(), "EPSG:23030"); |
92 |
getHandler().startInnerBoundary("inner1", generateRandomLinearRing(), |
|
93 |
generateRandomLinearRing(), |
|
94 |
generateRandomLinearRing(), "EPSG:23030"); |
|
95 |
getHandler().endInnerBoundary(); |
|
96 |
getHandler().startInnerBoundary("inner2", generateRandomLinearRing(), |
|
97 |
generateRandomLinearRing(), |
|
98 |
generateRandomLinearRing(), "EPSG:23030"); |
|
99 |
getHandler().endInnerBoundary(); |
|
89 | 100 |
getHandler().endPolygon(); |
90 | 101 |
getHandler().endFeature(); |
91 | 102 |
getHandler().startFeature("Sagunto","f2"); |
trunk/libraries/libGPE/src-test/org/gvsig/gpe/GPEErrorHandlerTest.java | ||
---|---|---|
43 | 43 |
* |
44 | 44 |
* $Id$ |
45 | 45 |
* $Log$ |
46 |
* Revision 1.1 2007-04-12 17:06:42 jorpiell |
|
46 |
* Revision 1.2 2007-04-13 13:14:55 jorpiell |
|
47 |
* Created the base tests and add some methods to the content handler |
|
48 |
* |
|
49 |
* Revision 1.1 2007/04/12 17:06:42 jorpiell |
|
47 | 50 |
* First GML writing tests |
48 | 51 |
* |
49 | 52 |
* |
... | ... | |
52 | 55 |
* @author Jorge Piera LLodr? (jorge.piera@iver.es) |
53 | 56 |
*/ |
54 | 57 |
public class GPEErrorHandlerTest extends GPEErrorHandler{ |
58 |
public Object badLayer(String error, Object layer) { |
|
59 |
// TODO Ap?ndice de m?todo generado autom?ticamente |
|
60 |
return null; |
|
61 |
} |
|
55 | 62 |
|
63 |
public Object badElement(String error, Object element) { |
|
64 |
// TODO Ap?ndice de m?todo generado autom?ticamente |
|
65 |
return null; |
|
66 |
} |
|
67 |
|
|
68 |
public Object badArea(String error, Object bBox) { |
|
69 |
// TODO Ap?ndice de m?todo generado autom?ticamente |
|
70 |
return null; |
|
71 |
} |
|
72 |
|
|
73 |
public Object badGeometry(String error, Object geometry) { |
|
74 |
// TODO Ap?ndice de m?todo generado autom?ticamente |
|
75 |
return null; |
|
76 |
} |
|
77 |
|
|
78 |
public Object badFeature(String error, Object feature) { |
|
79 |
// TODO Ap?ndice de m?todo generado autom?ticamente |
|
80 |
return null; |
|
81 |
} |
|
82 |
|
|
83 |
public void addError(Throwable e) { |
|
84 |
e.printStackTrace(); |
|
85 |
} |
|
56 | 86 |
} |
trunk/libraries/libGPE/src-test/org/gvsig/gpe/GPEContentHandlerTest.java | ||
---|---|---|
43 | 43 |
* |
44 | 44 |
* $Id$ |
45 | 45 |
* $Log$ |
46 |
* Revision 1.1 2007-04-12 17:06:42 jorpiell |
|
46 |
* Revision 1.2 2007-04-13 13:14:55 jorpiell |
|
47 |
* Created the base tests and add some methods to the content handler |
|
48 |
* |
|
49 |
* Revision 1.1 2007/04/12 17:06:42 jorpiell |
|
47 | 50 |
* First GML writing tests |
48 | 51 |
* |
49 | 52 |
* |
... | ... | |
52 | 55 |
* @author Jorge Piera LLodr? (jorge.piera@iver.es) |
53 | 56 |
*/ |
54 | 57 |
public class GPEContentHandlerTest extends GPEContentHandler{ |
58 |
private String tab = ""; |
|
55 | 59 |
|
60 |
public Object startLayer(Object parent, Object bBox, String id, |
|
61 |
String name, String description,String srs) { |
|
62 |
System.out.print(tab + "Start Layer: " + name + "\n"); |
|
63 |
tab = tab + "\t"; |
|
64 |
return null; |
|
65 |
} |
|
56 | 66 |
|
67 |
public void endLayer(Object layer) { |
|
68 |
tab = tab.substring(0, tab.length()-1); |
|
69 |
System.out.print(tab + "End Layer\n"); |
|
70 |
|
|
71 |
} |
|
72 |
|
|
73 |
public void addNameToLayer(Object layer,String name){ |
|
74 |
System.out.print(tab + "Layer name changed: " + name + "\n"); |
|
75 |
} |
|
76 |
|
|
77 |
public void addDescriptionToLayer(Object layer,String description){ |
|
78 |
System.out.print(tab + "Layer description changed: " + description + "\n"); |
|
79 |
} |
|
80 |
|
|
81 |
public Object startElement(Object parent, String name, Object value, |
|
82 |
Object type) { |
|
83 |
// TODO Ap?ndice de m?todo generado autom?ticamente |
|
84 |
return null; |
|
85 |
} |
|
86 |
|
|
87 |
public void endElement(Object element) { |
|
88 |
// TODO Ap?ndice de m?todo generado autom?ticamente |
|
89 |
|
|
90 |
} |
|
91 |
|
|
92 |
public Object startBbox(double[] x, double[] y, double[] z, String id, |
|
93 |
String srs) { |
|
94 |
// TODO Ap?ndice de m?todo generado autom?ticamente |
|
95 |
return null; |
|
96 |
} |
|
97 |
|
|
98 |
public void endBbox(Object bbox) { |
|
99 |
// TODO Ap?ndice de m?todo generado autom?ticamente |
|
100 |
|
|
101 |
} |
|
102 |
|
|
103 |
public Object startPoint(double x, double y, double z, String id, String srs) { |
|
104 |
System.out.print(tab + "Start Point, SRS:" + srs + "\n"); |
|
105 |
tab = tab + "\t"; |
|
106 |
System.out.print(tab + x + "," + y + "," + z + "\n"); |
|
107 |
tab = tab.substring(0, tab.length()-1); |
|
108 |
return null; |
|
109 |
} |
|
110 |
|
|
111 |
public void endPoint(Object point) { |
|
112 |
System.out.print(tab + "End Point\n"); |
|
113 |
} |
|
114 |
|
|
115 |
public Object startLineString(double[] x, double[] y, double[] z, String id, |
|
116 |
String srs) { |
|
117 |
System.out.print(tab + "Start LineString, SRS:" + srs + "\n"); |
|
118 |
tab = tab + "\t"; |
|
119 |
for (int i=0 ; i<x.length ; i++){ |
|
120 |
System.out.print(tab + x[i] + "," + y[i] + "," + z[i] + "\n"); |
|
121 |
} |
|
122 |
tab = tab.substring(0, tab.length()-1); |
|
123 |
return null; |
|
124 |
} |
|
125 |
|
|
126 |
public void endLineString(Object line) { |
|
127 |
System.out.print(tab + "End LineString:\n"); |
|
128 |
} |
|
129 |
|
|
130 |
public Object startLinearRing(double[] x, double[] y, double[] z, String id, |
|
131 |
String srs) { |
|
132 |
// TODO Ap?ndice de m?todo generado autom?ticamente |
|
133 |
return null; |
|
134 |
} |
|
135 |
|
|
136 |
public void endLinearRing(Object linearRing) { |
|
137 |
// TODO Ap?ndice de m?todo generado autom?ticamente |
|
138 |
|
|
139 |
} |
|
140 |
|
|
141 |
public Object startPolygon(double[] x, double[] y, double[] z, String id, |
|
142 |
String srs) { |
|
143 |
// TODO Ap?ndice de m?todo generado autom?ticamente |
|
144 |
return null; |
|
145 |
} |
|
146 |
|
|
147 |
public void endPolygon(Object polygon) { |
|
148 |
// TODO Ap?ndice de m?todo generado autom?ticamente |
|
149 |
|
|
150 |
} |
|
151 |
|
|
152 |
public void addInnerBoundary(Object polygon, Object linearRing) { |
|
153 |
// TODO Ap?ndice de m?todo generado autom?ticamente |
|
154 |
|
|
155 |
} |
|
156 |
|
|
157 |
public void addOuterBoundary(Object polygon, Object linearRing) { |
|
158 |
// TODO Ap?ndice de m?todo generado autom?ticamente |
|
159 |
|
|
160 |
} |
|
161 |
|
|
162 |
public boolean isViewInBox(Object bbox, Object view) { |
|
163 |
// TODO Ap?ndice de m?todo generado autom?ticamente |
|
164 |
return false; |
|
165 |
} |
|
166 |
|
|
167 |
public boolean isGeometryInBox(Object bbox, Object geometry) { |
|
168 |
// TODO Ap?ndice de m?todo generado autom?ticamente |
|
169 |
return false; |
|
170 |
} |
|
171 |
|
|
172 |
public void addFeature(Object layer, Object feature) { |
|
173 |
// TODO Ap?ndice de m?todo generado autom?ticamente |
|
174 |
|
|
175 |
} |
|
176 |
|
|
177 |
public void addBbox(Object item, Object bbox) { |
|
178 |
// TODO Ap?ndice de m?todo generado autom?ticamente |
|
179 |
|
|
180 |
} |
|
181 |
|
|
182 |
public void addElement(Object feature, Object element) { |
|
183 |
// TODO Ap?ndice de m?todo generado autom?ticamente |
|
184 |
|
|
185 |
} |
|
186 |
|
|
187 |
public void addGeometry(Object feature, Object geometry) { |
|
188 |
// TODO Ap?ndice de m?todo generado autom?ticamente |
|
189 |
|
|
190 |
} |
|
191 |
|
|
192 |
public Object startFeature(String name, String id) { |
|
193 |
System.out.print(tab + "Start Feature: " + name + "\n"); |
|
194 |
return null; |
|
195 |
} |
|
196 |
|
|
197 |
public void addNameToFeature(Object feature, String name){ |
|
198 |
System.out.print(tab + "Feature name changed: " + name + "\n"); |
|
199 |
} |
|
200 |
|
|
201 |
public void endFeature(Object feature) { |
|
202 |
System.out.print(tab + "End Feature\n"); |
|
203 |
} |
|
204 |
|
|
57 | 205 |
} |
206 |
|
trunk/libraries/libGPE/src-test/org/gvsig/gpe/readers/GPEReaderBaseTest.java | ||
---|---|---|
1 | 1 |
package org.gvsig.gpe.readers; |
2 | 2 |
|
3 | 3 |
import java.io.File; |
4 |
import java.lang.reflect.InvocationTargetException; |
|
4 | 5 |
|
6 |
import org.gvsig.gpe.GPEContentHandlerTest; |
|
7 |
import org.gvsig.gpe.GPEErrorHandlerTest; |
|
8 |
import org.gvsig.gpe.GPEParser; |
|
9 |
import org.gvsig.gpe.GPERegister; |
|
10 |
|
|
5 | 11 |
import junit.framework.TestCase; |
6 | 12 |
|
7 | 13 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
... | ... | |
48 | 54 |
* |
49 | 55 |
* $Id$ |
50 | 56 |
* $Log$ |
51 |
* Revision 1.1 2007-04-13 07:17:54 jorpiell |
|
57 |
* Revision 1.2 2007-04-13 13:14:55 jorpiell |
|
58 |
* Created the base tests and add some methods to the content handler |
|
59 |
* |
|
60 |
* Revision 1.1 2007/04/13 07:17:54 jorpiell |
|
52 | 61 |
* Add the writting tests for the simple geometries |
53 | 62 |
* |
54 | 63 |
* |
... | ... | |
60 | 69 |
*/ |
61 | 70 |
public abstract class GPEReaderBaseTest extends TestCase { |
62 | 71 |
private File file = null; |
72 |
private GPEParser parser = null; |
|
63 | 73 |
|
64 |
public void setUp(){ |
|
74 |
public void setUp() throws Exception{ |
|
75 |
GPERegister.addGpeDriver(getGPEParserName(), |
|
76 |
new GPEContentHandlerTest(), |
|
77 |
new GPEErrorHandlerTest()); |
|
65 | 78 |
file = new File(getFile()); |
79 |
assertEquals(GPERegister.accept(file),true); |
|
80 |
parser = GPERegister.getParser(file); |
|
81 |
assertNotNull(parser); |
|
66 | 82 |
} |
67 | 83 |
|
84 |
public void testParse() throws Exception{ |
|
85 |
parser.parse(file); |
|
86 |
} |
|
87 |
|
|
68 | 88 |
/** |
89 |
* Each test must to return its parser name |
|
90 |
* to register it before to start the parsing |
|
91 |
* process |
|
92 |
*/ |
|
93 |
public abstract String getGPEParserName(); |
|
94 |
|
|
95 |
/** |
|
69 | 96 |
* Gets the GML file to open |
70 | 97 |
* @return |
71 | 98 |
*/ |
72 | 99 |
public abstract String getFile(); |
73 | 100 |
|
74 |
/** |
|
75 |
* Return the numbre of features |
|
76 |
* @return |
|
77 |
*/ |
|
78 |
public abstract int getNumFeatures(); |
|
79 |
|
|
80 |
/** |
|
81 |
* Compare the feature number i |
|
82 |
* @param i |
|
83 |
*/ |
|
84 |
public abstract void compareFeature(int i); |
|
101 |
|
|
85 | 102 |
} |
trunk/libraries/libGPE/src/org/gvsig/gpe/writers/IGPEWriterHandler.java | ||
---|---|---|
43 | 43 |
* |
44 | 44 |
* $Id$ |
45 | 45 |
* $Log$ |
46 |
* Revision 1.1 2007-04-13 07:17:54 jorpiell |
|
46 |
* Revision 1.2 2007-04-13 13:14:55 jorpiell |
|
47 |
* Created the base tests and add some methods to the content handler |
|
48 |
* |
|
49 |
* Revision 1.1 2007/04/13 07:17:54 jorpiell |
|
47 | 50 |
* Add the writting tests for the simple geometries |
48 | 51 |
* |
49 | 52 |
* Revision 1.2 2007/04/12 17:06:42 jorpiell |
... | ... | |
83 | 86 |
|
84 | 87 |
public void endPoint(); |
85 | 88 |
|
89 |
public void startMultiPoint(String id, String srs); |
|
90 |
|
|
91 |
public void endMuliPoint(); |
|
92 |
|
|
86 | 93 |
public void startLineString(String id,double[] x, double[] y, double[] z, String srs); |
87 | 94 |
|
88 | 95 |
public void endLineString(); |
89 | 96 |
|
97 |
public void startMultiLineString(String id, String srs); |
|
98 |
|
|
99 |
public void endMultiLineString(); |
|
100 |
|
|
90 | 101 |
public void startLinearRing(String id,double[] x, double[] y, double[] z, String srs); |
91 | 102 |
|
92 | 103 |
public void endLinearRing(); |
... | ... | |
95 | 106 |
|
96 | 107 |
public void endPolygon(); |
97 | 108 |
|
109 |
public void startMultiPolygon(String id, String srs); |
|
110 |
|
|
111 |
public void endMultiPolygon(); |
|
112 |
|
|
98 | 113 |
public void startInnerBoundary(String id,double[] x, double[] y, double[] z, String srs); |
99 | 114 |
|
100 | 115 |
public void endInnerBoundary(); |
101 |
|
|
102 |
public void startOuterBoundary(String id,double[] x, double[] y, double[] z, String srs); |
|
103 |
|
|
104 |
public void endOuterBoundary(); |
|
105 |
|
|
106 |
|
|
107 | 116 |
} |
trunk/libraries/libGPE/src/org/gvsig/gpe/writers/GPEWriterHandler.java | ||
---|---|---|
50 | 50 |
* |
51 | 51 |
* $Id$ |
52 | 52 |
* $Log$ |
53 |
* Revision 1.1 2007-04-13 07:17:54 jorpiell |
|
53 |
* Revision 1.2 2007-04-13 13:14:55 jorpiell |
|
54 |
* Created the base tests and add some methods to the content handler |
|
55 |
* |
|
56 |
* Revision 1.1 2007/04/13 07:17:54 jorpiell |
|
54 | 57 |
* Add the writting tests for the simple geometries |
55 | 58 |
* |
56 | 59 |
* Revision 1.2 2007/04/12 17:06:42 jorpiell |
... | ... | |
117 | 120 |
|
118 | 121 |
} |
119 | 122 |
|
120 |
public void endOuterBoundary() { |
|
121 |
// TODO Auto-generated method stub |
|
122 |
|
|
123 |
} |
|
124 |
|
|
125 | 123 |
public void endPoint() { |
126 | 124 |
// TODO Auto-generated method stub |
127 | 125 |
|
... | ... | |
165 | 163 |
public void startLinearRing(String id, double[] x, double[] y, double[] z, String srs) { |
166 | 164 |
// TODO Auto-generated method stub |
167 | 165 |
|
168 |
} |
|
166 |
}
|
|
169 | 167 |
|
170 |
public void startOuterBoundary(String id, double[] x, double[] y, double[] z, String srs) { |
|
171 |
// TODO Auto-generated method stub |
|
172 |
|
|
173 |
} |
|
174 |
|
|
175 | 168 |
public void startPoint(String id, double x, double y, double z, String srs) { |
176 | 169 |
// TODO Auto-generated method stub |
177 | 170 |
|
... | ... | |
204 | 197 |
*/ |
205 | 198 |
public String getFormat() { |
206 | 199 |
return format; |
200 |
} |
|
201 |
|
|
202 |
public void endMuliPoint() { |
|
203 |
// TODO Auto-generated method stub |
|
204 |
|
|
205 |
} |
|
206 |
|
|
207 |
public void endMultiLineString() { |
|
208 |
// TODO Auto-generated method stub |
|
209 |
|
|
210 |
} |
|
211 |
|
|
212 |
public void endMultiPolygon() { |
|
213 |
// TODO Auto-generated method stub |
|
214 |
|
|
215 |
} |
|
216 |
|
|
217 |
public void startMultiLineString(String id, String srs) { |
|
218 |
// TODO Auto-generated method stub |
|
219 |
|
|
220 |
} |
|
221 |
|
|
222 |
public void startMultiPoint(String id, String srs) { |
|
223 |
// TODO Auto-generated method stub |
|
224 |
|
|
225 |
} |
|
226 |
|
|
227 |
public void startMultiPolygon(String id, String srs) { |
|
228 |
// TODO Auto-generated method stub |
|
229 |
|
|
207 | 230 |
} |
208 | 231 |
|
209 | 232 |
} |
trunk/libraries/libGPE/src/org/gvsig/gpe/GPEContentHandler.java | ||
---|---|---|
43 | 43 |
* |
44 | 44 |
* $Id$ |
45 | 45 |
* $Log$ |
46 |
* Revision 1.3 2007-04-12 17:06:42 jorpiell |
|
46 |
* Revision 1.4 2007-04-13 13:14:55 jorpiell |
|
47 |
* Created the base tests and add some methods to the content handler |
|
48 |
* |
|
49 |
* Revision 1.3 2007/04/12 17:06:42 jorpiell |
|
47 | 50 |
* First GML writing tests |
48 | 51 |
* |
49 | 52 |
* Revision 1.2 2007/04/11 13:04:51 jorpiell |
... | ... | |
69 | 72 |
// TODO Ap?ndice de m?todo generado autom?ticamente |
70 | 73 |
|
71 | 74 |
} |
75 |
|
|
76 |
public void addNameToLayer(Object layer,String name){ |
|
77 |
|
|
78 |
} |
|
79 |
|
|
80 |
public void addDescriptionToLayer(Object layer,String description){ |
|
81 |
|
|
82 |
} |
|
72 | 83 |
|
73 | 84 |
public Object startElement(Object parent, String name, Object value, |
74 | 85 |
Object type) { |
... | ... | |
102 | 113 |
|
103 | 114 |
} |
104 | 115 |
|
105 |
public Object startLineString(double x, double y, double z, String id,
|
|
116 |
public Object startLineString(double[] x, double[] y, double[] z, String id,
|
|
106 | 117 |
String srs) { |
107 | 118 |
// TODO Ap?ndice de m?todo generado autom?ticamente |
108 | 119 |
return null; |
... | ... | |
113 | 124 |
|
114 | 125 |
} |
115 | 126 |
|
116 |
public Object startLinearRing(double x, double y, double z, String id,
|
|
127 |
public Object startLinearRing(double[] x, double[] y, double[] z, String id,
|
|
117 | 128 |
String srs) { |
118 | 129 |
// TODO Ap?ndice de m?todo generado autom?ticamente |
119 | 130 |
return null; |
... | ... | |
124 | 135 |
|
125 | 136 |
} |
126 | 137 |
|
127 |
public Object startPolygon(double x, double y, double z, String id,
|
|
138 |
public Object startPolygon(double[] x, double[] y, double[] z, String id,
|
|
128 | 139 |
String srs) { |
129 | 140 |
// TODO Ap?ndice de m?todo generado autom?ticamente |
130 | 141 |
return null; |
... | ... | |
175 | 186 |
|
176 | 187 |
} |
177 | 188 |
|
178 |
public void endFeature(Object feature) {
|
|
189 |
public Object startFeature(String name, String id) {
|
|
179 | 190 |
// TODO Auto-generated method stub |
191 |
return null; |
|
192 |
} |
|
193 |
|
|
194 |
public void addNameToFeature(Object feature, String name){ |
|
180 | 195 |
|
181 | 196 |
} |
182 |
|
|
183 |
public Object startFeature(String name, String id) {
|
|
197 |
|
|
198 |
public void endFeature(Object feature) {
|
|
184 | 199 |
// TODO Auto-generated method stub |
185 |
return null; |
|
200 |
|
|
186 | 201 |
} |
187 | 202 |
|
203 |
|
|
204 |
|
|
188 | 205 |
} |
trunk/libraries/libGPE/src/org/gvsig/gpe/IGPEContentHandler.java | ||
---|---|---|
45 | 45 |
* |
46 | 46 |
* $Id$ |
47 | 47 |
* $Log$ |
48 |
* Revision 1.5 2007-04-12 17:06:42 jorpiell |
|
48 |
* Revision 1.6 2007-04-13 13:14:55 jorpiell |
|
49 |
* Created the base tests and add some methods to the content handler |
|
50 |
* |
|
51 |
* Revision 1.5 2007/04/12 17:06:42 jorpiell |
|
49 | 52 |
* First GML writing tests |
50 | 53 |
* |
51 | 54 |
* Revision 1.4 2007/04/11 13:04:51 jorpiell |
... | ... | |
71 | 74 |
|
72 | 75 |
public void endLayer(Object layer); |
73 | 76 |
|
77 |
public void addNameToLayer(Object layer,String name); |
|
78 |
|
|
79 |
public void addDescriptionToLayer(Object layer,String description); |
|
80 |
|
|
74 | 81 |
public Object startFeature(String name, String id); |
75 | 82 |
|
76 | 83 |
public void endFeature(Object feature); |
77 | 84 |
|
85 |
public void addNameToFeature(Object feature, String name); |
|
86 |
|
|
78 | 87 |
public Object startElement(Object parent, String name, Object value, Object type); |
79 | 88 |
|
80 | 89 |
public void endElement(Object element); |
... | ... | |
87 | 96 |
|
88 | 97 |
public void endPoint(Object point); |
89 | 98 |
|
90 |
public Object startLineString(double x, double y, double z, String id, String srs);
|
|
99 |
public Object startLineString(double[] x, double[] y, double[] z, String id, String srs);
|
|
91 | 100 |
|
92 | 101 |
public void endLineString(Object line); |
93 | 102 |
|
94 |
public Object startLinearRing(double x, double y, double z, String id, String srs);
|
|
103 |
public Object startLinearRing(double[] x, double[] y, double[] z, String id, String srs);
|
|
95 | 104 |
|
96 | 105 |
public void endLinearRing(Object linearRing); |
97 | 106 |
|
98 |
public Object startPolygon(double x, double y, double z, String id, String srs);
|
|
107 |
public Object startPolygon(double[] x, double[] y, double[] z, String id, String srs);
|
|
99 | 108 |
|
100 | 109 |
public void endPolygon(Object polygon); |
101 | 110 |
|
... | ... | |
103 | 112 |
|
104 | 113 |
public void addOuterBoundary(Object polygon,Object linearRing); |
105 | 114 |
|
106 |
public boolean isViewInBox(Object bbox, Object view); |
|
107 |
|
|
108 |
public boolean isGeometryInBox(Object bbox, Object geometry); |
|
109 |
|
|
110 | 115 |
public void addFeature(Object layer,Object feature); |
111 | 116 |
|
112 | 117 |
public void addBbox(Object item,Object bbox); |
... | ... | |
114 | 119 |
public void addElement(Object feature,Object element); |
115 | 120 |
|
116 | 121 |
public void addGeometry(Object feature, Object geometry); |
122 |
|
|
123 |
public boolean isViewInBox(Object bbox, Object view); |
|
124 |
|
|
125 |
public boolean isGeometryInBox(Object bbox, Object geometry); |
|
117 | 126 |
|
118 |
|
|
119 | 127 |
} |
Also available in: Unified diff