/* Package GeoTools/WFS Implementation * Copyright (C) 2001 Cameron Shorter (camerons@users.sourceforge.net) * Artur Hefczyc (kobit@users.sourceforge.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Id: WFSLayer.java,v 1.2 2002/02/17 04:10:21 camerons Exp $ * $Author: camerons $ * $Date: 2002/02/17 04:10:21 $ */ package uk.ac.leeds.ccg.ogc; import uk.ac.leeds.ccg.geotools.*; import uk.ac.leeds.ccg.gml.*; import java.net.*; import java.util.*; import java.awt.*; import java.io.InputStream; /** * WFSLayer provides an interface to view map layers from Web Feature Services * (as defined by the Open GIS Consortium). * * @author Cameron Shorter * @author Artur Hefczyc * @version $Revision: 1.2 $ */ public class WFSLayer extends WebServiceLayer { /** Provides base URL and utils for WFS */ private WFSDataSource wfsDataSource; /** Extent of the layer */ private GeoRectangle bbox; private final static boolean DEBUG=true; /** * Construct a WFS Layer. * @param wfsDataSource all info except extent required to draw a WFS layer. */ public WFSLayer( WFSDataSource wfsDataSource) { if(DEBUG)System.out.println("WFSLayer created"); this.wfsDataSource=wfsDataSource; } /** Build a new layer based on the extent passed in. It gets called by * WebServices.PaintScaled(). * @param gg Graphical information required to build the layer. (In * particular, extent). */ public Layer buildLayer(GeoGraphics gg) { URL url; GeoRectangle extent = gg.getScale().getMapExtent(); Layer layer; wfsDataSource.setExtent(extent); url=wfsDataSource.getURL(); if (url!=null) { GML2Reader gml=new GML2Reader(url,wfsDataSource.getProxy()); layer=gml.getLayer(); } else { layer=null; } return layer; } public void paintScaled(GeoGraphics gg) { GeoRectangle extent; extent = gg.getScale().getMapExtent(); if (extent==null||extent.isEmpty()&&this.bbox!=null){ gg.getScale().setMapExtent(this.bbox,true); if(DEBUG)System.out.println("WFSLayer: setExent="+extent); } super.paintScaled(gg); } }