C# ArcObjects ArcGIS Desktop 10.2.1 Zoom enumGeometryBind.BindGeometrySource does not respond

660
1
03-22-2017 05:34 AM
croemersabris
New Contributor II

We developed a function to step over an polygon layer, for each polygon, select every house (point layer) which lies inside the polygon. Now we zoom in den Map on these Buildings, to export the map.

This jobs sometimes runs into an Esri Function enumGeometryBind.BindGeometrySource without response. But always at different polygons/areas.

Sometimes all 6.000 areas are exported, sometimes the "no response" is at the 150th area, sometimes at area 3.500 ... .

We put logs into our code to check the input feature and the selectionset and IEnumGeometryBind, but there is nothing we found as irregular. When u run the same areas again the programm will zoom to the area, where it doesnt work out before and maybe won't repsond at a another area.
We develop with C# under VS 2015 and ArcGIS Desktop 10.2.1. All Layers are DBQuerylayers in ArcGIS from SQLServer2012.

Migth be something with COM?

Here the Code:

Snippet

public static void ZoomToSelection(string layername, bool layeraktualisieren)         {             try            {                 IEnumGeometry enumGeometry = new EnumFeatureGeometryClass();                 IEnumGeometryBind enumGeometryBind = enumGeometry as IEnumGeometryBind;                   ArrayList envelopList = new ArrayList();                   IEnvelope2 maxEnvelope = new EnvelopeClass();                  ILayer layer = cGlobalUtilGISLayer.GetLayer(layername);                  if (layer == null)                 {                               //Debuglog...                     return;                 }                 IFeatureSelection featureSelection = layer as IFeatureSelection;                 if (featureSelection != null && featureSelection.SelectionSet != null)                 {                     //Debuglog...
                    return;                                    }                    
                //The following function doesnt respond sometimes!
                enumGeometryBind.BindGeometrySource(null, featureSelection.SelectionSet);                    IGeometryFactory3 geometryFactory = new GeometryEnvironmentClass();                 maxEnvelope.Union(geometryFactory.CreateGeometryFromEnumerator(enumGeometry).Envelope);                                                  cGlobalGISVar.MyActiveView.Extent = maxEnvelope;                                   if (layeraktualisieren)                 {                     cGlobalGISVar.MyActiveView.Refresh();                  }             }             catch (Exception ex)             {  
                 //Debuglog... 
            }         }
Reply
0 Kudos
1 Reply
croemersabris
New Contributor II

The Snippet plugin didnt got my simplify corrections correct after i copied the function from vs.

so again:

Snippet

public static void ZoomToSelection(string layername, bool layeraktualisieren,string ff) {     try    {         IEnumGeometry enumGeometry = new EnumFeatureGeometryClass();         IEnumGeometryBind enumGeometryBind = enumGeometry as IEnumGeometryBind;         ArrayList envelopList = new ArrayList();         IEnvelope2 maxEnvelope = new EnvelopeClass();         ILayer layer = cGlobalUtilGISLayer.GetLayer(layername);         if (layer == null)         {             //Debuglog...                                 return;                          }         IFeatureSelection featureSelection = layer as IFeatureSelection;         if (featureSelection != null && featureSelection.SelectionSet != null)         {                                  //Debuglog...            return;         }           //The following function doesnt respond sometimes!        enumGeometryBind.BindGeometrySource(null, featureSelection.SelectionSet);           IGeometryFactory3 geometryFactory = new GeometryEnvironmentClass();         maxEnvelope.Union(geometryFactory.CreateGeometryFromEnumerator(enumGeometry).Envelope);         cGlobalGISVar.MyActiveView.Extent = maxEnvelope;         if (layeraktualisieren)         {             cGlobalGISVar.MyActiveView.Refresh();         }     }     catch (Exception ex)     {         //Debuglog...     } }
Reply
0 Kudos