MapTools.org

[Chameleon] Form Elements

Rene Teniere TENIERER@gov.ns.ca
Mon, 09 Feb 2004 15:41:20 -0400
I have added this piece of code under myOnLoad() function:
function showExtents()
{
  x1 = goCWCJSAPI.oMap.minx + 1000;
  y1 = goCWCJSAPI.oMap.miny + 1000;
  x2 = goCWCJSAPI.oMap.maxx - 1000;
  y2 = goCWCJSAPI.oMap.maxy - 1000;
  alert(x1+' '+y1+' '+x2+' '+y2);

  goCWCJSAPI.oMap.SetExtents(x1,y1,x2,y2);
  goCWCJSAPI.oMap.Refresh();

  x1 = goCWCJSAPI.oMap.minx;
  y1 = goCWCJSAPI.oMap.miny;
  x2 = goCWCJSAPI.oMap.maxx;
  y2 = goCWCJSAPI.oMap.maxy;
  alert(x1+' '+y1+' '+x2+' '+y2);
}
I am using this as a test to try and get familiar with this method. It
only works up till goCWCJSAPI.oMap.SetExtents(x1,y1,x2,y2);. Am I going
about this the right way? Like I say, the ultimate goal is to load up
the page using a set of custom extents each time.

Rene

>>> "Rene  Teniere " <TENIERER@gov.ns.ca> 2004-02-09 2:49:49 PM >>>
Is there any way to do it through HTML? All of my extents are through
a
JS variable. Here is my html file to give you reference:

<cwc2 type="SharedResource" name="projection">
    <projection name="NAD 83 / Geographic" srs="epsg:4269"/>
    <projection name="WGS 84 / Geographic" srs="epsg:4326"/>
    <projection name="WGS 84 / Auto UTM" srs="AUTO:42001"/>
    <projection name="WGS 84 / Auto Tr. Mercator" srs="AUTO:42002"/>
    <projection name="WGS 84 / Auto Orthographic" srs="AUTO:42003"/>
    <projection name="WGS 84 / Auto Equirectangular"
srs="AUTO:42004"/>
    <projection name="WGS 84 / LCC Canada" srs="epsg:42101"/>
    <projection name="NAD 83 / NRCan LCC Canada" srs="epsg:42304"/>
    <projection name="NAD 83 / UTM Zone 20" srs="epsg:2038"
default="true"/>
</cwc2>

<!-- defaults for textbuttons-->
<cwc2 type="SharedResource" name="TextButton">
    <textbuttoncolor value="d9d9d9"/>
    <textbuttonwidth value="90"/>
    <textbuttonheight value="24"/>
    <textbuttonbackgroundimage value=""/>
    <textbuttonborder_topleft_image
value="c:/chameleon11a/websites/wap/images/tl_2.png"/>
    <textbuttonborder_top_image
value="c:/chameleon11a/websites/wap/images/t_2.png"/>
    <textbuttonborder_topright_image
value="c:/chameleon11a/websites/wap/images/tr_2.png"/>
    <textbuttonborder_right_image
value="c:/chameleon11a/websites/wap/images/r_2.png"/>
    <textbuttonborder_bottomright_image
value="c:/chameleon11a/websites/wap/images/br_2.png"/>
    <textbuttonborder_bottom_image
value="c:/chameleon11a/websites/wap/images/b_2.png"/>
    <textbuttonborder_bottomleft_image
value="c:/chameleon11a/websites/wap/images/bl_2.png"/>
    <textbuttonborder_left_image
value="c:/chameleon11a/websites/wap/images/l_2.png"/>
    <textbuttonpadding value="2"/>
    <textbuttonnudge value="0"/>
    <labelcolor value="111111"/>
    <labelfont value="c:/chameleon11a/etc/arialbd.ttf"/>
    <labelalign value="left"/>
    <labelfontsize value=11"/>
    <labelantialias value="true"/>
    <usetextbuttoncache value="false"/>
</cwc2>

<cwc2 type="SharedResource" name="WaitImage">
    <waitimage language="en-CA" waitimage="images/spinner.gif"
waitimagewidth="216" waitimageheight="50"/>
    <waitimage language="fr-CA" waitimage="images/spinner_f.gif"
waitimagewidth="216" waitimageheight="50"/>
</cwc2>

<html>
<head>
<title>Parcel Sketch Map</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">

<script language="JavaScript">
function myOnLoad()
{
  CWC2OnLoadFunction();
}

function getCookie(name)
{
  var labelLen = name.length;
  var cookieData = document.cookie;
  var cLen = cookieData.length;
  var i = 0;
  var cEnd;
  while (i < cLen)
  {
    var j = i + labelLen;
    if(cookieData.substring(i,j) == name)
    {
      cEnd = cookieData.indexOf(";",j);
      if(cEnd == -1)
      {
        cEnd = cookieData.length;
      }
      return unescape(cookieData.substring(j+1, cEnd));
    }
    i = i + 1;
  }
  return "";
}

