[Chameleon] jsapi and scalezoom widget

Liz Godwin godwin.liz at gmail.com
Mon Feb 5 16:34:34 EST 2007


Another bad message... It seems the text of this message was ommitted
in the posting that
come through. I'm resending the text portion only (see below for the
copy) as plain
text.  If you have a problem with the attachments and want them,
please contact me directly.

Cheers,

Liz

On 2/1/07, Liz Godwin <godwin.liz at gmail.com> wrote:
> Sorry Brent - it's rather busy around here.  I'm CC:ing the list on this
> because I think enyone can benefit from this.  I'm just sorry that I haven't
> had time to package it up better.  I fear if I wait to do it right it won't
> happen, so here it all is :-)
>
> Everything is based on Chameleon 2.2.  Only REALLY tested in IE6 and Firefox
> 1.0+
>
> 1..  ScaleZoom Widget for JSAPI mode.
> the one I have built is rather convoluted, and a little bit buggy.  If you
> use it with a fixed size of map, it might work much better.  This one works
> with our dynamic map resize - which is probably part of the problem.  I say
> it has problems, but they are intermittent and <  2% of the time.
>
> So not to destroy/harm to the original scale zoom widget in Chameleon, we
> made our own widget: NLWISZoomBar
> see attached zip file (NLWISZoomBar.zip).  There are two files, a php widget
> file and the separate javascript.  Put this in your widgets directiory.
>
> The following changes to UpdateMap.php will also be required.  This is in
> chameleon/htdocs
> starting at around 216
>
> used this instead... (the COMPASS_POINT section is unchanged but shown so
> you know where to make changes).  This changes was required because the
> SCALE_ZOOM navigation check was originally happening outside of NAV_CMD
> check which didn't make sense.  This change brings it inside the NAV_CMD
> check.
>  if (substr($HTTP_FORM_VARS["NAV_CMD"], 0, 13) ==
> "COMPASS_POINT")
>     {
>
> include("widgets/CompassPoint/CompassPoint.widget.php");
>
>         $oWidget = new CompassPoint();
>         $oWidget->InitDefaults();
>         $oWidget->mszDirection = strtoupper(substr(
> $HTTP_FORM_VARS["NAV_CMD"], 14 ));
>         $oWidget->SetMap($oMapSession);
>
>         $oWidget->SetURL($oHttpFormVars, $HTTP_FORM_VARS);
>         $_SESSION["gszCurrentState"] = $oMapSession->saveState();
>      }
>      if ($HTTP_FORM_VARS["NAV_CMD"] == "SCALE_ZOOM" &&
>         isset( $HTTP_FORM_VARS["SCALE_ZOOM"]) &&
>         $HTTP_FORM_VARS["SCALE_ZOOM"] != "")
>
>     {
>         include("widgets/ScaleZoom/ScaleZoom.widget.php");
>         $oWidget = new ScaleZoom();
>         $oWidget->InitDefaults();
>         $oWidget->SetMap($oMapSession);
>         $oWidget->SetURL($oHttpFormVars, $HTTP_FORM_VARS);
>
>         $_SESSION["gszCurrentState"] = $oMapSession->saveState();
>     }
>      $szFormContents .=
> BuildHTMLOutputMapExtentsChanged($oMap);
> }
>  Insert the following section around line 756 after saving of context, but
> before this line:
> $_SESSION["gszCurrentState"] = $oMapSession->saveState();
>
>  Code to add:
> if (isset( $HTTP_FORM_VARS["PROCESS_NLWISZOOMBAR"]) &&
>     $HTTP_FORM_VARS["PROCESS_NLWISZOOMBAR"] == "1")
> {
>
> include("widgets/NLWISZoomBar/NLWISZoomBar.widget.php");
>     $oWidget = new NLWISZoomBar();
>     $oWidget->InitDefaults();
>     $oWidget->SetMap($oMapSession);
>     $oWidget->SetURL($oHttpFormVars, $HTTP_FORM_VARS);
>     $_SESSION["gszCurrentState"] = $oMapSession->saveState();
>
>     $nLevels = $HTTP_FORM_VARS["NLWISZOOMBAR_LEVELS"];
>     $oWidget->nMaxWidthFactor =
> $HTTP_FORM_VARS["NLWISZOOMBAR_MAXWIDTHFACTOR"];
>     $nMinScale = $oWidget->getMinScale();
>     $nMaxScale = $oWidget->getMaxScale();
>     $aScale =
> $oWidget->getZoomBarLevels($nLevels,$nMinScale,$nMaxScale);
>
>     $szFormContents .= "<input type=\"hidden\"
> name=\"UPDATE_NLWISZOOMBAR_SCALES".
>                     "\"
> value='".implode(",",$aScale)."'>\n";
>     $szFormContents .= "<input type=\"hidden\"
> name=\"UPDATE_NLWISZOOMBAR_CURRENTSCALE".
>                     "\"
> value='".$oMapSession->oMap->scale."'>\n";
> }
>
> The widget will recalculate the individual zoom scales based on the changing
> max and min scales (these depend on the size of the map which is why it's
> dynamic).  The number of ticks is user defined, and uses CSS for styling. -
> see attached zoombar.css for what I use in our app.
>
> How used in Template:
> <cwc2 type="NLWISZoomBar" LEVELS="8" zoominlabel="Zoom In"
> zoomoutlabel="Zoom Out" topelement="zoomBar"></cwc2>
>   Ok.  That's it for the ZooomBar!
>
> For the Mapsizing... much more complicated, and my javascript is rather
> integrated against the template and CSS.
>
> Basically though, I watch for window resize events (registered with JSAPI)
> and when they happen I change the size of all the other components on the
> page that matter - map (many layers here are affected), right side button
> container, left side tabbed pages container.
>
> I'll see if I can package it up separately and send it along next...  Please
> don't hesitate to ask questions about what I've already included.  I did
> this quickly and it's possible I missed something.
>
> Cheers,
>
> Liz
>
>
>
>
>
>
>
> On 1/30/07, Brent Lund < Brent.Lund at state.mn.us > wrote:
> >
> >
> >
> >
> > Hi Liz,
> >
> >
> >
> > Just checking back with you to see if you have time available to send the
> scripts mentioned below.
> >
> >
> >
> > Thanks,
> >
> >
> >
> > Brent
> >
> >
> >
> > ________________________________
>
> >
> > From: Liz Godwin [mailto: godwin.liz at gmail.Com]
> > Sent: Tuesday, January 16, 2007 2:40 PM
> > To: Brent Lund
> > Subject: Re: [Chameleon] jsapi and scalezoom widget
> >
> >
> >
> > Hi Brent,
> >
> > I extended the mapsize widget to support JSAPI but also there's some
> javascript there.  It isn't very graceful.  And the code could probably be
> done better - but it works!
> >
> > I can send you that too.  It's something I've been meaning to give back to
> the group, but I havn't had time to fix it up yet.  Bear with me - I'll try
> to get the code to you this week....
> >
> > Liz
> >
> >
> > On 1/16/07, Brent Lund <Brent.Lund at state.mn.us> wrote:
> >
> >
> >
> > Liz,
> >
> >
> >
> > I really like how your site auto fits the map to the size of the browser.
>   Is this done in a css? Or script? Both?
> >
> >
> >
> > Thanks again
> >
> >
> >
> >
> > Brent
> >
> >
> >
> > ________________________________
>
> >
> > From: Liz Godwin [mailto: godwin.liz at gmail.com]
> > Sent: Monday, January 15, 2007 9:10 AM
> > To: chameleon at lists.maptools.org
> > Cc: Brent.Lund at state.mn.us
> > Subject: Re: [Chameleon] jsapi and scalezoom widget
> >
> >
> >
> > We're using a slightlyolder version of Chameleon (2.0?) - but in that the
> ScaleZoom widget wasn't jsapi enabled.  We made changes to enable it, but
> it's still a bit flakey (randomly), mostly just with IE.
> >
> > I'd be happy to share it with you or anyone else.  Of course if you make
> it better, please share back :-)
> >
> > It can be seen in action here (it's along the top of the map):
> > http://nlwis-snite1.agr.gc.ca/eco/
> >
> > Cheers,
> >
> > Liz
> >
> >
> > On 1/11/07, Brent Lund <Brent.Lund at state.mn.us > wrote:
> >
> >
> >
> > My ScaleZoom widget is not updated when in jsapi mode.   It will updated
> the map (zoom in/out), but ScaleZoom itself is not redrawn.  Am I missing
> something?
> >
> >
> >
> > Thanks,
> >
> > Brent
> >
> >
> >
> >
> >
> >
> >
> > <CWC2 TYPE="ScaleZoom"
> >
> > ORIENTATION="HORIZONTAL"
> >
> > ENABLED="TRUE"
> >
> > VISIBLE="TRUE"
> >
> > INCREASEIMAGE="images/z-in2.png"
> >
> > DECREASEIMAGE="images/z-out2.png"
> >
> > CURRENTIMAGE="images/zoom_current.png"
> >
> > PUTTABLETAGS="TRUE"
> >
> > >
> >
> >
> >
> >    <ZOOMVALUE SCALE="100000" IMAGE="images/zoom_inc.png"/>
> >
> >    <ZOOMVALUE SCALE="50000" IMAGE="images/zoom_inc.png"/>
> >
> >    <ZOOMVALUE SCALE="20000" IMAGE="images/zoom_inc.png"/>
> >
> >    <ZOOMVALUE SCALE="10000" IMAGE="images/zoom_inc.png"/>
> >
> >    <ZOOMVALUE SCALE="5000" IMAGE="images/zoom_inc.png"/>
> >
> > </CWC2>
> >
> >
> > _______________________________________________
> > Chameleon mailing list
> > Chameleon at lists.maptools.org
> > http://lists.maptools.org/mailman/listinfo/chameleon
> >
> >
> >
> >
>
>
>


More information about the Chameleon mailing list