Commit a15394f59cb37d1b64bb65439409ecc664ccf2d0

Authored by Edmar Moretti
1 parent fe22e2de

--no commit message

classesphp/lews/index.php
... ... @@ -1,64 +0,0 @@
1   -<HTML>
2   -<HEAD>
3   -<TITLE>PHP WMS Client</TITLE>
4   -<LINK REL='stylesheet' TYPE='text/css' HREF='wms_style.css'>
5   -</HEAD>
6   -<BODY BGCOLOR=#FFFFFF>
7   -
8   -<H1>PHP WMS Client</H1>
9   -
10   -<P>This client uses the XML capabilities of PHP and standard web application
11   -programming techniques to present an HTML/JavaScript view of
12   -<A HREF='http://www.opengis.org'>OpenGIS</A> Web Map Server (WMS) internet
13   -mapping servers.</P>
14   -
15   -<H2>Test Servers</H2>
16   -
17   -<P>Our goal is to "do the right thing" with all these servers. It will be
18   -a long hard road.</P>
19   -
20   -<?
21   -
22   -$servers = array(
23   -
24   - array("Refractions USA","http://office.refractions.net/ms/cgi-bin/mapserv?map=/home/httpd/mapserver/html/usa/usa.map&","Good"),
25   - array("Refractions PostGIS","http://mapserver.refractions.net/cgi-bin/mapserv?map=/home/www/mapserv/maps/postgis.map&","OK"),
26   - array("CubeWerx World","http://www.cubewerx.com/demo/cubeserv/cubeserv.cgi?","Bad"),
27   - array("DMSolutions GMAP","http://www2.dmsolutions.ca/cgi-bin/mswms_gmap?","Good")
28   -);
29   -
30   -print "<TABLE WIDTH=100% BORDER=1 CELLPADDING=5>";
31   -print "<TR BGCOLOR=#EEEEEE><TH>WMS Site</TH><TH>Online Resource URL</TH><TH>Status</TH></TR>";
32   -foreach ( $servers as $s ) {
33   - $hurl = urlencode($s[1]);
34   - print "<TR><TH ALIGN=CENTER>$s[0]</TH><TD><A HREF='wms.php?onlineresource=$hurl'>$s[1]</A></TD><TD>$s[2]</TD></TR>";
35   -}
36   -
37   -?>
38   -
39   -<FORM ACTION='wms.php' METHOD='get'>
40   -<TR>
41   - <TH ALIGN=RIGHT>Enter a Server</TH>
42   - <TD COLSPAN=2><INPUT NAME='onlineresource' TYPE='text' SIZE='50'>
43   - <INPUT TYPE='submit' VALUE=' Try Server '></TD>
44   -</TR>
45   -</FORM>
46   -
47   -</TABLE>
48   -
49   -
50   -<H2>To Do List</H2>
51   -
52   -<UL>
53   -<LI>Properly handle heirarchical &lt;Layer&gt; objects and provide a
54   -tree-based layer list.
55   -<LI>Enable and disable layer entries appropriately based on the
56   -&lt;ScaleHint&gt; provided for &lt;Layer&gt;s.
57   -<LI>Continue to test against new and unknown WMS servers to obtain maximum
58   -compatibility.
59   -<LI>Aesthetic improvements to the interface. Graphical mode selectors,
60   -rollovers, highlighting. "Themability" of the interface.
61   -</UL>
62   -
63   -</BODY>
64   -</HTML>
classesphp/lews/wms.php
... ... @@ -1,129 +0,0 @@
1   -<HTML>
2   -<HEAD>
3   -<TITLE>WMS</TITLE>
4   -<LINK REL="stylesheet" TYPE="text/css" HREF="wms_style.css">
5   -<SCRIPT LANGUAGE='JavaScript'>
6   -
7   -function doSetup() {
8   - //
9   - // Initialize the mapframe variables for future wraparound, copying
10   - // data out of layerframe, which read the information from the
11   - // XML capabilities file.
12   - //
13   - var flds = new Array( "bbox", "format", "mode", "width", "height", "srs", "onlineresource" );
14   - for ( i = 0; i < flds.length; i++ ) {
15   - mapframe.document.mapform.elements[flds[i]].value =
16   - layerframe.document.layerform.elements[flds[i]].value;
17   - }
18   - //
19   - // Read the mapframe size and set the state variables.
20   - //
21   - doSize();
22   - //
23   - // Have the layerframe initiate the first update. This gets all
24   - // the layer states to match the form values.
25   - //
26   - layerframe.toggle();
27   -}
28   -
29   -function doSize() {
30   - //
31   - // Read the mapframe size using javascript and set the
32   - // width and height variables in the mapframe.
33   - //
34   - var width = 500;
35   - var height = 500;
36   - //
37   - // IE has different ways of reading frame size.
38   - //
39   - if( navigator.appName.indexOf('Microsoft') != -1 ) { // IE
40   - if ( window.createPopup ) { // IE >= 5.5
41   - width = top.mapframe.frameElement.clientWidth;
42   - height = top.mapframe.frameElement.clientHeight;
43   - } else { // IE < 5.5
44   - width = top.mapframe.document.body.clientWidth;
45   - height = top.mapframe.document.body.clientHeight;
46   - }
47   - }
48   - //
49   - // Other browsers are fairly consistent.
50   - //
51   - else { // Not IE
52   - width = top.mapframe.innerWidth;
53   - height = top.mapframe.innerHeight;
54   - }
55   - //
56   - // Set the size state values in the mapframe.
57   - //
58   - mapframe.document.mapform.width.value = width;
59   - mapframe.document.mapform.height.value = height;
60   -}
61   -
62   -function doResize() {
63   - //
64   - // On a resize event, read the new size, then
65   - // redraw the map.
66   - //
67   - doSize();
68   - mapframe.document.mapform.submit();
69   -}
70   -
71   -</SCRIPT>
72   -<SCRIPT LANGUAGE='JavaScript'>
73   -
74   -//
75   -// Netscape 4 event handling requires us to capture
76   -// the resize event at the top.
77   -//
78   -if ( navigator.appName.indexOf('Netscape') != -1 ) {
79   - self.captureEvents( Event.RESIZE );
80   -}
81   -
82   -//
83   -// Set some event handlers.
84   -//
85   -self.onload = doSetup;
86   -self.onresize = doResize;
87   -
88   -</SCRIPT>
89   -</HEAD>
90   -
91   -<FRAMESET
92   - border=1
93   - rows=55,*
94   - framespacing=0
95   - >
96   -
97   - <FRAME
98   - name=titleframe
99   - frameBorder=Yes
100   - scrolling=No
101   - src="wms_titleframe.php"
102   - >
103   -
104   - <FRAMESET
105   - border=1
106   - cols=250,*
107   - frameSpacing=0
108   - >
109   -
110   - <FRAME
111   - name=layerframe
112   - frameBorder=Yes
113   - scrolling=Yes
114   - src="wms_layerframe.php?onlineresource=<? echo urlencode($_GET['onlineresource']) ?>"
115   - >
116   - <FRAME
117   - name=mapframe
118   - frameBorder=Yes
119   - marginHeight=0
120   - marginWidth=0
121   - scrolling=No
122   - src="wms_mapframe.php"
123   - >
124   -
125   - </FRAMESET>
126   -
127   -</FRAMESET>
128   -
129   -</HTML>
classesphp/lews/wms_layerframe.php
... ... @@ -1,99 +0,0 @@
1   -<HTML>
2   -<HEAD>
3   -<LINK REL='stylesheet' TYPE='text/css' HREF='wms_style.css'>
4   -
5   -<SCRIPT LANGUAGE='JavaScript'>
6   -
7   -function toggle(event) {
8   - var lyrs = new Array();
9   - var qlyrs = new Array();
10   - for( i = 0; i < document.layerform.elements.length; i++ ) {
11   - if( document.layerform.elements[i].name == "checks" ) {
12   - if( document.layerform.elements[i].checked ) {
13   - lyrs.push(document.layerform.elements[i].value);
14   - if( eval("document.layerform.query_" + document.layerform.elements[i].value + ".value") ) {
15   - qlyrs.push(document.layerform.elements[i].value);
16   - }
17   - }
18   - }
19   - }
20   - top.mapframe.document.mapform.layers.value = lyrs.join(",");
21   - top.mapframe.document.mapform.qlayers.value = qlyrs.join(",");
22   - top.mapframe.doSubmit();
23   -}
24   -
25   -</SCRIPT>
26   -
27   -</HEAD>
28   -<BODY>
29   -
30   -<?
31   -
32   -
33   -# -------------------------------------------------------------
34   -# Import the WMS support functions for PHP. These are mostly responsible for
35   -# handling the XML capabilities request, and creating appropriate JavaScript
36   -# objects from that data.8
37   -#
38   -# PHP functions are also used to generate the query result page.
39   -#
40   -include("wms_functions.php");
41   -
42   -# -------------------------------------------------------------
43   -# Test that there is a wms service defined before proceding.
44   -#
45   -if ( ! $onlineresource ) {
46   - # No WMS service provided.
47   - wms_fatal("No 'onlineresource' defined.");
48   - }
49   -
50   -$wms_service_request = $onlineresource . "REQUEST=GetCapabilities&SERVICE=WMS";
51   -
52   -
53   -# -------------------------------------------------------------
54   -# Test that the capabilites file has successfully downloaded.
55   -#
56   -if( !($wms_capabilities = file($wms_service_request)) ) {
57   - # Cannot download the capabilities file.
58   - wms_fatal("Unable to retrieve capabilities file '$wms_service_request'.");
59   -}
60   -
61   -$wms_capabilities = implode("",$wms_capabilities);
62   -
63   -# -------------------------------------------------------------
64   -# Test that the capabilites file has successfully parsed.
65   -#
66   -if( !($dom = xmldoc($wms_capabilities)) ) {
67   - # Cannot parse the capabilities file.
68   - wms_fatal("Unable to parse capabilities file from '$onlineresource'.<P>" . xml2html($wms_capabilities));
69   -}
70   -
71   -# -------------------------------------------------------------
72   -# Create the JavaScript map object and layer objects.
73   -# Set the layer objects to have a valid reference to the map object.
74   -#
75   -#print xml2html($wms_capabilities); exit;
76   -print "<H1>" . wms_title($dom) . "</H1>";
77   -print "<FORM NAME='layerform'>";
78   -foreach (wms_layers($dom) as $layer) {
79   - print wms_layer2html($layer);
80   -}
81   -$bbox = wms_bbox($dom);
82   -print wms_hidden("bbox",$bbox);
83   -print wms_hidden("format","image/png");
84   -print wms_hidden("mode","PAN");
85   -print wms_hidden("width","500");
86   -print wms_hidden("height","500");
87   -print wms_hidden("onlineresource",$onlineresource);
88   -print wms_hidden("srs",wms_srs($dom));
89   -print "</FORM>";
90   -$bbox = explode(",",$bbox);
91   -print "<TABLE BORDER=0 WIDTH=100% CELLPADDING=3>";
92   -print "<TR VALIGN=TOP><TH CLASS=SMALL ALIGN=RIGHT>BBOX:</TH><TD CLASS=SMALL>LL $bbox[0],$bbox[1]<BR> UR $bbox[2],$bbox[3]</TD></TR>";
93   -print "<TR VALIGN=TOP><TH CLASS=SMALL ALIGN=RIGHT>SRS:</TH><TD CLASS=SMALL>".wms_srs($dom)."</TD></TR>";
94   -print "</TABLE>";
95   -
96   -?>
97   -
98   -</BODY>
99   -</HTML>
classesphp/lews/wms_mapframe.php
... ... @@ -1,156 +0,0 @@
1   -<HTML>
2   -<HEAD>
3   -<LINK REL='stylesheet' TYPE='text/css' HREF='wms_style.css'>
4   -<SCRIPT LANGUAGE='JavaScript'>
5   -
6   -function doQuery() {
7   - //
8   - // If we are in query mode, we want a new window
9   - // to submit the form into.
10   - //
11   - var win_size = "width=280,height=450";
12   - var win_frame = "status=no,menubar=no,toolbar=no,resizeable=yes,scrollbars=yes";
13   - window.qwin = open("","queryframe",win_size + "," + win_frame);
14   - window.qwin.focus();
15   - return(true);
16   -}
17   -
18   -function doSubmit() {
19   - //
20   - // This function takes submissions from the layer list and
21   - // ensures they go to the right target if we happen to be
22   - // in query mode at the time.
23   - //
24   - if ( document.mapform.mode.value == "qry" ) {
25   - document.mapform.action = "wms_mapframe.php";
26   - document.mapform.target = "mapframe";
27   - }
28   - document.mapform.submit();
29   -}
30   -
31   -function setMode(mode) {
32   - //
33   - // This takes mode changes from the titleframe and handles
34   - // the interface state appropriately.
35   - //
36   - document.mapform.mode.value = mode;
37   - if ( mode == "qry" ) {
38   - //
39   - // Set the target and action appropriately for query mode.
40   - //
41   - document.mapform.onsubmit = doQuery;
42   - document.mapform.action = "wms_query.php";
43   - document.mapform.target = "queryframe";
44   - }
45   - else {
46   - //
47   - // Set the target and action appropriately for other modes.
48   - //
49   - document.mapform.action = "wms_mapframe.php";
50   - document.mapform.onsubmit = null;
51   - document.mapform.target = "mapframe";
52   - if( window.qwin != null ) {
53   - window.qwin.close();
54   - }
55   - }
56   - if ( mode == "all" ) {
57   - document.mapform.submit();
58   - }
59   -}
60   -
61   -
62   -</SCRIPT>
63   -</HEAD>
64   -<BODY TOPMARGIN=0 BOTTOMMARGIN=0 RIGHTMARGIN=0 LEFTMARGIN=0>
65   -<FORM NAME='mapform' TARGET='mapframe' METHOD='post' ACTION='wms_mapframe.php'>
66   -
67   -<?
68   -
69   -include("wms_functions.php");
70   -
71   -if ( $_POST["onlineresource"] ) {
72   -
73   - $size = array($_POST["width"],$_POST["height"]);
74   - $bbox = explode(",",$_POST["bbox"]);
75   -
76   - if( $_POST["mapimg_x"] && $_POST["mapimg_y"] ) {
77   -
78   - $click = array($_POST["mapimg_x"],$_POST["mapimg_y"]);
79   -
80   - if( $_POST["mode"] == "pan" ) {
81   - $bbox = wms_pan( $bbox, $size, $click );
82   - }
83   - elseif( $_POST["mode"] == "zin" ) {
84   - $bbox = wms_pan( $bbox, $size, $click );
85   - $bbox = wms_zoom( $bbox, 0.5 );
86   - }
87   - elseif( $_POST["mode"] == "zout" ) {
88   - $bbox = wms_pan( $bbox, $size, $click );
89   - $bbox = wms_zoom( $bbox, 2.0 );
90   - }
91   - }
92   -
93   - #
94   - # We are in zoom-to-extents mode, to override current
95   - # extent with saved original extent. Then switch to
96   - # the default mode (pan).
97   - #
98   - if( $_POST["mode"] == "all" ) {
99   - $bbox = explode(",",$_POST["bbox0"]);
100   - $_POST["mode"] = "pan";
101   - }
102   - #
103   - # Resize the spatial extents to match the image
104   - # aspect.
105   - #
106   - $bbox = wms_scale( $bbox, $size );
107   - $_POST["bbox"] = implode(",",$bbox);
108   - #
109   - # Store the initial extent for future use.
110   - #
111   - if( ! $_POST["bbox0"] ) {
112   - $_POST["bbox0"] = $_POST["bbox"];
113   - }
114   - #
115   - # Create the GETMAP URL.
116   - #
117   - $url = $_POST["onlineresource"] .
118   - "VERSION=" . urlencode("1.1.0") . "&" .
119   - "REQUEST=GetMap&" .
120   - "BBOX=" . urlencode($_POST["bbox"]) . "&" .
121   - "LAYERS=" . urlencode($_POST["layers"]) . "&" .
122   - "SRS=" . urlencode($_POST["srs"]) . "&" .
123   - "WIDTH=" . urlencode($_POST["width"]) . "&" .
124   - "HEIGHT=" . urlencode($_POST["height"]) . "&" .
125   - "FORMAT=" . urlencode($_POST["format"]);
126   - #
127   - # Get the map image.
128   - #
129   - print "<INPUT BORDER=0 TYPE='image' NAME='mapimg' SRC='$url'>";
130   -
131   -}
132   -
133   -#
134   -# Fill out the wraparound information. This saves the state of the
135   -# system for use in the next action.
136   -#
137   -$wms_vars = array("bbox","format","width","height","layers","mode","srs","onlineresource","bbox0","qlayers");
138   -foreach ( $wms_vars as $var ) {
139   - print wms_hidden($var,$_POST[$var]);
140   -}
141   -
142   -?>
143   -
144   -</FORM>
145   -<SCRIPT LANGUAGE='JavaScript'>
146   -//
147   -// A silly hack to ensure that if we are in query mode the
148   -// form target and action correspond to the query mode.
149   -//
150   -if ( document.mapform.mode.value == "qry" ) {
151   - document.mapform.target = "queryframe";
152   - document.mapform.action = "wms_query.php";
153   -}
154   -</SCRIPT>
155   -</BODY>
156   -</HTML>
classesphp/lews/wms_titleframe.php
... ... @@ -1,75 +0,0 @@
1   -<HTML>
2   -<HEAD>
3   -<LINK REL='stylesheet' TYPE='text/css' HREF='wms_style.css'>
4   -</HEAD>
5   -<SCRIPT LANGUAGE='JavaScript'>
6   -function doClick(mode) {
7   - //
8   - // Ensure that buttons behave the way we want. When we
9   - // get graphical buttons, this behavior will still exist,
10   - // but the javascript will be more complex with rollovers
11   - // and so on.
12   - //
13   - if( mode == "all" ) {
14   - //
15   - // If zooming to all, set the mode back to the default
16   - // mode (pan) right away, then initiate the action.
17   - //
18   - top.mapframe.setMode(mode);
19   - mode = "pan";
20   - }
21   - //
22   - // Blank all modes then set the mode to the current one.
23   - //
24   - for ( var i = 0; i < document.controls.elements.length; i++ ) {
25   - document.controls.elements[i].checked = false;
26   - }
27   - eval("document.controls." + mode + ".checked = true");
28   - //
29   - // Pass the mode on through.
30   - //
31   - top.mapframe.setMode(mode);
32   - return false;
33   -}
34   -</SCRIPT>
35   -<BODY>
36   -<FORM NAME=controls>
37   -
38   -<TABLE WIDTH=100% BORDER=0>
39   -<TR>
40   -<TD ALIGN=LEFT><A HREF="index.php" TARGET="_top">Home</A></TD>
41   -<TD ALIGN=RIGHT>
42   -<INPUT
43   - TYPE=radio
44   - NAME=all
45   - onClick='doClick("all")'
46   - > ALL
47   -<INPUT
48   - TYPE=radio
49   - NAME=pan
50   - CHECKED
51   - onClick='doClick("pan")'
52   - > PAN
53   -<INPUT
54   - TYPE=radio
55   - NAME=zin
56   - onClick='doClick("zin")'
57   - > ZIN
58   -<INPUT
59   - TYPE=radio
60   - NAME=zout
61   - onClick='doClick("zout")'
62   - > ZOUT
63   -<INPUT
64   - TYPE=radio
65   - NAME=qry
66   - onClick='doClick("qry")'
67   - > QRY
68   -</TD>
69   -</TR>
70   -</TABLE>
71   -
72   -</FORM>
73   -
74   -</BODY>
75   -</HTML>