Esempio n. 1
0
        //public void CreateAnimationFromPath_scene()
        //{
        //    //IGlobe pGlobe = axGlobeControl1.Globe;
        //    //IGlobeDisplay globeDisplay = pGlobe.GlobeDisplay;
        //    //IScene scene = globeDisplay.Scene;
        //    IScene pScene = axSceneControl1.Scene;
        //    ISceneGraph sceneGraph = pScene.SceneGraph;
        //    IScene scene = sceneGraph.Scene;

        //    // 获取动画扩展
        //    IBasicScene2 basicScene2 = scene as IBasicScene2;
        //    IAnimationExtension animationExtension = basicScene2.AnimationExtension;

        //    //获取路径

        //    //读取shp文件

        //    IWorkspaceFactory pWorkspaceFactory = new ShapefileWorkspaceFactory();

        //    string path = @"D:\code\GISDiary\GISDiary\bin\Debug\res\poi5line_lei\poi5line_lei\poi5line_lei.shp";
        //    string pFolder = System.IO.Path.GetDirectoryName(path);
        //    string pFileName = System.IO.Path.GetFileName(path);

        //    //2打开shapeFile工作空间
        //    IWorkspace pWorkspace = pWorkspaceFactory.OpenFromFile(pFolder, 0);
        //    IFeatureWorkspace pFeatureWorkspace = pWorkspace as IFeatureWorkspace;

        //    //3、打开要素类
        //    IFeatureClass pFeatureClass = pFeatureWorkspace.OpenFeatureClass(pFileName);

        //    //4、创建要素图层
        //    IFeatureLayer pFLayer = new FeatureLayerClass();

        //    //5、关联图层和要素类
        //    pFLayer.FeatureClass = pFeatureClass;
        //    pFLayer.Name = pFeatureClass.AliasName;
        //    int b = pFeatureClass.ObjectClassID;

        //    ILayer pLayer = pFLayer;
        //    IFeatureLayer featureLayer = pLayer as IFeatureLayer;
        //    IFeatureClass featureClass = featureLayer.FeatureClass;
        //    //int pFeatureID = pFeatureClass.FeatureClassID;
        //    int pFeatureID = 0;
        //    IFeature feature = featureClass.GetFeature(pFeatureID);
        //    IGeometry geometry = feature.Shape;

        //    //创建AGAnimationUtils和AGImportPathOptions对象
        //    ESRI.ArcGIS.Animation.IAGAnimationUtils agAnimationUtils = new AGAnimationUtilsClass();
        //    ESRI.ArcGIS.Animation.IAGImportPathOptions agImportPathOptions = new AGImportPathOptionsClass();

        //    // 设置AGImportPathOptions的属性
        //    agImportPathOptions.BasicMap = (IBasicMap)pScene;
        //    agImportPathOptions.AnimationTracks = (IAGAnimationTracks)pScene;
        //    agImportPathOptions.AnimationType = new AnimationTypeGlobeCameraClass();
        //    agImportPathOptions.AnimatedObject = pScene.SceneGraph.ActiveViewer.Camera; //动画对象
        //    agImportPathOptions.PathGeometry = geometry;                      //动画轨迹
        //    agImportPathOptions.ConversionType = ESRI.ArcGIS.Animation.esriFlyFromPathType.esriFlyFromPathObsAndTarget;
        //    agImportPathOptions.LookaheadFactor = 0.05;
        //    agImportPathOptions.RollFactor = 0;

        //    agImportPathOptions.AnimationEnvironment = animationExtension.AnimationEnvironment;
        //    IAGAnimationContainer AGAnimationContainer = animationExtension.AnimationTracks.AnimationObjectContainer;

        //    //创建
        //    agAnimationUtils.CreateFlybyFromPath(AGAnimationContainer, agImportPathOptions);

        //    //播放

        //    //获取AGAnimationEnvironment对象
        //    IBasicScene2 basicscene = pScene as IBasicScene2;
        //    IAnimationExtension animationEx = basicscene.AnimationExtension;
        //    IAGAnimationEnvironment agAnimationEnv;
        //    agAnimationEnv = animationEx.AnimationEnvironment;
        //    agAnimationEnv.AnimationDuration = Convert.ToDouble("30");//持续时间
        //    agAnimationEnv.PlayType = esriAnimationPlayType.esriAnimationPlayTypeDuration; //播放模式

        //    agAnimationEnv.PlayMode = esriAnimationPlayMode.esriAnimationPlayOnceForward;

        //    agAnimationEnv.PlayMode = esriAnimationPlayMode.esriAnimationPlayOnceReverse;
        //    //agAnimationEnv.PlayMode = esriAnimationPlayMode.esriAnimationPlayLoopForward;
        //    //agAnimationEnv.PlayMode = esriAnimationPlayMode.esriAnimationPlayLoopReverse;


        //    IAGAnimationPlayer agAnimationPlayer = agAnimationUtils as IAGAnimationPlayer;

        //    agAnimationPlayer.PlayAnimation(pScene as IAGAnimationTracks, agAnimationEnv, null);



        //    //保存

        //    string SaveFilePath = @"res\flyScene";
        //    if (System.IO.File.Exists(SaveFilePath))
        //    {
        //        System.IO.File.Delete(SaveFilePath);
        //        agAnimationUtils.SaveAnimationFile(AGAnimationContainer, SaveFilePath, esriArcGISVersion.esriArcGISVersion10);
        //    }

        //}

        #endregion

        #region "Stop Animation and Show Grave Information"



        private void showGrave()//资料卡展示
        {
            //十字丝定位放大

            //子窗体展示
            //longitude = 117;/*****************/
            Form_showGrave fn = new Form_showGrave();

            fn.MdiParent     = this;
            fn.StartPosition = FormStartPosition.CenterScreen;

            /*            //除此之外,也可以手动设置窗口显示的位置,即窗口坐标。首先必须把窗体的显示位置设置为手动。
             *          fn.StartPosition = FormStartPosition.Manual;
             *          //随后获取屏幕的分辨率,也就是显示器屏幕的大小。
             *          int xWidth = SystemInformation.PrimaryMonitorSize.Width;//获取显示器屏幕宽度
             *          int yHeight = SystemInformation.PrimaryMonitorSize.Height;//高度
             *          //然后定义窗口位置,以主窗体为例
             *          //MessageBox.Show(xWidth.ToString(), yHeight.ToString());
             *         //fn.Location = new Point(xWidth / 2, yHeight / 2);//这里需要再减去窗体本身的宽度和高度的一半
             *         在窗体的属性location里设置
             */

            fn.Show();
            SetParent((int)fn.Handle, (int)this.Handle);
        }
