Advertisement
Guest User

Untitled

a guest
Mar 30th, 2015
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.33 KB | None | 0 0
  1. int position = 0;
  2. var combo = AddIn.FromID<btnComboBoxQ7>(ThisAddIn.IDs.btnComboBoxQ7);
  3.  
  4. switch (combo.CurrentValue)
  5. {
  6. case ("ECOZONE"):
  7. position = 4;
  8. break;
  9.  
  10. case ("EDIST_NAME"):
  11. position = 5;
  12. break;
  13.  
  14. case ("ECOREGION"):
  15. position = 6;
  16. break;
  17.  
  18.  
  19. case ("ECORG_NAME"):
  20. position = 7;
  21. break;
  22.  
  23. case ("ECODIST"):
  24. position = 8;
  25. break;
  26. }
  27.  
  28. IMxDocument mxdoc = ArcMap.Application.Document as IMxDocument;
  29. IStatusBar statusBar = ArcMap.Application.StatusBar;
  30. ISelectionSet2 selectionSet;
  31. if (mxdoc.SelectedItem is IFeatureLayer2)
  32. {
  33. string message = null;
  34. ILayer layer = mxdoc.SelectedLayer;
  35. IFeatureLayer2 featureLayer = layer as IFeatureLayer2;
  36.  
  37.  
  38. IFeatureSelection featureSelection = featureLayer as IFeatureSelection;
  39. selectionSet = featureSelection.SelectionSet as ISelectionSet2;
  40. ICursor Cursor = null;
  41. selectionSet.Search(null, true, out Cursor);
  42. IFeatureCursor featureCursor = Cursor as IFeatureCursor;
  43.  
  44.  
  45.  
  46. IFeatureLayer layer1;
  47. layer1 = (IFeatureLayer)mxdoc.SelectedLayer;
  48. int fieldIndex = featureCursor.Fields.FindField("ALPS_ID");
  49. IFeature feature = featureCursor.NextFeature();
  50. while (feature != null)
  51. {
  52. message += feature.Value[fieldIndex] + ",";
  53. feature = featureCursor.NextFeature();
  54. }
  55. statusBar.Message[0] = "ALPS_ID is:" + message;
  56.  
  57.  
  58. ISpatialFilter spatialFilter;
  59. spatialFilter = new SpatialFilter();
  60. spatialFilter.Geometry = feature.Shape;
  61.  
  62. spatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelWithin;
  63.  
  64. IFeatureLayer2 featureLayer2 = layer as IFeatureLayer2;
  65.  
  66.  
  67. IFeatureSelection featureSelection2 = featureLayer2 as IFeatureSelection;
  68. selectionSet = featureSelection.SelectionSet as ISelectionSet2;
  69. ICursor Cursor2 = null;
  70.  
  71.  
  72. selectionSet.Search(spatialFilter, true, out Cursor2);
  73.  
  74. IFeatureCursor featureCursor2 = Cursor as IFeatureCursor;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement