Revision 449

View differences:

org.gvsig.gpe/library/tags/org.gvsig.gpe-2.1.10/org.gvsig.gpe.lib/org.gvsig.gpe.lib.impl/src/test/java/org/gvsig/gpe/lib/impl/containers/MultiPolygon.java
1
package org.gvsig.gpe.lib.impl.containers;
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: MultiPolygon.java 93 2007-05-09 10:03:19Z jorpiell $
45
 * $Log$
46
 * Revision 1.1  2007/05/09 10:03:19  jorpiell
47
 * Add the multigeometry tests
48
 *
49
 *
50
 */
51
/**
52
 * This class represetnts a MultiPolygon
53
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
54
 */
55
public class MultiPolygon extends MultiGeometry{
56
	
57
	/**
58
	 * Adds a new Polygon
59
	 * @param polygon
60
	 * Polygon to add
61
	 */
62
	public void addPolygon(Polygon polygon) {
63
		addGeometry(polygon);
64
	}
65
	
66
	/**
67
	 * Gets a Polygon at position i
68
	 * @param i
69
	 * position
70
	 */
71
	public Polygon getMultiPolygonAt(int i) {
72
		return (Polygon)getGeometryAt(i);
73
	}
74
}
0 75

  
org.gvsig.gpe/library/tags/org.gvsig.gpe-2.1.10/org.gvsig.gpe.lib/org.gvsig.gpe.lib.impl/src/test/java/org/gvsig/gpe/lib/impl/containers/CoordinatesSequence.java
1
package org.gvsig.gpe.lib.impl.containers;
2

  
3
import java.io.IOException;
4

  
5
import org.gvsig.gpe.lib.api.parser.ICoordinateIterator;
6
import org.gvsig.gpe.lib.api.writer.ICoordinateSequence;
7

  
8
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
9
 *
10
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
11
 *
12
 * This program is free software; you can redistribute it and/or
13
 * modify it under the terms of the GNU General Public License
14
 * as published by the Free Software Foundation; either version 2
15
 * of the License, or (at your option) any later version.
16
 *
17
 * This program is distributed in the hope that it will be useful,
18
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
 * GNU General Public License for more details.
21
 *
22
 * You should have received a copy of the GNU General Public License
23
 * along with this program; if not, write to the Free Software
24
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
25
 *
26
 * For more information, contact:
27
 *
28
 *  Generalitat Valenciana
29
 *   Conselleria d'Infraestructures i Transport
30
 *   Av. Blasco Ib??ez, 50
31
 *   46010 VALENCIA
32
 *   SPAIN
33
 *
34
 *      +34 963862235
35
 *   gvsig@gva.es
36
 *      www.gvsig.gva.es
37
 *
38
 *    or
39
 *
40
 *   IVER T.I. S.A
41
 *   Salamanca 50
42
 *   46005 Valencia
43
 *   Spain
44
 *
45
 *   +34 963163400
46
 *   dac@iver.es
47
 */
48
/* CVS MESSAGES:
49
 *
50
 * $Id$
51
 * $Log$
52
 *
53
 */
54
/**
55
 * @author Jorge Piera Llodr? (jorge.piera@iver.es)
56
 */
