/// <summary>
        /// 开始演示
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonPlay_Click(object sender, EventArgs e)
        {
            if (m_WaterFeature != null)
            {
                //水面高度
                m_dBaseAlt = Convert.ToDouble(textBoxWaterAlt.Text);
                //判断不能超过最大最小值
                if (m_dBaseAlt > m_pntMaxAlt.Z)
                {
                    m_dBaseAlt = m_pntMaxAlt.Z;
                }
                if (m_dBaseAlt < m_pntMinAlt.Z)
                {
                    m_dBaseAlt = m_pntMinAlt.Z;
                }
                textBoxWaterAlt.Text = m_dBaseAlt.ToString("f2");
                trackBarAlt.Value    = Math.Min((int)m_dBaseAlt, trackBarAlt.Maximum);
                GSOGeoWater geoWater = (GSOGeoWater)m_WaterFeature.Geometry;
                geoWater.SetAltitude(m_dBaseAlt);

                int nF = Convert.ToInt32(textBoxFrequency.Text);
                if (nF <= 0)
                {
                    nF = 1;
                }
                timerPlay.Interval = (int)(1000.0 / nF);
                timerPlay.Start();
            }
            else
            {
                MessageBox.Show("请先进行分析!");
            }
        }
        /// <summary>
        /// 创建个计时器
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void timerPlay_Tick(object sender, EventArgs e)
        {
            if (m_WaterFeature != null)
            {
                if (m_dBaseAlt > m_pntMaxAlt.Z)
                {
                    if (checkBoxLoopPlay.Checked)
                    {
                        m_dBaseAlt = m_pntMinAlt.Z;
                    }
                    else
                    {
                        timerPlay.Stop();
                    }
                }
                //每秒升高
                m_dBaseAlt += (double)numericUpDownAddPerTime.Value;
                globeControl1.Globe.Analysis3D.FetchNoSourceFloodAnalyseResult(m_dBaseAlt, out m_dFloodArea, out m_dTotalArea,
                                                                               out m_pntMaxAlt, out m_pntMinAlt);

                SetText();

                textBoxWaterAlt.Text = m_dBaseAlt.ToString("f2");
                trackBarAlt.Value    = Math.Min((int)m_dBaseAlt, trackBarAlt.Maximum);
                GSOGeoWater geoWater = (GSOGeoWater)m_WaterFeature.Geometry;
                geoWater.SetAltitude(m_dBaseAlt);
            }
        }
Esempio n. 3
0
        private void ShowWater()
        {
            if (m_WaterFeature == null || m_WaterFeature.IsDeleted)
            {
                m_dBaseAlt = m_pntMinAlt.Z;

                GSOGeoWater geoWater = m_polygon3D.ConvertToGeoWater();

                GSOExtrudeStyle extrudeStyle = new GSOExtrudeStyle();

                if (checkBoxExtrude.Checked)
                {
                    extrudeStyle.ExtrudeType = EnumExtrudeType.ExtrudeToValue;
                }
                else
                {
                    extrudeStyle.ExtrudeType = EnumExtrudeType.ExtrudeNone;
                }

                extrudeStyle.ExtrudeValue    = m_pntMinAlt.Z;
                extrudeStyle.TailPartVisible = false;


                GSOSimplePolygonStyle3D polygonStyle = new GSOSimplePolygonStyle3D();
                polygonStyle.FillColor = Color.FromArgb(200, 0, 0, 255);

                extrudeStyle.BodyStyle = polygonStyle;

                geoWater.ExtrudeStyle = extrudeStyle;


                geoWater.AltitudeMode = EnumAltitudeMode.Absolute;
                geoWater.SetAltitude(m_dBaseAlt);
                geoWater.ReflectSky = false;
                geoWater.WaveWidth  = 0.1;
                geoWater.Play();



                m_WaterFeature          = new GSOFeature();
                m_WaterFeature.Geometry = geoWater;
                m_globe.MemoryLayer.AddFeature(m_WaterFeature);
                m_globe.Refresh();

                trackBarAlt.Maximum  = (int)m_pntMaxAlt.Z;
                trackBarAlt.Minimum  = (int)m_pntMinAlt.Z;
                trackBarAlt.Value    = trackBarAlt.Minimum;
                textBoxWaterAlt.Text = m_dBaseAlt.ToString("f2");
            }
            else
            {
                GSOGeoWater geoWater = (GSOGeoWater)m_WaterFeature.Geometry;
                geoWater.SetAltitude(m_dBaseAlt);
                m_globe.Refresh();

                trackBarAlt.Maximum = (int)m_pntMaxAlt.Z;
                trackBarAlt.Minimum = (int)m_pntMinAlt.Z;
            }
        }
 /// <summary>
 /// 重播按钮
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void buttonReplay_Click(object sender, EventArgs e)
 {
     if (m_WaterFeature != null)
     {
         m_dBaseAlt           = m_pntMinAlt.Z; //设置为最低点
         textBoxWaterAlt.Text = m_dBaseAlt.ToString("f2");
         trackBarAlt.Value    = trackBarAlt.Minimum;
         GSOGeoWater geoWater = (GSOGeoWater)m_WaterFeature.Geometry;
         geoWater.SetAltitude(m_dBaseAlt);
         int nF = Convert.ToInt32(textBoxFrequency.Text);
         if (nF <= 0)
         {
             nF = 1;
         }
         timerPlay.Interval = (int)(1000.0 / nF);
         timerPlay.Start();
     }
 }