コード例 #1
0
        //指定模型,并设置其节点动画属性
        private void cb_Model_SelectedIndexChanged(object sender, EventArgs e)
        {
            //如果之前的模型正在运动,则停止运动
            if (m_nodeAnimation != null && m_nodeAnimation.IsEnabled == true)
            {
                m_nodeAnimation.IsEnabled = false;
            }

            //获取当前模型,并设置节点动画
            String featureName = this.cb_Model.SelectedItem as String;

            Feature3Ds features = m_layerKML.Features;

            Feature3D[] feature3Ds = features.FindFeature(featureName, Feature3DSearchOption.AllFeatures);
            if (feature3Ds.Length > 0)
            {
                Feature3D    feature3D    = feature3Ds[0];
                GeoPlacemark geoPlacemark = feature3D.Geometry as GeoPlacemark;
                m_geoModel = geoPlacemark.Geometry as GeoModel;
                if (m_geoModel != null)
                {
                    m_nodeAnimation = m_geoModel.NodeAnimation;
                    //位置变更事件
                    m_nodeAnimation.TimePositionChanged -= new TimePositionChangedEventHandler(m_nodeAnimationTimePositionChanged);
                    m_nodeAnimation.TimePositionChanged += new TimePositionChangedEventHandler(m_nodeAnimationTimePositionChanged);

                    if (m_geoLine3D != null && m_geoLine3D.PartCount > 0)
                    {
                        m_nodeAnimation.SetTrack(m_geoLine3D);
                        m_nodeAnimation.TimePostition = 0;
                    }
                }
            }
        }
コード例 #2
0
        //关闭对话框
        private void DlgNodeAnimation_FormClosing(object sender, FormClosingEventArgs e)
        {
            this.cb_Model.Items.Clear();
            this.m_sceneControl.Scene.TrackingLayer.Clear();
            m_nodeAnimation.TimePositionChanged -= new TimePositionChangedEventHandler(m_nodeAnimationTimePositionChanged);
            m_sceneControl.Tracked   -= new Tracked3DEventHandler(m_sceneControl_Tracked);
            m_nodeAnimation.IsEnabled = false;

            m_geoLine3D               = null;
            m_style3D                 = null;
            m_nodeAnimation           = null;
            m_geoModel                = null;
            this.btn_AddToKML.Enabled = false;
        }