57
public class CoordinatesSequence implements ICoordinateSequence, ICoordinateIterator{
58
	private double[][] coordinates;
59
	private int next = 0;
60
	
61
	public CoordinatesSequence(double x, double y, double z){
62
		coordinates = new double[3][1];
63
		coordinates[0][0] = x;
64
		coordinates[1][0] = y;
65
		coordinates[2][0] = z;		
66
	}
67
	
68
	public CoordinatesSequence(double[] x, double[] y, double[] z){
69
		coordinates = new double[3][1];
70
		coordinates[0] = x;
71
		coordinates[1] = y;
72
		coordinates[2] = z;		
73
	}	
74
	
75
	/*
76
	 * (non-Javadoc)
77
	 * @see org.gvsig.gpe.parser.ICoordinateIterator#getDimension()
78
	 */
79
	public int getDimension() {
80
		return coordinates.length;
81
	}
82

  
83
	/*
84
	 * (non-Javadoc)
85
	 * @see org.gvsig.gpe.parser.ICoordinateIterator#hasNext()
86
	 */
87
	public boolean hasNext() throws IOException {
88
		return (next < coordinates[0].length);
89
	}
90

  
91
	/*
92
	 * (non-Javadoc)
93
	 * @see org.gvsig.gpe.parser.ICoordinateIterator#next(double[])
94
	 */
95
	public void next(double[] buffer) throws IOException {
96
		for (int i=0 ; i<buffer.length ; i++){
97
			buffer[i] = coordinates[i][next];			
98
		}
99
		next++;
100
	}
101

  
102
	public int getSize() {
103
		return coordinates[0].length;
104
	}
105

  
106
	public ICoordinateIterator iterator() {
107
		return this;
108
	}
109

  
110
}
0 111

  
org.gvsig.gpe/library/tags/org.gvsig.gpe-2.1.10/org.gvsig.gpe.lib/org.gvsig.gpe.lib.impl/src/test/java/org/gvsig/gpe/lib/impl/containers/MultiPoint.java
1
package org.gvsig.gpe.lib.impl.containers;
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: MultiPoint.java 93 2007-05-09 10:03:19Z jorpiell $
45
 * $Log$
46
 * Revision 1.1  2007/05/09 10:03:19  jorpiell
47
 * Add the multigeometry tests
48
 *
49
 *
50
 */
51
/**
52
 * This class represetnts a Multipoint
53
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
54
 */
55
public class MultiPoint extends MultiGeometry{
56
	
57
	/**
58
	 * Adds a new Point
59
	 * @param point
60
	 * Point to add
61
	 */
62
	public void addPoint(Point point) {
63
		addGeometry(point);
64
	}
65
	
66
	/**
67
	 * Gets a Point at position i
68
	 * @param i
69
	 * position
70
	 */
71
	public Point getMultiPointAt(int i) {
72
		return (Point)getGeometryAt(i);
73
	}
74
}
0 75

  
org.gvsig.gpe/library/tags/org.gvsig.gpe-2.1.10/org.gvsig.gpe.lib/org.gvsig.gpe.lib.impl/src/test/java/org/gvsig/gpe/lib/impl/containers/MultiGeometry.java
1
package org.gvsig.gpe.lib.impl.containers;
2

  
3
import java.util.ArrayList;
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: MultiGeometry.java 180 2007-11-21 11:19:46Z csanchez $
48
 * $Log$
49
 * Revision 1.1  2007/05/09 10:03:19  jorpiell
50
 * Add the multigeometry tests
51
 *
52
 *
53
 */
54
/**
55
 * This class represetnts a Multigeometry
56
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
57
 */
58
public class MultiGeometry extends Geometry {
59
	
60

  
61

  
62
	private ArrayList geometries = null;
63
	
64
	public MultiGeometry(){
65
		geometries = new ArrayList();
66
	}
67

  
68
	/**
69
	 * @return the geometries
70
	 */
71
	public ArrayList getGeometries() {
72
		return geometries;
73
	}
74
	
75
	/**
76
	 * Adds a new Geometry
77
	 * @param geometry
78
	 * Geometry to add
79
	 */
80
	public void addGeometry(Geometry geometry) {
81
		geometries.add(geometry);
82
	}
83
	
84
	/**
85
	 * Gets a Geometry at position i
86
	 * @param i
87
	 * position
88
	 */
89
	public Object getGeometryAt(int i) {
90
		return geometries.get(i);
91
	}
92
}
0 93

  
org.gvsig.gpe/library/tags/org.gvsig.gpe-2.1.10/org.gvsig.gpe.lib/org.gvsig.gpe.lib.impl/src/test/java/org/gvsig/gpe/lib/impl/containers/Layer.java
1
package org.gvsig.gpe.lib.impl.containers;
2

  
3
import java.util.ArrayList;
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: Layer.java 81 2007-05-02 11:46:50Z jorpiell $
48
 * $Log$
49
 * Revision 1.3  2007/05/02 11:46:07  jorpiell
