Newer
Older
GHFX_REFACTOR / Forms / FrmValveAnalysis.cs
wxn on 2 Nov 2016 2 KB 提交
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevComponents.DotNetBar;
using GeoScene.Data;
using System.Data.SqlClient;
using GeoScene.Globe;

namespace PipeLine.Forms
{
    public partial class FrmValveAnalysis : Office2007Form
    {
        private GSOFeature m_feature;
        private GSOGlobeControl m_globeControl;
        private GSOLayer m_layer;

        public FrmValveAnalysis(GSOFeature feat, GSOLayer layer, GSOGlobeControl globeControl)
        {
            InitializeComponent();
            m_feature = feat;
            m_layer = layer;
            m_globeControl = globeControl;
        }

        private void FrmValveAnalysis_Load(object sender, EventArgs e)
        { 
            string valve = m_feature.GetValue("阀门ID").ToString();
            if (valve == "")
                return;
            string[] valves = valve.Split(',');
            for (int i = 0; i < valves.Length; i++)
            {
                listBox1.Items.Add(valves[i]);
            }
        }
        private void btnSel_Click(object sender, EventArgs e)
        {
            if (listBox1.SelectedItem == null)
            {
                MessageBox.Show("请选择阀门编码!", "提示!");
                return;
            }
            string featurename = listBox1.SelectedItem.ToString();
            featurename = featurename.Trim();
            GSOFeatures features = m_layer.GetFeatureByName(featurename, false);
            for (int i = 0; i < features.Length; i++)
            {
                if (features[i].Name == featurename)
                {
                    m_feature = features[i];
                    m_globeControl.Globe.FlyToFeature(m_feature, 0, 0, 5);
                }
            }
        }

        private void btnLight_Click(object sender, EventArgs e)
        {
            timer1.Start();
        }

        int count = 0;
        private void timer1_Tick(object sender, EventArgs e)
        {
            if (count < 12)
            {
                count++;
                if (m_feature != null)
                {
                    if (count % 2 != 0)
                    {
                        m_feature.HighLight = true;
                        m_globeControl.Refresh();
                    }
                    else
                    {
                        m_feature.HighLight = false;
                        m_globeControl.Refresh();
                    }
                }
            }
            else
            {
                timer1.Stop();
                count = 0;
            }
        }
    }
}