示例#1
0
        private GSOAniObjTimeLine createKeyFrame(GSOAniObjTimeLine timeLine, GSOFeature featureAboutAnimation)
        {
            if (timeLine == null || featureAboutAnimation == null || featureAboutAnimation.Geometry == null)
            {
                return null;
            }
            GSOFeature feature = featureAboutAnimation.Clone();
            if (feature.Geometry.Style == null || feature.Geometry.Style is GSOSimpleLineStyle3D)
            {
                feature.Geometry.Style = new GSOPipeLineStyle3D();
            }
            feature.Geometry.AltitudeMode = EnumAltitudeMode.RelativeToGround;
            ((GSOGeoPolyline3D)feature.Geometry).SmoothToSpline();
            ((GSOStyle3D)feature.Geometry.Style).UsingBlur = true;
            globeControl1.Globe.MemoryLayer.AddFeature(feature);

            GSOAniFeature featureAnimation = new GSOAniFeature();//动画的类型--要素动画
            featureAnimation.Feature = feature;                  //动画的关联对象

            GSOAniEffectLineGrow effect = new GSOAniEffectLineGrow();//动画效果-线增长动画
            effect.StartValue = 0;
            effect.EndValue = 1;
            effect.FrameCount = 1200;
            effect.RepeatCount = 1;
            //effect.IsSmooth = false;

            GSOAniKeyFrame keyFream = new GSOAniKeyFrame(); //关键帧
            keyFream.Frame = 0;
            keyFream.AddEffect(effect);                     //给关键帧添加动画效果

            timeLine.AddKeyFrame(keyFream);
            return timeLine;
        }
示例#2
0
        private void 线增长动画ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (globeControl1.Globe.SelectedObject != null)
            {
                GSOFeature feature = globeControl1.Globe.SelectedObject;
                feature.HighLight = false;
                globeControl1.Globe.Refresh();
                if (feature.Geometry != null && feature.Geometry.Type == EnumGeometryType.GeoPolyline3D)
                {
                    if (feature.Geometry.Style == null)
                    {
                        feature.Geometry.Style = new GSOSimpleLineStyle3D();
                    }
                    feature.Geometry.AltitudeMode = EnumAltitudeMode.RelativeToGround;
                    ((GSOGeoPolyline3D)feature.Geometry).SmoothToSpline();
                    ((GSOStyle3D)feature.Geometry.Style).UsingBlur = true;
                    globeControl1.Globe.MemoryLayer.AddFeature(feature);

                    GSOAniFeature featureAnimation = new GSOAniFeature();//动画的类型--要素动画
                    featureAnimation.Feature = feature;                  //动画的关联对象

                    GSOAniEffectLineGrow effect = new GSOAniEffectLineGrow();//动画效果-线增长动画
                    effect.StartValue = 0;
                    effect.EndValue = 1;
                    effect.FrameCount = 1200;
                    effect.RepeatCount = 1;
                    //effect.IsSmooth = false;

                    GSOAniKeyFrame keyFream = new GSOAniKeyFrame(); //关键帧
                    keyFream.Frame = 0;
                    keyFream.AddEffect(effect);                     //给关键帧添加动画效果

                    GSOAniObjTimeLine timeLine = new GSOAniObjTimeLine();//动画对象
                    timeLine.Name = "线增长动画对象";
                    timeLine.AniObject = featureAnimation;               //动画对象的动画类型
                    timeLine.AddKeyFrame(keyFream);                      //给动画对象添加关键帧

                    GSOAnimationPage page = new GSOAnimationPage();      //动画
                    page.FPS = 60;                                       //动画--帧率
                    page.FrameCount = 20 * 60; //动画时长 * 帧率         //动画--帧总数
                    page.Name = "线增长动画";
                    page.AddObjTimeLine(timeLine);                       //给动画添加动画对象

                    globeControl1.Globe.AnimationPages.Add(page);
                    globeControl1.Globe.AnimationPages.GetAt(globeControl1.Globe.AnimationPages.Length - 1).Play();
                    globeControl1.Refresh();
                }
                else
                {
                    MessageBox.Show("请选中一条线!","提示");
                }
            }
        }
