001: //=============================================================================
002: //=== Copyright (C) 2001-2007 Food and Agriculture Organization of the
003: //=== United Nations (FAO-UN), United Nations World Food Programme (WFP)
004: //=== and United Nations Environment Programme (UNEP)
005: //===
006: //=== This program is free software; you can redistribute it and/or modify
007: //=== it under the terms of the GNU General Public License as published by
008: //=== the Free Software Foundation; either version 2 of the License, or (at
009: //=== your option) any later version.
010: //===
011: //=== This program is distributed in the hope that it will be useful, but
012: //=== WITHOUT ANY WARRANTY; without even the implied warranty of
013: //=== MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: //=== General Public License for more details.
015: //===
016: //=== You should have received a copy of the GNU General Public License
017: //=== along with this program; if not, write to the Free Software
018: //=== Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
019: //===
020: //=== Contact: Jeroen Ticheler - FAO - Viale delle Terme di Caracalla 2,
021: //=== Rome - Italy. email: geonetwork@osgeo.org
022: //==============================================================================
023:
024: package org.wfp.vam.intermap.kernel.map.mapServices;
025:
026: import java.util.*;
027:
028: import org.jdom.*;
029:
030: import org.wfp.vam.intermap.kernel.map.mapServices.constants.MapServices;
031:
032: public abstract class MapService {
033: // Map server parameters
034: protected String serverUrl;
035: protected String name;
036:
037: // Map server generic information
038: protected Element info;
039:
040: protected Hashtable layers = new Hashtable();
041:
042: // Last response from the server
043: protected Element lastResponse = new Element(
044: MapServices.LAST_RESPONSE_TAG);
045:
046: /**
047: * Constructor
048: *
049: * @param url map server URL
050: * @param name map service name
051: * @param type map service type
052: *
053: */
054: public MapService(String mapServerUrl, String serviceName) {
055: serverUrl = mapServerUrl;
056: name = serviceName;
057: }
058:
059: /**
060: * Method getTitle
061: *
062: * @return a String
063: */
064: public String getTitle() {
065: return getName();
066: };
067:
068: public abstract int getType();
069:
070: public String getServerURL() {
071: return serverUrl;
072: }
073:
074: public String getName() {
075: return name;
076: }
077:
078: public Element getInfo() {
079: return (Element) info.clone();
080: }
081:
082: public abstract String getImageUrl(BoundingBox bBox, int width,
083: int height) throws ServiceException, Exception;
084:
085: public abstract String getLegendUrl() throws Exception;
086:
087: public abstract void identify(int layer, int x, int y, int width,
088: int height, int tolerance, String reqFormat)
089: throws Exception;
090:
091: // public abstract void getFieldValue(int layer, int x, int y, int width, int height, int tolerance, String fieldName) throws Exception;
092:
093: public Element getLastResponse() {
094: return (Element) lastResponse.clone();
095: }
096:
097: public abstract BoundingBox getDefBoundingBox() throws Exception;
098:
099: public abstract BoundingBox getBoundingBox();
100:
101: public abstract void setActiveLayer(int layer) throws Exception;
102:
103: public abstract int getActiveLayer();
104:
105: public abstract void setLayerVisible(String id, boolean visible);
106:
107: public abstract Vector getVisibleLayers();
108:
109: public abstract Element toElement();
110:
111: }
|