50
 * Writing tests updated
51
 *
52
 * Revision 1.2  2007/04/19 07:23:20  jorpiell
53
 * Add the add methods to teh contenhandler and change the register mode
54
 *
55
 * Revision 1.1  2007/04/14 16:06:35  jorpiell
56
 * Add the container classes
57
 *
58
 *
59
 */
60
/**
61
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
62
 */
63
public class Layer {
64
	private String name = null;
65
	private String description = null;
66
	private String id = null;
67
	private Layer parentLayer = null;
68
	private ArrayList features = new ArrayList();
69
	private ArrayList layers = new ArrayList();
70
	private String srs = null;
71
	private Bbox bbox = null;
72
	
73
	/**
74
	 * @return the bbox
75
	 */
76
	public Bbox getBbox() {
77
		return bbox;
78
	}
79

  
80
	/**
81
	 * @param bbox the bbox to set
82
	 */
83
	public void setBbox(Object bbox) {
84
		if (bbox != null){
85
			this.bbox = (Bbox)bbox;
86
		}
87
	}
88

  
89
	/**
90
	 * @return the srs
91
	 */
92
	public String getSrs() {
93
		return srs;
94
	}
95

  
96
	/**
97
	 * @param srs the srs to set
98
	 */
99
	public void setSrs(String srs) {
100
		this.srs = srs;
101
	}
102

  
103
	public Layer() {
104
		super();
105
	}
106

  
107
	/**
108
	 * @return the description
109
	 */
110
	public String getDescription() {
111
		return description;
112
	}
113

  
114
	/**
115
	 * @param description the description to set
116
	 */
117
	public void setDescription(String description) {
118
		this.description = description;
119
	}
120

  
121
	/**
122
	 * @return the id
123
	 */
124
	public String getId() {
125
		return id;
126
	}
127

  
128
	/**
129
	 * @param id the id to set
130
	 */
131
	public void setId(String id) {
132
		this.id = id;
133
	}
134

  
135
	/**
136
	 * @return the name
137
	 */
138
	public String getName() {
139
		return name;
140
	}
141

  
142
	/**
143
	 * @param name the name to set
144
	 */
145
	public void setName(String name) {
146
		this.name = name;
147
	}
148
	
149
	/**
150
	 * @return the features
151
	 */
152
	public ArrayList getFeatures() {
153
		return features;
154
	}
155
	
156
	/**
157
	 * Adds a new feature
158
	 * @param layer
159
	 */
160
	public void addFeature(Feature feature){
161
		features.add(feature);
162
	}
163
	
164
	/**
165
	 * Adds a new layer
166
	 * @param layer
167
	 */
168
	public void addLayer(Layer layer){
169
		layers.add(layer);
170
	}
171
	
172
	/**
173
	 * Adds a new layer
174
	 * @param layer
175
	 */
176
	public void addFeature(Object feature){
177
		if (feature instanceof Feature){
178
			features.add(feature);
179
		}
180
	}
181

  
182
	/**
183
	 * @return the parentLayer
184
	 */
185
	public Layer getParentLayer() {
186
		return parentLayer;
187
	}
188

  
189
	/**
190
	 * @param parentLayer the parentLayer to set
191
	 */
192
	public void setParentLayer(Object parentLayer) {
193
		if (parentLayer != null){
194
			this.parentLayer = (Layer)parentLayer;
195
		}
196
	}
197

  
198
	/**
199
	 * @return the layers
200
	 */
201
	public ArrayList getLayers() {
202
		return layers;
203
	}
204
	
205
	
206
	/**
207
	 * @return the layer at position i
208
	 * @param i
209
	 * Layer position
210
	 */
211
	public Layer getLayerAt(int i) {
212
		return (Layer)layers.get(i);
213
	}
214
}
0 215

  
org.gvsig.gpe/library/tags/org.gvsig.gpe-2.1.10/org.gvsig.gpe.lib/org.gvsig.gpe.lib.impl/src/test/java/org/gvsig/gpe/lib/impl/containers/LineString.java
1
package org.gvsig.gpe.lib.impl.containers;
2

  
3
import java.util.ArrayList;
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: LineString.java 94 2007-05-09 10:25:45Z jorpiell $
48
 * $Log$
