private void buttonX2_Click(object sender, EventArgs e) { ESRI.ArcGIS.Analyst3D.IScene scene = (ESRI.ArcGIS.Analyst3D.IScene)GlobeControl.Globe; // Explicit cast. ESRI.ArcGIS.Geometry.IEnvelope envelope = GlobalValues.element3D.Geometry.Envelope; ESRI.ArcGIS.Analyst3D.ICamera camera = GlobeControl.Globe.GlobeDisplay.ActiveViewer.Camera; ESRI.ArcGIS.GlobeCore.IGlobeCamera globeCamera = (ESRI.ArcGIS.GlobeCore.IGlobeCamera) camera; // Explicit cast. ESRI.ArcGIS.Analyst3D.ISceneViewer sceneViewer = GlobeControl.Globe.GlobeDisplay.ActiveViewer; globeCamera.SetToZoomToExtents(envelope, GlobeControl.Globe, sceneViewer); }
private void CreateFlybyFromPathAnimation(ESRI.ArcGIS.GlobeCore.IGlobe globe, ESRI.ArcGIS.Geodatabase.IFeature lineFeature, ESRI.ArcGIS.Animation.IAGImportPathOptions AGImportPathOptionsCls) { ESRI.ArcGIS.GlobeCore.IGlobeDisplay globeDisplay = globe.GlobeDisplay; ESRI.ArcGIS.Analyst3D.IScene scene = globeDisplay.Scene; // Get a handle to the animation extension ESRI.ArcGIS.Analyst3D.IBasicScene2 basicScene2 = (ESRI.ArcGIS.Analyst3D.IBasicScene2)scene; // Explicit Cast ESRI.ArcGIS.Animation.IAnimationExtension animationExtension = basicScene2.AnimationExtension; // Get the geometry of the line feature ESRI.ArcGIS.Geometry.IGeometry geometry = lineFeature.Shape; // Create AGAnimationUtils and AGImportPathOptions objects ESRI.ArcGIS.Animation.IAGAnimationUtils AGAnimationUtilsCls = new ESRI.ArcGIS.Animation.AGAnimationUtilsClass(); AGImportPathOptionsCls.PathGeometry = geometry; AGImportPathOptionsCls.AnimationEnvironment = animationExtension.AnimationEnvironment; ESRI.ArcGIS.Animation.IAGAnimationContainer AGAnimationContainer = animationExtension.AnimationTracks.AnimationObjectContainer; // Call "CreateFlybyFromPath" method AGAnimationUtilsCls.CreateFlybyFromPath(AGAnimationContainer, AGImportPathOptionsCls); }
public void ZoomToSelectedGlobeFeatures(ESRI.ArcGIS.GlobeCore.IGlobe globe, IEnvelope pEv, string name) { 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; ESRI.ArcGIS.Analyst3D.IScene scene = globeDisplay.Scene; 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; ZAware.ZAware = (true); envelope.Union(pEv); IFeatureLayer pFlyr = null; for (int i = 0; i < scene.LayerCount; ++i) { if (scene.get_Layer(i).Name == name) { pFlyr = scene.get_Layer(i) as IFeatureLayer; break; } } ESRI.ArcGIS.Geodatabase.IGeoDataset geoDataset = (ESRI.ArcGIS.Geodatabase.IGeoDataset)pFlyr; if (geoDataset != null) { ESRI.ArcGIS.Geometry.IEnvelope layerExtent = geoDataset.Extent; layersExtentEnvelope.Union(layerExtent); } System.Double width = envelope.Width; System.Double height = envelope.Height; if (width == 0.0 && height == 0.0) { 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 * 0.8; envelope.Height = dim * 0.8; 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); }