Statistics
| Revision:

root / trunk / extensions / extSymbology / src / org / gvsig / remoteClient / sld / sld1_0_0 / SLDFeatureTypeStyle1_0_0.java @ 20768

History | View | Annotate | Download (6.01 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 org.gvsig.remoteClient.sld.sld1_0_0;
42

    
43
import java.io.IOException;
44

    
45
import org.gvsig.remoteClient.gml.schemas.XMLSchemaParser;
46
import org.gvsig.remoteClient.sld.SLDFeatureTypeStyle;
47
import org.gvsig.remoteClient.sld.SLDTags;
48
import org.xmlpull.v1.XmlPullParserException;
49

    
50
import com.iver.cit.gvsig.fmap.drivers.legend.LegendDriverException;
51

    
52
/**
53
 * Implements the FeatureTypeStyle element of an SLD implementation specification 
54
 * (version 1.0.0).<p>
55
 * The FeatureTypeStyle defines the styling that is to be applied to a single feature
56
 * type of a layer. This element may also be externally re-used outside of the WMSes
57
 * and layers.<p>
58
 * 
59
 * The FeatureTypeStyle element identifies that explicit separation between the
60
 * handling of features of specific feature types. The 'layer' concept is unique 
61
 * to WMS and SLD, but features are used more generally, such as in WFS and GML,
62
 * so this explicit separation is important.<p>
63
 * 
64
 * Like a UserStyle, a FeatureTypeStyle can have a Name, Title, and Abstract.
65
 * The Name element does not have an explicit use at present, though it conceivably
66
 * might be used to reference a feature style in some feature-style library. The Title
67
 * and Abstract are for human-readable information.<p>
68
 * 
69
 * The FeatureTypeName identifies the specific feature type that the feature-type 
70
 * style is for. It is allowed to be optional, but only if one feature type is 
71
 * in-context (in-layer) and that feature type must match the syntax and semantics 
72
 * of all feature-property references inside of the FeatureTypeStyle. Note that 
73
 * there is no restriction against a single UserStyle from including multiple 
74
 * FeatureTypeStyles that reference the same FeatureTypeName. This case does not 
75
 * create an exception in the rendering semantics,however, since a map styler is 
76
 * expected to process all FeatureTypeStyles in the order that they appear, 
77
 * regardless, plotting one instance over top of another.<p>
78
 * 
79
 * The SemanticTypeIdentifier is experimental and is intended to be used to identify
80
 * what the feature style is suitable to be used for using community-controlled 
81
 * name(s). For example, a single style may be suitable to use with many different
82
 * feature types. The syntax of the SemanticTypeIdentifier string is undefined, but
83
 * the strings �generic:line�, �generic:polygon�, �generic:point�, �generic:text�,
84
 * �generic:raster�, and �generic:any� are reserved to indicate that a FeatureTypeStyle
85
 * may be used with any feature type with the corresponding default geometry type
86
 * (i.e., no feature properties are referenced in the feature-type style).<p>
87
 * 
88
 * The FeatureTypeStyle contains one or more Rule elements that allow conditional
89
 * rendering. Rules are discussed in Section 10.
90
 * 
91
 * @see SLDRule1_0_0 
92
 * @see http://portal.opengeospatial.org/files/?artifact_id=1188
93
 * 
94
 * @author pepe vidal salvador - jose.vidal.salvador@iver.es
95
*/
96
public class SLDFeatureTypeStyle1_0_0 extends SLDFeatureTypeStyle {
97

    
98
        
99
        public void parse(XMLSchemaParser parser,int cuTag, String expressionType)throws IOException, XmlPullParserException, LegendDriverException  {
100
                int currentTag;
101
                boolean end = false;
102

    
103
                parser.require(XMLSchemaParser.START_TAG, null, SLDTags.FEATURETYPESTYLE);
104
                currentTag = parser.next();
105

    
106
                while (!end)
107
                {
108
                        switch(currentTag)
109
                        {
110
                        case XMLSchemaParser.START_TAG:
111
                                if (parser.getName().compareTo(SLDTags.NAME)==0) {
112
                                        setName(parser.nextText());
113
                                }
114
                                else if(parser.getName().compareTo(SLDTags.TITLE)==0) {
115
                                        setTitle(parser.nextText());
116
                                }
117
                                else if(parser.getName().compareTo(SLDTags.ABSTRACT)==0) {
118
                                        setFtsAbstract(parser.nextText());
119
                                }
120
                                else if(parser.getName().compareTo(SLDTags.FEATURETYPENAME)==0) {
121
                                        setFeatureTypeName(parser.nextText());
122
                                }
123
                                else if (parser.getName().compareTo(SLDTags.SEMANTICTYPEIDENTIFIER)==0){
124
                                        for (int i = 0; i < parser.getAttributeCount(); i++) {
125
                                                addSemanticTypeIdentifier((parser.getAttributeValue(i)));
126
                                        }
127
                                }
128
                                else if(parser.getName().compareTo(SLDTags.RULE)==0){
129
                                        SLDRule1_0_0 rule = new SLDRule1_0_0();
130
                                        rule.parse(parser,currentTag,null);
131
                                        rule.applyScale2Symbolizers(rule.getMinScaleDenominator(),rule.getMaxScaleDenominator());
132
                                        rule.addSymbolizers2Filter();
133
                                        addRule(rule);
134
                                }
135
                                break;
136
                        case XMLSchemaParser.END_TAG:
137
                                if (parser.getName().compareTo(SLDTags.FEATURETYPESTYLE) == 0)
138
                                        end = true;
139
                                break;
140
                        case XMLSchemaParser.TEXT:
141
                                break;
142
                        }
143
                        if (!end)
144
                                currentTag = parser.next();
145
                }
146

    
147
                parser.require(XMLSchemaParser.END_TAG, null, SLDTags.FEATURETYPESTYLE);
148

    
149
        }
150

    
151
        
152
        public String toXML() {
153
                // TODO Auto-generated method stub
154
                throw new Error ("Not yet implemented");
155
        }
156
        
157
        
158
}