I have complex querytask that includes whereclause and custom Drawing Area -or- Map Extent window. Results are displayed on left Pane (Like google) and I draw PushPins on a MyGraphiicsLayer for each feature result.
I was setting the visibility of layer that was queried to true (to show the default symbology from the msd) but now my client does not want to see EVERY FEATURE (with that default symbology from msd) but only the ones returned from QueryTask.
How can I do this without disturbing my existing Querytask logic - I'm lazy and don't wish to rewrite a whole lot...
After looking at FeatureLayer with Mode=SelectionOnly (could not figure out how to incorporate this correctly) I just
(1) have a single global variable FeatureLayer _tempQueryResult'
(2) in the method where I am building my QueryTask, I just added this:
if (this._tempQueryResult != null)
{
Map.Layers.Remove(this._tempQueryResult);
}
FeatureLayer fl = new FeatureLayer()
fl.Url = rest_map_svc_url;
fl.Where = whereClause;
fl.Geometry = geom;
fl.Update();
fl.Refresh();
Map.Layers.Add(fl);
this._tempQueryResult = fl;
in my clear results method
I just remove tempQueryResult from map.
No need to have N featurelayers, one for each queryable layer, I have 30++.
This did not interfere with my existing querytask that was building a left pane with result, drawing pushpin on result.
User is able to still check/uncheck the layer itself, to show all features; unchecking would still keep
the results displayed.
Still not sure when one would use selectiononly mode - I could not find this usable in my case.
Just opening this thread for further discussion.
All comments are welcome.