Attachment Relate Info Window Widget version 3.0.2i for FlexViewer 3.0

2231
9
Jump to solution
09-18-2012 08:34 AM
ThomasFraser
New Contributor II
Hi,

I'm currently using the Attachment Relate Info Window Widget version 3.0.2i for FlexViewer 3.0
against a Feature Layer in my FlexViewer 3.0 App.
The Feature Layer is at the bottom of my Operational Layers list so that it draws on top when the App is run.
The problem I have is that the out of the box PopUp functionality is not working for my Dynamic Layers in the Operational Layers tag.

The issue seems to be with the following code in the Map Manager:

var label:String = isOperationLayer ? m_operationalLayers[m_operationalLayerIndex].label : m_basemapLayers[m_basemapLayerIndex].label;

I have since discovered that if the Feature Layer is placed above the Dynamic Layers in the Operational Layers tag in the Main Config file then the out of the box PopUps work as well as the Attachment Relate Info Window Widget version 3.0.2i for FlexViewer 3.0

I guess my question is for Robert Scheitlin, who created the Widget, to see if there is a quick way to edit the Map Manager code to enable me to keep the Feature Layer at the bottom of the Operational Layers list as i need this Layer to draw on top of everything else.

Many Thanks

Tom

P.s The Attachment Relate Info Window Widget version 3.0.2i for FlexViewer 3.0 is an excellent Widget.
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
9 Replies
RobertScheitlin__GISP
MVP Emeritus
Tom,

   The viewer team seems to have a bug if the last operational layer in the main config.xml uses the info and infoconfig attributes. The issue is that the m_operationalLayerIndex is incremented in the loadNextOperationalOrBasemapLayer function to a number that is beyond what the array of operational layers contains (all this detail is actually for the team when I email them this thread). To fix this issue just replace the infoReady function with this modified one in the MapManager.mxml:

            private function infoReady(event:AppEvent):void
            {
                var id:String = event.data.id as String;
                var isOperationLayer:Boolean = event.data.isOptLayer;
                if (m_operationalLayerIndex >= m_operationalLayers.length){
                    m_operationalLayerIndex--;
                }
                var label:String = isOperationLayer ? m_operationalLayers[m_operationalLayerIndex].label : m_basemapLayers[m_basemapLayerIndex].label;
                if (id == label)
                {
                    infoTemplate = event.data.infoWidget;
                    var baseWidget:IBaseWidget = infoTemplate as IBaseWidget;
                    var infoConfigXML:XML = baseWidget.configXML;
                    infoRender = new ClassFactory(infoTemplate.infoClass);
                    infoRender.properties = { infoConfig: infoConfigXML, map: map };

                    if (isOperationLayer)
                    {
                        m_operationalLayers[m_operationalLayerIndex].layer.infoWindowRenderer = infoRender;
                    }
                    else
                    {
                        m_basemapLayers[m_basemapLayerIndex].layer.infoWindowRenderer = infoRender;
                    }
                    loadNextOperationalOrBasemapLayer(isOperationLayer);
                }
            }


Also you need to be sure in the future to post flex viewer and or widget questions to the Flex Viewer forum:

http://forums.arcgis.com/forums/111-ArcGIS-Viewer-for-Flex

Don't forget to click the Mark as answer check on this post and to click the top arrow (promote).
Follow the steps as shown in the below graphic:

0 Kudos
ThomasFraser
New Contributor II
Robert,

Thanks for the quick reply.

I made the changes to MapLayers.mxml that you posted but now i'm getting the following error:
TypeError: Error #1010: A term is undefined and has no properties.

Any ideas?

I'll be sure to post in the relevant forum in future.

Thanks

Tom
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Tom,

   I tested this code change and it works fine... So you did replace the whole infoReady function in the MapManager.mxml and moved your feature layer back to the bottom of the operational layers?
0 Kudos
ThomasFraser
New Contributor II
Robert,

So I found out what the problem was.
Because I have more than one Dynamic layer in the operational layers list the if statement needed adjusting to:
if (m_operationalLayerIndex >= m_operationalLayers.length)
{
      m_operationalLayerIndex = m_operationalLayers.length-1;
}


