root / trunk / libraries / libFMap / src / com / iver / cit / gvsig / fmap / core / ShapeFactory.java @ 2183
History | View | Annotate | Download (3.84 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 |
|
44 |
/**
|
45 |
* Clase que crea las geometr?as, contendra un m?todo create por cada tipo de
|
46 |
* geometria que soporte gvSIG
|
47 |
*/
|
48 |
public class ShapeFactory { |
49 |
/**
|
50 |
* Crea una geometr?a que contiene como shape un punto 2D.
|
51 |
*
|
52 |
* @param x Coordenada x.
|
53 |
* @param y Coordenada y.
|
54 |
*
|
55 |
* @return Geometr?a.
|
56 |
*/
|
57 |
public static IGeometry createPoint2D(double x, double y) { |
58 |
return new FGeometry(new FPoint2D(x, y)); |
59 |
} |
60 |
public static IGeometry createPoint2D(FPoint2D p) { |
61 |
return new FGeometry(p); |
62 |
} |
63 |
|
64 |
|
65 |
/**
|
66 |
* Crea una geometr?a que contiene como shape un Multipunto 2D.
|
67 |
*
|
68 |
* @param x Coordenada x.
|
69 |
* @param y Coordenada y.
|
70 |
*
|
71 |
* @return Geometr?a.
|
72 |
*/
|
73 |
public static IGeometry createMultipoint2D(double[] x, double[] y) { |
74 |
return new FMultiPoint2D(x, y); |
75 |
} |
76 |
|
77 |
/**
|
78 |
* Crea una geometr?a que contiene como shape un punto 3D.
|
79 |
*
|
80 |
* @param x Coordenada x.
|
81 |
* @param y Coordenada y.
|
82 |
* @param z Coordenada z.
|
83 |
*
|
84 |
* @return Geometr?a.
|
85 |
*/
|
86 |
public static IGeometry createPoint3D(double x, double y, double z) { |
87 |
return new FGeometry(new FPoint3D(x, y, z)); |
88 |
} |
89 |
|
90 |
/**
|
91 |
* Crea una geometr?a que contiene como shape un Multipunto 3D.
|
92 |
*
|
93 |
* @param x Coordenada x.
|
94 |
* @param y Coordenada y.
|
95 |
* @param z Coordenada z.
|
96 |
*
|
97 |
* @return Geometr?a.
|
98 |
*/
|
99 |
public static IGeometry createMultipoint3D(double[] x, double[] y, |
100 |
double[] z) { |
101 |
return new FMultipoint3D(x, y, z); |
102 |
} |
103 |
|
104 |
/**
|
105 |
* Crea una geometr?a que contiene como shape un Polil?nea 2D.
|
106 |
*
|
107 |
* @param shape GeneralPathX.
|
108 |
*
|
109 |
* @return Geometr?a.
|
110 |
*/
|
111 |
public static IGeometry createPolyline2D(GeneralPathX shape) { |
112 |
return new FGeometry(new FPolyline2D(shape)); |
113 |
} |
114 |
|
115 |
/**
|
116 |
* Crea una geometr?a que contiene como shape un Polil?nea 3D.
|
117 |
*
|
118 |
* @param shape GeneralPathX.
|
119 |
* @param pZ Vector de Z.
|
120 |
*
|
121 |
* @return Geometr?a.
|
122 |
*/
|
123 |
public static IGeometry createPolyline3D(GeneralPathX shape, double[] pZ) { |
124 |
return new FGeometry(new FPolyline3D(shape, pZ)); |
125 |
} |
126 |
/**
|
127 |
* Crea una geometr?a que contiene como shape un Pol?gono 3D.
|
128 |
*
|
129 |
* @param shape GeneralPathX.
|
130 |
* @param pZ Vector de Z.
|
131 |
*
|
132 |
* @return Geometr?a.
|
133 |
*/
|
134 |
public static IGeometry createPolygon3D(GeneralPathX shape, double[] pZ) { |
135 |
return new FGeometry(new FPolygon3D(shape, pZ)); |
136 |
} |
137 |
|
138 |
/**
|
139 |
* Crea una geometr?a que contiene como shape un Pol?gono 2D.
|
140 |
*
|
141 |
* @param shape GeneralPathX.
|
142 |
*
|
143 |
* @return Geometr?a.
|
144 |
*/
|
145 |
public static IGeometry createPolygon2D(GeneralPathX shape) { |
146 |
return new FGeometry(new FPolygon2D(shape)); |
147 |
} |
148 |
|
149 |
/**
|
150 |
* Crea a partir de un FShape una geometr?a.
|
151 |
*
|
152 |
* @param shp FShape.
|
153 |
*
|
154 |
* @return Geometr?a.
|
155 |
*/
|
156 |
public static FGeometry createGeometry(FShape shp) { |
157 |
return new FGeometry(shp); |
158 |
} |
159 |
|
160 |
} |