svn-gvsig-desktop / tags / v1_1_Build_1015 / libraries / libArcIMS / src / org / gvsig / remoteClient / arcims / utils / ServiceInformationLayerFeatures.java @ 13679
History | View | Annotate | Download (6.21 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2006 Prodevelop 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 |
* Prodevelop Integraci?n de Tecnolog?as SL
|
34 |
* Conde Salvatierra de ?lava , 34-10
|
35 |
* 46004 Valencia
|
36 |
* Spain
|
37 |
*
|
38 |
* +34 963 510 612
|
39 |
* +34 963 510 968
|
40 |
* gis@prodevelop.es
|
41 |
* http://www.prodevelop.es
|
42 |
*/
|
43 |
|
44 |
package org.gvsig.remoteClient.arcims.utils; |
45 |
|
46 |
import com.iver.cit.gvsig.fmap.core.FShape; |
47 |
|
48 |
import org.gvsig.remoteClient.arcims.styling.renderers.Renderer; |
49 |
|
50 |
import java.util.ArrayList; |
51 |
import java.util.Iterator; |
52 |
import java.util.Vector; |
53 |
|
54 |
|
55 |
/**
|
56 |
* Class that stores a layer information of a vector image
|
57 |
*
|
58 |
* @author jsanz
|
59 |
*
|
60 |
*/
|
61 |
public class ServiceInformationLayerFeatures extends ServiceInformationLayer { |
62 |
// public final static int MULTIPOINT = 1;
|
63 |
// public final static int POLYLINE = 2;
|
64 |
// public final static int POLYGON = 3;
|
65 |
private String fclasstype; |
66 |
private int intFclassType; |
67 |
private Vector fieldsInfo = null; |
68 |
private Renderer layerMainRenderer = null; |
69 |
|
70 |
/**
|
71 |
* The constructor of this class receives the type of vectorial
|
72 |
* information is stored in the layer (polygon,line or point)
|
73 |
*
|
74 |
* @param _fclasstype
|
75 |
*/
|
76 |
public ServiceInformationLayerFeatures(String _fclasstype) { |
77 |
this.type = ServiceInfoTags.vLAYERTYPE_F;
|
78 |
this.intFclassType = FShape.NULL;
|
79 |
this.setFclasstype(_fclasstype);
|
80 |
} |
81 |
|
82 |
public String toString() { |
83 |
String out;
|
84 |
out = "Layer: " + this.name + "\t(" + this.type + "-" + |
85 |
this.fclasstype + ")"; |
86 |
|
87 |
return out;
|
88 |
} |
89 |
|
90 |
/**
|
91 |
* Return a FieldInformation object from the vector passing
|
92 |
* @see FieldInformation
|
93 |
* an index
|
94 |
* @param index
|
95 |
* @return FieldInformation object
|
96 |
*/
|
97 |
public FieldInformation getFieldInformation(int index) { |
98 |
if ((this.fieldsInfo.size() > index) && |
99 |
(this.fieldsInfo.get(index) != null)) { |
100 |
return (FieldInformation) this.fieldsInfo.get(index); |
101 |
} else {
|
102 |
return null; |
103 |
} |
104 |
} |
105 |
|
106 |
/**
|
107 |
* Return a FieldInformation object from the vector passing
|
108 |
* a FieldInformation name
|
109 |
* @see FieldInformation
|
110 |
* @param name
|
111 |
* @return FieldInformation object
|
112 |
*/
|
113 |
public FieldInformation getFieldInformation(String name) { |
114 |
FieldInformation fi = null;
|
115 |
|
116 |
if (this.fieldsInfo != null) { |
117 |
Iterator it = fieldsInfo.iterator();
|
118 |
|
119 |
while (it.hasNext()) {
|
120 |
fi = (FieldInformation) it.next(); |
121 |
|
122 |
if (fi.getName().equalsIgnoreCase(name)) {
|
123 |
return fi;
|
124 |
} |
125 |
} |
126 |
} |
127 |
|
128 |
return fi;
|
129 |
} |
130 |
|
131 |
/**
|
132 |
* Returns an array of FieldInformation objects passing
|
133 |
* a type
|
134 |
* @see FieldInformation
|
135 |
* @param type
|
136 |
* @return
|
137 |
*/
|
138 |
public ArrayList getFieldInformationByType(int type) { |
139 |
ArrayList fisA = new ArrayList(); |
140 |
FieldInformation fiTemp = null;
|
141 |
Iterator it = fieldsInfo.iterator();
|
142 |
|
143 |
while (it.hasNext()) {
|
144 |
fiTemp = (FieldInformation) it.next(); |
145 |
|
146 |
if (fiTemp.getType() == type) {
|
147 |
fisA.add(fiTemp); |
148 |
} |
149 |
} |
150 |
|
151 |
if (fisA == null) { |
152 |
return null; |
153 |
} else {
|
154 |
return fisA;
|
155 |
} |
156 |
} |
157 |
|
158 |
/**
|
159 |
* Set a FieldInformation object into the vector @see ServiceInformationLayerFeatures#fieldsInfo
|
160 |
*
|
161 |
* @see FieldInformation
|
162 |
*/
|
163 |
public void addFieldInformation(FieldInformation fi) { |
164 |
if (this.fieldsInfo == null) { |
165 |
this.fieldsInfo = new Vector(); |
166 |
} |
167 |
|
168 |
this.fieldsInfo.add(fi);
|
169 |
} |
170 |
|
171 |
/**
|
172 |
* @return Returns the fclasstype.
|
173 |
*/
|
174 |
public String getFclasstype() { |
175 |
return fclasstype;
|
176 |
} |
177 |
|
178 |
/**
|
179 |
* @param fclasstype The fclasstype to set.
|
180 |
*/
|
181 |
public void setFclasstype(String fclasstype) { |
182 |
this.fclasstype = fclasstype;
|
183 |
|
184 |
if (fclasstype.equals(ServiceInfoTags.aMULTIPOINT)) {
|
185 |
intFclassType = FShape.MULTIPOINT; |
186 |
} else if (fclasstype.equals(ServiceInfoTags.aPOLYLINE)) { |
187 |
intFclassType = FShape.LINE; |
188 |
} else if (fclasstype.equals(ServiceInfoTags.aPOLYGON)) { |
189 |
intFclassType = FShape.POLYGON; |
190 |
} |
191 |
} |
192 |
|
193 |
/**
|
194 |
* @return Returns the fieldsInfo.
|
195 |
*/
|
196 |
public Vector getFieldsInfo() { |
197 |
return fieldsInfo;
|
198 |
} |
199 |
|
200 |
// public FieldInformation getFieldInfoByName(String name){
|
201 |
// Iterator it = fieldsInfo.iterator()
|
202 |
// }
|
203 |
|
204 |
/**
|
205 |
* @param fieldsInfo The fieldsInfo to set.
|
206 |
*/
|
207 |
public void setFieldsInfo(Vector fieldsInfo) { |
208 |
this.fieldsInfo = fieldsInfo;
|
209 |
} |
210 |
|
211 |
/**
|
212 |
* @return Returns the intFclassType.
|
213 |
*/
|
214 |
public int getIntFclassType() { |
215 |
return intFclassType;
|
216 |
} |
217 |
|
218 |
/**
|
219 |
* @param intFclassType The intFclassType to set.
|
220 |
*/
|
221 |
public void setIntFclassType(int intFclassType) { |
222 |
this.intFclassType = intFclassType;
|
223 |
} |
224 |
|
225 |
/**
|
226 |
* @return Returns the layerMainRenderer.
|
227 |
*/
|
228 |
public Renderer getLayerMainRenderer() { |
229 |
return layerMainRenderer;
|
230 |
} |
231 |
|
232 |
/**
|
233 |
* @param layerMainRenderer The layerMainRenderer to set.
|
234 |
*/
|
235 |
public void setLayerMainRenderer(Renderer layerMainRenderer) { |
236 |
this.layerMainRenderer = layerMainRenderer;
|
237 |
} |
238 |
} |