缩放的地理范围选功能。使用这种方法确保所有选中的功能是显示在屏幕上。
///Zooms to the geographic extent of the selected features. Using this method ensures that all the selected features are displayed on the screen.
/// 
///An IGlobe interface
///  
///
public void ZoomToSelectedGlobeFeatures(ESRI.ArcGIS.GlobeCore.IGlobe globe)
{
  ESRI.ArcGIS.GlobeCore.IGlobeDisplay globeDisplay = globe.GlobeDisplay;
  ESRI.ArcGIS.Analyst3D.ISceneViewer sceneViewer = globeDisplay.ActiveViewer;
  ESRI.ArcGIS.Analyst3D.ICamera camera = sceneViewer.Camera;
  ESRI.ArcGIS.GlobeCore.IGlobeCamera globeCamera = (ESRI.ArcGIS.GlobeCore.IGlobeCamera)camera; // Explicit Cast
  ESRI.ArcGIS.Analyst3D.IScene scene = globeDisplay.Scene;
  ESRI.ArcGIS.Carto.IEnumLayer enumLayer = scene.get_Layers(null, true);

  ESRI.ArcGIS.Geometry.IEnvelope envelope = new ESRI.ArcGIS.Geometry.EnvelopeClass();
  envelope.SetEmpty();
  ESRI.ArcGIS.Geometry.IEnvelope layersExtentEnvelope = new ESRI.ArcGIS.Geometry.EnvelopeClass();
  layersExtentEnvelope.SetEmpty();
  ESRI.ArcGIS.Geometry.IZAware ZAware = (ESRI.ArcGIS.Geometry.IZAware)envelope; // Explicit Cast
  ZAware.ZAware = (true);

  ESRI.ArcGIS.Geodatabase.ISpatialFilter spatialFilter = new ESRI.ArcGIS.Geodatabase.SpatialFilterClass();
  ESRI.ArcGIS.Geometry.ISpatialReference spatialReference = scene.SpatialReference;
  System.Boolean haveFeatures = false;
  enumLayer.Reset();

  ESRI.ArcGIS.Carto.ILayer layer;
  while ((layer = enumLayer.Next()) != null)
  {
    if (layer == null)
      break;


    if (layer is ESRI.ArcGIS.Carto.IFeatureLayer)
    {
      ESRI.ArcGIS.Carto.IFeatureLayer featureLayer = (ESRI.ArcGIS.Carto.IFeatureLayer)layer; // Explicit Cast
      ESRI.ArcGIS.Carto.IFeatureSelection featureSelection = (ESRI.ArcGIS.Carto.IFeatureSelection)layer; // Explicit Cast
      ESRI.ArcGIS.Geodatabase.ISelectionSet selectionSet = featureSelection.SelectionSet;
      ESRI.ArcGIS.Geodatabase.IFeatureClass featureClass = featureLayer.FeatureClass;
      System.String shapeField = featureClass.ShapeFieldName;
      spatialFilter.GeometryField = shapeField;
      spatialFilter.set_OutputSpatialReference(shapeField, spatialReference);

      // The next 2 lines of code are different from many other ArcObjects programming techniques in that the 
      // ICursor Interface variable 'cursor' is initialized to a Null value. It is set by reference with the 
      // call to the Search method; hence the need for the 'out' argument (see MSDN for more information).
      ESRI.ArcGIS.Geodatabase.ICursor cursor;
      selectionSet.Search(spatialFilter, true, out cursor);

      ESRI.ArcGIS.Geodatabase.IFeatureCursor featureCursor = (ESRI.ArcGIS.Geodatabase.IFeatureCursor)cursor; // Explicit Cast

      System.Boolean getLayerExtent = true;
      ESRI.ArcGIS.Geodatabase.IFeature feature;  // Automatically initialized to null. Used to test existence of a feature in the featureCursor
      while ((feature = featureCursor.NextFeature()) != null)
      {
        ESRI.ArcGIS.Geometry.IGeometry geometry = feature.Shape;
        ESRI.ArcGIS.Geometry.IEnvelope featureExtent = geometry.Envelope;
        envelope.Union(featureExtent);
        haveFeatures = true;

        if (getLayerExtent)
        {
          ESRI.ArcGIS.Geodatabase.IGeoDataset geoDataset = (ESRI.ArcGIS.Geodatabase.IGeoDataset)featureLayer; // Explicit Cast
          if (geoDataset != null)
          {
            ESRI.ArcGIS.Geometry.IEnvelope layerExtent = geoDataset.Extent;
            layersExtentEnvelope.Union(layerExtent);
           }
           getLayerExtent = false;
        }
      }
    }
  }

  // Since the size of points is very small, we use a special case to zoom in closer

  System.Double width = envelope.Width;
  System.Double height = envelope.Height;
  if (width == 0.0 && height == 0.0)  // Must be a single point, Zoom to 1 x 1 degree area,
  {                                   // or lets say 1/20th of layer extent, whichever is smallest.
    System.Double dim = 1.0;

    System.Boolean bEmpty = layersExtentEnvelope.IsEmpty;
    if (!bEmpty)
    {
      System.Double layerWidth = layersExtentEnvelope.Width;
      System.Double layerHeight = layersExtentEnvelope.Height;
      System.Double layerDim = System.Math.Max(layerWidth, layerHeight) * 0.05;
      if (layerDim > 0.0)
        dim = System.Math.Min(1.0, layerDim);
    }

    System.Double xMin = envelope.XMin;
    System.Double yMin = envelope.YMin;

    ESRI.ArcGIS.Geometry.IPoint point = new ESRI.ArcGIS.Geometry.PointClass();
    point.X = xMin;
    point.Y = yMin;

    envelope.Width = dim;
    envelope.Height = dim;
    envelope.CenterAt(point);
  }
  else if (width == 0.0 || height == 0.0)
  {
    System.Double maxDim = System.Math.Max(width, height);
    envelope.Width = maxDim;
    envelope.Height = maxDim;
  }

  globeCamera.SetToZoomToExtents(envelope, globe, sceneViewer);
  sceneViewer.Redraw(true);