示例#3
0
        private void ConnexityAnalysis()
        {
            GSODataset curCAYDataset = m_ConnexityAnalysisFirstLayer.Dataset;
            string srName = curCAYDataset.Name;
            GSONetworkDataset curCAYNDataset = curCAYDataset.DataSource.GetDatasetByName(srName + "Network") as GSONetworkDataset;
            if (curCAYNDataset == null)
            {
                MessageBox.Show("该图层没有创建网络拓扑,请先创建网络拓扑信息再进行分析!", "提示");
                return;
            }

            int[] arryResID;
            curCAYNDataset.ConnexityAnalysis(m_ConnexityAnalysisFirstFeature.ID, m_ConnexityAnaylsisSecondFeature.ID, out arryResID, false, true);
            m_ConnexityAnalyResFeatures = m_ConnexityAnalysisFirstLayer.GetFeaturesByIDs(arryResID);
            if (m_ConnexityAnalyResFeatures == null || m_ConnexityAnalyResFeatures.Length < 1)
            {
                String strLine1 = "管线:" + m_ConnexityAnalysisFirstFeature.ID;
                String strLine2 = "管线:" + m_ConnexityAnaylsisSecondFeature.ID;
                MessageBox.Show(strLine1 + " 与 " + strLine2 + " 不连通", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);

            }
            else
            {
                int nCount = m_ConnexityAnalyResFeatures.Length;
                GSOGeoPolyline3D effectLine = new GSOGeoPolyline3D();
                GSOPoint3ds effectPart = new GSOPoint3ds();
                for (int i = 0; i < nCount; i++)
                {
                    m_ConnexityAnalyResFeatures[i].HighLight = true;
                    GSOGeoPolyline3D geoline = m_ConnexityAnalyResFeatures[i].Geometry as GSOGeoPolyline3D;
                    if (geoline != null)
                    {
                        //管线显示流动效果
                        for (int j = 0; j < geoline.PartCount; j++)
                        {
                            effectLine.AddPart(geoline[j]);
                        }
                    }
                }
                effectLine.SmoothToSpline();
                GSOFeature feature = new GSOFeature();
                feature.Geometry = effectLine;
                if (feature.Geometry.Style == null)
                {
                    feature.Geometry.Style = new GSOSimpleLineStyle3D();
                }
                feature.Geometry.AltitudeMode = EnumAltitudeMode.RelativeToGround;
                ((GSOStyle3D)feature.Geometry.Style).UsingBlur = true;
                globeControl1.Globe.MemoryLayer.AddFeature(feature);

                GSOAniFeature featureAnimation = new GSOAniFeature();//动画的类型--要素动画
                featureAnimation.Feature = feature;                  //动画的关联对象

                GSOGeoMarker marker = new GSOGeoMarker(0, 0, 0,"");
                GSOMarkerStyle3D markerStyle = new GSOMarkerStyle3D();
                markerStyle.IconPath = Application.StartupPath + "/Resource/image/star4.bmp";
                marker.Style = markerStyle;
                marker.AltitudeMode = EnumAltitudeMode.RelativeToGround;
                GSOFeature markerFeature = new GSOFeature();
                markerFeature.Geometry = marker;

                GSOAniEffectLineGrow effect = new GSOAniEffectLineGrow();//动画效果-线增长动画
                effect.StartValue = 0;
                effect.EndValue = 1;
                effect.FrameCount = 1200;
                effect.RepeatCount = 1;
                effect.IsSmooth = false;
                effect.ActorFeature = markerFeature;

                GSOAniKeyFrame keyFream = new GSOAniKeyFrame(); //关键帧
                keyFream.Frame = 0;
                keyFream.AddEffect(effect);                     //给关键帧添加动画效果

                GSOAniObjTimeLine timeLine = new GSOAniObjTimeLine();//动画对象
                timeLine.Name = "线增长动画对象";
                timeLine.AniObject = featureAnimation;               //动画对象的动画类型
                timeLine.AddKeyFrame(keyFream);                      //给动画对象添加关键帧

                GSOAnimationPage page = new GSOAnimationPage();      //动画
                page.FPS = 60;                                       //动画--帧率
                page.FrameCount = 20 * 60; //动画时长 * 帧率         //动画--帧总数
                page.Name = "线增长动画";
                page.AddObjTimeLine(timeLine);                       //给动画添加动画对象

                globeControl1.Globe.AnimationPages.Add(page);

                globeControl1.Globe.AnimationPages.GetAt(globeControl1.Globe.AnimationPages.Length - 1).Play();

                globeControl1.Refresh();
            }
        }