Revision 9507
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/drivers/gml/FMAPGeometryFactory.java | ||
---|---|---|
3 | 3 |
import java.awt.geom.Point2D; |
4 | 4 |
import java.util.ArrayList; |
5 | 5 |
import java.util.Date; |
6 |
import java.util.Iterator; |
|
7 |
import java.util.LinkedHashMap; |
|
8 |
import java.util.Map; |
|
9 |
import java.util.Set; |
|
6 | 10 |
|
7 | 11 |
import org.apache.log4j.Logger; |
8 | 12 |
import org.gvsig.remoteClient.gml.factories.IGeometriesFactory; |
13 |
import org.gvsig.remoteClient.gml.types.IXMLType; |
|
9 | 14 |
|
10 | 15 |
import com.hardcode.gdbms.engine.values.ComplexValue; |
11 | 16 |
import com.hardcode.gdbms.engine.values.Value; |
... | ... | |
63 | 68 |
* |
64 | 69 |
* $Id$ |
65 | 70 |
* $Log$ |
66 |
* Revision 1.2 2006-10-10 12:55:27 jorpiell |
|
71 |
* Revision 1.3 2006-12-29 17:12:10 jorpiell |
|
72 |
* Se tienen en cuenta los simpleTypes y los choices, adem?s de los atributos multiples |
|
73 |
* |
|
74 |
* Revision 1.2 2006/10/10 12:55:27 jorpiell |
|
67 | 75 |
* Se ha a?adido el soporte de features complejas |
68 | 76 |
* |
69 | 77 |
* Revision 1.1 2006/08/10 12:03:43 jorpiell |
... | ... | |
89 | 97 |
return ShapeFactory.createMultipoint2D(x,y); |
90 | 98 |
} |
91 | 99 |
|
92 |
public Object createSimpleFeature(String element, Object geometry, ArrayList params, ArrayList values) { |
|
93 |
ArrayList fmapParams = getParams((ArrayList)params.get(1)); |
|
94 |
Value[] fmapValues = getValues((ArrayList)params.get(1),(ArrayList)values.get(1)); |
|
100 |
|
|
101 |
public Object createSimpleFeature(String element, IXMLType type,Map values,Object geometry) { |
|
102 |
Object[] fmapParams = values.keySet().toArray(); |
|
103 |
Value[] fmapValues = getValues(values); |
|
95 | 104 |
IFeature feature = new DefaultFeature((IGeometry)geometry,fmapValues); |
96 | 105 |
return new FeatureWithAttributes(feature,fmapParams,fmapValues); |
97 | 106 |
} |
... | ... | |
107 | 116 |
return null; |
108 | 117 |
} |
109 | 118 |
|
110 |
private ArrayList getParams(ArrayList params){ |
|
111 |
ArrayList fmapParams = new ArrayList(); |
|
112 |
for (int i=0 ; i<params.size() ; i++){ |
|
113 |
if (!(params.get(i) instanceof ArrayList)){ |
|
114 |
fmapParams.add(params.get(i)); |
|
119 |
private Value[] getValues(Map values){ |
|
120 |
int i = 0; |
|
121 |
Set keys = values.keySet(); |
|
122 |
Iterator it = keys.iterator(); |
|
123 |
Value[] returnValues = new Value[keys.size()]; |
|
124 |
while(it.hasNext()){ |
|
125 |
String key = (String)it.next(); |
|
126 |
Object obj = values.get(key); |
|
127 |
if (obj instanceof ArrayList){ |
|
128 |
returnValues[i] = getMultipleValue(key,(ArrayList)obj); |
|
129 |
}else if(obj instanceof LinkedHashMap){ |
|
130 |
returnValues[i] = getComplexValue(key,(LinkedHashMap)obj); |
|
131 |
}else{ |
|
132 |
returnValues[i] = getValue(obj); |
|
133 |
} |
|
134 |
i++; |
|
135 |
} |
|
136 |
return returnValues; |
|
137 |
} |
|
138 |
|
|
139 |
private Value getComplexValue(String name,Map hash){ |
|
140 |
ComplexValue value = ValueFactory.createComplexValue(name); |
|
141 |
Set keys = hash.keySet(); |
|
142 |
Iterator it = keys.iterator(); |
|
143 |
while (it.hasNext()){ |
|
144 |
String key = (String)it.next(); |
|
145 |
Object obj = hash.get(key); |
|
146 |
if (obj instanceof ArrayList){ |
|
147 |
value.put(key,getMultipleValue(key,(ArrayList)obj)); |
|
148 |
}else if(obj instanceof LinkedHashMap){ |
|
149 |
value.put(key,getComplexValue(key,(LinkedHashMap)obj)); |
|
150 |
}else{ |
|
151 |
value.put(key,getValue(obj)); |
|
115 | 152 |
} |
116 | 153 |
} |
117 |
return fmapParams;
|
|
154 |
return value;
|
|
118 | 155 |
} |
119 | 156 |
|
120 |
private Value[] getValues(ArrayList params,ArrayList values){ |
|
121 |
int i = 0; |
|
122 |
ArrayList fmapValues = new ArrayList(); |
|
123 |
while(i<params.size()){ |
|
124 |
if ((i+1 < params.size()) && (params.get(i+1) instanceof ArrayList)){ |
|
125 |
ComplexValue value = ValueFactory.createComplexValue((String)params.get(i)); |
|
126 |
ArrayList subParams = getParams((ArrayList)params.get(i+1)); |
|
127 |
Value[] subValues = getValues((ArrayList)params.get(i+1),(ArrayList)values.get(i+1)); |
|
128 |
for (int j=0 ; j<subParams.size() ; j++){ |
|
129 |
value.put(subParams.get(j),subValues[j]); |
|
130 |
} |
|
131 |
fmapValues.add(value); |
|
132 |
i = i + 2; |
|
157 |
private Value getMultipleValue(String name,ArrayList al){ |
|
158 |
ComplexValue value = ValueFactory.createComplexValue(name); |
|
159 |
for (int i=0 ; i<al.size() ; i++){ |
|
160 |
String attName = name + "_" + i; |
|
161 |
Object obj = al.get(i); |
|
162 |
if (obj instanceof ArrayList){ |
|
163 |
value.put(attName,getMultipleValue(attName,(ArrayList)obj)); |
|
164 |
}else if(obj instanceof LinkedHashMap){ |
|
165 |
value.put(attName,getComplexValue(attName,(LinkedHashMap)obj)); |
|
133 | 166 |
}else{ |
134 |
fmapValues.add(getValue(values.get(i))); |
|
135 |
i++; |
|
136 |
} |
|
167 |
value.put(attName,getValue(obj)); |
|
168 |
} |
|
137 | 169 |
} |
138 |
Value[] returnValues = new Value[fmapValues.size()]; |
|
139 |
for (int k=0 ; k<fmapValues.size() ; k++){ |
|
140 |
returnValues[k] = (Value)fmapValues.get(k); |
|
141 |
} |
|
142 |
return returnValues; |
|
170 |
return value; |
|
143 | 171 |
} |
144 | 172 |
|
145 | 173 |
/** |
... | ... | |
170 | 198 |
|
171 | 199 |
public class FeatureWithAttributes{ |
172 | 200 |
private IFeature feature; |
173 |
private ArrayList attributeName;
|
|
201 |
private Object[] attributeName;
|
|
174 | 202 |
private Value[] attributeValue; |
175 | 203 |
|
176 |
public FeatureWithAttributes(IFeature feature, ArrayList attributeName, Value[] attributeValue) {
|
|
204 |
public FeatureWithAttributes(IFeature feature, Object[] attributeName, Value[] attributeValue) {
|
|
177 | 205 |
super(); |
178 | 206 |
this.feature = feature; |
179 | 207 |
this.attributeName = attributeName; |
... | ... | |
183 | 211 |
/** |
184 | 212 |
* @return Returns the attributeName. |
185 | 213 |
*/ |
186 |
public ArrayList getAttributeName() {
|
|
214 |
public Object[] getAttributeName() {
|
|
187 | 215 |
return attributeName; |
188 | 216 |
} |
189 | 217 |
|
... | ... | |
203 | 231 |
|
204 | 232 |
} |
205 | 233 |
|
234 |
|
|
206 | 235 |
} |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/drivers/gml/GMLDriver.java | ||
---|---|---|
73 | 73 |
* |
74 | 74 |
* $Id$ |
75 | 75 |
* $Log$ |
76 |
* Revision 1.6 2006-10-02 08:49:50 jorpiell |
|
76 |
* Revision 1.7 2006-12-29 17:12:10 jorpiell |
|
77 |
* Se tienen en cuenta los simpleTypes y los choices, adem?s de los atributos multiples |
|
78 |
* |
|
79 |
* Revision 1.6 2006/10/02 08:49:50 jorpiell |
|
77 | 80 |
* Cambios provocados el el cambio de FSymbol |
78 | 81 |
* |
79 | 82 |
* Revision 1.5 2006/10/02 08:41:23 jorpiell |
... | ... | |
177 | 180 |
features.add(feature); |
178 | 181 |
|
179 | 182 |
if (!setModel){ |
180 |
getTableModel().setColumnIdentifiers(feature.getAttributeName().toArray());
|
|
183 |
getTableModel().setColumnIdentifiers(feature.getAttributeName()); |
|
181 | 184 |
} |
182 | 185 |
|
183 | 186 |
clave = ValueFactory.createValue(index); |
... | ... | |
273 | 276 |
*/ |
274 | 277 |
public String getAttributeName(int position){ |
275 | 278 |
if (features.size() > 0){ |
276 |
return ((String)((FeatureWithAttributes)features.get(0)).getAttributeName().get(position));
|
|
279 |
return ((String)((FeatureWithAttributes)features.get(0)).getAttributeName()[position]);
|
|
277 | 280 |
} |
278 | 281 |
return null; |
279 | 282 |
} |
trunk/libraries/libRemoteServices/src/org/gvsig/remoteClient/gml/factories/IGeometriesFactory.java | ||
---|---|---|
1 | 1 |
package org.gvsig.remoteClient.gml.factories; |
2 | 2 |
|
3 | 3 |
import java.awt.geom.Point2D; |
4 |
import java.util.ArrayList;
|
|
4 |
import java.util.Map;
|
|
5 | 5 |
|
6 |
import org.gvsig.remoteClient.gml.types.IXMLType; |
|
6 | 7 |
|
8 |
|
|
7 | 9 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
8 | 10 |
* |
9 | 11 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
... | ... | |
48 | 50 |
* |
49 | 51 |
* $Id$ |
50 | 52 |
* $Log$ |
51 |
* Revision 1.2 2006-12-22 11:25:44 csanchez |
|
53 |
* Revision 1.3 2006-12-29 17:15:48 jorpiell |
|
54 |
* Se tienen en cuenta los simpleTypes y los choices, adem?s de los atributos multiples |
|
55 |
* |
|
56 |
* Revision 1.2 2006/12/22 11:25:44 csanchez |
|
52 | 57 |
* Nuevo parser GML 2.x para gml's sin esquema |
53 | 58 |
* |
54 | 59 |
* Revision 1.1 2006/08/10 12:00:49 jorpiell |
... | ... | |
112 | 117 |
* Create a simple feature |
113 | 118 |
* @param element |
114 | 119 |
* Element name |
120 |
* @param type |
|
121 |
* Geoemtry type |
|
122 |
* @param params |
|
123 |
* Params values |
|
115 | 124 |
* @param geometry |
116 | 125 |
* Geoemtry |
117 |
* @param params |
|
118 |
* Params names |
|
119 |
* @param values |
|
120 |
* Params values |
|
121 | 126 |
* @return |
122 | 127 |
*/ |
123 | 128 |
public Object createSimpleFeature(String element, |
124 |
Object geometry,
|
|
125 |
ArrayList params,
|
|
126 |
ArrayList values);
|
|
129 |
IXMLType type,
|
|
130 |
Map values,
|
|
131 |
Object geometry);
|
|
127 | 132 |
|
128 | 133 |
} |
trunk/libraries/libRemoteServices/src/org/gvsig/remoteClient/gml/factories/GeometriesFactory.java | ||
---|---|---|
1 | 1 |
package org.gvsig.remoteClient.gml.factories; |
2 | 2 |
|
3 | 3 |
import java.awt.geom.Point2D; |
4 |
import java.util.ArrayList;
|
|
4 |
import java.util.Map;
|
|
5 | 5 |
|
6 |
import org.gvsig.remoteClient.gml.types.IXMLType; |
|
6 | 7 |
import org.gvsig.remoteClient.gml.v2.GMLSimpleFeature_v2; |
7 | 8 |
|
8 | 9 |
|
... | ... | |
50 | 51 |
* |
51 | 52 |
* $Id$ |
52 | 53 |
* $Log$ |
53 |
* Revision 1.2 2006-12-22 11:25:44 csanchez |
|
54 |
* Revision 1.3 2006-12-29 17:15:48 jorpiell |
|
55 |
* Se tienen en cuenta los simpleTypes y los choices, adem?s de los atributos multiples |
|
56 |
* |
|
57 |
* Revision 1.2 2006/12/22 11:25:44 csanchez |
|
54 | 58 |
* Nuevo parser GML 2.x para gml's sin esquema |
55 | 59 |
* |
56 | 60 |
* Revision 1.1 2006/08/10 12:00:49 jorpiell |
... | ... | |
95 | 99 |
* (non-Javadoc) |
96 | 100 |
* @see org.gvsig.remoteClient.gml.factories.IGeometriesFactory#createSimpleFeature(java.lang.String, java.lang.Object, java.util.ArrayList, java.util.ArrayList) |
97 | 101 |
*/ |
98 |
public Object createSimpleFeature(String element, Object geometry, ArrayList params, ArrayList values) {
|
|
99 |
GMLSimpleFeature_v2 feature = new GMLSimpleFeature_v2(element,params,values,geometry);
|
|
102 |
public Object createSimpleFeature(String element, IXMLType type, Map values, Object geometry) {
|
|
103 |
GMLSimpleFeature_v2 feature = new GMLSimpleFeature_v2(element,type,values,geometry);
|
|
100 | 104 |
return feature; |
101 | 105 |
} |
102 | 106 |
|
trunk/libraries/libRemoteServices/src/org/gvsig/remoteClient/gml/factories/XMLTypesFactory.java | ||
---|---|---|
53 | 53 |
* |
54 | 54 |
* $Id$ |
55 | 55 |
* $Log$ |
56 |
* Revision 1.7 2006-12-22 11:25:44 csanchez |
|
56 |
* Revision 1.8 2006-12-29 17:15:48 jorpiell |
|
57 |
* Se tienen en cuenta los simpleTypes y los choices, adem?s de los atributos multiples |
|
58 |
* |
|
59 |
* Revision 1.7 2006/12/22 11:25:44 csanchez |
|
57 | 60 |
* Nuevo parser GML 2.x para gml's sin esquema |
58 | 61 |
* |
59 | 62 |
* Revision 1.5 2006/10/11 11:21:00 jorpiell |
... | ... | |
111 | 114 |
public static IXMLType getType(String type){ |
112 | 115 |
IXMLType xmlType = (IXMLType)types.get(type.toUpperCase()); |
113 | 116 |
if (xmlType == null){ |
114 |
xmlType = getTypeWithOutNameSpace(type); |
|
117 |
xmlType = getTypeWithOutNameSpace(type);
|
|
115 | 118 |
} |
116 | 119 |
return xmlType; |
117 | 120 |
} |
... | ... | |
159 | 162 |
addType(complexType); |
160 | 163 |
return complexType; |
161 | 164 |
} |
165 |
|
|
166 |
public static XMLSimpleType addSimpleType(String name,String type){ |
|
167 |
XMLSimpleType simpleType = new XMLSimpleType(name,type); |
|
168 |
types.put(name.toUpperCase(),simpleType); |
|
169 |
return simpleType; |
|
170 |
} |
|
162 | 171 |
|
163 | 172 |
/** |
164 | 173 |
* Just for degug. It prints all the registred components. |
trunk/libraries/libRemoteServices/src/org/gvsig/remoteClient/gml/schemas/XMLSchemaParser.java | ||
---|---|---|
64 | 64 |
* |
65 | 65 |
* $Id$ |
66 | 66 |
* $Log$ |
67 |
* Revision 1.5 2006-12-22 11:25:44 csanchez |
|
67 |
* Revision 1.6 2006-12-29 17:15:48 jorpiell |
|
68 |
* Se tienen en cuenta los simpleTypes y los choices, adem?s de los atributos multiples |
|
69 |
* |
|
70 |
* Revision 1.5 2006/12/22 11:25:44 csanchez |
|
68 | 71 |
* Nuevo parser GML 2.x para gml's sin esquema |
69 | 72 |
* |
70 | 73 |
* Revision 1.4 2006/10/10 12:52:28 jorpiell |
... | ... | |
349 | 352 |
* Etiqueta <simpleType> * |
350 | 353 |
****************************/ |
351 | 354 |
// SIMPLE TYPE elements like enumarations not implemented |
352 |
|
|
355 |
else if (getName().compareTo(CapabilitiesTags.SIMPLETYPE)==0){ |
|
356 |
parseSimpleType(); |
|
357 |
} |
|
353 | 358 |
/************************ |
354 | 359 |
* Etiqueta <element> * |
355 | 360 |
************************/ |
... | ... | |
391 | 396 |
return 0; |
392 | 397 |
} |
393 | 398 |
|
399 |
private void parseSimpleType() throws IOException, XmlPullParserException{ |
|
400 |
int currentTag; |
|
401 |
boolean end = false; |
|
402 |
currentTag = getEventType(); |
|
403 |
|
|
404 |
String typeName = null; |
|
405 |
String typeValue = null; |
|
406 |
|
|
407 |
for (int i=0 ; i<getAttributeCount() ; i++){ |
|
408 |
if (getAttributeName(i).compareTo(CapabilitiesTags.ELEMENT_NAME) == 0){ |
|
409 |
typeName = getAttributeValue(i); |
|
410 |
} |
|
411 |
} |
|
412 |
|
|
413 |
while (!end){ |
|
414 |
switch(currentTag){ |
|
415 |
case KXmlParser.START_TAG: |
|
416 |
if (getName().compareTo(CapabilitiesTags.RESTRICTION)==0){ |
|
417 |
for (int i=0 ; i<getAttributeCount() ; i++){ |
|
418 |
if (getAttributeName(i).compareTo(CapabilitiesTags.BASE) == 0){ |
|
419 |
typeValue = getAttributeValue(i); |
|
420 |
} |
|
421 |
} |
|
422 |
} |
|
423 |
//Falta parsear los tipos enumerados |
|
424 |
break; |
|
425 |
case KXmlParser.END_TAG: |
|
426 |
if (getName().compareTo(CapabilitiesTags.SIMPLETYPE) == 0) |
|
427 |
end = true; |
|
428 |
break; |
|
429 |
case KXmlParser.TEXT: |
|
430 |
break; |
|
431 |
} |
|
432 |
if (!end){ |
|
433 |
currentTag = next(); |
|
434 |
} |
|
435 |
} |
|
436 |
if ((typeName != null) && (typeValue != null)){ |
|
437 |
XMLTypesFactory.addSimpleType(typeName,typeValue); |
|
438 |
} |
|
439 |
} |
|
440 |
|
|
441 |
|
|
442 |
|
|
394 | 443 |
/************************************************************************************ |
395 | 444 |
* FUNCION PARSE COMPLEX TYPE(COMPLEX TYPE) * |
396 | 445 |
* * |
... | ... | |
424 | 473 |
else if(getName().compareTo(CapabilitiesTags.SEQUENCE)==0){ |
425 | 474 |
parseSequence(complexType); |
426 | 475 |
} |
476 |
/************************ |
|
477 |
* Etiqueta <choice> * |
|
478 |
************************/ |
|
479 |
else if(getName().compareTo(CapabilitiesTags.CHOICE)==0){ |
|
480 |
parseChoice(complexType); |
|
481 |
} |
|
427 | 482 |
break; |
428 | 483 |
case KXmlParser.END_TAG: |
429 | 484 |
if (getName().compareTo(CapabilitiesTags.COMPLEXTYPE) == 0) |
... | ... | |
569 | 624 |
} |
570 | 625 |
} |
571 | 626 |
|
627 |
private void parseChoice(XMLComplexType complexType) throws IOException, XmlPullParserException |
|
628 |
{ |
|
629 |
int currentTag; |
|
630 |
boolean end = false; |
|
631 |
|
|
632 |
require(KXmlParser.START_TAG, null, CapabilitiesTags.CHOICE); |
|
633 |
currentTag = next(); |
|
634 |
|
|
635 |
complexType.setAttributesType(XMLComplexType.CHOICE_TYPE); |
|
636 |
|
|
637 |
while (!end) |
|
638 |
{ |
|
639 |
switch(currentTag) |
|
640 |
{ |
|
641 |
case KXmlParser.START_TAG: |
|
642 |
/************************ |
|
643 |
* Etiqueta <Element> * |
|
644 |
************************/ |
|
645 |
if (getName().compareTo(CapabilitiesTags.ELEMENT)==0){ |
|
646 |
XMLElement element = new XMLElement(this); |
|
647 |
if (element != null){ |
|
648 |
complexType.addSubtypes(element); |
|
649 |
} |
|
650 |
} |
|
651 |
break; |
|
652 |
case KXmlParser.END_TAG: |
|
653 |
if (getName().compareTo(CapabilitiesTags.CHOICE) == 0) |
|
654 |
end = true; |
|
655 |
break; |
|
656 |
case KXmlParser.TEXT: |
|
657 |
break; |
|
658 |
} |
|
659 |
if (!end){ |
|
660 |
currentTag = next(); |
|
661 |
} |
|
662 |
} |
|
663 |
} |
|
664 |
|
|
572 | 665 |
/** |
573 | 666 |
* @return Returns the attributes. |
574 | 667 |
*/ |
trunk/libraries/libRemoteServices/src/org/gvsig/remoteClient/gml/schemas/XMLElement.java | ||
---|---|---|
54 | 54 |
* |
55 | 55 |
* $Id$ |
56 | 56 |
* $Log$ |
57 |
* Revision 1.9 2006-12-22 11:25:44 csanchez |
|
57 |
* Revision 1.10 2006-12-29 17:15:48 jorpiell |
|
58 |
* Se tienen en cuenta los simpleTypes y los choices, adem?s de los atributos multiples |
|
59 |
* |
|
60 |
* Revision 1.9 2006/12/22 11:25:44 csanchez |
|
58 | 61 |
* Nuevo parser GML 2.x para gml's sin esquema |
59 | 62 |
* |
60 | 63 |
* Revision 1.8 2006/11/16 13:27:42 jorpiell |
... | ... | |
156 | 159 |
if (type != null){ |
157 | 160 |
return type; |
158 | 161 |
} |
159 |
if (typeUnknown != null){ |
|
162 |
if (typeUnknown != null){
|
|
160 | 163 |
this.type = XMLTypesFactory.getType(typeUnknown); |
161 | 164 |
} |
162 | 165 |
if ((type == null) && (typeUnknown != null)){ |
163 | 166 |
if (typeUnknown.split(":").length > 1){ |
164 | 167 |
this.type = XMLTypesFactory.getType(null + ":" + typeUnknown.split(":")[1]); |
168 |
if (type == null){ |
|
169 |
this.type = XMLTypesFactory.getType(typeUnknown.split(":")[1]); |
|
170 |
} |
|
165 | 171 |
} |
166 | 172 |
} |
167 | 173 |
return type; |
... | ... | |
215 | 221 |
try{ |
216 | 222 |
setMaxOccurs(Integer.parseInt(parser.getAttributeValue(i))); |
217 | 223 |
}catch(NumberFormatException e){ |
218 |
setMaxOccurs(0);
|
|
224 |
setMaxOccurs(-1);
|
|
219 | 225 |
} |
220 | 226 |
}else if (parser.getAttributeName(i).compareTo(CapabilitiesTags.ELEMENT_MINOCCURS) == 0){ |
221 | 227 |
try{ |
222 | 228 |
setMinOccurs(Integer.parseInt(parser.getAttributeValue(i))); |
223 | 229 |
}catch(NumberFormatException e){ |
224 |
setMinOccurs(0);
|
|
230 |
setMinOccurs(-1);
|
|
225 | 231 |
} |
226 | 232 |
}else if (parser.getAttributeName(i).compareTo(CapabilitiesTags.ELEMENT_REF) == 0){ |
227 | 233 |
setReference(parser.getAttributeValue(i)); |
... | ... | |
416 | 422 |
} |
417 | 423 |
return new Vector(); |
418 | 424 |
} |
425 |
|
|
426 |
/** |
|
427 |
* Returns if the attribute is multiple or not |
|
428 |
* @return |
|
429 |
*/ |
|
430 |
public boolean isMultiple(){ |
|
431 |
if (maxOccurs == 1){ |
|
432 |
return false; |
|
433 |
} |
|
434 |
return true; |
|
435 |
} |
|
419 | 436 |
} |
trunk/extensions/extWFS2/src-test/com/iver/cit/gvsig/fmap/layers/gml/ComplexValueTestPanel.java | ||
---|---|---|
1 | 1 |
package com.iver.cit.gvsig.fmap.layers.gml; |
2 | 2 |
|
3 | 3 |
import java.util.ArrayList; |
4 |
import java.util.LinkedHashMap; |
|
4 | 5 |
|
5 | 6 |
import javax.swing.JFrame; |
6 | 7 |
|
... | ... | |
53 | 54 |
* |
54 | 55 |
* $Id$ |
55 | 56 |
* $Log$ |
56 |
* Revision 1.3 2006-12-26 09:10:37 ppiqueras |
|
57 |
* Revision 1.4 2006-12-29 17:11:37 jorpiell |
|
58 |
* Se tienen en cuenta los simpleTypes y los choices, adem?s de los atributos multiples |
|
59 |
* |
|
60 |
* Revision 1.3 2006/12/26 09:10:37 ppiqueras |
|
57 | 61 |
* Cambiado "atttibutes" en todas las aparaciones en atributos, métodos, clases o comentarios por "fields". (Sólo a aquellas que afectan a clases dentro del proyecto extWFS2). |
58 | 62 |
* |
59 | 63 |
* Revision 1.2 2006/11/01 17:29:08 jorpiell |
... | ... | |
76 | 80 |
|
77 | 81 |
private void initialize(){ |
78 | 82 |
FeatureWithAttributes feature = (FeatureWithAttributes) createComplexGeometry(); |
79 |
for (int i=0 ; i<feature.getAttributeName().size() ; i++){
|
|
83 |
for (int i=0 ; i<feature.getAttributeName().length ; i++){
|
|
80 | 84 |
if (feature.getAttributeValue()[i] instanceof ComplexValue){ |
81 | 85 |
createFrame((ComplexValue)feature.getAttributeValue()[i]); |
82 | 86 |
} |
... | ... | |
98 | 102 |
private Object createComplexGeometry(){ |
99 | 103 |
FMAPGeometryFactory factory = new FMAPGeometryFactory(); |
100 | 104 |
Object geometry = factory.createGeometry(getGMLGeometry()); |
101 |
return factory.createSimpleFeature("PERSONA",geometry,getParams(),getValues());
|
|
105 |
return factory.createSimpleFeature("PERSONA",null,getValues(),geometry);
|
|
102 | 106 |
} |
103 | 107 |
|
104 | 108 |
private ArrayList getParams(){ |
... | ... | |
138 | 142 |
return params; |
139 | 143 |
} |
140 | 144 |
|
141 |
private ArrayList getValues(){ |
|
142 |
ArrayList values = new ArrayList(); |
|
143 |
ArrayList tipo = new ArrayList(); |
|
144 |
ArrayList fields = new ArrayList(); |
|
145 |
ArrayList direccion = new ArrayList(); |
|
146 |
ArrayList banco = new ArrayList(); |
|
147 |
ArrayList numero = new ArrayList(); |
|
145 |
private LinkedHashMap getValues(){ |
|
146 |
LinkedHashMap values = new LinkedHashMap(); |
|
147 |
LinkedHashMap fields = new LinkedHashMap(); |
|
148 |
LinkedHashMap direccion = new LinkedHashMap(); |
|
149 |
LinkedHashMap banco = new LinkedHashMap(); |
|
150 |
LinkedHashMap numero = new LinkedHashMap(); |
|
148 | 151 |
|
149 |
numero.add("0033"); |
|
150 |
numero.add("6733"); |
|
151 |
numero.add("11"); |
|
152 |
numero.add("8745367465"); |
|
153 | 152 |
|
154 |
direccion.add("C/San jose"); |
|
155 |
direccion.add("54"); |
|
153 |
numero.put("BANCO","0033"); |
|
154 |
numero.put("SUCURSAL","6733"); |
|
155 |
numero.put("DC","11"); |
|
156 |
numero.put("CC","8745367465"); |
|
156 | 157 |
|
157 |
banco.add("Bancaja"); |
|
158 |
banco.add("Urbana 24"); |
|
159 |
banco.add(null); |
|
160 |
banco.add(numero); |
|
158 |
direccion.put("DOMICILIO","C/San jose"); |
|
159 |
direccion.put("NUMERO","54"); |
|
161 | 160 |
|
162 |
fields.add("Nombre"); |
|
163 |
fields.add("Apellidos"); |
|
164 |
fields.add(null); |
|
165 |
fields.add(direccion); |
|
166 |
fields.add(null); |
|
167 |
fields.add(banco); |
|
161 |
banco.put("ENTIDAD","Bancaja"); |
|
162 |
banco.put("SUCURSAL","Urbana 24"); |
|
163 |
banco.put("NUMERO",numero); |
|
168 | 164 |
|
169 |
tipo.add("Persona"); |
|
170 |
tipo.add(fields); |
|
171 |
|
|
172 |
values.add("Tipo"); |
|
173 |
values.add(tipo); |
|
165 |
fields.put("NOMBRE","Pepe"); |
|
166 |
fields.put("APELLIDOS","Sanchez Lopez"); |
|
167 |
fields.put("DIRECCION",direccion); |
|
168 |
fields.put("BANCO",banco); |
|
169 |
|
|
170 |
values.put("DATOS",fields); |
|
174 | 171 |
|
175 | 172 |
return values; |
176 | 173 |
} |
trunk/extensions/extWFS2/src-test/com/iver/cit/gvsig/fmap/layers/gml/GMLParseTest.java | ||
---|---|---|
63 | 63 |
* |
64 | 64 |
* $Id$ |
65 | 65 |
* $Log$ |
66 |
* Revision 1.7 2006-12-26 09:10:37 ppiqueras |
|
66 |
* Revision 1.8 2006-12-29 17:11:37 jorpiell |
|
67 |
* Se tienen en cuenta los simpleTypes y los choices, adem?s de los atributos multiples |
|
68 |
* |
|
69 |
* Revision 1.7 2006/12/26 09:10:37 ppiqueras |
|
67 | 70 |
* Cambiado "atttibutes" en todas las aparaciones en atributos, métodos, clases o comentarios por "fields". (Sólo a aquellas que afectan a clases dentro del proyecto extWFS2). |
68 | 71 |
* |
69 | 72 |
* Revision 1.6 2006/11/06 17:12:41 jorpiell |
... | ... | |
116 | 119 |
while (iterator.hasNext()){ |
117 | 120 |
System.out.println("********* FEATURE NUMBER " + i + " ***********+"); |
118 | 121 |
FeatureWithAttributes feature = (FeatureWithAttributes) iterator.next(); |
119 |
for (int j=0 ; j<feature.getAttributeName().size() ; j++){
|
|
122 |
for (int j=0 ; j<feature.getAttributeName().length ; j++){
|
|
120 | 123 |
if (feature.getAttributeValue()[j] instanceof ComplexValue){ |
121 |
printComplexType((String)feature.getAttributeName().get(j),(ComplexValue)feature.getAttributeValue()[j],1);
|
|
124 |
printComplexType((String)feature.getAttributeName()[j],(ComplexValue)feature.getAttributeValue()[j],1);
|
|
122 | 125 |
}else{ |
123 |
System.out.print((String)feature.getAttributeName().get(j) + ":" + feature.getAttributeValue()[j] + "\n");
|
|
126 |
System.out.print((String)feature.getAttributeName()[j] + ":" + feature.getAttributeValue()[j] + "\n");
|
|
124 | 127 |
} |
125 | 128 |
} |
126 | 129 |
i++; |
Also available in: Unified diff