public MultipleGlobeViewers()
 {
     globe          = ArcGlobe.Globe;
     globeDisplay   = globe.GlobeDisplay;
     globeCamera    = (ESRI.ArcGIS.GlobeCore.IGlobeCamera)globeDisplay.ActiveViewer.Camera;
     globeDispEvent = (ESRI.ArcGIS.GlobeCore.IGlobeDisplayEvents_Event)globeDisplay;
 }
 public MultipleGlobeViewers()
 {
     globe = ArcGlobe.Globe;
     globeDisplay = globe.GlobeDisplay;
     globeCamera = (ESRI.ArcGIS.GlobeCore.IGlobeCamera)globeDisplay.ActiveViewer.Camera;
     globeDispEvent = (ESRI.ArcGIS.GlobeCore.IGlobeDisplayEvents_Event)globeDisplay;
 }
        //public ILayer AddShapefileUsingOpenFileDialog(IActiveView activeView)
        //{
        //    //parameter check
        //    if (activeView == null)
        //    {
        //        return null;
        //    }

        //    // Use the OpenFileDialog Class to choose which shapefile to load.
        //    System.Windows.Forms.OpenFileDialog openFileDialog = new System.Windows.Forms.OpenFileDialog();
        //    openFileDialog.InitialDirectory = @"C:\Users\mgh\Desktop\AirPlane2";
        //    openFileDialog.Filter = "Shapefiles (*.shp)|*.shp";
        //    openFileDialog.FilterIndex = 2;
        //    openFileDialog.RestoreDirectory = true;
        //    openFileDialog.Multiselect = false;

        //    IFeatureLayer featureLayer = null;

        //    if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
        //    {
        //        // The user chose a particular shapefile.

        //        // The returned string will be the full path, filename and file-extension for the chosen shapefile. Example: "C:\test\cities.shp"
        //        string shapefileLocation = openFileDialog.FileName;

        //        if (shapefileLocation != "")
        //        {
        //            // Ensure the user chooses a shapefile

        //            // Create a new ShapefileWorkspaceFactory CoClass to create a new workspace
        //            IWorkspaceFactory workspaceFactory = new ShapefileWorkspaceFactoryClass();

        //            // IO.Path.GetDirectoryName(shapefileLocation) returns the directory part of the string. Example: "C:\test\"
        //            IFeatureWorkspace featureWorkspace = (IFeatureWorkspace)workspaceFactory.OpenFromFile(System.IO.Path.GetDirectoryName(shapefileLocation), 0); // Explicit Cast

        //            // IO.Path.GetFileNameWithoutExtension(shapefileLocation) returns the base filename (without extension). Example: "cities"
        //            IFeatureClass featureClass = featureWorkspace.OpenFeatureClass(System.IO.Path.GetFileNameWithoutExtension(shapefileLocation));

        //            featureLayer = new FeatureLayer();
        //            featureLayer.FeatureClass = featureClass;
        //            featureLayer.Name = featureClass.AliasName;
        //            featureLayer.Visible = true;

        //            AddVectorDataToGlobe(GlobeControl.Globe, esriGlobeLayerType.esriGlobeLayerTypeDraped, (ILayer)featureLayer);

        //            // Zoom the display to the full extent of all layers in the map
        //            activeView.Extent = featureLayer.AreaOfInterest;
        //            activeView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);

        //            ChangeRasterize();
        //            ChangeHeightProperties(featureLayer);

        //            // ChangeProp();
        //            //AddDrapeLayerToGlobeElevationSurface(m_globe.GlobeDisplay, (ILayer)featureLayer, @"C:\Users\mgh\Desktop\AirPlane2\AirPlane\AirPlane\bin\Debug\GlobeData\wsiearth.tif");
        //        }
        //        else
        //        {

        //        }
        //    }
        //    else
        //    {

        //    }

        //    return (ILayer)featureLayer;
        //}

        public void AddVectorDataToGlobe(ESRI.ArcGIS.GlobeCore.IGlobe globe, ESRI.ArcGIS.GlobeCore.esriGlobeLayerType globeLayerType, ESRI.ArcGIS.Carto.ILayer layer)
        {
            if (globe == null || layer == null || globeLayerType == ESRI.ArcGIS.GlobeCore.esriGlobeLayerType.esriGlobeLayerTypeElevation || globeLayerType == ESRI.ArcGIS.GlobeCore.esriGlobeLayerType.esriGlobeLayerTypeUnknown)
            {
                return;
            }

            ESRI.ArcGIS.GlobeCore.IGlobeDisplay  globeDisplay  = globe.GlobeDisplay;
            ESRI.ArcGIS.GlobeCore.IGlobeDisplay2 globeDisplay2 = globeDisplay as ESRI.ArcGIS.GlobeCore.IGlobeDisplay2; // Reference or Boxing Conversion
            globeDisplay2.PauseCaching = true;
            globe.AddLayerType(layer, globeLayerType, true);
            ESRI.ArcGIS.GlobeCore.IGlobeDisplayLayers   globeDisplayLayers   = globeDisplay as ESRI.ArcGIS.GlobeCore.IGlobeDisplayLayers; // Reference or Boxing Conversion
            ESRI.ArcGIS.GlobeCore.IGlobeLayerProperties globeLayerProperties = globeDisplayLayers.FindGlobeProperties(layer);
            globeLayerProperties.Type = esriGlobeDataType.esriGlobeDataVector;
            globeLayerProperties.IsDynamicallyRasterized = false;
            globeDisplay2.PauseCaching = false;
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
 public VisualizeCameraPath()
 {
     globe        = ArcGlobe.Globe;
     globeDisplay = globe.GlobeDisplay;
     globeCamera  = globeDisplay.ActiveViewer.Camera as IGlobeCamera;
 }
Ejemplo n.º 6
0
        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);
        }
 public VisualizeCameraPath()
 {
     globe = ArcGlobe.Globe;
     globeDisplay = globe.GlobeDisplay;
     globeCamera = globeDisplay.ActiveViewer.Camera as IGlobeCamera;
 }