49
 * Revision 1.2  2007/05/09 10:25:45  jorpiell
50
 * Add the multiGeometries
51
 *
52
 * Revision 1.1  2007/04/14 16:06:35  jorpiell
53
 * Add the container classes
54
 *
55
 *
56
 */
57
/**
58
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
59
 */
60
public class LineString extends Geometry {
61
	private ArrayList coordinates = null;
62
				
63
	public LineString() {
64
		super();
65
		coordinates = new ArrayList();
66
	}
67

  
68
	public void addCoordinate(double[] coordinate){
69
		coordinates.add(coordinate);
70
	}
71
	
72
	public double geCoordinateAt(int index, int dimension){
73
		return ((double[])(coordinates.get(index)))[dimension];
74
	}
75
	
76
	public int getCoordinatesNumber(){
77
		return coordinates.size();
78
	}			
79
}
0 80

  
org.gvsig.gpe/library/tags/org.gvsig.gpe-2.1.10/org.gvsig.gpe.lib/org.gvsig.gpe.lib.impl/src/test/java/org/gvsig/gpe/lib/impl/containers/MetaData.java
1
package org.gvsig.gpe.lib.impl.containers;
2

  
3
import java.util.ArrayList;
4

  
5
public class MetaData {
6
	
7
	private MetaData parentData = null;
8
	private ArrayList dataList = new ArrayList();
9
	private String tagType = null;
10
	private String tagData = null;
11
	
12
	/**
13
	 * @return the tagType
14
	 */
15
	public String getTagType() {
16
		return this.tagType;
17
	}
18
	
19
	/**
20
	 * @param name the tagType to set
21
	 */
22
	public void setTagType(String tagType) {
23
		this.tagType = tagType;
24
	}
25
	
26
	/**
27
	 * @param name the tag data to set
28
	 */
29
	public void setTagData(String tagData) {
30
		this.tagData = tagData;
31
	}
32
	
33
	/**
34
	 * @param name the tag data to set
35
	 */
36
	public String getTagData() {
37
		return tagData;
38
	}
39
	
40
	/**
41
	 * @return the data list
42
	 */
43
	public ArrayList getDataList() {
44
		return dataList;
45
	}
46
	
47
	/**
48
	 * @return the metadata at position i
49
	 * @param i
50
	 * Element position
51
	 */
52
	public MetaData getElementAt(int i) {
53
		return (MetaData)dataList.get(i);
54
	}
55
	
56
	/**
57
	 * @return the parent metadata
58
	 */
59
	public MetaData getParentData() {
60
		return parentData;
61
	}
62
	
63
	/**
64
	 * @param parent metadata the parentElement to set
65
	 */
66
	public void setParentData(Object parentData) {
67
		if (parentData != null){
68
			this.parentData = (MetaData)parentData;
69
			((MetaData)parentData).addChildData(this);
70
		}
71
	}
72
		
73
	/**
74
	 * @param adds a child metadata
75
	 */
76
	public void addChildData(MetaData subData) {
77
		getDataList().add(subData);
78
	}
79
	
80
}
0 81

  
org.gvsig.gpe/library/tags/org.gvsig.gpe-2.1.10/org.gvsig.gpe.lib/org.gvsig.gpe.lib.impl/src/test/java/org/gvsig/gpe/lib/impl/containers/Curve.java
1
package org.gvsig.gpe.lib.impl.containers;
2

  
3
import java.util.ArrayList;
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

  
46
/**
47
 * This class represetnts a Curve
48
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
49
 */
