[fusion-users] PanQuery and pink backgrounds

Paul Deschamps pdeschamps at dmsolutions.ca
Fri Sep 12 23:12:42 EDT 2008


Hi Marc,

First in your fusion init function replace your activate widget code to
this:

   var panWidget = Fusion.getWidgetById('PanTool');
   mapWidget.activateWidget(panWidget);

Second use the pan widget definition i have provided in my earlier email
(show below) as well.

  <Widget>
        <Name>PanTool</Name>
        <Type>PanQuery</Type>
        <Description>Click or click and drag to select
features</Description>
      <Extension>
            <SelectionType>INTERSECTS</SelectionType>
            <Tolerance>25</Tolerance>
            <QueryActiveLayer>false</QueryActiveLayer>
      </Extension>
      <ImageUrl>images/icons/pan.png</ImageUrl>
      <Tooltip>Click or click and drag to select features</Tooltip>
    </Widget>



On Fri, Sep 12, 2008 at 4:36 PM, Marc Pfister <mpfister at enplan.com> wrote:

>
> >The other thing to note is the maptip is actually triggering a "QUERY /
> SELECTION" to get the maptip and thus the selection has changed. You can see
> the correct
>
> >behavior if you quickly drag pan it does not get a chance to fire maptips
> and then change the selection.
>
>
>
> >What you need to do is basically disable the maptips widget when the pan
> widget is active.
>
>
>
> I need the maptips to be always be on, and it seems to break every UI
> convention of a tooltip to have it only work some of the time.
>
>
One thing you can try is to just offset it a little from the cursor
position. it's not a fix but if we are able to get the selection issue
resolved  it would be less obvious.


> So in order to fix this, is it possible to query information without
> changing the selection? Alternately, could one store the current selection,
> and have maptips revert back to that selection after it does its
> query/selection thing?
>

Your widget is a good basis thus far. Here's one method you can do to
preform the query:

call a separate php script in the widget and in that script open up the
mapfile then do a queryByRect and return the results in json.

You can also add extension parameters in your appdef so you know what
layer(s) you want to display. The parsed applicationDef widget extentsion
data is located in the widgetTag.extension object.

Then your json would only return the data that the tips is looking for and
your not preforming a query/selection in the fusion framework.

Add this to the init section of the widget:

        var json = widgetTag.extension;

        this.szMaptipLayerName = json.LayerName ? json.LayerName[0] :
this.LayerName;
        this.szAttribureName = json.AttributeName ? json.AttributeName[0] :
this.AttributeName;

Now in your maptips widget extensions you have.

      <Extension>
           <LayerName>some_layer_name</LayerName>
           <AttributeName>Parcel_name</AttributeName>
      </Extension>

Hope this helps

Cheers

Paul D.

---
Paul Deschamps
Applications Specialist
DM Solutions Group.




