/// <summary>
        /// 撤防/布防
        /// </summary>
        /// <param name="e"></param>
        protected override void OnMouseDoubleClick(MouseEventArgs e)
        {
            if (Property.Type == EMapType.VChannel || Property.Type == EMapType.DIChannel ||Property.Type == EMapType.DOChannel)
            {
                if (!setnotice)
                    return;

                Statue = (Statue == WatchStatue.Normal || Statue == WatchStatue.Warning) ? WatchStatue.Stopped : WatchStatue.Normal;

                //renzihao 2008-5-28 双击时节点保存报警状态
                ((Data.NodeInformation)Node.Tag).Watch = Statue;
                //布撤防
                switch (Statue)
                {
                    case WatchStatue.Stopped:
                        Watch(false);
                        break;
                    case WatchStatue.Normal:
                        Watch(true);
                        break;
                    case WatchStatue.Warning:
                        Watch(false);
                        break;
                    case WatchStatue.Invalid:
                        break;
                }
            }
            else
            {
                if (null != NextLevelEvent )
                {
                    EventArgs args = new EventArgs();
                    NextLevelEvent(this, args);
                }
            }

            base.OnMouseDoubleClick(e);
        }
Example #2
0
        /// <summary>
        /// 增加地图标识
        /// </summary>
        /// <param name="_type">标识类型</param>
        /// <param name="_name">名称</param>
        /// <param name="_status">状态</param>
        /// <param name="_node">地图标识所对应的设备树节点</param>
        /// <param name="_pt">标识物所处位置</param>
        public void AddObject(EMapType _type, string _name, WatchStatue _status, TreeNode _node,Point _pt)
        {
            EMapObject obj = new EMapObject();

            //linwei 2008-5-28
            //初始化右键菜单
            ObjectProperty _property = new ObjectProperty();
            _property.Type = _type;
            _property.Name = _name;
            _property.Status = _status;
            _property.ParentSN = MapIndex;
            obj.Property = _property;

            obj.Node = _node;

            Map.AddObject(obj);
            obj.Location = _pt;
            obj.Property.X = _pt.X;
            obj.Property.Y = _pt.Y;

            if (_type == EMapType.ChildMap)
            {
                obj.Property.IsArea = true;
            }

            obj.LoadPropertyEvnet +=new EventHandler<EventArgs>(obj_LoadPropertyEvnet);
            obj.NextLevelEvent+=new EventHandler<EventArgs>(obj_NextLevelEvent);
            obj.WatchEvent += new EventHandler<WatchEvnetArgs>(obj_WatchEvent);
            InitObjectEvent(obj);

            objlist.Add(obj);
            Select(obj);
            GetTip(obj);

            m_IsSaved = false;
        }
        /// <summary>
        /// 设置布防/撤防
        /// </summary>
        /// <param name="IsWatch">状态:true - 布防,false - 撤防</param>
        public void Watch(bool IsWatch)
        {
            //linwei 2008-07-11 在地图节点布撤防时,判断一下当前节点的Node是否为空
            if (Node != null)
            {
                //renzihao 2008-5-27 把改变图片提前
                Statue = (IsWatch) ? WatchStatue.Normal : WatchStatue.Stopped;
                //renzihao 2005-5-28 树节点改变报警状态
                ((Data.NodeInformation) Node.Tag).Watch = Statue;

                if (Statue == WatchStatue.Warning && null != ClearWarningEvent)
                {
                    EventArgs args = new EventArgs();
                    ClearWarningEvent(this, args);
                }

                if (null != WatchEvent)
                {
                    WatchEvnetArgs args = new WatchEvnetArgs();
                    args.IsWatch = IsWatch;
                    WatchEvent(this, args);
                }

                Statue = (IsWatch) ? WatchStatue.Normal : WatchStatue.Stopped;
            }
        }