50
public class Curve extends Geometry {
51
	private ArrayList coordinates = null;
52
	private ArrayList segments = null;
53
	
54
	public Curve(){
55
		segments = new ArrayList();
56
		coordinates = new ArrayList();
57
	}
58
		
59
	/**
60
	 * Adds a segment 
61
	 * @param segment
62
	 * The segment to add
63
	 */
64
	public void addSegment(LineString segment){
65
		segments.add(segment);
66
	}
67
	
68
	/**
69
	 * Gets a segment
70
	 * @param i
71
	 * The segment position
72
	 * @return
73
	 * A Segment
74
	 */
75
	public LineString getSegmentAt(int i){
76
		return (LineString)segments.get(i);
77
	}
78
	
79
	/**
80
	 * @return the number of seg
81
	 */
82
	public int getSegmentsSize(){
83
		return segments.size();
84
	}
85
	
86
	public void addCoordinate(double[] coordinate){
87
		coordinates.add(coordinate);
88
	}
89
	
90
	public double geCoordinateAt(int index, int dimension){
91
		return ((double[])(coordinates.get(index)))[dimension];
92
	}
93
	
94
	public int getCoordinatesNumber(){
95
		return coordinates.size();
96
	}	
97
}
98

  
99

  
0 100

  
org.gvsig.gpe/library/tags/org.gvsig.gpe-2.1.10/org.gvsig.gpe.lib/org.gvsig.gpe.lib.impl/src/test/java/org/gvsig/gpe/lib/impl/containers/Polygon.java
1
package org.gvsig.gpe.lib.impl.containers;
2

  
3
import java.util.ArrayList;
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: Polygon.java 94 2007-05-09 10:25:45Z jorpiell $
48
 * $Log$
49
 * Revision 1.3  2007/05/09 10:25:45  jorpiell
50
 * Add the multiGeometries
51
 *
52
 * Revision 1.2  2007/04/19 07:23:20  jorpiell
53
 * Add the add methods to teh contenhandler and change the register mode
54
 *
55
 * Revision 1.1  2007/04/14 16:06:35  jorpiell
56
 * Add the container classes
57
 *
58
 *
59
 */
60
/**
61
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
62
 */
63
public class Polygon extends Geometry {
64
	private ArrayList coordinates = null;
65
	private ArrayList innerBoundary = new ArrayList();
66
	
67
	public Polygon() {
68
		super();
69
		coordinates = new ArrayList();
70
	}
71

  
72
	public void addCoordinate(double[] coordinate){
73
		coordinates.add(coordinate);
74
	}
75
	
76
	public double geCoordinateAt(int index, int dimension){
77
		return ((double[])(coordinates.get(index)))[dimension];
78
	}
79
	
80
	public int getCoordinatesNumber(){
81
		return coordinates.size();
82
	}	
83
	
84
	/**
85
	 * @return the innerBoundary
86
	 */
87
	public ArrayList getInnerBoundary() {
88
		return innerBoundary;
89
	}
90
	
91
	/**
92
	 * Adds a new layer
93
	 * @param layer
94
	 */
95
	public void addInnerBoundary(Polygon polygon){
96
		innerBoundary.add(polygon);
97
	}
98
	
99
	/**
100
	 * Adds a new layer
101
	 * @param layer
102
	 */
103
	public void addInnerBoundary(Object polygon){
104
		if (polygon instanceof Polygon){
105
			innerBoundary.add(polygon);
106
		}
107
	}
108
}
0 109

  
org.gvsig.gpe/library/tags/org.gvsig.gpe-2.1.10/org.gvsig.gpe.lib/org.gvsig.gpe.lib.impl/src/test/java/org/gvsig/gpe/lib/impl/containers/Point.java
1
package org.gvsig.gpe.lib.impl.containers;
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: Point.java 94 2007-05-09 10:25:45Z jorpiell $
45
 * $Log$
46
 * Revision 1.2  2007/05/09 10:25:45  jorpiell
47
 * Add the multiGeometries
48
 *
49
 * Revision 1.1  2007/04/14 16:06:35  jorpiell
50
 * Add the container classes
51
 *
52
 *
53
 */
54
/**
55
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
56
 */