*From:* pdescham49 at gmail.com [mailto:pdescham49 at gmail.com] *On Behalf Of *Paul
> Deschamps
> *Sent:* Friday, September 12, 2008 1:00 PM
> *To:* Marc Pfister; fusion-users
>
> *Subject:* Re: [fusion-users] PanQuery and pink backgrounds
>
>
>
> My comments are within the original email below: adding this back into the
> list.
>
> On Fri, Sep 12, 2008 at 2:26 PM, Marc Pfister <mpfister at enplan.com> wrote:
>
> > Why are you using a hacked version of pan? when panquery is there?
>
>
>
>
>
> I'm using the hacked version of pan because when I try to use panquery, I
> get two of the pan icons, one disabled and one enabled but not selectable.
> However if I just drop the onmouseup select method and event binding from
> panquery.js into pan.js, then it works as it is supposed to.
>
>
> You should not have this issue if you were to revert it to the the panquery
> widget i can tell you why this is happening.
>
>
>
> > If you want a clue on the "wierd behaviour" it is your map tips fired
> event that causes the focus to be lost.  That is causing the selection to be
> triggered when you pan
>
>
>
> Well shoot. That's going to be a problem. I suppose I could make a clone of
> selection.php just for maptips that returns the same thing but doesn't
> trigger a selection event?
>
>
>
>  The other thing to note is the maptip is actually triggering a "QUERY /
> SELECTION" to get the maptip and thus the selection has changed. You can see
> the correct behavior if you quickly drag pan it does not get a chance to
> fire maptips and then change the selection.
>
> What you need to do is basically disable the maptips widget when the pan
> widget is active.
>
> Essentially in looking into this further it is the maptip div itself that
> is the losing focus issue. when you mouse moves over that div you loose
> focus on the map Window causing the pan to fire.
>
>
>
>
>  Thanks for your help,
>
>
>
> Marc
>
>
>
>  Cheers
>
> Paul D.
>
>
>
>
>
>
>
> *From:* pdescham49 at gmail.com [mailto:pdescham49 at gmail.com] *On Behalf Of *Paul
> Deschamps
> *Sent:* Friday, September 12, 2008 11:16 AM
>
>
> *To:* Marc Pfister
> *Cc:* Paul Spencer; fusion-users at lists.osgeo.org
> *Subject:* Re: [fusion-users] PanQuery and pink backgrounds
>
>
>
> I would be willing to assist you on getting the panquery widget to work.
> Why are you using a hacked version of pan? when panquery is there?
>
> heres an example for panquery in appDef
>
> <!-- CONTAINER-->
>       <Container>
>           <Name>toolbar</Name>
>           <Type>Toolbar</Type>
>           <Position>left</Position>
>           <Item>
>               <Function>Widget</Function>
>               <Widget>FitToWindow</Widget>
>           </Item>
>           <Item>
>               <Function>Widget</Function>
>               <Widget>ZoomIn</Widget>
>           </Item>
>           <Item>
>               <Function>Widget</Function>
>               <Widget>ZoomOut</Widget>
>           </Item>
>           <Item>
>               <Function>Widget</Function>
>               <Widget>PanQuery</Widget>
>           </Item>
>       </Container>
>
>     <Widget>
>         <Name>PanQuery</Name>
>         <Type>PanQuery</Type>
>         <Description>Click or click and drag to select
> features</Description>
>       <Extension>
>             <SelectionType>INTERSECTS</SelectionType>
>             <Tolerance>25</Tolerance>
>             <QueryActiveLayer>false</QueryActiveLayer>
>       </Extension>
>       <ImageUrl>images/icons/pan.png</ImageUrl>
>       <Tooltip>Click or click and drag to select features</Tooltip>
>     </Widget>
>
> also if you do not want it to have a "button" for it at all you can add
> this to your fusion initialized function and set it active
>
> function onInitialize() {
>
>     var map = Fusion.getMapById('mapArea');
>
>     // activate PanQuery
>     var panWidget = Fusion.getWidgetById('PanQuery');
>     map.activateWidget(panWidget);
>
> }
>
> If you want a clue on the "wierd behaviour" it is your map tips fired event
> that causes the focus to be lost.  That is causing the selection to be
> triggered when you pan.
>
>
> Cheers
>
> Paul D.
>
> On Fri, Sep 12, 2008 at 1:07 PM, Marc Pfister <mpfister at enplan.com> wrote:
>
> My app is at:
>
>
>
> http://209.20.81.81/fusion/templates/mapserver/corning/
>
>
>
> Also, there's some weird behavior I just noticed with PanQuery – when the
> map redraws, it draws a new querymap based off of a query on location where
> you started your click and drag, even though it does not make the selection
> there.
>
>
>
> Note that my PanQuery is a modified pan.js, not panquery.js.
>
>
>
> And, is it just me or is the selection highlight not drawn with the
> antialiased renderer?
>
>
>
> I'm using 1.1.0 RC1.
>
>
>
> Marc
>
>
>
>
>
> *From:* pdescham49 at gmail.com [mailto:pdescham49 at gmail.com] *On Behalf Of *Paul
> Deschamps
> *Sent:* Thursday, September 11, 2008 6:21 PM
> *To:* Marc Pfister
> *Cc:* Paul Spencer; fusion-users at lists.osgeo.org
> *Subject:* Re: [fusion-users] PanQuery and pink backgrounds
>
>
>
> I would like to assist you on this:
>
> 1. Can we see your application? if not can you post your appdef. template
> and supporting js code?
> 2. What revision are you using?
>
> Cheers
>
> Paul D.
>
> On Thu, Sep 11, 2008 at 5:18 PM, Marc Pfister <mpfister at enplan.com> wrote:
>
>
> Paul Spencer [mailto:pspencer at dmsolutions.ca] wrote:
>
> > I haven't tried the panquery widget in a while.  The intention of the
> > widget was to have a dual mode widget that if you click and drag, it
> > pans and if you just click it does a query.  Looking at the code, it
> > doesn't appear to have anything that would cause it to make two
> > buttons.  Perhaps you have something unintentional in your
> > ApplicationDefinition (widget declared twice perhaps?).
>
> I noticed a few things and now have it working.
>
> 1. PanQuery.js requires Pan.js
> 2. I end up with 2 icons. Hmmmmm....
> 3. I set PanQuery.js and Pan.js to output a message to console when
> initializing.
> 4. I have a map that only has PanQuery in its ApplicationDefinition.xml
> 5. When it starts, I get messages that both Pan and PanQuery have
> initialized.
> 6. Perhaps it's adding a new OpenLayers control twice, once for each
> initialization.
> 7. Try commenting out the creation and adding of the control in either
> JS. No dice.
> 8. OK, try taking the event binding and the mouseup event method and
> adding into pan.js
> 9. Use query-fied pan.js
> 10. Success!
>
> So I'm not sure why exactly I couldn't get PanQuery.js to work, but it
> seems to have something to do with the require.
>
> Marc
>
>
> _______________________________________________
> fusion-users mailing list
> fusion-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/fusion-users
>
>
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/fusion-users/attachments/20080912/e0c5b914/attachment-0001.html


More information about the fusion-users mailing list