This assumes the Feature Layer is always at the bottom of the list.

Thanks again for your help with this.

Tom
0 Kudos
ThomasFraser
New Contributor II
Hi Robert,

I have come accross another issue which is when you have more than one Feature Layer then the solution in my last post no longer works.

I had a chat with a colleague and we thought we might be able to loop through the Operational Layers and hardcode the label in the InfoReady function rather than using the layer index.
Do you think this would be a viable solution or can you think of a more simple way to get round the issue for now?

Below I have copied my config.xml <map> code:

<map wraparound180="true" fullextent="-20000000 -20000000 20000000 20000000" top="40" addarcgisbasemaps="true">
   <basemaps>
            <layer type="tiled" label="Imagery" icon="https://www.arcgis.com/sharing/rest/content/items/86de95d4e0244cba80f0fa2c9403a7b2/info/thumbnail/tempimagery.jpg" url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer" visible="true"/>
            <layer type="tiled" label="Imagery with Labels" icon="https://www.arcgis.com/sharing/rest/content/items/413fd05bbd7342f5991d5ec96f4f8b18/info/thumbnail/tempimagery_with_labels_ne_usa.png" url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer" visible="false"/>
            <layer type="tiled" label="Imagery with Labels" url="http://services.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places/MapServer" visible="false" reference="true"/>
            <layer type="tiled" label="Streets" icon="https://www.arcgis.com/sharing/rest/content/items/d8855ee4d3d74413babfb0f41203b168/info/thumbnail/tempstreets.jpg" url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer" visible="false"/>
            <layer type="tiled" label="Topographic" icon="https://www.arcgis.com/sharing/rest/content/items/6e03e8c26aad4b9c92a87c1063ddb0e3/info/thumbnail/temptopographic.jpg" url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer" visible="false"/>
            <layer type="tiled" label="Terrain with Labels" icon="https://www.arcgis.com/sharing/rest/content/items/aab054ab883c4a4094c72e949566ad40/info/thumbnail/tempTerrain_with_labels_ne_usa.png" url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Terrain_Base/MapServer" visible="false"/>
            <layer type="tiled" label="Terrain with Labels" url="http://services.arcgisonline.com/ArcGIS/rest/services/Reference/World_Reference_Overlay/MapServer" visible="false" reference="true"/>
            <layer type="tiled" label="Light Gray Canvas" icon="https://www.arcgis.com/sharing/rest/content/items/8b3b470883a744aeb60e5fff0a319ce7/info/thumbnail/templight_gray_canvas_with_labels__ne_usa.png" url="http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer" visible="false"/>
            <layer type="tiled" label="Light Gray Canvas" url="http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Reference/MapServer" visible="false" reference="true"/>
            <layer type="tiled" label="National Geographic" icon="https://www.arcgis.com/sharing/rest/content/items/509e2d6b034246d692a461724ae2d62c/info/thumbnail/natgeo.jpg" url="http://services.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer" visible="false"/>
            <layer type="tiled" label="Oceans" icon="https://www.arcgis.com/sharing/rest/content/items/48b8cec7ebf04b5fbdcaf70d09daff21/info/thumbnail/tempoceans.jpg" url="http://services.arcgisonline.com/ArcGIS/rest/services/Ocean_Basemap/MapServer" visible="false"/>
            <layer type="osm" label="OpenStreetMap" icon="https://www.arcgis.com/sharing/rest/content/items/5d2bfa736f8448b3a1708e1f6be23eed/info/thumbnail/temposm.jpg" visible="false"/>
        </basemaps> 

        <operationallayers>
            <layer label="GDE" type="dynamic" visible="false" alpha="1.0"
                   url="http://********/ArcGIS/rest/services/Applications/NVOR_GDE/MapServer">
                   <sublayer id="1" popupconfig="popups/PopUp_NWE_Struct_Elements.xml"/>
                   <sublayer id="2" popupconfig="popups/PopUp_NAF_Struct_Elements.xml"/>
                   <sublayer id="3" popupconfig="popups/PopUp_WAF_Struct_Elements.xml"/>
                   <sublayer id="5" popupconfig="popups/PopUp_SE_Algeria_GDE_Struct.xml"/>
                   <sublayer id="6" popupconfig="popups/PopUp_SE_Algeria_GDE_Drain_sys.xml"/>
                   <sublayer id="7" popupconfig="popups/PopUp_SE_Algeria_GDE_Sed_Input_Flowdir.xml"/>
                   <sublayer id="8" popupconfig="popups/PopUp_SE_Algeria_GDE_Outcrop.xml"/>
                   <sublayer id="9" popupconfig="popups/PopUp_SE_Algeria_GDE_Depo.xml"/>
                   <sublayer id="11" popupconfig="popups/PopUp_NAF_Struct.xml"/>
                   <sublayer id="12" popupconfig="popups/PopUp_NAF_Isopach.xml"/>
                   <sublayer id="13" popupconfig="popups/PopUp_NAF_Depo_Boundary.xml"/>
                   <sublayer id="14" popupconfig="popups/PopUp_NAF_Depo.xml"/>
                   <sublayer id="16" popupconfig="popups/PopUp_NAF_Paleo_Struct.xml"/>
                   <sublayer id="17" popupconfig="popups/PopUp_NAF_Paleo_Subcrop_Boundary.xml"/>
                   <sublayer id="18" popupconfig="popups/PopUp_NAF_Paleo_Subcrop.xml"/>
                   <sublayer id="20" popupconfig="popups/PopUp_WAF_GDE_Depo.xml"/>
            </layer>
            <layer label="Play Risk" type="dynamic" visible="false" 
                   url="http://********/ArcGIS/rest/services/Applications/NVOR_PlayRisk/MapServer">
                   <sublayer id="0" popupconfig="popups/PopUp_PlayRisk.xml"/>
            </layer>
            <layer label="General Layers" type="dynamic" visible="true"
                   url="http://********/ArcGIS/rest/services/Applications/NVOR/MapServer">
                   <sublayer id="0" popupconfig="popups/PopUp_Wells.xml"/>
                   <sublayer id="1" popupconfig="popups/PopUp_Hess_Basins.xml"/>
                   <sublayer id="2" popupconfig="popups/PopUp_IHS_Fields.xml"/>
                   <sublayer id="3" popupconfig="popups/PopUp_Woodmac_Fields.xml"/>
                   <sublayer id="4" popupconfig="popups/PopUp_Hess_Leases.xml"/>
                   <sublayer id="5" popupconfig="popups/PopUp_IHS_Leases.xml"/>
 </layer>
            <layer label="Lease Opportunities" type="feature" visible="true" alpha="0.5" info="widgets/InfoTemplates/AttRelateInfoWinWidget.swf"
                   infoconfig="widgets/InfoTemplates/IWT_LeaseOpps.xml"
                   url="http://********/ArcGIS/rest/services/Applications/NVOR_Edit/FeatureServer/0">
            </layer>
   <layer label="PF Maps" type="feature" visible="true" alpha="0.5" info="widgets/InfoTemplates/AttRelateInfoWinWidget.swf"
                   infoconfig="widgets/InfoTemplates/IWT_PFMapping.xml"
                   url="http://********/ArcGIS/rest/services/Applications/NVO_Edit/FeatureServer/0">
            </layer>
        </operationallayers>
    </map>


Many Thanks

Tom
0 Kudos
CarterBancroft
New Contributor
As fraser_th stated, the proposed fixes do not work with multiple feature layers. I've been having a difficult time debugging this issue, but I've gathered a good bit of info and I've submitted the issue on github and I hope that someone will deal with it. In the meantime, if I can come up with a fix I will submit a pull-request.

Here is the issue I created on github...

https://github.com/ArcGIS/ArcGISViewerForFlex/issues/4
0 Kudos
ThomasFraser
New Contributor II
Thanks for opening this up to another forum.
Hopefully you get response with a hack job or a solution soon.
0 Kudos
Juan_CarlosFranco
Esri Contributor
0 Kudos
ThomasFraser
New Contributor II
Thanks jcfranco.

I have made the changes to my MapManager.mxml and I can now have the Attachment Relate Info Widget tool working against multiple Featur Layers in my config.xml

Many thanks for the solution.

Tom
0 Kudos