Esempio n. 2
0
        private void button4_Click(object sender, EventArgs e)
        {
            //墓穴展示
            Form_showGrave f4 = new Form_showGrave();

            f4.MdiParent     = this;
            f4.StartPosition = FormStartPosition.CenterScreen;
            f4.Show();
            SetParent((int)f4.Handle, (int)this.Handle);
        }
Esempio n. 3
0
        private void pictureBox2_Click(object sender, EventArgs e)
        {
            // difficultyAll1.Visible = true;

            System.Timers.Timer t = new System.Timers.Timer(5000);//10000ms空隙
            longitude = 117;
            showGrave();
            //Thread.Sleep(3000);

            //CheckForIllegalCrossThreadCalls = false;
            //t = new System.Timers.Timer(3000);//10000ms空隙
            //t.Elapsed += new System.Timers.ElapsedEventHandler(CloseGrave);//调用函数
            //t.AutoReset = false;//是否循环调用
            //t.Enabled = true;//是否调用

            fn        = new Form_showGrave();
            longitude = 111;
            showGrave();
            Thread.Sleep(1000);
            //CheckForIllegalCrossThreadCalls = false;
            ////   t = new System.Timers.Timer(5000);//10000ms空隙
            //t = new System.Timers.Timer(3000);//10000ms空隙
            //t.Elapsed += new System.Timers.ElapsedEventHandler(CloseGrave);//调用函数
            //t.AutoReset = false;//是否循环调用
            //t.Enabled = true;//是否调用

            fn        = new Form_showGrave();
            longitude = 109;
            showGrave();
            Thread.Sleep(1000);
            //CheckForIllegalCrossThreadCalls = false;
            ////    t = new System.Timers.Timer(5000);//10000ms空隙
            //t = new System.Timers.Timer(8000);//10000ms空隙
            //t.Elapsed += new System.Timers.ElapsedEventHandler(CloseGrave);//调用函数
            //t.AutoReset = false;//是否循环调用
            //t.Enabled = true;//是否调用

            fn        = new Form_showGrave();
            longitude = 128;
            showGrave();
            Thread.Sleep(1000);
            //CheckForIllegalCrossThreadCalls = false;
            ////   t = new System.Timers.Timer(5000);//10000ms空隙
            //t = new System.Timers.Timer(8000);//10000ms空隙
            //t.Elapsed += new System.Timers.ElapsedEventHandler(CloseGrave);//调用函数
            //t.AutoReset = false;//是否循环调用
            //t.Enabled = true;//是否调用

            fn        = new Form_showGrave();
            longitude = 91;
            showGrave();
            Thread.Sleep(1000);
            //CheckForIllegalCrossThreadCalls = false;
            ////   t = new System.Timers.Timer(5000);//10000ms空隙
            //t = new System.Timers.Timer(8000);//10000ms空隙
            //t.Elapsed += new System.Timers.ElapsedEventHandler(CloseGrave);//调用函数
            //t.AutoReset = false;//是否循环调用
            //t.Enabled = true;//是否调用

            fn        = new Form_showGrave();
            longitude = 107;
            showGrave();
            Thread.Sleep(1000);
            //CheckForIllegalCrossThreadCalls = false;
            //// t = new System.Timers.Timer(5000);//10000ms空隙
            //t = new System.Timers.Timer(8000);//10000ms空隙
            //t.Elapsed += new System.Timers.ElapsedEventHandler(CloseGrave);//调用函数
            //t.AutoReset = false;//是否循环调用
            //t.Enabled = true;//是否调用
        }