Revision 3725

View differences:

org.gvsig.raster.wms/tags/org.gvsig.raster.wms-2.2.14/org.gvsig.raster.wms.io/src/main/java/org/gvsig/raster/wms/io/WMSServerExplorerParameters.java
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

  
23
/*
24
* AUTHORS (In addition to CIT):
25
* 2009 IVER T.I   {{Task}}
26
*/
27

  
28
package org.gvsig.raster.wms.io;
29

  
30
import org.gvsig.fmap.dal.DataServerExplorerParameters;
31
import org.gvsig.fmap.dal.spi.AbstractDataParameters;
32
import org.gvsig.raster.impl.store.AbstractRasterDataParameters;
33
import org.gvsig.tools.ToolsLocator;
34
import org.gvsig.tools.dynobject.DelegatedDynObject;
35
import org.gvsig.tools.dynobject.DynClass;
36
import org.gvsig.tools.dynobject.DynStruct;
37
import org.gvsig.tools.persistence.PersistenceManager;
38

  
39
/**
40
 * Parameters for the WMS provider
41
 * @author Nacho Brodin (nachobrodin@gmail.com)
42
 */
43
public class WMSServerExplorerParameters extends AbstractDataParameters implements DataServerExplorerParameters {
44
	protected static final String  FIELD_HOST          = "host";
45
	protected static DynClass      DYNCLASS            = null;
46
	private DelegatedDynObject     delegatedDynObject  = null;
47
	private static final String    FIELD_XYAXISORDER          = "xyaxisorder";
48
	
49
	public WMSServerExplorerParameters() {
50
		super();
51
		initialize();
52
	}
53

  
54
	protected void initialize() {
55
		this.delegatedDynObject = (DelegatedDynObject) ToolsLocator
56
				.getDynObjectManager().createDynObject(
57
						registerDynClass());
58
	}
59
	
60
	public static DynStruct registerDynClass() {
61
		PersistenceManager manager = ToolsLocator.getPersistenceManager();
62
		DynStruct definition = manager.getDefinition("WMSServerExplorerParameters_Persistent");
63
		if( definition == null ) {
64
			definition = manager.addDefinition(
65
					WMSServerExplorerParameters.class,
66
					"WMSServerExplorerParameters_Persistent",
67
					"WMS Explorer DataParameters Persistency",
68
					null, 
69
					null
70
			);
71
		}
72

  
73
		AbstractRasterDataParameters.registerDynClass(definition);
74

  
75
		definition.addDynFieldBoolean(FIELD_XYAXISORDER)
76
		.setDescription("Longitude first in axis order")
77
		.setMandatory(false);
78

  
79
		definition.addDynFieldString(FIELD_HOST)
80
		.setDescription("Uniform Resource Identifier (File name or URL)")
81
		.setMandatory(false);		
82
		return definition;
83
	}
84
	
85
	protected DelegatedDynObject getDelegatedDynObject() {
86
		return delegatedDynObject;
87
	}
88
	
89
	/**
90
	 * Gets the assigned host
91
	 * @return
92
	 */
93
	public String getHost() {
94
		return (String) this.getDynValue(FIELD_HOST);
95
	}
96

  
97
	/**
98
	 * Assign the host to this explorer
99
	 * @param host
100
	 */
101
	public void setHost(String host) {
102
		this.setDynValue(FIELD_HOST, host);
103
	}
104

  
105
	public String getDataStoreName() {
106
		return WMSProvider.NAME;
107
	}
108
	
109
	public String getDescription() {
110
		return WMSProvider.DESCRIPTION;
111
	}
112

  
113
	public String getExplorerName() {
114
		return WMSServerExplorer.NAME;
115
	}
116

  
117
	/**
118
	 * <p>Gets the behaviour of the WMS client with regards the axis order</p>
119
	 * 
120
	 * <p>Returns <code>true</code> if the WMS parser should assume that the
121
	 * order of the coordinates follows the XY axis order
122
	 * (the first coordinate corresponds to the horizontal X
123
	 * axis, while the second  coordinate corresponds to the
124
	 * vertical Y axis), regardless the protocol version and CRS in use.</p>
125
	 * 
126
	 * <p>Returns <code>false</code> if the WMS parser should decide the
127
	 * axis order based on the protocol version and the coordinate
128
	 * reference system (CRS) in use. In particular, if protocol
129
	 * version is >= 1.3.0, then the WMS parser assumes
130
	 * the axis order defined in the official EPSG registry for the
131
	 * CRS in use. For versions < 1.3.0, the XY axis order is assumed.</p>
132
	 * 
133
	 * <p>The default value is <code>false</code></p>.
134
	 * @see #setXyAxisOrder(boolean)
135
	 * @return
136
	 */
137
	public boolean isXyAxisOrder() {
138
		if (hasDynValue(FIELD_XYAXISORDER)) {
139
			Object obj = getDynValue(FIELD_XYAXISORDER);
140
			if(obj instanceof Boolean) {
141
				Boolean b = (Boolean)getDynValue(FIELD_XYAXISORDER);
142
				if(b != null)
143
					return ((Boolean)b).booleanValue();
144
			}
145
			if(obj instanceof String) {
146
				String b = (String)getDynValue(FIELD_XYAXISORDER);
147
				if(b != null)
148
					return new Boolean(((String)b));
149
			}
150
		}
151
		return false;
152
	}
153

  
154
	/**
155
	 * <p>Sets the behaviour of the WMS client with regards the axis order.<p>
156
	 * 
157
	 * <p>If set to <code>true</code>, then the XY axis order
158
	 * is assumed for all the WMS
159
	 * protocol versions and coordinate reference systems.</p>
160
	 * 
161
	 * <p>If set to <code>false</code>
162
	 * then the WMS parser will decide the axis order based on
163
	 * the protocol version and the coordinate reference system (CRS)
164
	 * in use. In particular, if protocol
165
	 * version is >= 1.3.0, then the WMS parser assumes
166
	 * the axis order defined in the official EPSG registry for the
167
	 * CRS in use. For versions < 1.3.0, the XY axis order is assumed.</p>
168
	 * 
169
	 * 
170
	 * @param assumeXY
171
	 * @see #isXyAxisOrder()
172
	 */
173
	public void setXyAxisOrder(boolean assumeXY) {
174
		this.setDynValue(FIELD_XYAXISORDER, new Boolean(assumeXY));
175
	}
176
}
0 177

  
org.gvsig.raster.wms/tags/org.gvsig.raster.wms-2.2.14/org.gvsig.raster.wms.io/src/main/java/org/gvsig/raster/wms/io/RemoteWMSStyle.java
1
package org.gvsig.raster.wms.io;
2

  
3
import java.lang.reflect.Field;
4

  
5
import org.gvsig.remoteclient.wms.WMSStyle;
6
import org.gvsig.tools.ToolsLocator;
7
import org.gvsig.tools.dynobject.DynStruct;
8
import org.gvsig.tools.persistence.PersistenceManager;
9
import org.gvsig.tools.persistence.Persistent;
10
import org.gvsig.tools.persistence.PersistentState;
11
import org.gvsig.tools.persistence.exception.PersistenceException;
12

  
13
/**
14
 * Just a C-struct-like class.
15
 * @author jaume
16
 *
17
 */
