Select to view content in your preferred language

efficiency question: Hope someone can advise (sfv1.3, arc gis 9.3.1)

781
3
08-03-2010 07:49 AM
grahamcooke
Regular Contributor
I have a mapservice that contains a point feature class relating to ALL barriers on UK sites. This may end up containing upwards of a thousand point features when all data has been collected.

My users will be in different regions and when they load my application, they actually load a .NET wrapper site which selects the maps available to them. They then choose the map they want from a list of those available according to their region in the .net app and when they hit the go button, my flex app gets the mapservice url (from the flex application url parameters passed in from the aspx page they just visited ) dynamically.

In flex sfv 1.3, I have created a barriers widget, which will allow users to set barriers to open or closed on a given day. Obviously to do this i need to load in the barriers feature class as a layer when they open the widget. Should I "pre-query" the feature class first and only load the barriers for their region? Or should I just load the whole feature class? - as only the barriers in their region will be visible to them anyway because they should only see features within the current basemaps extent (basemaps are tiled)

If i preselect the features based on region (using a find task when the widget loads?) then I need to determine their region in flex (as it was actually determined in .NET previously). It seems to me in order to do this, then i need to set up a global variable that stores the region when the flex application is loaded.

So I guess my question is: Do I go with just opening up the whole feature class and rely on the mapping extent to ensure only the features related to the currently mapped region being shown, or is better practice to filter the barriers features that I load up with a query. If i do the latter, how do I actually create a global variable in flex?

I found this article: http://www.mikechambers.com/blog/2007/02/05/global-variables-within-flex-applications/ but can't seem to get either the public static class with public static string variable (suggested in the comments), or the Application.application.[varname] (suggested in the article itself) to work. I did do the imports mx.core.Application but still couldn't reference the AreaName variable i set up in index.mxml

Apologies for the longwinded post, hope I have been clear!
Tags (2)
0 Kudos
3 Replies
RobertScheitlin__GISP
MVP Emeritus
graham,

   Why not pass the region as part of the url parameter?
0 Kudos
grahamcooke
Regular Contributor
graham,

   Why not pass the region as part of the url parameter?


hi Robert,

Damn I knew I would explain this all wrong!!

Ok, Users are allocated to regions, regions have training areas, training areas are the maps that i work with in the SFV. The user login screen (in .net part of my app)  gets the logged in users region code and presents a list of maps they can choose from. This then gets passed as a url param to an aspx which hosts my flex app: like "http://flexapp/flex.aspx?MAP=http://gisserver/maps/trainingareaname/mapserver.

So you can see that the training area name (which is what im after, not the region...my initial post was a bit vague i grant you) is already passed in as part of the url params. I make sure that the map services are named the same as the trainingarea names for ease of use.

All this is kind of irrelevant though.... if i have the name i want as part of the url or whatever, I still  need to store it in a global variable (or something) so i can access it from widget code.  This then brings me to the last paragraph of my first post: If this is the way to do it, how do i do that? how do you create global variable in flex that you can set when the application is loaded and are then available for use in widget code.

Is my idea about loading the whole barrier layer completely inefficient then?
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Graham,

   OK, lets get just a little more detail than.

Global variables are suppose to be extremely simple. If you put a Public var myGlobalVar:String = "Hello World"; in the Index.mxml than you can call it from any where in code using this.parentApplication.myGlobalVar

You will have access to your url parameter from the MapManager.mxml and could just put the public var there also Public var myGlobalVar:String = "Hello World"; than you can call that from anywhere using SiteContainer.getInstance().mapManager.myGlobalVar; You will have to ensure that you import com.esri.solutions.flexviewer.SiteContainer;

Your idea about loading the whole barrier layer is less efficient than querying.
0 Kudos