57
public class Point extends Geometry {
58
	private double[] coordinates;
59
		
60
	/**
61
	 * @return the x
62
	 */
63
	public double getX() {
64
		return coordinates[0];
65
	}
66
	/**
67
	 * @param x the x to set
68
	 */
69
	public void setX(double x) {
70
		coordinates[0] = x;
71
	}
72
	/**
73
	 * @return the y
74
	 */
75
	public double getY() {
76
		return coordinates[1];
77
	}
78
	/**
79
	 * @param y the y to set
80
	 */
81
	public void setY(double y) {
82
		coordinates[1] = y;
83
	}
84
	/**
85
	 * @return the z
86
	 */
87
	public double getZ() {
88
		return coordinates[2];
89
	}
90
	/**
91
	 * @param z the z to set
92
	 */
93
	public void setZ(double z) {
94
		coordinates[2] = z;
95
	}
96
	/**
97
	 * @param coordinates the coordinates to set
98
	 */
99
	public void setCoordinates(double[] coordinates) {
100
		this.coordinates = coordinates;
101
	}
102
}
0 103

  
org.gvsig.gpe/library/tags/org.gvsig.gpe-2.1.10/org.gvsig.gpe.lib/org.gvsig.gpe.lib.impl/src/test/java/org/gvsig/gpe/lib/impl/containers/Element.java
1
package org.gvsig.gpe.lib.impl.containers;
2

  
3
import java.util.ArrayList;
4

  
5

  
6
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
7
 *
8
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
9
 *
10
 * This program is free software; you can redistribute it and/or
11
 * modify it under the terms of the GNU General Public License
12
 * as published by the Free Software Foundation; either version 2
13
 * of the License, or (at your option) any later version.
14
 *
15
 * This program is distributed in the hope that it will be useful,
16
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 * GNU General Public License for more details.
19
 *
20
 * You should have received a copy of the GNU General Public License
21
 * along with this program; if not, write to the Free Software
22
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
23
 *
24
 * For more information, contact:
25
 *
26
 *  Generalitat Valenciana
27
 *   Conselleria d'Infraestructures i Transport
28
 *   Av. Blasco Ib??ez, 50
29
 *   46010 VALENCIA
30
 *   SPAIN
31
 *
32
 *      +34 963862235
33
 *   gvsig@gva.es
34
 *      www.gvsig.gva.es
35
 *
36
 *    or
37
 *
38
 *   IVER T.I. S.A
39
 *   Salamanca 50
40
 *   46005 Valencia
41
 *   Spain
42
 *
43
 *   +34 963163400
44
 *   dac@iver.es
45
 */
46
/* CVS MESSAGES:
47
 *
48
 * $Id: Element.java 108 2007-05-15 07:28:34Z jorpiell $
49
 * $Log$
50
 * Revision 1.4  2007/05/15 07:28:34  jorpiell
51
 * Children Element printed
52
 *
53
 * Revision 1.3  2007/05/02 11:46:07  jorpiell
54
 * Writing tests updated
55
 *
56
 * Revision 1.2  2007/04/19 11:50:20  csanchez
57
 * Actualizacion protoripo libGPE
58
 *
59
 * Revision 1.1  2007/04/14 16:06:35  jorpiell
60
 * Add the container classes
61
 *
62
 *
63
 */
64
/**
65
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
66
 */