18
public class RemoteWMSStyle implements Persistent {
19
	/*
20
	 * Please! ensure that the fields are double, int, or Object
21
	 * or otherwise add the corresponding entry in the clone() method.
22
	 */
23
    public String name;
24
    public String title;
25
    public String styleAbstract;
26
    public String format;
27
    public String type;
28
    public String href;
29
    public WMSLayerNode parent;
30
    public int legendHeight;
31
    public int legendWidth;
32
    
33
	public void loadFromState(PersistentState state) throws PersistenceException {
34
		this.name = state.getString("name");
35
		this.title = state.getString("title");
36
		this.styleAbstract = state.getString("styleAbstract");
37
		this.format = state.getString("format");
38
		this.type = state.getString("type");
39
		this.href = state.getString("href");
40
		this.parent = (WMSLayerNode)state.get("parent");
41
		this.legendHeight = state.getInt("legendHeight");
42
		this.legendWidth = state.getInt("legendWidth");
43
	}
44

  
45
	public void saveToState(PersistentState state) throws PersistenceException {
46
		state.set("parent", parent);	
47
		state.set("name", name);	
48
		state.set("title", title);	
49
		state.set("styleAbstract", styleAbstract);	
50
		state.set("format", format);	
51
		state.set("type", type);	
52
		state.set("href", href);
53
		state.set("legendHeight", legendHeight);
54
		state.set("legendWidth", legendWidth);
55
	}	
56
    
57
    public static void registerPersistent() {
58
		PersistenceManager manager = ToolsLocator.getPersistenceManager();
59
		DynStruct definition = manager.getDefinition("RemoteWMSStyle_Persistent");
60
		if( definition == null ) {
61
			definition = manager.addDefinition(
62
					RemoteWMSStyle.class,
63
					"RemoteWMSStyle_Persistent",
64
					"RemoteWMSStyle Persistence",
65
					null, 
66
					null
67
			);
68
		}
69

  
70
		definition.addDynFieldInt("legendHeight").setMandatory(false);
71
		definition.addDynFieldInt("legendWidth").setMandatory(false);
72
		definition.addDynFieldObject("parent").setClassOfValue(WMSLayerNode.class).setMandatory(false);
73
		definition.addDynFieldString("name").setMandatory(false);		
74
		definition.addDynFieldString("title").setMandatory(false);
75
		definition.addDynFieldString("styleAbstract").setMandatory(false);
76
		definition.addDynFieldString("format").setMandatory(false);
77
		definition.addDynFieldString("type").setMandatory(false);
78
		definition.addDynFieldString("href").setMandatory(false);
79
	}
80
    
81
    /*
82
	 * Please! ensure that the fields are double, int, or Object
83
	 * or otherwise add the corresponding entry in the clone() method.
84
	 */
85

  
86
    /**
87
     * Creates a new instance of FMapWMSStyle
88
     * @param uri
89
     * @param title
90
     * @param styleAbstract
91
     * @param parent
92
     */
93
    public RemoteWMSStyle(WMSStyle style, WMSLayerNode parent){
94

  
95
        this.name = style.getName();
96
        this.title = style.getTitle();
97
        this.styleAbstract = style.getAbstract();
98
        this.legendWidth = style.getLegendURLWidth();
99
        this.legendHeight = style.getLegendURLHeight();
100
        this.format = style.getLegendURLFormat();
101
        this.href = style.getLegendURLOnlineResourceHRef();
102
        this.type = style.getLegendURLOnlineResourceType();
103
        this.parent = parent;
104
    }
105

  
106
    public RemoteWMSStyle() {
107
		// TODO Auto-generated constructor stub
108
	}
109

  
110
	public String toString(){
111
        return name;
112
    }
113

  
114
    public Object clone() throws CloneNotSupportedException {
115
    	RemoteWMSStyle clone = new RemoteWMSStyle();
116
        Field[] fields = RemoteWMSStyle.class.getFields();
117
        for (int i = 0; i < fields.length; i++) {
118
        	try {
119
        		Class<?> clazz = getClass();
120
        		String fieldName = fields[i].getName();
121
        		// int entry
122
				if (fields[i].getType().equals(Integer.class)) {
123
					clazz.getField(fieldName).
124
					setInt(clone, clazz.getField(fieldName)
125
								.getInt(this));
126
				// double entry
127
				} else if (fields[i].getType().equals(Double.class)) {
128
					clazz.getField(fieldName).
129
					setDouble(clone, clazz.getField(fieldName)
130
							.getDouble(this));
131
				// any object entry
132
				} else {
133
					clazz.getField(fieldName).
134
					set(clone, clazz.getField(fieldName)
135
							.get(this));
136
				}
137
			} catch (Exception e) {
138
				throw new CloneNotSupportedException("Reflect error when cloning " +
139
						"'"+fields[i].getName()+"' field " +
140
						"(FMapWMSStyle)");
141
			}
142
		}
143
        return clone;
144
    }
145

  
146
	public String getName() {
147
		return name;
148
	}
149

  
150
	public String getTitle() {
151
		return title;
152
	}
153

  
154
	public String getStyleAbstract() {
155
		return styleAbstract;
156
	}
157

  
158
	public String getFormat() {
159
		return format;
160
	}
161

  
162
	public String getType() {
163
		return type;
164
	}
165

  
166
	public String getHref() {
167
		return href;
168
	}
169

  
170
	public WMSLayerNode getParent() {
171
		return parent;
172
	}
173

  
174
	public int getLegendHeight() {
175
		return legendHeight;
176
	}
177

  
178
	public int getLegendWidth() {
179
		return legendWidth;
180
	}
181
	
182
	public void setParent(WMSLayerNode node) {
183
		this.parent = node;
184
	}
185
	
186
	public void setName(String name) {
187
		this.name = name;
188
	}
189

  
190
	public void setTitle(String title) {
191
		this.title = title;
192
	}
193

  
194
	public void setStyleAbstract(String sa) {
195
		this.styleAbstract = sa;
196
	}
197

  
198
	public void setType(String type) {
199
		this.type = type;
200
	}
201

  
202
	public void setHref(String href) {
203
		this.href = href;
204
	}
205

  
206
	public void setLegendHeight(int lHeight) {
207
		this.legendHeight = lHeight;
208
	}
209

  
210
	public void setLegendWidth(int lWidth) {
211
		this.legendWidth = lWidth;
212
	}
213
}
0 214

  
org.gvsig.raster.wms/tags/org.gvsig.raster.wms-2.2.14/org.gvsig.raster.wms.io/src/main/java/org/gvsig/raster/wms/io/WMSDataParameters.java
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.wms.io;
23

  
24
import java.awt.Dimension;
25
import java.awt.geom.Rectangle2D;
26
import java.util.List;
27
import java.util.Map;
28
import java.util.Vector;
29

  
30
import org.gvsig.compat.net.ICancellable;
31
import org.gvsig.fmap.dal.coverage.store.parameter.RemoteStoreParameters;
32

  
33
/**
34
 * Parameters for the WMS provider
35
 * @author Nacho Brodin (nachobrodin@gmail.com)
36
 */
