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