Revision 40787
branches/v02_desarrollo/libraries/sld/temp/org.gvsig.sldsupport.lib.impl/src/main/java/org/gvsig/sldsupport/impl/sld1_0_0/handler/Handler1_0_0.java | ||
---|---|---|
51 | 51 |
import org.gvsig.sldsupport.impl.sld1_0_0.layers.SLDNamedLayer1_0_0; |
52 | 52 |
import org.gvsig.sldsupport.impl.sld1_0_0.layers.SLDUserLayer1_0_0; |
53 | 53 |
import org.gvsig.sldsupport.sld.SLDObject; |
54 |
import org.gvsig.sldsupport.sld.SLDRoot; |
|
54 | 55 |
import org.gvsig.sldsupport.sld.SLDTags; |
56 |
import org.gvsig.sldsupport.sld.layer.SLDLayer; |
|
57 |
import org.gvsig.sldsupport.sld.symbol.SLDSymbol; |
|
55 | 58 |
import org.kxml2.io.KXmlParser; |
56 | 59 |
import org.xmlpull.v1.XmlPullParser; |
57 | 60 |
import org.xmlpull.v1.XmlPullParserException; |
... | ... | |
74 | 77 |
if (tag == XmlPullParser.START_DOCUMENT) { |
75 | 78 |
parser.next(); |
76 | 79 |
parser.require(KXmlParser.START_TAG, null, SLDTags.SLD_ROOT); |
77 |
/* |
|
78 |
* Now we are in root |
|
79 |
*/ |
|
80 |
// Now we are in root |
|
80 | 81 |
} else { |
81 | 82 |
if (tag != XmlPullParser.START_TAG) { |
82 | 83 |
throw new SLDReadException( |
... | ... | |
88 | 89 |
if (name.compareToIgnoreCase(SLDTags.SLD_ROOT) == 0) { |
89 | 90 |
return parseRoot(parser); |
90 | 91 |
} else { |
91 |
if (name.compareToIgnoreCase(SLDTags.SLD_ROOT) == 0) { |
|
92 |
if (name.compareToIgnoreCase(SLDTags.USERDEFINEDLAYER) == 0 |
|
93 |
|| name.compareToIgnoreCase(SLDTags.NAMEDLAYER) == 0) { |
|
92 | 94 |
return parseLayer(parser); |
93 | 95 |
} else { |
94 |
if (name.compareToIgnoreCase(SLDTags.SLD_ROOT) == 0) { |
|
95 |
return parseSymbol(parser); |
|
96 |
if (name.compareToIgnoreCase(SLDTags.LINESYMBOLIZER) == 0 |
|
97 |
|| name.compareToIgnoreCase(SLDTags.POLYGONSYMBOLIZER) == 0 |
|
98 |
|| name.compareToIgnoreCase(SLDTags.POINTSYMBOLIZER) == 0 |
|
99 |
|| name.compareToIgnoreCase(SLDTags.TEXTSYMBOLIZER) == 0 |
|
100 |
|| name.compareToIgnoreCase(SLDTags.RASTERSYMBOLIZER) == 0) { |
|
96 | 101 |
|
102 |
return parseSymbol(parser); |
|
97 | 103 |
} |
98 | 104 |
} |
99 | 105 |
} |
100 |
|
|
101 |
|
|
102 |
/* |
|
103 |
|
|
104 |
*/ |
|
106 |
throw new SLDReadException( |
|
107 |
"Misplaced input stream. Bad opening tag: " + name); |
|
108 |
} |
|
109 |
|
|
110 |
private SLDSymbol parseSymbol(XmlPullParser parser) { |
|
111 |
// TODO Auto-generated method stub |
|
105 | 112 |
return null; |
106 |
|
|
107 |
// if ( parser.getEventType() != XmlPullParser.END_DOCUMENT ) { |
|
108 |
// |
|
109 |
// String value = parser.getAttributeValue("",SLDTags.VERSION_ATTR); |
|
110 |
// setVersion(value); |
|
111 |
// |
|
112 |
// parser.require(KXmlParser.START_TAG, null, SLDTags.SLD_ROOT); |
|
113 |
// tag = parser.nextTag(); |
|
114 |
// |
|
115 |
// while(tag != KXmlParser.END_DOCUMENT){ |
|
116 |
// switch(tag){ |
|
117 |
// case KXmlParser.START_TAG: |
|
118 |
// if (parser.getName().compareTo(SLDTags.USERDEFINEDLAYER)==0) |
|
119 |
// { |
|
120 |
// SLDUserLayer1_0_0 lyr = new SLDUserLayer1_0_0(); |
|
121 |
// lyr.parse(parser); |
|
122 |
// if (lyr.getName()!= null && lyr.getName()!="") |
|
123 |
// layers.add(lyr); |
|
124 |
// else throw new SLDReadException(new Exception( |
|
125 |
// "Invalid or empty SLD layer user name")); |
|
126 |
// } |
|
127 |
// else if(parser.getName().compareTo(SLDTags.NAMEDLAYER)==0) |
|
128 |
// { |
|
129 |
// SLDNamedLayer1_0_0 lyr = new SLDNamedLayer1_0_0(); |
|
130 |
// lyr.parse(parser); |
|
131 |
// if (lyr.getName()!= null && lyr.getName()!="") |
|
132 |
// layers.add(lyr); |
|
133 |
// else throw new SLDReadException(new Exception( |
|
134 |
// "Invalid or empty SLD layer name")); |
|
135 |
// |
|
136 |
// } |
|
137 |
// break; |
|
138 |
// case KXmlParser.END_TAG: |
|
139 |
// break; |
|
140 |
// case KXmlParser.TEXT: |
|
141 |
// break; |
|
142 |
// } |
|
143 |
// tag = parser.next(); |
|
144 |
// } |
|
145 |
// parser.require(KXmlParser.END_DOCUMENT, null, null); |
|
146 |
// } |
|
113 |
} |
|
114 |
|
|
147 | 115 |
|
116 |
private SLDLayer parseLayer(XmlPullParser parser) { |
|
117 |
// TODO Auto-generated method stub |
|
118 |
return null; |
|
119 |
} |
|
120 |
|
|
121 |
private SLDRoot parseRoot(XmlPullParser parser) { |
|
122 |
// TODO Auto-generated method stub |
|
123 |
return null; |
|
148 | 124 |
} |
149 | 125 |
} |
Also available in: Unified diff