Select to view content in your preferred language

Pass current view extents (or center) from map to URL in header link

2240
8
Jump to solution
10-20-2014 03:08 PM
DerekHunter2
New Contributor II

Is it possible to include a headerwidget link URL (to a another flex viewer) that appends the current center or extent to the URL.  This is in order to send the user from the current viewer to another viewer zoomed to that same extent.

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Derek,

  Here is a compiled widget for it then. I need another widget to support like I need a hole in my head so I will likely not post this anywhere but here.

This is a UI section widget, so it does NOT go in the normal widget container, it belongs with the OverviewMapWidget, HeaderControllerWidget, etc.

<widget left="3" bottom="45"   config="widgets/shareMap/shareMapWidget.xml" url="widgets/shareMap/shareMapWidget.swf"/>

View solution in original post

0 Kudos
8 Replies
RobertScheitlin__GISP
MVP Emeritus

Derek,

  Here is my urlDialog.mxl code that I call from a button in a widget (not a header link like you asked).

<?xml version="1.0" encoding="utf-8"?>

<s:BorderContainer xmlns:fx="http://ns.adobe.com/mxml/2009"

                   xmlns:s="library://ns.adobe.com/flex/spark"

                   xmlns:mx="library://ns.adobe.com/flex/mx"

                   width="400" height="175"

                   creationComplete="Init()"

                   styleName="WidgetCanvas">

    <fx:Script>

        <![CDATA[

            import com.esri.ags.geometry.Extent;

            import mx.managers.PopUpManager;

           

            [Bindable] public var sPPIN:String = "";

           

            [Bindable] private var _Url:String = "";

           

            [Bindable] public var _extent:Extent;

           

            private function close():void

            {

                PopUpManager.removePopUp(this);

            }

           

            private function Init():void

            {

                _Url = this.parentApplication.url.substring(0,this.parentApplication.url.length - 3) + "html";

                _Url += "?PPIN=" + sPPIN;

                //_Url += "&EXT=" + _extent.xmin.toFixed(4) + "," + _extent.ymin.toFixed(4) + "," + _extent.xmax.toFixed(4) + "," + _extent.ymax.toFixed(4);

            }

        ]]>

    </fx:Script>

    <s:Label x="10" y="10" width="300" maxHeight="60" styleName="WidgetText"

             text="This is the URL that you can copy and email to someone so they can paste it into their browser and see the parcel you are viewing."/>

    <s:TextArea left="10" right="10" bottom="10" height="93" alpha="1.0"

                fontFamily="Arial" fontSize="10" text="{_Url}" />

    <s:Line x="10" y="61" width="95%">

        <s:stroke>

            <s:SolidColorStroke color="0xffffff" weight="1"/>

        </s:stroke>

    </s:Line>

    <s:Image right="10" top="10" width="20" height="20" buttonMode="true" click="close()"

              source="assets/images/w_close.png" toolTip="Close" useHandCursor="true"/>

</s:BorderContainer>

and my code to call this dialog:

private var container:ViewerContainer = ViewerContainer.getInstance();

private var urlWindow:urlDialog;

            private function getURL(event:Event):void {

                var parcelResult:ParcelResult = ItemRenderer(event.target).data as ParcelResult;

                urlWindow = new urlDialog();

                urlWindow.x = (container.mapManager.map.width / 2) - (urlWindow.width / 2)

                urlWindow.y = (container.mapManager.map.height / 2) - (urlWindow.height / 2)

                urlWindow.sPPIN = parcelResult.ppin;

                urlWindow._extent = container.mapManager.map.extent;

                PopUpManager.addPopUp(urlWindow, container.mapManager.map, true);

                PopUpManager.centerPopUp(urlWindow);

            }

0 Kudos
DerekHunter2
New Contributor II

Thanks Robert.

I was thinking it would be less complex.  I'm sure this is simple for a developer, but beyond my capabilities.  Not sure how to implement that.

Thanks for the information though.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Derek,

  Here is a compiled widget for it then. I need another widget to support like I need a hole in my head so I will likely not post this anywhere but here.

This is a UI section widget, so it does NOT go in the normal widget container, it belongs with the OverviewMapWidget, HeaderControllerWidget, etc.

<widget left="3" bottom="45"   config="widgets/shareMap/shareMapWidget.xml" url="widgets/shareMap/shareMapWidget.swf"/>

0 Kudos
DerekHunter2
New Contributor II

Thanks.  How would one hard code in an address other than the viewer they are currently in?  I am trying to take a user from a tile-based viewer to a dynamic viewer so they can see the most current data.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Derek,

   I can add that feature. You should mark this as answered and replies that you get in GeoNet as helpful if they were helpful to you.

0 Kudos
DerekHunter2
New Contributor II

Awesome.  Is that something I can edit in Flash Builder?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Here is the updated code: Just uncomment the alternatebaseurl tag in the XML and replace with your desired URL

0 Kudos
DerekHunter2
New Contributor II

As always thanks for your help.  Your help is invaluable.

Since I already have a config appended to the base URL (/index.html?config=new_config.xml) is there a way to embed the & to your base url paramter for the extent?

Could you also suggest how tool could be made into a button that just takes the user to that extent of the other viewer without having to copy and past the url into another browser tab?

0 Kudos