<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html;charset=ISO-8859-15">
<title></title>
</head>
<body text="#000000" bgcolor="#ffffff">
thank you <br>
I followed the procedure you offered<br>
I can draw rubberband. But zooming is not still working. <br>
<br>
I will appreciate if you find what the wrong is ?<br>
<br>
regards<br>
<br>
here is the complete php code:<br>
<br>
<small><?php<br>
if (!extension_loaded('php_mapscript.so')) {<br>
if (!dl('php_mapscript.so')) {<br>
exit;<br>
}<br>
}<br>
<br>
$map_file="./kara.map";<br>
global $map;<br>
global $result;<br>
$map = ms_newMapObj($map_file);<br>
<br>
<br>
$jeolayer = $map->getLayerByName("jeo");<br>
$jeoClass0 = $jeolayer->getClass(9);<br>
$jeoStyle = $jeoClass0->getStyle("*");<br>
$jeoStyle->color->setRGB(0,255,0);<br>
$jeolayer ->set("status",1);<br>
<br>
if ( isset($HTTP_POST_VARS["mapa_x"]) &&
isset($HTTP_POST_VARS["mapa_y"])<br>
&& !isset($HTTP_POST_VARS["full"]) ) {<br>
<br>
<br>
$extent_to_set = explode(" ",$HTTP_POST_VARS["extent"]);<br>
<br>
$map->setextent($extent_to_set[0],$extent_to_set[1],<br>
$extent_to_set[2],$extent_to_set[3]);<br>
<br>
<br>
$my_extent = ms_newrectObj();<br>
<br>
$my_extent->setextent($extent_to_set[0],$extent_to_set[1],<br>
$extent_to_set[2],$extent_to_set[3]);<br>
<br>
$zoom_rect = ms_newRectObj();<br>
<br>
$zoom_rect->setextent($_POST["mapa_x"] -
$_POST["w"],$_POST["mapa_y"],<br>
$_POST["mapa_x"],$_POST["mapa_y"]-$_POST["h"]);<br>
<br>
<br>
$map->zoomrectangle($zoom_rect,$map->width,$map->height,$my_extent);<br>
<br>
}<br>
<br>
$image=$map->draw();<br>
$image_url=$image->saveWebImage();<br>
$extent_to_html = $map->extent->minx."
".$map->extent->miny." "<br>
.$map->extent->maxx."
".$map->extent->maxy;<br>
<br>
<br>
?><br>
<br>
<html><br>
<head><br>
<title>karabük</title><br>
<br>
<STYLE><br>
#rubberBand {<br>
position: absolute;<br>
visibility: hidden;<br>
width: 0px; height: 0px;<br>
border: 1px solid #ff0000;<br>
}<br>
</STYLE><br>
<br>
<SCRIPT><br>
<br>
function startRubber (evt) {<br>
if (document.all) {<br>
var r = document.all.rubberBand;<br>
r.style.width = 0;<br>
r.style.height = 0;<br>
r.style.pixelLeft = event.x;<br>
r.style.pixelTop = event.y;<br>
r.style.visibility = 'visible';<br>
}<br>
<br>
else if (document.layers) {<br>
var r = document.rubberBand;<br>
r.clip.width = 0; r.clip.height = 0;<br>
r.left = evt.x;<br>
r.top = evt.y;<br>
r.visibility = 'show';<br>
}<br>
<br>
else if (document.getElementById) {<br>
var r = document.getElementById('rubberBand');<br>
r.style.width = 0;<br>
r.style.height = 0;<br>
r.style.left = evt.clientX + 'px';<br>
r.style.top = evt.clientY + 'px';<br>
r.style.visibility = 'visible';<br>
}<br>
document.captureEvents(Event.MOUSEMOVE);<br>
document.onmousemove = moveRubber;<br>
}<br>
<br>
function moveRubber (evt) {<br>
if (document.all) {<br>
var r = document.all.rubberBand;<br>
r.style.width = event.x - r.style.pixelLeft - 2;<br>
r.style.height = event.y - r.style.pixelTop - 2;<br>
var f = document.forms('viewmap');<br>
f.w.value = r.style.width;<br>
f.h.value = r.style.height;<br>
}<br>
<br>
else if (document.layers) {<br>
var r = document.rubberBand;<br>
r.clip.width = evt.x - r.left - 2 ;<br>
r.clip.height = evt.y - r.top - 2;<br>
r.document.open();<br>
r.document.write('<table width="'<br>
+ r.clip.width + '" height="' + r.clip.height<br>
+ '"
BORDER="1"><tr><td><\/td><\/tr><\/table>');<br>
r.document.close();<br>
var f = document.forms('viewmap');<br>
f.w.value = r.clip.width;<br>
f.h.value = r.clip.height;<br>
}<br>
<br>
else if (document.getElementById) {<br>
var r = document.getElementById('rubberBand');<br>
r.style.width = evt.clientX - parseInt(r.style.left) - 2;<br>
r.style.height = evt.clientY - parseInt(r.style.top) - 2;<br>
var ht = document.getElementById('h');<br>
var wt = document.getElementById('w');<br>
wt.value = r.style.width;<br>
ht.value = r.style.height;<br>
}<br>
}<br>
<br>
function stopRubber (evt) {<br>
document.releaseEvents(Event.MOUSEMOVE);<br>
document.onmousemove = null;<br>
}<br>
<br>
</SCRIPT><br>
<br>
</head><br>
<br>
<body><br>
<br>
<CENTER><br>
<br>
<table cellpadding="1" cellspacing="1" border="1" ><br>
<FORM name="viewmap" id="viewmap" METHOD=POST ACTION=<?php echo<br>
$HTTP_SERVER_VARS['PHP_SELF']?>><br>
<tr><br>
<td colspan="4">zoom</td><br>
</tr><br>
<tr><br>
<td rowspan="3" colspan="2" width="50%"><br>
<br>
<input type="hidden" name="h" id="h" value="0" ><br>
<input type="hidden" name="w" id="w" value="0" ><br>
<br>
<input type="image" id="mapa" name="mapa"<br>
src="<?php echo $image_url?>"
onMouseDown="startRubber(event)"<br>
onMouseUp="stopRubber(event)" ><br>
</td><br>
<td width="5%"></td><br>
<td bgcolor="#ffffcc" > orkun </td><br>
<br>
</tr><br>
<tr><br>
<td></td><br>
<td bgcolor="#e8e9ea"> ORKUN </td><br>
<br>
</tr><br>
<tr><br>
<td><br>
<br>
</td><br>
<td><br>
<br>
</td><br>
<br>
</tr><br>
<tr><br>
<td>coordinat<td><br>
<td><td><br>
<br>
</tr><br>
<INPUT TYPE=HIDDEN NAME="extent" VALUE="<?php echo
$extent_to_html?>"><br>
</form><br>
<div id="rubberBand" name="rubberBand"></div><br>
<br>
</table><br>
<br>
</body><br>
<br>
</html></small><br>
<br>
<br>
<br>
Sandeep Bashyal wrote:<br>
<blockquote type="cite" cite="midopsf1xawdreanvnq@smtp.wlink.com.np">On
Fri, 15 Oct 2004 10:21:03 +0300, temiz <a class="moz-txt-link-rfc2396E" href="mailto:temiz@deprem.gov.tr"><temiz@deprem.gov.tr></a>
wrote:
<br>
<br>
<blockquote type="cite">hello Mr.Sandeep,
<br>
<br>
thank you for your help.
<br>
I have examined the javascript code you suggested.
<br>
Unfortunately I have also little knowledge about javascript. So, I
coudn't
<br>
manage to get rectangle coordinates drawn as rubberband.
<br>
I think getting coord. values is the way for zooming.
<br>
<br>
Do you have any idea about how coord values can get?
<br>
<br>
best wishes
<br>
<br>
Bashyal wrote:
<br>
<br>
<blockquote type="cite">On Thu, 14 Oct 2004 17:13:37 +0300, temiz
<a class="moz-txt-link-rfc2396E" href="mailto:temiz@DEPREM.GOV.TR"><temiz@DEPREM.GOV.TR></a> wrote:
<br>
<br>
<blockquote type="cite">hello
<br>
<br>
for zooming, I want to build rubberband.
<br>
How can I get an example which contain rubberband for zooming ?
<br>
<br>
kind regards
<br>
<br>
Ahmet temiz
<br>
<br>
<br>
______________________________________
<br>
Inflex - installed on mailserver for domain @deprem.gov.tr
<br>
Queries to: <a class="moz-txt-link-abbreviated" href="mailto:postmaster@deprem.gov.tr">postmaster@deprem.gov.tr</a>
<br>
<br>
______________________________________
<br>
The views and opinions expressed in this e-mail message are the
sender's
<br>
own
<br>
and do not necessarily represent the views and the opinions of
<br>
Earthquake Research Dept.
<br>
of General Directorate of Disaster Affairs.
<br>
<br>
Bu e-postadaki fikir ve gorusler gonderenin sahsina ait olup, yasal
<br>
olarak T.C.
<br>
B.I.B. Afet Isleri Gn.Mud. Deprem Arastirma Dairesi'ni baglayici
<br>
nitelikte degildir.
<br>
<br>
</blockquote>
<br>
Ahmet,
<br>
<br>
I've found the rubberband zoom box by Gayathri Swaminathan to be simple
<br>
and quite useful. You can download it here:
<br>
<a class="moz-txt-link-freetext" href="http://mapserver.gis.umn.edu/user_utilities/RBand.zip">http://mapserver.gis.umn.edu/user_utilities/RBand.zip</a>
<br>
Just call startRubber and stopRubber functions on mouseDown and mouseUp
<br>
events on the main map image and put hidden form elements containing
the
<br>
width and height of the "rubberband" layer.
<br>
<br>
Works pretty well for my limited knowledge of javascript and mapserver
:).
<br>
<br>
Regards.
<br>
<br>
-- Sandeep Bashyal
<br>
-- National GIS Officer
<br>
Humanitarian Assistance Information System (HAIS)
<br>
United Nations (NEP/01/008)
<br>
UN House, Pulchowk
<br>
G.P.O. Box 107
<br>
Kathmandu, Nepal
<br>
Tel: (+977) 01 5543957
<br>
(+977) 01 5554304
<br>
Cell:(+977) 9841270854
<br>
Fax: (+977) 01 5528059
<br>
--------------------------------------------------
<br>
<a class="moz-txt-link-freetext" href="mailto:gis@undphais.org.np">mailto:gis@undphais.org.np</a>
<br>
<a class="moz-txt-link-freetext" href="mailto:sandeep@earthmapping.com">mailto:sandeep@earthmapping.com</a>
<br>
<a class="moz-txt-link-freetext" href="http://www.undp.org.np">http://www.undp.org.np</a>
<br>
<br>
<br>
</blockquote>
<br>
<br>
______________________________________
<br>
Inflex - installed on mailserver for domain @deprem.gov.tr
<br>
Queries to: <a class="moz-txt-link-abbreviated" href="mailto:postmaster@deprem.gov.tr">postmaster@deprem.gov.tr</a>
<br>
<br>
______________________________________
<br>
The views and opinions expressed in this e-mail message are the
sender's own
<br>
and do not necessarily represent the views and the opinions of
Earthquake Research Dept.
<br>
of General Directorate of Disaster Affairs.
<br>
<br>
Bu e-postadaki fikir ve gorusler gonderenin sahsina ait olup, yasal
olarak T.C.
<br>
B.I.B. Afet Isleri Gn.Mud. Deprem Arastirma Dairesi'ni baglayici
nitelikte degildir.
<br>
<br>
<br>
</blockquote>
Ahmet,
<br>
<br>
I'm new to javascript too and could not quite understand how the
rubberband zoom box works in the included example file. This is how I
improvised:
<br>
<br>
Contents of rubberband.js:
<br>
---------------------------
<br>
function startRubber (evt) {
<br>
if (document.all) {
<br>
var r = document.all.rubberBand;
<br>
r.style.width = 0;
<br>
r.style.height = 0;
<br>
r.style.pixelLeft = event.x;
<br>
r.style.pixelTop = event.y;
<br>
r.style.visibility = 'visible';
<br>
}
<br>
<br>
else if (document.layers) {
<br>
var r = document.rubberBand;
<br>
r.clip.width = 0; r.clip.height = 0;
<br>
r.left = evt.x;
<br>
r.top = evt.y;
<br>
r.visibility = 'show';
<br>
}
<br>
<br>
else if (document.getElementById) {
<br>
var r = document.getElementById('rubberBand');
<br>
r.style.width = 0;
<br>
r.style.height = 0;
<br>
r.style.left = evt.clientX + 'px';
<br>
r.style.top = evt.clientY + 'px';
<br>
r.style.visibility = 'visible';
<br>
}
<br>
document.captureEvents(Event.MOUSEMOVE);
<br>
document.onmousemove = moveRubber;
<br>
}
<br>
<br>
function moveRubber (evt) {
<br>
if (document.all) {
<br>
var r = document.all.rubberBand;
<br>
r.style.width = event.x - r.style.pixelLeft - 2;
<br>
r.style.height = event.y - r.style.pixelTop - 2;
<br>
var f = document.forms('viewmap');
<br>
f.w.value = r.style.width;
<br>
f.h.value = r.style.height;
<br>
}
<br>
<br>
else if (document.layers) {
<br>
var r = document.rubberBand;
<br>
r.clip.width = evt.x - r.left - 2 ;
<br>
r.clip.height = evt.y - r.top - 2;
<br>
r.document.open();
<br>
r.document.write('<table width="'
<br>
+ r.clip.width + '" height="' + r.clip.height
<br>
+ '"
BORDER="1"><tr><td><\/td><\/tr><\/table>');
<br>
r.document.close();
<br>
var f = document.forms('viewmap');
<br>
f.w.value = r.clip.width;
<br>
f.h.value = r.clip.height;
<br>
}
<br>
<br>
else if (document.getElementById) {
<br>
var r = document.getElementById('rubberBand');
<br>
r.style.width = evt.clientX - parseInt(r.style.left) - 2;
<br>
r.style.height = evt.clientY - parseInt(r.style.top) - 2;
<br>
var ht = document.getElementById('h');
<br>
var wt = document.getElementById('w');
<br>
wt.value = r.style.width;
<br>
ht.value = r.style.height;
<br>
}
<br>
}
<br>
<br>
function stopRubber (evt) {
<br>
document.releaseEvents(Event.MOUSEMOVE);
<br>
document.onmousemove = null;
<br>
}
<br>
<br>
Contents of the form:
<br>
---------------------------------------------------
<br>
<form name="viewmap" id="viewmap" method="post"
<br>
action="<?php echo $HTTP_SERVER_VARS['PHP_SELF'] ?>">
<br>
<input type="hidden" name="h" id="h" value="0" />
<br>
<input type="hidden" name="w" id="w" value="0" />
<br>
<input type="image" id="mapa" name="mapa"
<br>
src="<?php echo $image_url?>"
onMouseDown="startRubber(event)"
<br>
onMouseUp="stopRubber(event)" />
<br>
</form>
<br>
<div id="rubberBand" name="rubberBand"></div>
<br>
<br>
Zooming to rectangle (I'm using php mapscript):
<br>
-----------------------------------------------------
<br>
$zoom_rect = ms_newRectObj();
<br>
$zoom_rect->setextent($_POST["mapa_x"] -
$_POST["w"],$_POST["mapa_y"],
<br>
$_POST["mapa_x"],$_POST["mapa_y"]-$_POST["h"]);
<br>
$map->zoomrectangle($zoom_rect,$map->width,$map->height,$current_extent);
<br>
//where $current_extent is a rectangular object with the current extent
of the map.
<br>
<br>
Hope this helps a bit. I've tested it on IE6, NS7, Opera7.5 and
Firefox0.93.
<br>
<br>
Regards.
<br>
</blockquote>
<BR><PRE>
______________________________________
Inflex - installed on mailserver for domain @deprem.gov.tr
Queries to: postmaster@deprem.gov.tr
______________________________________
The views and opinions expressed in this e-mail message are the sender's own
and do not necessarily represent the views and the opinions of Earthquake Research Dept.
of General Directorate of Disaster Affairs.
Bu e-postadaki fikir ve gorusler gonderenin sahsina ait olup, yasal olarak T.C.
B.I.B. Afet Isleri Gn.Mud. Deprem Arastirma Dairesi'ni baglayici nitelikte degildir.
</pre><BR></body>
</html>