AnsweredAssumed Answered

How can I preset the symbol that 'analysis.Buffer' uses to render?

Question asked by htudosieesri-ca-esridist Employee on Jul 28, 2016
Latest reply on Aug 2, 2016 by htudosieesri-ca-esridist

I'm using this work around:

 

var v1 = await QueuedTask.Run(() => Geoprocessing.MakeValueArray(l1, null, units));
await Geoprocessing.ExecuteToolAsync("analysis.Buffer", v1).ContinueWith(async t =>
{
     var fillBuffLayer = DeltaLayer.Map.Layers.Where(l =>
     {
          var b = l as FeatureLayer;
          return (b != null) && (b.LabelClasses[0].WhereClause == "[BUFF_DIST]");
     }).FirstOrDefault();

     var buffLayer1 = (FeatureLayer)fillBuffLayer;
     if (buffLayer1 != null)
     {
          var simpleValueRenderer =
              (CIMSimpleRenderer)buffLayer1.CreateRenderer(BufferFillRendererDefinition));
          buffLayer1.SetRenderer(simpleValueRenderer);
     }

 

However it takes long time to execute and flickers ugly...

The second issue I face: the above code continue like this:

 

    if (l2 != null)
    {
        var v2 = await QueuedTask.Run(() => Geoprocessing.MakeValueArray(l2, null, units));
        await Geoprocessing.ExecuteToolAsync("analysis.Buffer", v2);

        var emptyBuffLayer = DeltaLayer.Map.Layers.Where(l =>
        {
            var b = l as FeatureLayer;
            return (b != null) && !Equals(b, buffLayer1) && (b.LabelClasses[0].WhereClause == "[BUFF_DIST]");
        }).FirstOrDefault();

        var buffLayer2 = (FeatureLayer)emptyBuffLayer;
        if (buffLayer2 != null)
        {
            var simpleValueRenderer = 
                (CIMSimpleRenderer)(buffLayer2.CreateRenderer(BufferEmptyRendererDefinition));
            buffLayer2.SetRenderer(simpleValueRenderer);
        }

 

and it is called after a Select and a Zoom to a feature which contains the points from the arrays l1 and l2.

With or without this code, after Select/Zoom, the map remains busy for a long lime (like in 5-10 seconds - why?!)

 

...Most of the times it fails either the points in l1 or l2 (IReadOnlyCollection<object>), or both, or fails to change the renter. However, some times (quite seldom) it works well...

 

Would it be because of the busy time on the mapView?

 

(And - third: Intellisesnse reports closures for l1, l2 and this on both ContinueWith...)

Outcomes