37
public interface WMSDataParameters extends RemoteStoreParameters {
38

  
39
	public void setLayerQuery(String string);
40

  
41
	public void setInfoLayerQuery(String string);
42
	
43
	/**
44
	 * Sets the info by point format
45
	 */
46
	public void setInfoFormat(String format);
47
	
48
	/**
49
	 * Gets the info by point format
50
	 * @return
51
	 */
52
	public String getInfoFormat();
53

  
54
	public void setFormat(String string);
55

  
56
	public void setSRS(String string);
57

  
58
	public void setWmsTransparency(boolean boolean1);
59

  
60
	public void setURI(String string);
61

  
62
	public void setStyles(List<RemoteWMSStyle> styles);
63

  
64
	/**
65
	 * Sets the dimension vector that is a list of key-value pairs containing
66
	 * the name of the dimension and the value for it
67
	 * @param dimensions
68
	 */
69
	public void setDimensions(Vector<String> dimensions);
70

  
71
	/**
72
	 * Sets the set of URLs that should be accessed for each operation performed
73
	 * to the server.
74
	 *
75
	 * @param onlineResources
76
	 */
77
	public void setOnlineResources(Map<String, String> onlineResources);
78

  
79
	public void setQueryable(boolean boolean1);
80

  
81
	public void setFixedSize(Dimension dimension);
82

  
83
	public String getURI();
84

  
85
	public String getInfoLayerQuery();
86

  
87
	public String getLayerQuery();
88

  
89
	public String getFormat();
90

  
91
	public String getSRSCode();
92

  
93
	/**
94
	 * @return Returns the wmsTransparency.
95
	 */
96
	public boolean isWmsTransparent();
97

  
98
	public List<RemoteWMSStyle> getStyles();
99

  
100
	public Vector<String> getDimensions();
101

  
102
	/**
103
	 * Gets the URL that should be accessed for an operation performed
104
	 * to the server.
105
	 *
106
	 * @param onlineResources
107
	 */
108
	public String getOnlineResource(String operation);
109
	
110
	/**
111
	 * Gets the online resource map
112
	 *
113
	 * @param onlineResources
114
	 */
115
	public Map<String,String> getOnlineResource();
116

  
117
	/**
118
	 * If it is true, this layer accepts GetFeatureInfo operations. This WMS operations
119
	 * maps to FMap's infoByPoint(p) operation.
120
	 */
121
	public boolean isQueryable();
122

  
123
	public Dimension getFixedSize();
124

  
125
	/**
126
	 * Sets the bounding box of the request
127
	 */
128
	public void setExtent(Rectangle2D bBox);
129
	
130
	/**
131
	 * Gets the bounding box of the request
132
	 * @return
133
	 */
134
	public Rectangle2D getExtent();
135

  
136
	public void setCancellable(ICancellable cancel);
137

  
138
	public Object getSRS();
139

  
140
	public void setOverrideHost(boolean b);
141

  
142
	public void setName(String title);
143
        
144
        public String getName();
145

  
146
	public int getWidth();
147

  
148
	public int getHeight();
149

  
150
	public ICancellable getCancellable();
151
	
152
	/**
153
	 * <p>Gets the behaviour of the parser with regards the axis order</p>
154
	 * 
155
	 * <p>Returns <code>true</code> if the WMS parser should assume that the
156
	 * order of the coordinates follows the XY axis order
157
	 * (the first coordinate corresponds to the horizontal X
158
	 * axis, while the second  coordinate corresponds to the
159
	 * vertical Y axis), regardless the protocol version and CRS in use.</p>
160
	 * 
161
	 * <p>Returns <code>false</code> if the WMS parser should decide the
162
	 * axis order based on the protocol version and the coordinate
163
	 * reference system (CRS) in use. In particular, if protocol
164
	 * version is >= 1.3.0, then the WMS parser assumes
165
	 * the axis order defined in the official EPSG registry for the
166
	 * CRS in use. For versions < 1.3.0, the XY axis order is assumed.</p>
167
	 * 
168
	 * <p>The default value is <code>false</code></p>.
169
	 * @see #setXyAxisOrder(boolean)
170
	 * @return
171
	 */
172
	public boolean isXyAxisOrder();
173

  
174
	/**
175
	 * <p>Sets the behaviour of the parser with regards the axis order.<p>
176
	 * 
177
	 * <p>If set to <code>true</code>, then the XY axis order
178
	 * is assumed for all the WMS
179
	 * protocol versions and coordinate reference systems.</p>
180
	 * 
181
	 * <p>If set to <code>false</code>
182
	 * then the WMS parser will decide the axis order based on
183
	 * the protocol version and the coordinate reference system (CRS)
184
	 * in use. In particular, if protocol
185
	 * version is >= 1.3.0, then the WMS parser assumes
186
	 * the axis order defined in the official EPSG registry for the
187
	 * CRS in use. For versions < 1.3.0, the XY axis order is assumed.</p>
188
	 * 
189
	 * 
190
	 * @param assumeXY
191
	 * @see #isXyAxisOrder()
192
	 */
193
	public void setXyAxisOrder(boolean assumeXY);
194
}
0 195

  
org.gvsig.raster.wms/tags/org.gvsig.raster.wms-2.2.14/org.gvsig.raster.wms.io/src/main/java/org/gvsig/raster/wms/io/WMSDataParametersImpl.java
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

  
23
package org.gvsig.raster.wms.io;
24

  
25
import java.awt.Dimension;
26
import java.awt.geom.Rectangle2D;
27
import java.util.Hashtable;
28
import java.util.List;
29
import java.util.Map;
30
import java.util.Vector;
31

  
32
import org.gvsig.compat.net.ICancellable;
33
import org.gvsig.fmap.crs.CRSFactory;
34
import org.gvsig.fmap.dal.coverage.store.RasterDataServerExplorer;
35
import org.gvsig.fmap.dal.coverage.store.parameter.RasterDataParameters;
36
import org.gvsig.raster.impl.store.AbstractRasterDataParameters;
37
import org.gvsig.tools.ToolsLocator;
38
import org.gvsig.tools.dynobject.DelegatedDynObject;
39
import org.gvsig.tools.dynobject.DynClass;
40
import org.gvsig.tools.dynobject.DynStruct;
41
import org.gvsig.tools.persistence.PersistenceManager;
42

  
43
/**
44
 * Parameters for the WMS provider
45
 * @author Nacho Brodin (nachobrodin@gmail.com)
46
 */
