svn-gvsig-desktop / trunk / libraries / libFMap / src / com / iver / cit / gvsig / fmap / core / ShapeFactory.java @ 2943
History | View | Annotate | Download (4.01 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
4 |
*
|
5 |
* This program is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License
|
7 |
* as published by the Free Software Foundation; either version 2
|
8 |
* of the License, or (at your option) any later version.
|
9 |
*
|
10 |
* This program is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
*
|
15 |
* You should have received a copy of the GNU General Public License
|
16 |
* along with this program; if not, write to the Free Software
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
18 |
*
|
19 |
* For more information, contact:
|
20 |
*
|
21 |
* Generalitat Valenciana
|
22 |
* Conselleria d'Infraestructures i Transport
|
23 |
* Av. Blasco Ib??ez, 50
|
24 |
* 46010 VALENCIA
|
25 |
* SPAIN
|
26 |
*
|
27 |
* +34 963862235
|
28 |
* gvsig@gva.es
|
29 |
* www.gvsig.gva.es
|
30 |
*
|
31 |
* or
|
32 |
*
|
33 |
* IVER T.I. S.A
|
34 |
* Salamanca 50
|
35 |
* 46005 Valencia
|
36 |
* Spain
|
37 |
*
|
38 |
* +34 963163400
|
39 |
* dac@iver.es
|
40 |
*/
|
41 |
package com.iver.cit.gvsig.fmap.core; |
42 |
|
43 |
import com.iver.cit.gvsig.fmap.core.gt2.FLiteShape; |
44 |
|
45 |
|
46 |
/**
|
47 |
* Clase que crea las geometr?as, contendra un m?todo create por cada tipo de
|
48 |
* geometria que soporte gvSIG
|
49 |
*/
|
50 |
public class ShapeFactory { |
51 |
/**
|
52 |
* Crea una geometr?a que contiene como shape un punto 2D.
|
53 |
*
|
54 |
* @param x Coordenada x.
|
55 |
* @param y Coordenada y.
|
56 |
*
|
57 |
* @return Geometr?a.
|
58 |
*/
|
59 |
public static IGeometry createPoint2D(double x, double y) { |
60 |
return new FGeometry(new FPoint2D(x, y)); |
61 |
} |
62 |
public static IGeometry createPoint2D(FPoint2D p) { |
63 |
return new FGeometry(p); |
64 |
} |
65 |
|
66 |
|
67 |
/**
|
68 |
* Crea una geometr?a que contiene como shape un Multipunto 2D.
|
69 |
*
|
70 |
* @param x Coordenada x.
|
71 |
* @param y Coordenada y.
|
72 |
*
|
73 |
* @return Geometr?a.
|
74 |
*/
|
75 |
public static IGeometry createMultipoint2D(double[] x, double[] y) { |
76 |
return new FMultiPoint2D(x, y); |
77 |
} |
78 |
|
79 |
/**
|
80 |
* Crea una geometr?a que contiene como shape un punto 3D.
|
81 |
*
|
82 |
* @param x Coordenada x.
|
83 |
* @param y Coordenada y.
|
84 |
* @param z Coordenada z.
|
85 |
*
|
86 |
* @return Geometr?a.
|
87 |
*/
|
88 |
public static IGeometry createPoint3D(double x, double y, double z) { |
89 |
return new FGeometry(new FPoint3D(x, y, z)); |
90 |
} |
91 |
|
92 |
/**
|
93 |
* Crea una geometr?a que contiene como shape un Multipunto 3D.
|
94 |
*
|
95 |
* @param x Coordenada x.
|
96 |
* @param y Coordenada y.
|
97 |
* @param z Coordenada z.
|
98 |
*
|
99 |
* @return Geometr?a.
|
100 |
*/
|
101 |
public static IGeometry createMultipoint3D(double[] x, double[] y, |
102 |
double[] z) { |
103 |
return new FMultipoint3D(x, y, z); |
104 |
} |
105 |
|
106 |
/**
|
107 |
* Crea una geometr?a que contiene como shape un Polil?nea 2D.
|
108 |
*
|
109 |
* @param shape GeneralPathX.
|
110 |
*
|
111 |
* @return Geometr?a.
|
112 |
*/
|
113 |
public static IGeometry createPolyline2D(GeneralPathX shape) { |
114 |
return new FGeometry(new FPolyline2D(shape)); |
115 |
} |
116 |
|
117 |
/**
|
118 |
* Crea una geometr?a que contiene como shape un Polil?nea 3D.
|
119 |
*
|
120 |
* @param shape GeneralPathX.
|
121 |
* @param pZ Vector de Z.
|
122 |
*
|
123 |
* @return Geometr?a.
|
124 |
*/
|
125 |
public static IGeometry createPolyline3D(GeneralPathX shape, double[] pZ) { |
126 |
return new FGeometry(new FPolyline3D(shape, pZ)); |
127 |
} |
128 |
/**
|
129 |
* Crea una geometr?a que contiene como shape un Pol?gono 3D.
|
130 |
*
|
131 |
* @param shape GeneralPathX.
|
132 |
* @param pZ Vector de Z.
|
133 |
*
|
134 |
* @return Geometr?a.
|
135 |
*/
|
136 |
public static IGeometry createPolygon3D(GeneralPathX shape, double[] pZ) { |
137 |
return new FGeometry(new FPolygon3D(shape, pZ)); |
138 |
} |
139 |
|
140 |
/**
|
141 |
* Crea una geometr?a que contiene como shape un Pol?gono 2D.
|
142 |
*
|
143 |
* @param shape GeneralPathX.
|
144 |
*
|
145 |
* @return Geometr?a.
|
146 |
*/
|
147 |
public static IGeometry createPolygon2D(GeneralPathX shape) { |
148 |
return new FGeometry(new FPolygon2D(shape)); |
149 |
} |
150 |
|
151 |
/**
|
152 |
* Crea a partir de un FShape una geometr?a.
|
153 |
*
|
154 |
* @param shp FShape.
|
155 |
*
|
156 |
* @return Geometr?a.
|
157 |
*/
|
158 |
public static FGeometry createGeometry(FShape shp) { |
159 |
return new FGeometry(shp); |
160 |
} |
161 |
|
162 |
public static IGeometry createGeometry(FLiteShape gt2geometry) { |
163 |
return new Gt2Geometry(gt2geometry); |
164 |
} |
165 |
|
166 |
|
167 |
} |