root / branches / Mobile_Compatible_Hito_1 / libFMap / src / es / prodevelop / gvsig / mobile / fmap / driver / vect / shp / SHP.java @ 21606
History | View | Annotate | Download (4.35 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 |
/************************************************
|
42 |
* *
|
43 |
* Modfied By: *
|
44 |
* Prodevelop Integraci?n de Tecnolog?as SL *
|
45 |
* Conde Salvatierra de ?lava , 34-10 *
|
46 |
* 46004 Valencia *
|
47 |
* Spain *
|
48 |
* *
|
49 |
* +34 963 510 612 *
|
50 |
* +34 963 510 968 *
|
51 |
* gis@prodevelop.es *
|
52 |
* http://www.prodevelop.es *
|
53 |
* *
|
54 |
* gvSIG Mobile Team 2006 *
|
55 |
* *
|
56 |
************************************************/
|
57 |
|
58 |
package es.prodevelop.gvsig.mobile.fmap.driver.vect.shp; |
59 |
|
60 |
|
61 |
|
62 |
/**
|
63 |
* Clase con las constantes que representan los diferentes tipos de Shape y
|
64 |
* m?todos est?ticos relativos a los shapes.
|
65 |
*
|
66 |
* @author Vicente Caballero Navarro
|
67 |
*/
|
68 |
public class SHP { |
69 |
|
70 |
public static final int SHPT_NULL = 0; |
71 |
public static final int SHPT_POINT = 1; |
72 |
public static final int SHPT_ARC = 3; |
73 |
public static final int SHPT_POLYGON = 5; |
74 |
public static final int SHPT_MULTIPOINT = 8; |
75 |
public static final int SHPT_POINTZ = 11; |
76 |
public static final int SHPT_ARCZ = 13; |
77 |
public static final int SHPT_POLYGONZ = 15; |
78 |
public static final int SHPT_MULTIPOINTZ = 18; |
79 |
public static final int SHPT_POINTM = 21; |
80 |
public static final int SHPT_ARCM = 23; |
81 |
public static final int SHPT_POLYGONM = 25; |
82 |
public static final int SHPT_MULTIPOINTM = 28; |
83 |
public static final int SHPT_MULTIPATCH = 31; |
84 |
|
85 |
/**
|
86 |
* Crea a partir del tipo de geometr?a un shape del tipo m?s adecuado.
|
87 |
*
|
88 |
* @param type Tipo de geometr?a.
|
89 |
*
|
90 |
* @return Geometr?a m?s adecuada.
|
91 |
*
|
92 |
* @throws ShapefileException Se lanza cuando es causada por la creaci?n
|
93 |
* del shape.
|
94 |
*/
|
95 |
|
96 |
|
97 |
/**
|
98 |
* Crea un fichero en formato shape con las geometr?as que se pasan como
|
99 |
* par?metro en forma de array, un bitset para saber las seleccionadas, un
|
100 |
* SelectableDataSource para obtener los valores y el fichero a crear.
|
101 |
*
|
102 |
* @param fgs Array de geometr?as.
|
103 |
* @param bitset Bitset con la selecci?n.
|
104 |
* @param sds SelectableDataSource.
|
105 |
* @param f Fichero a crear o modificar.
|
106 |
*/
|
107 |
|
108 |
|
109 |
/**
|
110 |
* Obtiene un fichero shape con las geometr?as que se pasan como par?metro,
|
111 |
* sin crear un dbf.
|
112 |
*
|
113 |
* @param fgs Array de IGeometries.
|
114 |
* @param f Fichero que hay que crear.
|
115 |
*/
|
116 |
|
117 |
/**
|
118 |
* Devuelve un array con dos doubles, el primero representa el m?nimo valor
|
119 |
* y el segundo el m?ximo de entre los valores que se pasan como par?metro
|
120 |
* en forma de array.
|
121 |
*
|
122 |
* @param zs Valores a comprobar.
|
123 |
*
|
124 |
* @return Array de doubles con el valor m?nimo y el valor m?ximo.
|
125 |
*/
|
126 |
|
127 |
public static double[] getZMinMax(double[] zs) { |
128 |
if (zs == null) { |
129 |
return null; |
130 |
} |
131 |
|
132 |
double min = Double.MAX_VALUE; |
133 |
// double max = Double.MIN_VALUE;
|
134 |
// corregido tras el mail:
|
135 |
double max = -0.5 * Double.MAX_VALUE; |
136 |
|
137 |
for (int i = 0; i < zs.length; i++) { |
138 |
if (zs[i] > max) {
|
139 |
max = zs[i]; |
140 |
} |
141 |
|
142 |
if (zs[i] < min) {
|
143 |
min = zs[i]; |
144 |
} |
145 |
} |
146 |
|
147 |
return new double[] { min, max }; |
148 |
} |
149 |
} |