47
public class WMSDataParametersImpl extends AbstractRasterDataParameters implements WMSDataParameters {
48
	private static final String      FIELD_FORMAT          = "format";
49
	private static final String      FIELD_INFOFORMAT      = "infoformat";
50
	private static final String      FIELD_LAYERQUERY      = "layer_query";
51
	private static final String      FIELD_NAME            = "name";
52
	private static final String      FIELD_SRSSTR          = "srsstr";
53
	private static final String      FIELD_TRANSPARENCY    = "transparency";
54
	private static final String      FIELD_INFOLAYERQUERY  = "infolayerquery";
55
	private static final String      FIELD_QUERYABLE       = "queryable";
56
	private static final String      FIELD_OVERRIDE        = "override";
57
	private static final String      FIELD_STYLES          = "styles";
58
	private static final String      FIELD_DIMENSIONS      = "dimensions";
59
	private static final String      FIELD_ONLINERESOURC   = "onlineresources";
60
	private static final String      FIELD_FIXEDSIZE       = "fixedsize";
61
	private static final String      FIELD_EXTENT          = "extent";
62
	private static final String      FIELD_WIDTH           = "width";
63
	private static final String      FIELD_HEIGHT          = "height";
64
	private static final String      FIELD_DELETECACHE     = "deletecache";
65
	private static final String      FIELD_ASSUMEXYAXISORDER = "assumeXY";
66
	
67
	private DelegatedDynObject       delegatedDynObject    = null;
68
	protected static DynClass        DYNCLASS              = null;
69
	private ICancellable             cancel                = null;
70
	
71
	public WMSDataParametersImpl() {
72
		super();
73
		initialize();
74
	}
75
	
76
	protected void initialize() {
77
		this.delegatedDynObject = (DelegatedDynObject) ToolsLocator
78
				.getDynObjectManager().createDynObject(registerDynClass());
79
	}
80
	
81
	public static DynStruct registerDynClass() {
82
		PersistenceManager manager = ToolsLocator.getPersistenceManager();
83
		DynStruct definition = manager.getDefinition("WMSDataParameters_Persistent");
84
		if( definition == null ) {
85
			definition = manager.addDefinition(
86
					WMSDataParametersImpl.class,
87
					"WMSDataParameters_Persistent",
88
					"WMS DataParameters Persistency",
89
					null, 
90
					null
91
			);
92
		}
93

  
94
		AbstractRasterDataParameters.registerDynClass(definition);
95
		
96
		definition.addDynFieldObject(FIELD_EXTENT)
97
		.setDescription("Bounding box")
98
		.setClassOfValue(Rectangle2D.class)
99
		.setMandatory(false);
100
		
101
		definition.addDynFieldInt(FIELD_WIDTH)
102
		.setDescription("Width")
103
		.setMandatory(false);
104
		
105
		definition.addDynFieldInt(FIELD_HEIGHT)
106
		.setDescription("Height")
107
		.setMandatory(false);
108
		
109
		definition.addDynFieldString(FIELD_FORMAT)
110
		.setDescription("Format")
111
		.setMandatory(false);
112
		
113
		definition.addDynFieldString(FIELD_INFOFORMAT)
114
		.setDescription("Info by point format")
115
		.setMandatory(false);
116
		
117
		definition.addDynFieldString(FIELD_LAYERQUERY)
118
		.setDescription("Layer Query")
119
		.setMandatory(false);
120
		
121
		definition.addDynFieldString(FIELD_NAME)
122
		.setDescription("Name")
123
		.setMandatory(false);			
124
		
125
		definition.addDynFieldString(FIELD_SRSSTR)
126
		.setDescription("String that represents the SRS")
127
		.setMandatory(false);
128
		
129
		definition.addDynFieldBoolean(FIELD_TRANSPARENCY)
130
		.setDescription("Transparency")
131
		.setMandatory(false);
132
		
133
		definition.addDynFieldString(FIELD_INFOLAYERQUERY)
134
		.setDescription("InfoLayerQuery")
135
		.setMandatory(false);
136
		
137
		definition.addDynFieldBoolean(FIELD_QUERYABLE)
138
		.setDescription("Queryable")
139
		.setMandatory(false);
140
		
141
		definition.addDynFieldBoolean(FIELD_OVERRIDE)
142
		.setDescription("Override a host capabilities")
143
		.setMandatory(false);
144
		
145
		definition.addDynFieldList(FIELD_STYLES)
146
		.setDescription("Styles")
147
		.setClassOfItems(RemoteWMSStyle.class)
148
		.setMandatory(false);
149
		
150
		definition.addDynFieldList(FIELD_DIMENSIONS)
151
		.setDescription("Dimensions")
152
		.setClassOfItems(String.class)
153
		.setMandatory(false);
154
		
155
		definition.addDynFieldMap(FIELD_ONLINERESOURC)
156
		.setDescription("online resources")
157
		.setClassOfItems(String.class)
158
		.setMandatory(false);
159
		
160
		definition.addDynFieldObject(FIELD_FIXEDSIZE)
161
		.setDescription("Fixed size")
162
		.setClassOfValue(Dimension.class)
163
		.setMandatory(false);
164
		
165
		definition.addDynFieldBoolean(FIELD_DELETECACHE)
166
		.setDescription("Flag to delete cache the next request")
167
		.setMandatory(false);
168

  
169
		definition.addDynFieldBoolean(FIELD_ASSUMEXYAXISORDER)
170
		.setDescription("Flag to decide the axis order behaviour")
171
		.setMandatory(false);
172

  
173
		return definition;
174
	}
175
	
176
	/**
177
	 * Gets the format
178
	 * @return
179
	 */
180
	public String getFormat() {
181
		return (String) this.getDynValue(FIELD_FORMAT);
182
	}
183

  
184
	/**
185
	 * Sets the format
186
	 * @param format
187
	 */
188
	public void setFormat(String format) {
189
		this.setDynValue(FIELD_FORMAT, format);
190
	}
191
	
192
	/**
193
	 * Gets the info by point format
194
	 * @return
195
	 */
196
	public String getInfoFormat() {
197
		String o = (String) this.getDynValue(FIELD_INFOFORMAT);
198
		if(o == null)
199
			return "text/plain";
200
		return o;
201
	}
202

  
203
	/**
204
	 * Sets the info by point format
205
	 */
206
	public void setInfoFormat(String format) {
207
		this.setDynValue(FIELD_INFOFORMAT, format);
208
	}
209
	
210
	public String getLayerQuery() {
211
		return (String) this.getDynValue(FIELD_LAYERQUERY);
212
	}
213

  
214
	public void setLayerQuery(String layerQuery) {
215
		this.setDynValue(FIELD_LAYERQUERY, layerQuery);
216
	}
217
	
218
	/**
219
	 * Devuelve el SRS.
220
	 * @return SRS.
221
	 */
222
	public String getSRSCode() {
223
		return (String) this.getDynValue(FIELD_SRSSTR);
224
	}
225
	
226
	/**
227
	 * Inserta el SRS.
228
	 * @param m_srs SRS.
229
	 */
230
	public void setSRS(String m_srs) {
231
		this.setDynValue(FIELD_SRSSTR, m_srs);
232
		if(m_srs.equals("CRS:84"))
233
			m_srs = "EPSG:4326";
234
		setSRS(CRSFactory.getCRS(m_srs));
235
	}
236
	
237
	public void setSRSID(String srsid) {
238
		if (srsid == null) {
239
			setDynValue(FIELD_SRSSTR, null);
240
		} else {
241
			setDynValue(FIELD_SRSSTR, CRSFactory.getCRS(srsid));
242
		}
243
	}
244
	
245
	public String getName() {
246
		return (String) this.getDynValue(FIELD_NAME);
247
	}
248

  
249
	public void setName(String name) {
250
		this.setDynValue(FIELD_NAME, name);
251
	}
252
	
253
	public boolean isWmsTransparent() {
254
		Boolean b = (Boolean)getDynValue(FIELD_TRANSPARENCY);
255
		if(b != null)
256
			return ((Boolean)b).booleanValue();
257
		return false;
258
	}
259

  
260
	/**
261
	 * @param wmsTransparency The wmsTransparency to set.
262
	 */
263
	public void setWmsTransparency(boolean wmsTransparency) {
264
		this.setDynValue(FIELD_TRANSPARENCY, new Boolean(wmsTransparency));
265
	}
266
	
267
	public String getInfoLayerQuery() {
268
		return (String) this.getDynValue(FIELD_INFOLAYERQUERY);
269
	}
270

  
271
	public void setInfoLayerQuery(String infoLayerQuery) {
272
		this.setDynValue(FIELD_INFOLAYERQUERY, infoLayerQuery);
273
	}
274
	
275

  
276
	/**
277
	 * If it is true, this layer accepts GetFeatureInfo operations. This WMS operations
278
	 * maps to FMap's infoByPoint(p) operation.
279
	 * @param b
280
	 */
281
	public void setQueryable(boolean b) {
282
		this.setDynValue(FIELD_QUERYABLE, new Boolean(b));
283
	}
284
	
285
	public void setCancellable(ICancellable cancel) {
286
		this.cancel = cancel;
287
	}
288
	
289
	public ICancellable getCancellable() {
290
		return cancel;
291
	}
292
	
293
	public boolean isQueryable() {
294
		Boolean b = (Boolean)getDynValue(FIELD_QUERYABLE);
295
		if(b != null)
296
			return ((Boolean)b).booleanValue();
297
		return false;
298
	}
299
	
300
	public boolean isOverridingHost() {
301
		Boolean b = (Boolean)getDynValue(FIELD_OVERRIDE);
302
		if(b != null)
303
			return ((Boolean)b).booleanValue();
304
		return false;
305
	}
306
	
307
	public void setOverrideHost(boolean over) {
308
		this.setDynValue(FIELD_OVERRIDE, new Boolean(over));;
309
	}
310
	
311
	public void setStyles(List<RemoteWMSStyle> styles) {
312
		this.setDynValue(FIELD_STYLES, styles);
313
	}
314
	
315
	/**
316
	 * @param styles
317
	 */
318
	@SuppressWarnings("unchecked")
319
	public List<RemoteWMSStyle> getStyles() {
320
		return (List<RemoteWMSStyle>) this.getDynValue(FIELD_STYLES);
321
	}
322
	
323
	public void setDimensions(Vector<String> dimensions) {
324
		this.setDynValue(FIELD_DIMENSIONS, dimensions);
325
	}
326
	
327
	/**
328
	 * Gets the dimension vector that is a list of key-value pairs containing
329
	 * the name of the dimension and the value for it
330
	 * @return
331
	 */
332
	@SuppressWarnings("unchecked")
333
	public Vector<String> getDimensions() {
334
		return (Vector<String>) this.getDynValue(FIELD_DIMENSIONS);
335
	}
336

  
337
	public void setOnlineResources(Map<String, String> onlineResources) {
338
		this.setDynValue(FIELD_ONLINERESOURC, onlineResources);
339
	}
340
	
341
	public String getOnlineResource(String operation) {
342
		return (String) getOnlineResource().get(operation);
343
	}
344
	
345
	@SuppressWarnings("unchecked")
346
	public Map<String,String> getOnlineResource() {
347
		return (Map<String,String>) this.getDynValue(FIELD_ONLINERESOURC);
348
	}
349
	
350
	/**
351
	 * When a server is not fully featured and it only can serve constant map
352
	 * sizes this value must be set. It expresses the size in pixels (width, height)
353
	 * that the map will be requested.
354
	 * @param Dimension sz
355
	 */
356
	public void setFixedSize(Dimension sz) {
357
		this.setDynValue(FIELD_FIXEDSIZE, sz);
358
	}
359

  
360
	/**
361
	 * Tells whether if this layer must deal with the server with the constant-size
362
	 * limitations or not.
363
	 * @return boolean.
364
	 */
365
	public boolean isSizeFixed() {
366
		return (getDynValue(FIELD_FIXEDSIZE) != null);
367
	}
368
	
369
	/**
370
	 * Gets the value of the fixed size
371
	 * @return
372
	 */
373
	public Dimension getFixedSize() {
374
		return (Dimension) this.getDynValue(FIELD_FIXEDSIZE);
375
	}
376
	
377
	/**
378
	 * Assigns the extent. 
379
	 * When a provider is initialized this will need to know what is the extent before the request.
380
	 * 
381
	 * @param bBox
382
	 */
383
	public void setExtent(Rectangle2D bBox) {
384
		this.setDynValue(FIELD_EXTENT, bBox);
385
	}
386
	
387
	public void setWidth(int w) {
388
		this.setDynValue(FIELD_WIDTH, new Integer(w));
389
	}
390
	
391
	public void setHeight(int h) {
392
		this.setDynValue(FIELD_HEIGHT, new Integer(h));
393
	}
394
	
395
	/**
396
	 * Gets the bounding box
397
	 * @return
398
	 */
399
	public Rectangle2D getExtent() {
400
		return (Rectangle2D)getDynValue(FIELD_EXTENT);
401
	}
402
	
403
	/**
404
	 * Gets the width
405
	 * @return
406
	 */
407
	public int getWidth() {
408
		Integer b = (Integer)getDynValue(FIELD_WIDTH);
409
		if(b != null)
410
			return ((Integer)b).intValue();
411
		return 0;
412
	}
413
	
414
	/**
415
	 * Gets the height
416
	 * @return
417
	 */
418
	public int getHeight() {
419
		Integer b = (Integer)getDynValue(FIELD_HEIGHT);
420
		if(b != null)
421
			return ((Integer)b).intValue();
422
		return 0;
423
	}
424
	
425
	
426
	//**********************************************
427
	
428
	public String getDataStoreName() {
429
		return WMSProvider.NAME;
430
	}
431
	
432
	public String getDescription() {
433
		return WMSProvider.DESCRIPTION;
434
	}
435

  
436
	public String getExplorerName() {
437
		return WMSServerExplorer.NAME;
438
	}
439
	
440
	public boolean isValid() {
441
		return (this.getURI() != null);
442
	}
443
	
444
	protected DelegatedDynObject getDelegatedDynObject() {
445
		return delegatedDynObject;
446
	}
447
	
448
	public void deleteCache(boolean deleteCache) {
449
		this.setDynValue(FIELD_DELETECACHE, new Boolean(deleteCache));
450
	}
451
	
452
	public boolean isDeletingCache() {
453
		return ((Boolean)getDynValue(FIELD_DELETECACHE)).booleanValue();
454
	}
455
	
456
	@SuppressWarnings("unchecked")
457
	public WMSDataParameters clone() {
458
		WMSDataParametersImpl p = new WMSDataParametersImpl();
459
		p.setFormat(getFormat());
460
		p.setFixedSize(getFixedSize());
461
		p.setHeight(getHeight());
462
		p.setWidth(getWidth());
463
		p.setExtent(getExtent());
464
		p.setURI(getURI());
465
		p.setInfoLayerQuery(getInfoLayerQuery());
466
		p.setLayerQuery(getLayerQuery());
467
		p.setName(getName());
468
		p.setOnlineResources((Hashtable<String, String>)this.getDynValue(FIELD_ONLINERESOURC));
469
		p.setOverrideHost(isOverridingHost());
470
		p.setQueryable(isQueryable());
471
		p.setSRS(getSRS());
472
		p.setSRS(getSRSCode());
473
		p.setStyles(getStyles());
474
		p.setWmsTransparency(isWmsTransparent());
475
		p.setDimensions(getDimensions());
476
		p.setCancellable(getCancellable());
477
		p.setXyAxisOrder(isXyAxisOrder());
478
		return p;
479
	}
480
	
481
	public void assignFields(RasterDataParameters par, RasterDataServerExplorer explorer) {
482
		super.assignFields(par, explorer);
483
		WMSDataParametersImpl p = null;
484
		if(par instanceof WMSDataParametersImpl)
485
			p = (WMSDataParametersImpl)par;
486
		else
487
			return;
488
		setFormat(p.getFormat());
489
		setFixedSize(p.getFixedSize());
490
		setHeight(p.getHeight());
491
		setWidth(p.getWidth());
492
		setExtent(p.getExtent());
493
		setURI(p.getURI());
494
		setInfoLayerQuery(p.getInfoLayerQuery());
495
		setLayerQuery(p.getLayerQuery());
496
		setName(getName());
497
		setOnlineResources((Map<String, String>)p.getDynValue(FIELD_ONLINERESOURC));
498
		setOverrideHost(p.isOverridingHost());
499
		setQueryable(p.isQueryable());
500
		setSRS(p.getSRSCode());
501
		setStyles(p.getStyles());
502
		setWmsTransparency(p.isWmsTransparent());
503
		setDimensions(p.getDimensions());
504
		setCancellable(p.getCancellable());
505
		setXyAxisOrder(p.isXyAxisOrder());
506
	}
507

  
508
	public boolean isXyAxisOrder() {
509
		Boolean b = (Boolean)getDynValue(FIELD_ASSUMEXYAXISORDER);
510
		if(b != null)
511
			return b.booleanValue();
512
		return false;
513
	}
514

  
515
	public void setXyAxisOrder(boolean assumeXY) {
516
		setDynValue(FIELD_ASSUMEXYAXISORDER, assumeXY);
517
	}
518
}
0 519

  
org.gvsig.raster.wms/tags/org.gvsig.raster.wms-2.2.14/org.gvsig.raster.wms.io/src/main/java/org/gvsig/raster/wms/io/DefaultWMSIOLibrary.java
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.wms.io;
23

  
24
import org.gvsig.i18n.Messages;
25
import org.gvsig.raster.wms.io.time.DefaultDimension;
26
import org.gvsig.raster.wms.io.time.TimeDimension;
27
import org.gvsig.tools.library.AbstractLibrary;
28
import org.gvsig.tools.library.LibraryException;
29
/**
30
 *
31
 * @author Nacho Brodin (nachobrodin@gmail.com)
32
 */