var jsUID = getCookie("cUID");
var jsTRTCDE = getCookie("cTRTCDE");
var sExtents = getCookie("cExtents");
var jsTempExtents = new Array();
var jsExtents = new Array();
jsTempExtents = sExtents.split(",");

for(j=0; j<4; j=j+1)
{
  jsExtents[j] = Math.round(jsTempExtents[j]);
}
</script>

<link rel="stylesheet" href="cwc2.css" type="text/css">
<link rel="stylesheet" href="popup.css" type="text/css">
</head>

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"
onLoad="myOnLoad()">
  <form method="post" action="index.phtml">
    <tr><!-- InstanceBeginEditable name="header" -->
      <td>
        <table>
          <tr>
            <td border="0" valign="top" cellpadding="0"
cellspacing="0">
              <table>
                <tr>
                  <td>
                  <SCRIPT LANGUAGE="JavaScript">
                  document.writeln('<input type="button" value="Print
Map" onclick="window.print()">');
                  document.writeln('</td>');
                  document.writeln('<td>');
                  document.writeln('<input type="button" value="Close"
onclick="window.close()">');
                  </SCRIPT>
                  </td>
                </tr>
              </table>
            </td>
          </tr>
          <tr>
            <td>
              <table>
                <tr>
                  <td>
                  <SCRIPT LANGUAGE="JavaScript">
                  document.writeln('<font color="Black" face="Arial,
Helvetica, sans-serif" size=2><b>UID Number:</b>&nbsp;' + jsUID +
'</font>');
                  document.writeln('</td>');
                  document.writeln('<td width="5">');
                  document.writeln('</td>');
                  document.writeln('<td border="0" cellpadding="0"
cellspacing="0">');
                  document.writeln('<font color="Black" face="Arial,
Helvetica, sans-serif" size=2><b>Treatment Code:</b>&nbsp;' + jsTRTCDE
+
'</font>');
                  </SCRIPT>
                  </td>
                </tr>
              </table>
            </td>
          </tr>
          <tr>
            <td>
              <table border="1" align="left" valign="top"
cellpadding="0" cellspacing="0">
                <tr>
                  <td border="1" align="center">
                    <cwc2 type="MapDHTMLWidget" visible="true"
width="800" height="600"/>
                  </td>
                </tr>
              </table>
            </td>
          </tr>
          <tr>
            <td>
              <table border="0" align="left" valign="top"
cellpadding="0" cellspacing="0">
                <tr>
                  <td>
                    <cwc2 type="SCALEBAR" units="Meters"
visible="true"
width="250" height="3"/>
                  </td>
                  <td>
                    <cwc2 type="UpdateMap" visible="true"
Image="images/icon_update.png" ImageWidth="18" ImageHeight="18"
ImageTip="Update Map" label="Update Map"/>
                  </td>
                </tr>
              </table>
            </td>
          </tr>
        </table>
      </td>
    <!-- InstanceEndEditable --></tr>
  </form>
</body>
<!-- InstanceEnd --></html>

>From that, hopefully you can see what I'm getting at. This page is
loaded up from a separate html file using window.open(). If I do use
php, HTML form elements, or CWCJSAPI, could I do it within this page??

Rene

>>> Jason Fournier <jfournier@dmsolutions.ca> 2004-02-09 1:54:08 PM
>>>
Hi Rene,

If I understand your requirements correctly I think you can use the 
applyBoundingBox javascript function.  This function can be seen in 
BoundingBoxPopup.widget.php on line 229.  Essentially, you pass the
bbox 
coords to the function and it handles submitting and zooming.

Jason




Rene Teniere wrote:

>Hi All,
>
>Question: In my site the user enters a UID number linked to a
shapefile
>database, returning the numeric results specified to a table. The
user
>can then choose to view a sketch map of the area, whereby a new
static
>chameleon map will open. Instead of the full extent, I want the map
to
>display only the extent of the UID shapefile. The extents have
already
>been passed to the new map page and are ready to be used. The
question
>is, what would be the best way to incorporate the map extents in the
>code so that they will act upon the map when it is first opened? I
was
>thinking of using the form elements, but I do not know how to go
about
>it.
>
>Thanks,
>Rene
>
>Rene J.R. Teniere - BSc., D.GIS
>GIS Technician
>Nova Scotia Department of Natural Resources
>Forestry Division (GIS) - Truro
>
>Phone: (902) 893-5655
>Mobile: (902) 209-8956
>_______________________________________________
>Chameleon mailing list
>Chameleon@lists.maptools.org 
>http://lists.maptools.org/mailman/listinfo/chameleon 
>
>  
>

-- 
___________________________
Jason Fournier
DM Solutions Group
Application Developer
Ottawa, ON
613.565.5056 x 18
jfournier@dmsolutions.ca 



_______________________________________________
Chameleon mailing list
Chameleon@lists.maptools.org 
http://lists.maptools.org/mailman/listinfo/chameleon


This archive was generated by Pipermail.