Revision 41249

View differences:

trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.remoteclient/src/main/java/org/gvsig/remoteclient/wms/WMSLayer.java
138 138
     * add a new keyword to the keywordList.
139 139
     * @param key
140 140
     */
141
    protected void addkeyword(String key)
142
    {
141
    protected void addkeyword(String key) {
143 142
    	keywordList.add(key);
144 143
    }
145
    public ArrayList getKeywords()
146
    {
144
    
145
    public ArrayList getKeywords() {
147 146
    	return keywordList;
148 147
    }
148
    
149 149
    /**
150 150
     * <p>Adds a style to the styles vector</p>
151 151
     * @param _style
152 152
     */
153 153
    public void addStyle(org.gvsig.remoteclient.wms.WMSStyle _style) {
154
        styles.add( _style );    }
154
        styles.add( _style );    
155
    }
155 156

  
156
   /**
157
    /**
157 158
     * <p>Gets the style vector</p>
158 159
     * @return
159 160
     */
......
161 162
    	ArrayList list = new ArrayList();
162 163
    	if (styles != null)
163 164
    		list.addAll(styles);
164
    	if (this.getParent()!= null)
165
    	{
165
    	if (this.getParent()!= null) {
166 166
    		//return getAllStyles(this);
167 167
    		if(this.getParent().getStyles() != null)
168 168
    			list.addAll(this.getParent().getStyles());
......
170 170
        return list;
171 171
    }
172 172

  
173
    public ArrayList getAllStyles(WMSLayer layer)
174
    {
175
    	if (layer.getParent()!= null)
176
    	{
173
    public ArrayList getAllStyles(WMSLayer layer) {
174
    	if (layer.getParent()!= null) {
177 175
    		ArrayList list = getAllStyles(layer.getParent());
178
    		for(int i = 0; i < this.styles.size(); i++)
179
    		{
176
    		for(int i = 0; i < this.styles.size(); i++) {
180 177
    			list.add(styles.get(i));
181 178
    		}
182 179
    		return list;
183
    	}
184
    	else
185
    	{
180
    	} else {
186 181
    		return styles;
187 182
    	}
188 183
    }
184
    
189 185
    /**
190 186
     * <p>Adds a bbox to the Bboxes vector</p>
191 187
     * @param bbox
......
225 221

  
226 222

  
227 223
    //Methods to manipulate the box that defines the layer extent in LatLon SRS.
228
    public BoundaryBox getLatLonBox()
229
    {
224
    public BoundaryBox getLatLonBox() {
230 225
        return latLonBbox;
231 226
    }
232
    public void setLatLonBox(BoundaryBox box)
233
    {
227
    
228
    public void setLatLonBox(BoundaryBox box) {
234 229
        latLonBbox = box;
235 230
    }
231
    
236 232
    /**
237 233
     * <p>adds a new srs to the srs vector</p>
238 234
     */
239
    public void addSrs(String srs)
240
    {
235
    public void addSrs(String srs) {
241 236
    	if (!this.srs.contains(srs))
242 237
    		this.srs.add(srs);
243 238
    }
239
    
240
    public void removeSrs(String srs) {
241
   		this.srs.remove(srs);
242
    }
244 243

  
245
    public Vector getAllSrs()
246
    {
244
    public Vector getAllSrs() {
247 245
        Vector mySRSs = (Vector) this.srs.clone();
248 246
        if (parent!=null)
249 247
            mySRSs.addAll(parent.getAllSrs());
250 248
        return mySRSs;
251

  
252
//    	if (this.getParent()!= null)
253
//    	{
254
//    		Vector list = this.getParent().getAllSrs();
255
//    		for(int i = 0; i < this.srs.size(); i++)
256
//    		{
257
//    			list.add(srs.get(i));
258
//    		}
259
//    		return list;
260
//    	}
261
//    	else
262
//    	{
263
//    		return srs;
264
//    	}
265

  
266 249
    }
250

  
267 251
    /**
268 252
     * <p>gets the maximum scale for this layer</p>
269 253
     * @return
......
302 286
     * @return
303 287
     */
304 288
    public abstract ArrayList getDimensions();
305
//    public ArrayList getDimensions() {
306
//        return dimensions;
307
//    }
308 289

  
309
    public WMSDimension getDimension(String name)
310
    {
311
    	for(int i = 0; i < dimensions.size(); i++ ){
312
    		if(((WMSDimension)dimensions.get(i)).getName().compareTo(name)==0)
313
    		{
290
    public WMSDimension getDimension(String name) {
291
    	for(int i = 0; i < dimensions.size(); i++ ) {
292
    		if(((WMSDimension)dimensions.get(i)).getName().compareTo(name) == 0) {
314 293
    			return (WMSDimension)dimensions.get(i);
315 294
    		}
316 295
    	}
317 296
    	return null;
318 297
    }
319 298

  
320
//    /**
321
//     * <p>Sets the dimension vector defined for this layer</p>
322
//     * @param v
323
//     */
324
//    public void setDimensions(ArrayList v) {
325
//        dimensions = (ArrayList)v.clone();
326
//    }
327

  
328 299
    /**
329 300
     * <p>Adds a dimension to the dimension vector </p>
330 301
     * @param dimension
......
478 449
     * Parses the keywordlist from the capabilities and fills this list in the WMSLayer.
479 450
     * @param parser
480 451
     */
481
    protected void parseKeywordList(KXmlParser parser)  throws IOException, XmlPullParserException
482
    {
452
    protected void parseKeywordList(KXmlParser parser)  throws IOException, XmlPullParserException {
483 453
    	int currentTag;
484 454
    	boolean end = false;
485 455
    	String value;
......
487 457
    	parser.require(KXmlParser.START_TAG, null, CapabilitiesTags.KEYWORDLIST);
488 458
    	currentTag = parser.nextTag();
489 459

  
490
        while (!end)
491
    	{
492
			 switch(currentTag)
493
			 {
460
        while (!end) {
461
			 switch(currentTag) {
494 462
				case KXmlParser.START_TAG:
495
					if (parser.getName().compareTo(CapabilitiesTags.KEYWORD)==0)
496
					{
463
					if (parser.getName().compareTo(CapabilitiesTags.KEYWORD) == 0) {
497 464
						value = parser.nextText();
498 465
						if ((value != null) && (value.length() > 0 ))
499 466
							addkeyword(value);
......
506 473
				case KXmlParser.TEXT:
507 474
					break;
508 475
			 }
509
			 if (!end)
510
			 {
476
			 if (!end) {
511 477
				 currentTag = parser.next();
512 478
			 }
513 479
    	}
......
519 485
     * Maybe this method should be moved to the WMSLayer. Until now the attributes are teh same for all versions.
520 486
     * @param parser
521 487
     */
522
    protected void readLayerAttributes(KXmlParser parser)
523
    {
488
    protected void readLayerAttributes(KXmlParser parser) {
524 489
    	String value = new String();
525 490

  
526 491
        //First of all set whether the layer is Queryable reading the attribute.
527 492
        value = parser.getAttributeValue("", CapabilitiesTags.QUERYABLE);
528
        if (value != null)
529
        {
530
            if (value.compareTo("0")==0)
493
        if (value != null) {
494
            if (value.compareTo("0") == 0)
531 495
                setQueryable(false);
532 496
            else
533 497
                setQueryable(true);
534 498
        }
535 499
        value = parser.getAttributeValue("", CapabilitiesTags.OPAQUE);
536
        if (value != null)
537
        {
538
            if (value.compareTo("0")==0)
500
        if (value != null) {
501
            if (value.compareTo("0") == 0)
539 502
                setOpaque(false);
540 503
            else
541 504
                setOpaque(true);
542 505
        }
543 506
        value = parser.getAttributeValue("", CapabilitiesTags.NOSUBSETS);
544
        if (value != null)
545
        {
546
            if (value.compareTo("0")==0)
507
        if (value != null) {
508
            if (value.compareTo("0") == 0)
547 509
                setNoSubSets(false);
548 510
            else
549 511
            	setNoSubSets(true);
550 512
        }
551 513
        value = parser.getAttributeValue("", CapabilitiesTags.FIXEDWIDTH);
552
        if (value != null)
553
        {
514
        if (value != null) {
554 515
        	setfixedWidth(Integer.parseInt(value));
555 516
        }
556 517
        value = parser.getAttributeValue("", CapabilitiesTags.FIXEDHEIGHT);
557
        if (value != null)
558
        {
518
        if (value != null) {
559 519
        	setfixedHeight(Integer.parseInt(value));
560 520
        }
561 521
    }
......
565 525
     * <p>Inner class describing the MetadataURL tag in OGC specifications in WMS</p>
566 526
     *
567 527
     */
568
    protected class MetadataURL
569
    {
570
    	public MetadataURL()
571
    	{
528
    protected class MetadataURL {
529
    	public MetadataURL() {
572 530
    		type = new String();
573 531
    		format = new String();
574 532
    		onlineResource_xlink = new String();
......
586 544
     * <p>Inner class describing the DataURL tag in OGC specifications in WMS</p>
587 545
     *
588 546
     */
589
    protected class DataURL
590
    {
591
    	public DataURL()
592
    	{
547
    protected class DataURL {
548
    	public DataURL() {
593 549
    		type = new String();
594 550
    		format = new String();
595 551
    		onlineResource_xlink = new String();
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.remoteclient/src/main/java/org/gvsig/remoteclient/wms/wms_1_3_0/WMSLayer1_3_0.java
197 197
    private BoundaryBox changeAxis(String epsg, BoundaryBox oldbbox) {
198 198
    	if(epsg.contains("CRS:84") || epsg.contains("CRS84"))
199 199
    		return oldbbox;
200
        IProjection projSrc = CRSFactory.getCRS(epsg);
201
        if(projSrc != null && !projSrc.isProjected()) {
202
        	BoundaryBox bbox = new BoundaryBox();
203
        	bbox.setXmin(oldbbox.getYmin());	
204
            bbox.setYmin(oldbbox.getXmin());	
205
            bbox.setXmax(oldbbox.getYmax());	
206
            bbox.setYmax(oldbbox.getXmax());
207
            bbox.setSrs(oldbbox.getSrs());
208
            return bbox;
209
        }
200
    	try {
201
    		IProjection projSrc = CRSFactory.getCRS(epsg);
202
    		if(projSrc != null && !projSrc.isProjected()) {
203
    			BoundaryBox bbox = new BoundaryBox();
204
    			bbox.setXmin(oldbbox.getYmin());	
205
    			bbox.setYmin(oldbbox.getXmin());	
206
    			bbox.setXmax(oldbbox.getYmax());	
207
    			bbox.setYmax(oldbbox.getXmax());
208
    			bbox.setSrs(oldbbox.getSrs());
209
    			return bbox;
210
    		}
211
    	} catch (Exception e) {
212
    	}
210 213
        return oldbbox;
211 214
    }
212 215
  

Also available in: Unified diff