33
public class DefaultWMSIOLibrary extends AbstractLibrary {	
34

  
35
	/*public DefaultWMSIOLibrary() {
36
		super(DefaultWMSIOLibrary.class,Library.TYPE.IMPL);
37
		require(ToolsLibrary.class);
38
		require(DALLibrary.class);
39
		require(DALFileLibrary.class);
40
	}*/
41
	
42
	@Override
43
	protected void doInitialize() throws LibraryException {
44
		//RasterLibrary.wakeUp();
45
		WMSLayerNode.registerPersistent();
46
		RemoteWMSStyle.registerPersistent();
47
		DefaultDimension.registerPersistent();
48
		TimeDimension.registerPersistent();
49
		WMSDataParametersImpl.registerDynClass();
50
		
51
		Messages.addResourceFamily("org.gvsig.raster.wms.io.i18n.text",
52
				DefaultWMSIOLibrary.class.getClassLoader(),
53
				DefaultWMSIOLibrary.class.getClass().getName()); 
54
	}
55

  
56
	@Override
57
	protected void doPostInitialize() throws LibraryException {
58
		WMSServerExplorerParameters.registerDynClass();
59
		WMSDataParametersImpl.registerDynClass();
60
		WMSProvider.register();
61
	}
62
}
0 63

  
org.gvsig.raster.wms/tags/org.gvsig.raster.wms-2.2.14/org.gvsig.raster.wms.io/src/main/java/org/gvsig/raster/wms/io/WMSLayerNode.java
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.wms.io;
23

  
24
import java.awt.Dimension;
25
import java.util.ArrayList;
26
import java.util.List;
27

  
28
import org.gvsig.raster.wms.io.time.DefaultDimension;
29
import org.gvsig.raster.wms.io.time.RemoteTimeDimension;
30
import org.gvsig.raster.wms.io.time.TimeDimension;
31
import org.gvsig.tools.ToolsLocator;
32
import org.gvsig.tools.dynobject.DynStruct;
33
import org.gvsig.tools.persistence.PersistenceManager;
34
import org.gvsig.tools.persistence.Persistent;
35
import org.gvsig.tools.persistence.PersistentState;
36
import org.gvsig.tools.persistence.exception.PersistenceException;
37

  
38
/**
39
 * Class defining the node of the layer tree of a common WMS service.
40
 * @author jaume
41
 */
