diff --git a/HISTORY.TXT b/HISTORY.TXT index d43403e361..fde2e34c6b 100644 --- a/HISTORY.TXT +++ b/HISTORY.TXT @@ -15,6 +15,8 @@ the CVS logs is updated daily at the following URL: CVS HEAD (4.9-dev) ------------------ +- Added webObj constructor and destructor to swig interface with + calls to initWeb and freeWeb (bug 1798). - mapows.c: ensure msOWSDispatch() is always available even if there are no services to dispatch. This makes mapscript binding easier. diff --git a/map.h b/map.h index e335504120..aed56ed8ab 100644 --- a/map.h +++ b/map.h @@ -28,6 +28,9 @@ ****************************************************************************** * * $Log$ + * Revision 1.454 2006/06/08 07:51:11 umberto + * webObj constructor and destructor (bug 1798) + * * Revision 1.453 2006/06/04 16:46:10 hobu * trim log so it only goes back to the beginning of 4.8 * @@ -1272,6 +1275,8 @@ MS_DLL_EXPORT int initStyle(styleObj *style); MS_DLL_EXPORT void initReferenceMap(referenceMapObj *ref); MS_DLL_EXPORT void initScalebar(scalebarObj *scalebar); MS_DLL_EXPORT void initGrid( graticuleObj *pGraticule ); +MS_DLL_EXPORT void initWeb(webObj *web); +MS_DLL_EXPORT void freeWeb(webObj *web); MS_DLL_EXPORT featureListNodeObjPtr insertFeatureList(featureListNodeObjPtr *list, shapeObj *shape); MS_DLL_EXPORT void freeFeatureList(featureListNodeObjPtr list); diff --git a/mapscript/java/data/emptymap.map b/mapscript/java/data/emptymap.map new file mode 100644 index 0000000000..1cb2a0ecef --- /dev/null +++ b/mapscript/java/data/emptymap.map @@ -0,0 +1,7 @@ +MAP + NAME "Niedersachsen" + EXTENT 3400000 5700000 3700000 6000000 + SIZE 500 500 + +END + diff --git a/mapscript/java/examples/RunTimeBuiltWMSClient.java b/mapscript/java/examples/RunTimeBuiltWMSClient.java new file mode 100644 index 0000000000..d000cc32f7 --- /dev/null +++ b/mapscript/java/examples/RunTimeBuiltWMSClient.java @@ -0,0 +1,74 @@ +import edu.umn.gis.mapscript.*; + +/** + This example demoes a wms client almost entirely configured + at run time and without the use of a map file. + TODO: remove the need for even a basic map file and do everything at run time + + @author: Nicole Herman, Umberto Nicoletti +*/ +public class wms_client_part { + public static void main(String[] args) { + // Not needed anymore since mapserver 4.4.x + //System.loadLibrary("mapscript"); + System.out.println(mapscript.msGetVersion()); + mapObj map; + webObj web; + imageObj bild; + + map = new mapObj("data/emptymap.map"); + /* + map.setWidth(400); + map.setHeight(400); + map.setDebug(1); + // map.setExtent(3280364,5237512,3921499,6103271); + map.setExtent(3400000,5700000,3700000,6000000); + // map.setExtent(3300000,5600000,3800000,6100000); + */ + map.setProjection("init=epsg:31467"); + map.setImageType("png"); + + outputFormatObj output = new outputFormatObj("gd/png", ""); + output.setName("png"); + output.setDriver("gd/png"); + output.setMimetype("image/png"); + output.setExtension("png"); + output.setImagemode(mapscript.MS_IMAGEMODE_RGB); + + + // Instanz des WebObjekts + web = new webObj(); + web.setImagepath("/tmp/"); + web.setImageurl("http://katrin/~nicol/mapserver/tmp/"); + web.setLog("/tmp/wms.log"); + web.setHeader("nh_header.html"); + web.setTemplate("../html/form.html"); + web.setEmpty("../themen/noFeature.html"); + + web.setMap(map); + map.setWeb(web); + System.out.println("ImagePath="+web.getImagepath()); + + + // Layer Objekt wird erzeugt + layerObj layer; + layer = new layerObj(map); + layer.setName("DUEKN5000"); + layer.setDebug(mapscriptConstants.MS_ON); + layer.setType(mapscript.MS_LAYER_RASTER); + layer.setConnectiontype(mapscript.MS_WMS); + // TODO: replace with a permanent url + layer.setConnection("http://www.mapserver.niedersachsen.de/freezoneogc/mapserverogc?"); + layer.setMetaData("wms_srs", "EPSG:31467"); + layer.setMetaData("wms_name", "DUEKN5000"); + layer.setMetaData("wms_server_version", "1.1.1"); + layer.setMetaData("wms_format","image/png"); + layer.setProjection("init=epsg:31467"); + layer.setStatus(mapscriptConstants.MS_ON); + + bild = map.draw(); + bild.save("test.png", map); + bild.delete(); + } +} + diff --git a/mapscript/mapscript.i b/mapscript/mapscript.i index 421a6b8411..dfb648e9e9 100644 --- a/mapscript/mapscript.i +++ b/mapscript/mapscript.i @@ -260,6 +260,7 @@ typedef struct { %include "../swiginc/owsrequest.i" %include "../swiginc/connpool.i" %include "../swiginc/msio.i" +%include "../swiginc/web.i" /* ============================================================================= diff --git a/mapscript/swiginc/web.i b/mapscript/swiginc/web.i new file mode 100644 index 0000000000..99471cf53d --- /dev/null +++ b/mapscript/swiginc/web.i @@ -0,0 +1,57 @@ +/* =========================================================================== + $Id$ + + Project: MapServer + Purpose: SWIG interface file for mapscript webObj extensions + Author: Steve Lime + Umberto Nicoletti unicoletti@prometeo.it + + =========================================================================== + Copyright (c) 1996-2001 Regents of the University of Minnesota. + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + =========================================================================== +*/ + + +%include "../../map.h" + +/* Constructor and destructor for webObj + http://mapserver.gis.umn.edu/bugs/show_bug.cgi?id=579 */ + +%extend webObj +{ + + webObj() + { + webObj *web; + web = (webObj *) malloc(sizeof(webObj)); + initWeb(web); + return web; + } + + ~webObj() + { + if (!self) return; + freeWeb(self); + free(self); + } +} + +