Statistics
| Revision:

gvsig-raster / org.gvsig.raster.wmts / trunk / org.gvsig.raster.wmts / org.gvsig.raster.wmts.ogc / org.gvsig.raster.wmts.ogc.impl / src / main / java / org / gvsig / raster / wmts / ogc / impl / struct / WMTSTileMatrixSetImpl.java @ 2613

History | View | Annotate | Download (3.79 KB)

1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.gvsig.raster.wmts.ogc.impl.struct;
23

    
24
import java.io.IOException;
25
import java.util.ArrayList;
26
import java.util.List;
27

    
28
import org.gvsig.raster.wmts.ogc.struct.WMTSTileMatrix;
29
import org.gvsig.raster.wmts.ogc.struct.WMTSTileMatrixSet;
30
import org.kxml2.io.KXmlParser;
31
import org.xmlpull.v1.XmlPullParserException;
32

    
33

    
34
/**
35
 * <p>Defines a OGC style. Theme that describes the appeareance of certain layer.</p>
36
 * @author Nacho Brodin (nachobrodin@gmail.com)
37
 */
38
public abstract class WMTSTileMatrixSetImpl extends WMTSBaseStruct implements WMTSTileMatrixSet {
39
    protected WMTSBoundingBoxImpl        bbox                         = null;
40
    private String                       supportedCRS                 = null;
41
    private String                       wellKnownScaleSet            = null;
42
    protected List<WMTSTileMatrix>       tileMatrix                   = null;
43
    protected boolean                    forceChangeAxisOrder         = false;
44
        
45
    /**
46
         * Force to change the axis order read from the capabilities
47
         * @param force
48
         */
49
        public void setForceChangeAxisOrder(boolean force) {
50
                this.forceChangeAxisOrder = force;
51
        }
52
        
53
    /**
54
     * Parses this service ID
55
     * @param parser
56
     * @param content
57
     * @throws IOException
58
     * @throws XmlPullParserException
59
     */
60
        public abstract void parse(KXmlParser parser, List<WMTSTileMatrixSet> list) throws IOException, XmlPullParserException; 
61
    
62
        public void setLayerBBox(WMTSBoundingBoxImpl bbox) {
63
                if(bbox != null) {
64
                        this.bbox = bbox;
65
                        for (int i = 0; i < getTileMatrix().size(); i++) {
66
                                ((WMTSTileMatrixImpl)getTileMatrix().get(i)).setBBoxTileMatrixSet(bbox.toRectangle2D());
67
                        }
68
                }
69
        }
70
    
71
    public abstract WMTSBoundingBoxImpl getBoundingBox();
72
    
73
        public String getWellKnownScaleSet() {
74
                return wellKnownScaleSet;
75
        }
76

    
77
        public void setWellKnownScaleSet(String wellKnownScaleSet) {
78
                this.wellKnownScaleSet = wellKnownScaleSet;
79
        }
80
        
81
        public List<WMTSTileMatrix> getTileMatrix() {
82
                if(tileMatrix == null)
83
                        tileMatrix = new ArrayList<WMTSTileMatrix>();
84
                return tileMatrix;
85
        }
86

    
87
        public String getSupportedCRS() {
88
                //if(supportedCRS.compareTo("CRS:84") == 0)
89
                        //supportedCRS = "EPSG:4326";
90
                if(supportedCRS.contains("900913"))
91
                        supportedCRS = "EPSG:3857";
92
                return supportedCRS;
93
        }
94

    
95
        public void setSupportedCRS(String supportedCRS) {
96
                //if(supportedCRS.compareTo("CRS:84") == 0)
97
                        //supportedCRS = "EPSG:4326";
98
                if(supportedCRS.contains("900913"))
99
                        supportedCRS = "EPSG:3857";
100
                this.supportedCRS = supportedCRS;
101
        }
102
        
103
        public void parse(KXmlParser parser) throws IOException,
104
                        XmlPullParserException {
105
        }
106
        
107
        public void print() {
108
                System.out.println("*****WMTSTileMatrixSet******");
109
                if(bbox != null)
110
                        bbox.print();
111
                System.out.println("supportedCRS:" + getSupportedCRS());
112
                System.out.println("wellKnownScaleSet:" + getWellKnownScaleSet());
113
                for (int i = 0; i < tileMatrix.size(); i++) {
114
                        ((WMTSTileMatrixImpl)tileMatrix.get(i)).print();        
115
                }
116
        }
117
}