42
@SuppressWarnings("unchecked")
43
public class WMSLayerNode implements Persistent {
44
    private String                         _name              = null;
45
    private String                         _title             = null;
46
	private List<String>                   srs                = null;
47
    private boolean                        queryable;
48
    private boolean                        transparency;
49
    private String                         lAbstract          = null;
50
    private String                         latLonBox          = null;
51
    private int                            selectedStyleIndex = 0;
52
    private List<RemoteWMSStyle>           styles             = new ArrayList<RemoteWMSStyle>();
53
    private List<RemoteTimeDimension>      dimensions         = null;
54
    private List<String>                   keywords           = null;
55
    private List<WMSLayerNode>             children           = new ArrayList<WMSLayerNode>();
56
    private WMSLayerNode                   _parent            = null;
57
	private Dimension                      fixedSize          = null;
58
	
59
	public void loadFromState(PersistentState state) throws PersistenceException {
60
		this._name = state.getString("_name");
61
		this._title = state.getString("_title");
62
		this.srs = state.getList("srs");
63
		this.queryable = state.getBoolean("queryable");
64
		this.transparency = state.getBoolean("transparency");
65
		this.lAbstract = state.getString("lAbstract");
66
		this.latLonBox = state.getString("latLonBox");
67
		this.selectedStyleIndex = state.getInt("selectedStyleIndex");
68
		this.styles = state.getList("styles");
69
		this.dimensions = state.getList("dimensions");
70
		this.keywords = state.getList("keywords");
71
		this.children = state.getList("children");
72
		this._parent = (WMSLayerNode)state.get("_parent");
73
		this.fixedSize = (Dimension)state.get("fixedSize");
74
	}
75
	
76
	public void saveToState(PersistentState state) throws PersistenceException {
77
		state.set("_name", _name);
78
		state.set("_title", _title);
79
		state.set("srs", srs);
80
		state.set("queryable", queryable);
81
		state.set("transparency", transparency);
82
		state.set("lAbstract", lAbstract);
83
		state.set("latLonBox", latLonBox);
84
		state.set("selectedStyleIndex", selectedStyleIndex);
85
		state.set("styles", styles);
86
		state.set("dimensions", dimensions);
87
		state.set("keywords", keywords);
88
		state.set("children", children);
89
		state.set("_parent", _parent);
90
		state.set("fixedSize", fixedSize);
91
	}	
92
    
93
    public static void registerPersistent() {
94
		PersistenceManager manager = ToolsLocator.getPersistenceManager();
95
		DynStruct definition = manager.getDefinition("WMSLayerNode_Persistent");
96
		if( definition == null ) {
97
			definition = manager.addDefinition(
98
					WMSLayerNode.class,
99
					"WMSLayerNode_Persistent",
100
					"WMSLayerNode Persistence",
101
					null, 
102
					null
103
			);
104
		}
105

  
106
		definition.addDynFieldString("_name").setMandatory(false);
107
		definition.addDynFieldString("_title").setMandatory(false);
108
		definition.addDynFieldList("srs").setClassOfItems(String.class).setMandatory(false);
109
		definition.addDynFieldBoolean("queryable").setMandatory(false);
110
		definition.addDynFieldBoolean("transparency").setMandatory(false);
111
		definition.addDynFieldString("lAbstract").setMandatory(false);
112
		definition.addDynFieldString("latLonBox").setMandatory(false);		
113
		definition.addDynFieldInt("selectedStyleIndex").setMandatory(false);
114
		definition.addDynFieldList("styles").setClassOfItems(RemoteWMSStyle.class).setMandatory(false);
115
		definition.addDynFieldList("dimensions").setClassOfItems(RemoteTimeDimension.class).setMandatory(false);
116
		definition.addDynFieldList("keywords").setClassOfItems(String.class).setMandatory(false);
117
		definition.addDynFieldList("children").setClassOfItems(WMSLayerNode.class).setMandatory(false);
118
		definition.addDynFieldObject("_parent").setClassOfValue(WMSLayerNode.class).setMandatory(false);
119
		definition.addDynFieldObject("fixedSize").setClassOfValue(Dimension.class).setMandatory(false);
120
	}
121

  
122
	/**
123
     * @return Returns the name.
124
     */
125
    public String getName() {
126
        return _name;
127
    }
128

  
129
    public List<WMSLayerNode> getChildren() {
130
        return children;
131
    }
132

  
133
    /**
134
     * @param name The name to set.
135
     */
136
    public void setName(String name) {
137
        this._name = name;
138
    }
139

  
140
    /**
141
     * @return Returns the namedStyles.
142
     */
143
    public List<RemoteWMSStyle> getStyles() {
144
        return styles;
145
    }
146

  
147
    public List<String> getKeywords() {
148
    	return keywords;
149
    }
150
   
151
    /**
152
     * @return Returns the queryable.
153
     */
154
    public boolean isQueryable() {
155
        return queryable;
156
    }
157

  
158
    /**
159
     * @param queryable The queryable to set.
160
     */
161
    public void setQueryable(boolean queryable) {
162
        this.queryable = queryable;
163
    }
164
    
165
    /**
166
     * @return Returns the srs.
167
     */
168
    public List<String> getAllSrs() {
169
        if ((srs.size() == 0) && _parent!=null)
170
            return _parent.getAllSrs();
171
        return srs;
172
    }
173

  
174
    /**
175
     * @param srs The srs to set.
176
     */
177
    public void setSrs(List<String> srs) {
178
        this.srs = srs;
179
    }
180

  
181
    /**
182
     * @return Returns the title.
183
     */
184
    public String getTitle() {
185
        return _title;
186
    }
187

  
188
    public void setTitle(String title) {
189
        this._title = title.trim();
190
    }
191

  
192
    /**
193
     * @return Returns the transparency.
194
     */
195
    public boolean isTransparent() {
196
        return transparency;
197
    }
198

  
199
    /**
200
     * @param transparency The transparency to set.
201
     */
202
    public void setTransparency(boolean transparency) {
203
        this.transparency = transparency;
204
    }
205

  
206
    /**
207
     * Sets the list of sons of this layer.
208
     * @param children
209
     */
210
    public void setChildren(List<WMSLayerNode> children) {
211
        this.children = children;
212
    }
213

  
214
    public WMSLayerNode getParent() {
215
        return _parent;
216
    }
217
    
218
    public void setParent(WMSLayerNode parentNode) {
219
        this._parent = parentNode;
220
    }
221

  
222
    public List<RemoteTimeDimension> getDimensions() {
223
        return dimensions;
224
    }
225

  
226
    /**
227
     * Gets the layer abstract.
228
     *
229
     * @return Returns the abstract.
230
     */
231
    public String getAbstract() {
232
        return lAbstract;
233
    }
234

  
235
    /**
236
     * Sets the layer abstract.
237
     *
238
     * @param abstract The abstract to set.
239
     */
240
    public void setAbstract(String _abstract) {
241
        lAbstract = _abstract;
242
    }
243

  
244
    /**
245
     * @param name
246
     * @param units
247
     * @param unitSymbol
248
     * @param dimensionExpression
249
     */
250
    public void addDimension(String name, String units, String unitSymbol, String dimExpression) {
251
    	if (dimensions == null)
252
    		dimensions = new ArrayList<RemoteTimeDimension>();
253
    	if (name.equalsIgnoreCase("time")) {
254
    		try {
255
    			dimensions.add(new TimeDimension(units, unitSymbol,
256
    					dimExpression));
257
    		} catch (IllegalArgumentException e) {
258
    			// The TIME class does not yet support this kind of time so it
259
    			// will be treated as a DefaultDimension
260
    			dimensions.add(new DefaultDimension(name.toUpperCase(),
261
    					units, unitSymbol, dimExpression));
262
    		}
263
    	} else if (name.equalsIgnoreCase("sequence")) {
264
    		// TODO Not yet implemented
265
    		return;
266
    	} else {
267
    		dimensions.add(new DefaultDimension(name.toUpperCase(), units,
268
    				unitSymbol, dimExpression));
269
    	}
270

  
271
    }
272

  
273
    
274
    public void setLatLonBox(String _latLonBox) {
275
        latLonBox = _latLonBox;
276
    }
277

  
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff