Select to view content in your preferred language

Basic Questions and How to Center the Splash Widget (Customized SFV 2.0)

1305
9
08-04-2010 06:40 AM
MLowry
by
Frequent Contributor
Hi, I have customized the Sample Viewer in Flash Builder 4 quite significantly for my needs.

EDIT: I figured out how to center the splash page, my .xml config for it was using HTML lines that were too long so it kept moving it to the left. Just need to incorporate some line breaks to shorten the text lines and it centered right up, using the HTMLPopUp properties.


I have yet to figure out a few things though.

How do I use a sample .mxml, and turn it into a widget, and then add it to my config.xml file and use it in my map?

I have added operational layers and a static legend, and customized an identify tool using the sample in the widgets/InfoTemplates/SimpleInfoWinWidget.swf.

I have yet to figure out how to integrate the API 2.0 samples into the SFV source code though.

I can get the .mxml samples for the API to do what I want, but then I have no headed or splash page or buttons on the page like on the Sample Flex Viewer.

There must be some way to integrate the API samples into the SFV using the config file correct?




Please advise, and thanks in advance for the help!
Tags (2)
0 Kudos
9 Replies
MLowry
by
Frequent Contributor
My main goal right now is to get identify functionality on all of my operational layers in the SFV. Unfortunately, I don't have ArcGIS 10 yet, otherwise I could use the FeatureServer technology and that would solve my problems.

While using ArcGIS Server 9.3.1, I can only access MapServers and that limits the functionality of the SFV 2.0 included widgets. For example: (in operational layers of config.xml)

<layer label="Sample" type="feature" visible="false" alpha="0"
                 info="widgets/InfoTemplates/SimpleInfoWinWidget.swf"
                 infoconfig="widgets/InfoTemplates/Sample.xml"
                 useAMF="false"
                 url="http://SEVRER/ArcGIS/rest/services/Sample/Layers/MapServer/0"/>

This widget would provide me the full functionality I am aiming for, but it does not perform well because the ' type="feature" ' part of that code is only compatible with ArcGIS Server 10 with FeatureServer services.

In order for the layer to symbolize correctly, I have to change ' type="feature" ' to ' type="dynamic" ' and this change results in the SimpleInfoWidget not reading the data correctly.


These are my two questions:

1. How do I integrate the Flex API 2.0 .mxml samples into the SFV 2.0? Do I modify them and add them as widgets, or add the code to the MapManager.mxml, or another way?

2. How do I perform identify tasks on my layers that are added using ArcGIS Server 9.3.1 in the SFV 2.0?
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Mike,

    There is no secret way of taking a API Sample and making it into a widget, yet that is what you will need to do if you want an API sample to work in the Viewer. If you are going to want to do things like have an identify ability in the Flexviewer 2.0 BETA that does not have a identifyWidget developed for it yet than you will have to start from the beginning and learn how to develop a simple widget and then build off of those skills to create a more complicated widget like an identify widget.

   Your best bet as a beginner in Flex is to take the Sample Flex Viewer 1.x Identify widget and use that as your base to update it to be 2.0 compliant Here is the link to the SFV 1.x Identify Widget

http://resources.esri.com/arcgisserver/apis/flex/index.cfm?fa=codeGalleryDetails&scriptID=15939

Learning Widget development is not hard at all especially for a GIS Programmer. Just be open to the new language and learn it's differences from your previous language experience.
0 Kudos
DasaPaddock
Esri Regular Contributor
You can use the Flex API's FeatureLayer against layers in a 9.3 MapService. You won't get the server's rendering info automatically, but you may find it easier to create a renderer on the FeatureLayer then develop a new widget.

Reference:
http://help.arcgis.com/en/webapi/flex/apiref/com/esri/ags/layers/GraphicsLayer.html#renderer
0 Kudos
MLowry
by
Frequent Contributor
You can use the Flex API's FeatureLayer against layers in a 9.3 MapService. You won't get the server's rendering info automatically, but you may find it easier to create a renderer on the FeatureLayer then develop a new widget.

Reference:
http://help.arcgis.com/en/webapi/flex/apiref/com/esri/ags/layers/GraphicsLayer.html#renderer




I'm not sure I understand this. Which "FeatureLayer" in the API does this post refer to? Can I get any more guidance on how I would add the renderer to the widget? Is there another widget I could look at to get the code for that?

I think I know what you are talking about though, because if I use my 9.3.1 service and set it up like it is a 10 service, but use "mapserver" instead of "featureserver", then the info popup works, but their is no symbology (big black dots).

Is there any way to configure the big black dots that it defaults to from the 9.3.1 layer?
0 Kudos
DasaPaddock
Esri Regular Contributor
See around line 414 of MapManager.mxml where it's adding a FeatureLayer to the map. FeatureLayer extends GraphicsLayer so it inherits the renderer and symbol properties. If you set either one, you'll can control the symbology of the layer and you won't get the default colors.
0 Kudos
MLowry
by
Frequent Contributor
See around line 414 of MapManager.mxml where it's adding a FeatureLayer to the map. FeatureLayer extends GraphicsLayer so it inherits the renderer and symbol properties. If you set either one, you'll can control the symbology of the layer and you won't get the default colors.


Thanks for the help!

 case "dynamic":
                        var dynLayer:ArcGISDynamicMapServiceLayer = new ArcGISDynamicMapServiceLayer(url);
                        
                        dynLayer.alpha   = alpha;
                        dynLayer.id      = label;
                        dynLayer.name    = label;
                        dynLayer.token   = token;
                        dynLayer.visible = visible;
                        
                        if (autoRefresh > 0)
                        {
                            setInterval(dynLayer.refresh, autoRefresh * 1000);
                        }
                        if (visibleLayers)
                        {
                            var vizLayers:Array = visibleLayers.split(",");
                            for (var i:int = 0; i < vizLayers.length; i++)
                            {
                                vizLayers = Number(vizLayers); // convert to Numbers
                            }
                            dynLayer.visibleLayers = new ArrayCollection(vizLayers);
                        }
                        if (proxyEnabled)
                        {
                            dynLayer.proxyURL = configData.proxy.url;
                        }
                        
                        if (operationalLayer)
                        {
                            layerObject.layer = dynLayer;
                        }
                        
                        map.addLayer(dynLayer);
                        break;



Is this the area in mapmanager that I need to be editing in order to extend the InfoTemplates (SimpleInfoWinWidget is the one I am trying currently) capabilities to 9.3.1 service layers?

My main goal is just to do an identify on 9.3.1 services, so if the quickest and most efficient way to achieve this is by setting the symbols for each layer manually with images using renderers in the assets folder I have no problem with that.

Am I right on the right track here?


Using this code in my config, the layers will identify correctly like I need them to, but the symbology doesn't come across from the service. All of the points are large black dots. The black dots are not located in the assets directory so I can not find out where it is pulling these default symbols from.
 <layer label="Test" type="feature" visible="true" alpha="1" 
                 info="widgets/InfoTemplates/SimpleInfoWinWidget.swf"
                 infoconfig="widgets/InfoTemplates/test.xml"
                 url="http://test.gov/ArcGIS/rest/services/VulnComm/Alltest/MapServer/0"/>
                  
0 Kudos
DasaPaddock
Esri Regular Contributor
You want to change the FeatureLayer, so see the case "feature": section and then add something like this: featureLayer.symbol = new PictureMarkerSymbol();

Reference:
http://help.arcgis.com/en/webapi/flex/apiref/com/esri/ags/symbols/PictureMarkerSymbol.html
0 Kudos
MLowry
by
Frequent Contributor
You want to change the FeatureLayer, so see the case "feature": section and then add something like this: featureLayer.symbol = new PictureMarkerSymbol();

Reference:
http://help.arcgis.com/en/webapi/flex/apiref/com/esri/ags/symbols/PictureMarkerSymbol.html


Oh, I see now. This isn't too hard and I got it to work for one layer, but I don't see how I could set 20 different symbols, having one for each separate layer when they each load?
0 Kudos
DasaPaddock
Esri Regular Contributor
You could add a new config option to the layer that you read in the ConfigManager and then use in the MapManager.
0 Kudos