001 //$HeadURL: svn+ssh://jwilden@svn.wald.intevation.org/deegree/base/branches/2.5_testing/src/org/deegree/graphics/sld/UserLayer.java $ 002 /*---------------------------------------------------------------------------- 003 This file is part of deegree, http://deegree.org/ 004 Copyright (C) 2001-2009 by: 005 Department of Geography, University of Bonn 006 and 007 lat/lon GmbH 008 009 This library is free software; you can redistribute it and/or modify it under 010 the terms of the GNU Lesser General Public License as published by the Free 011 Software Foundation; either version 2.1 of the License, or (at your option) 012 any later version. 013 This library is distributed in the hope that it will be useful, but WITHOUT 014 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 015 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 016 details. 017 You should have received a copy of the GNU Lesser General Public License 018 along with this library; if not, write to the Free Software Foundation, Inc., 019 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 020 021 Contact information: 022 023 lat/lon GmbH 024 Aennchenstr. 19, 53177 Bonn 025 Germany 026 http://lat-lon.de/ 027 028 Department of Geography, University of Bonn 029 Prof. Dr. Klaus Greve 030 Postfach 1147, 53001 Bonn 031 Germany 032 http://www.geographie.uni-bonn.de/deegree/ 033 034 e-mail: info@deegree.org 035 ----------------------------------------------------------------------------*/ 036 package org.deegree.graphics.sld; 037 038 import static org.deegree.framework.xml.XMLTools.escape; 039 040 import org.deegree.framework.xml.Marshallable; 041 042 /** 043 * In addition to using named layers, it is also useful to be able to define custom user-defined 044 * layers for rendering. 045 * <p> 046 * </p> 047 * Since a layer is defined as a collection of potentially mixed-type features, the UserLayer 048 * element must provide the means to identify the features to be used. All features to be rendered 049 * are assumed to be fetched from a Web Feature Server (WFS) or a Web Coverage CapabilitiesService 050 * (WCS, in which case the term features is used loosely). 051 * 052 * 053 * @author <a href="mailto:k.lupp@web.de">Katharina Lupp</a> 054 * @author last edited by: $Author: mschneider $ 055 * @version $Revision: 18195 $ $Date: 2009-06-18 17:55:39 +0200 (Do, 18 Jun 2009) $ 056 */ 057 058 public class UserLayer extends AbstractLayer implements Marshallable { 059 060 private RemoteOWS remoteOWS = null; 061 062 /** 063 * constructor initializing the class with the <UserLayer> 064 * @param name 065 * @param layerFeatureConstraints 066 * @param userStyles 067 * @param remoteOWS 068 */ 069 public UserLayer( String name, LayerFeatureConstraints layerFeatureConstraints, AbstractStyle[] userStyles, 070 RemoteOWS remoteOWS ) { 071 super( name, layerFeatureConstraints, userStyles ); 072 setRemoteOWS( remoteOWS ); 073 } 074 075 /** 076 * the method returns a remote web service that enables the access to data that are not stored 077 * on same server as the WMS. 078 * 079 * @return the RemoteOWS 080 * 081 */ 082 public RemoteOWS getRemoteOWS() { 083 return remoteOWS; 084 } 085 086 /** 087 * sets the <RemoteOWS> 088 * 089 * @param remoteOWS 090 * the RemoteOWS 091 * 092 */ 093 public void setRemoteOWS( RemoteOWS remoteOWS ) { 094 this.remoteOWS = remoteOWS; 095 } 096 097 @Override 098 public String toString() { 099 String ret = getClass().getName() + "\n"; 100 ret = "remoteOWS = " + remoteOWS + "\n"; 101 102 return ret; 103 } 104 105 /** 106 * exports the content of the UserLayer as XML formated String 107 * 108 * @return xml representation of the UserLayer 109 */ 110 public String exportAsXML() { 111 112 StringBuffer sb = new StringBuffer( 5000 ); 113 sb.append( "<UserLayer>" ); 114 sb.append( "<Name>" ).append( escape( name ) ).append( "</Name>" ); 115 if ( remoteOWS != null ) { 116 sb.append( ( (Marshallable) remoteOWS ).exportAsXML() ); 117 } 118 119 sb.append( ( (Marshallable) layerFeatureConstraints ).exportAsXML() ); 120 121 for ( int i = 0; i < styles.size(); i++ ) { 122 sb.append( ( (Marshallable) styles.get( i ) ).exportAsXML() ); 123 } 124 sb.append( "</UserLayer>" ); 125 126 return sb.toString(); 127 } 128 }