67
public class Element {
68
	private String namespace = null;
69
	private String name = null;
70
	private String id = null;
71
	private Object value = null;
72
	private Object type = null;
73
	private Element parentElement = null;
74
	private ArrayList elements = new ArrayList();
75
	/**
76
	 * @return the id
77
	 */
78
	public String getId() {
79
		return id;
80
	}
81
	/**
82
	 * @param id the id to set
83
	 */
84
	public void setId(String id) {
85
		this.id = id;
86
	}
87
	/**
88
	 * @return the name
89
	 */
90
	public String getName() {
91
		return name;
92
	}
93
	/**
94
	 * @param name the name to set
95
	 */
96
	public void setName(String name) {
97
		this.name = name;
98
	}
99
	/**
100
	 * @return the type
101
	 */
102
	public Object getType() {
103
		return type;
104
	}
105
	/**
106
	 * @param type the type to set
107
	 */
108
	public void setType(Object type) {
109
		this.type = type;
110
	}
111
	/**
112
	 * @return the value
113
	 */
114
	public Object getValue() {
115
		return value;
116
	}
117
	/**
118
	 * @param value the value to set
119
	 */
120
	public void setValue(Object value) {
121
		this.value = value;
122
	}
123

  
124
	/**
125
	 * @return the parentElement
126
	 */
127
	public Element getParentElement() {
128
		return parentElement;
129
	}
130
	/**
131
	 * @param parentElement the parentElement to set
132
	 */
133
	public void setParentElement(Object parentElement) {
134
		if (parentElement != null){
135
			this.parentElement = (Element)parentElement;
136
			((Element)parentElement).addChildEElement(this);
137
		}
138
	}
139
	/**
140
	 * @return the elements
141
	 */
142
	public ArrayList getElements() {
143
		return elements;
144
	}
145
	
146
	/**
147
	 * @return the element at position i
148
	 * @param i
149
	 * Element position
150
	 */
151
	public Element getElementAt(int i) {
152
		return (Element)elements.get(i);
153
	}
154
		
155
	/**
156
	 * @param parentElement the parentElement to set
157
	 */
158
	public void setParentElement(Element parentElement) {
159
		this.parentElement = parentElement;
160
	}
161
	
162
	/**
163
	 * @param adds a child element
164
	 */
165
	public void addChildEElement(Element element) {
166
		getElements().add(element);
167
	}
168
	/**
169
	 * @return the namespace
170
	 */
171
	public String getNamespace() {
172
		return namespace;
173
	}
174
	/**
175
	 * @param namespace the namespace to set
176
	 */
177
	public void setNamespace(String namespace) {
178
		this.namespace = namespace;
179
	}
180
}
0 181

  
org.gvsig.gpe/library/tags/org.gvsig.gpe-2.1.10/org.gvsig.gpe.lib/org.gvsig.gpe.lib.impl/src/test/java/org/gvsig/gpe/lib/impl/containers/MultiLineString.java
1
package org.gvsig.gpe.lib.impl.containers;
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: MultiLineString.java 93 2007-05-09 10:03:19Z jorpiell $
45
 * $Log$
46
 * Revision 1.1  2007/05/09 10:03:19  jorpiell
47
 * Add the multigeometry tests
48
 *
49
 *
50
 */
51
/**
52
 * This class represetnts a MultiLineString
53
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
54
 */
55
public class MultiLineString extends MultiGeometry{
56
	
57
	/**
58
	 * Adds a new LineString
59
	 * @param lineString
60
	 * LineString to add
61
	 */
62
	public void addLineString(LineString lineString) {
63
		addGeometry(lineString);
64
	}
65
	
66
	/**
67
	 * Gets a LineString at position i
68
	 * @param i
69
	 * position
70
	 */
71
	public LineString getMultiLineStringAt(int i) {
72
		return (LineString)getGeometryAt(i);
73
	}
74
}
0 75

  
org.gvsig.gpe/library/tags/org.gvsig.gpe-2.1.10/org.gvsig.gpe.lib/org.gvsig.gpe.lib.impl/src/test/java/org/gvsig/gpe/lib/impl/containers/LinearRing.java
1
package org.gvsig.gpe.lib.impl.containers;
2

  
3
import java.util.ArrayList;
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: LinearRing.java 54 2007-04-14 16:06:35Z jorpiell $
48
 * $Log$
49
 * Revision 1.1  2007/04/14 16:06:35  jorpiell
50
 * Add the container classes
51
 *
52
 *
53
 */
54
/**
55
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
56
 */
57
public class LinearRing extends Geometry {
58
	private ArrayList coordinates = null;
59
		
60
	public LinearRing() {
61
		super();
62
		coordinates = new ArrayList();
63
	}
64

  
65
	public void addCoordinate(double[] coordinate){
66
		coordinates.add(coordinate);
67
	}
68
	
69
	public double geCoordinateAt(int index, int dimension){
70
		return ((double[])(coordinates.get(index)))[dimension];
71
	}
72
	
73
	public int getCoordinatesNumber(){
74
		return coordinates.size();
75
	}	
76
}
0 77

  
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff