Non interactive widget

1085
10
Jump to solution
06-03-2013 09:03 PM
FraserHand
Occasional Contributor III
Hi Guys,
Has anyone created a non interactive widget? I basically want to add a module that has access to the widget framework (config data, map etc etc) but doesn't have an icon or placement on any widget containers. I really want this to be completely independent of the Viewer core code so I don't have to worry about upgrades and customising the viewer code, but I want it to load automatically as any other widget.

Has anyone built something along these lines?

Cheers,
F
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
FraserHand
Occasional Contributor III
Duh. I moved the widget out of the container tray and set preload to true. Seems to achieve what I wanted. Just using the base widget with no widget template.
Thx,
F

View solution in original post

0 Kudos
10 Replies
FraserHand
Occasional Contributor III
Duh. I moved the widget out of the container tray and set preload to true. Seems to achieve what I wanted. Just using the base widget with no widget template.
Thx,
F
0 Kudos
GISDev1
Occasional Contributor III
Can you share what your widget does?
0 Kudos
FraserHand
Occasional Contributor III
Sure. It performs some actions against the map on the fly. When the widget loads it wires up against map events and listens for them.
One example is that we have a tiled imagery service cached down to certain scale. The customer doesn't want to cache below this scale due to the size requirements of the cache, nor do they want generate tile on demand. So one thing this widget will do is flick the tiled basemap over to a dynamic one. Any mapping validation tasks to change the viewer workflow or UI based on map state will go in here.
Cheers,
F
0 Kudos
RhettZufelt
MVP Frequent Contributor
Fraser,

Just a thought, if you don't want the extra load of the listners running, the tile map switch can be handled with the built in tools.

Look at the layer tag http://resources.arcgis.com/en/help/flex-viewer/concepts/index.html#/Layer_tag_overview/01m30000000p... and see for tiled layers, there is a displaylevels tag, and only the cache levels listed here will display for the map.

Also, there are max/min scale you can use for the layers themselves.  So, you can use the displaylevels or min/max scale to have it "turn off" the tiled layer and "turn on" the dynamic one at a particular LOD/scale.

R_
0 Kudos
FraserHand
Occasional Contributor III
Hi There,
Thanks for the idea. Just thinking about this - even if you have a cached layer turn on / off for a certain LOD - it will still show as a map layer right? So there would be 2 basemaps available rather than 1, even if one or the other doesn't display. One for the cached layer at n LODs and then the dynamic one. We are not after this behaviour, we only one service displayed in the basemaps. There is only 2 additional listeners on 1 layer so not really a major.
Thanks,
F
0 Kudos
RhettZufelt
MVP Frequent Contributor
Fraser,

Just played with this a little, if you only want the two basemaps, and no choice, this is what I did.

I set my first basemap to have maxscale="4000" and my second to have minscale="4000" and set both visible="true" in the main config. This way, it displays the one up until 1:4000, zoom in again and it switches to the other basemap.

However, you still get the list of available basemaps to choose from, so, I went into (I'm using eMapSwitcherWidget, but MapSwitcher is similar) to the eMapSwitcherWidget.mxml, down near the bottom there is the basemapsButton id. I changed as follows:

        <s:Button id="basemapsButton"
                  includeIn="thumbnailOptions"
                  label="{basemapsLabel}"
                  rollOut="startBasemapsHideTimer(event)"
                  rollOver="basemapsButton_rollOverHandler(event)"
                  skinClass="com.esri.viewer.skins.BasemapsButtonSkin"
      visible="false"/>


This way, you no longer get the basemap button or options, and it will always have a basemap loaded depending on what scale they are currently at.

R-
0 Kudos
FraserHand
Occasional Contributor III
Hey,
This still won't do it, as we have about 4 basemaps so still need the basemaps button and switching. Thanks for the ideas.
Cheers,
F
0 Kudos
RhettZufelt
MVP Frequent Contributor
Guess I misunderstood your last post when you said you only wanted one basemap in the Basemaps button, thought you were only dealing with the 2 basemaps, not 4.

In any case, you could do the same thing with 4 basemaps, or 40 for that matter as long as you have scale levels to switch with.

Now you got me curious.  Are your vanilla "listeners" actually adding/removing basemaps from the Basemaps button, or just changing the currently displayed basemap?

R_
0 Kudos
FraserHand
Occasional Contributor III
Hey,
Once the widget loads it caches the current map layer state (ids, urls, indexes) then attaches to layer add / remove and zoom start on the map.
It's got a config that runs off map labels so for a given label it has a scale cut off and a url to a dynamic service (you used to be able to call new ArcGISDynamicLayer against a tiled service at 10 and earlier but not 10.1). when we hit the cutoff scale it swaps out the cached service for a dynamic one. Since they have the same label / id whatever the Viewer framework doesn't care, and flipping to another basemap and back is fine. When we start zooming out we pull out the dynamic and replace with cached in same spot. The customer has really high quality imagery and they can make out their features at big scales, scales which would be inconvenient to cache to.
So will flip it over and the user never sees it happen.
Cheers,
Fraser
0 Kudos