Пример #1
0
        private void NodeEdit()
        {
            CameraTreeNode n = this.GetSelectedTreeNode();

            if (n != null)
            {
                if (!n.IsGroup())
                {
                    CameraClass    m      = n.Item as CameraClass;
                    CameraClass    e      = m.Clone() as CameraClass;
                    CameraEditForm fmEdit = new CameraEditForm(e);
                    fmEdit.ShowDialog(this);
                    if (DialogResult.OK == fmEdit.DialogResult)
                    {
                        fmEdit.Camera.Copy(m);
                        RootClass.Instance.SaveConfig();
                        MotionConfiguration.Instance.Save();

                        m.FireItemValueChangedEvent();
                    }
                }
                else
                {
                    n.BeginEdit();
                }
            }
        }
Пример #2
0
        public IVideoView Add(CameraClass c)
        {
            IVideoView v;

            if (c == null)
            {
                return(null);
            }
            v = this.Find(c);
            if (v == null)
            {
                if (this.AtTheEdge() == true)
                {
                    return(null);
                }
                CameraView x = new CameraView();
                x.CameraClass = c;
                this.CameraPanel.Controls.Add(x);
                x.ViewRatio       = this.ViewRatio;
                x.VisibleChanged += new EventHandler(this.IView_VisibleChanged);

                CameraBoardAddNewEventArgs e = new CameraBoardAddNewEventArgs(x);
                this.OnCameraBoardAddNewEvent(e);
                e = null;
                v = x;
                this.ShortcutAdd(v);
            }
            else
            {
                v.ViewRatio  = this.ViewRatio;
                v.Me.Visible = true;
            }
            this.ScrollToView(v.CameraClass.ID);
            return(v);
        }
Пример #3
0
    public override void ScaleorRotate()
    {
        float      pinchAmount     = 0;
        Quaternion desiredRotation = transform.rotation;

        CameraClass.Calculate();

        if (Mathf.Abs(CameraClass.pinchDistanceDelta) > 0)   // zoom
        {
            pinchAmount = CameraClass.pinchDistanceDelta;
            scale();
        }

        if (Mathf.Abs(CameraClass.turnAngleDelta) > 0)   // rotate
        {
            Vector3 rotationDeg = Vector3.zero;
            rotationDeg.z    = -CameraClass.turnAngleDelta;
            desiredRotation *= Quaternion.Euler(rotationDeg);
            rotateObj();
        }


        // not so sure those will work:
        transform.rotation  = desiredRotation;
        transform.position += Vector3.forward * pinchAmount;
    }
Пример #4
0
 public IVideoView Find(CameraClass c)
 {
     foreach (Control t in this.CameraPanel.Controls)
     {
         IVideoView v = t as IVideoView;
         if (v != null && v.CameraClass.ID == c.ID)
         {
             return(v);
         }
     }
     return(null);
 }
Пример #5
0
        // 初始化书签
        private void InitBookmark()
        {
            return;

            string xmlFile = AppDomain.CurrentDomain.BaseDirectory + "Config\\Bookmark.xml";

            if (!File.Exists(xmlFile))
            {
                return;
            }

            BookmarkList bookmarkList = XmlHelper.XmlDeserializeFromFile <BookmarkList>(xmlFile, Encoding.UTF8);

            if (bookmarkList == null || bookmarkList.BookmarkArr == null || bookmarkList.BookmarkArr.Count <= 0)
            {
                return;
            }

            List <string> names = new List <string>();

            foreach (Bookmark mark in bookmarkList.BookmarkArr)
            {
                // 创建书签
                ISceneBookmarks pBookmarks = axGlobeControl1.Globe.GlobeDisplay.Scene as ISceneBookmarks;
                IPoint          point      = new PointClass();
                point.X = mark.Longitude;
                point.Y = mark.Latitude;
                point.Z = mark.Altitude;

                ICamera camera = new CameraClass();
                camera.ProjectionType  = esri3DProjectionType.esriPerspectiveProjection;
                camera.Inclination     = mark.Inclination;
                camera.Azimuth         = mark.Azimuth;
                camera.RollAngle       = mark.RollAngle;
                camera.ViewFieldAngle  = mark.ViewFieldAngle;
                camera.ViewingDistance = mark.ViewingDistance;
                camera.Observer        = point;

                IBookmark3D pBookmark3D = new Bookmark3DClass();
                pBookmark3D.Name = mark.Name;
                pBookmark3D.Capture(camera);
                pBookmarks.AddBookmark(pBookmark3D);

                // 发布事件,通知主窗体添加按钮
                EventPublisher.PublishShowBookmarkEvent(this, new ShowBookmarkEventArgs()
                {
                    NameList = new System.Collections.Generic.List <string> {
                        mark.Name
                    }, Append = true
                });
            }
        }
Пример #6
0
        public CameraEditForm(CameraClass m)
        {
            InitializeComponent();
            MotionPreference.Instance.UpdateUI(this);

            mCameraClass = m;
            this.cameraViewTest.CameraClass = m;
            this.cameraViewTest.EditMode    = true;

            InitPropGrid();
            this.DialogResult = DialogResult.Cancel;
            this.Camera.PlugIns.ToolStripItemsInitialization(this.toolStripEdit.Items);
        }
Пример #7
0
        private void toolStripButtonNew_Click(object sender, EventArgs e)
        {
            CameraEditForm fmEdit;
            CameraClass    m = new CameraClass();

            fmEdit = new CameraEditForm(m);
            fmEdit.ShowDialog(this);
            if (fmEdit.DialogResult == DialogResult.OK)
            {
                this.NodeAdd(fmEdit.Camera);
                RootClass.Instance.SaveConfig();
                MotionConfiguration.Instance.Save();
            }
        }
Пример #8
0
 private bool NodeDelete(CameraTreeNode node)
 {
     if (node.IsGroup())
     {
         if (node.Nodes.Count > 0)
         {
             ArrayList list = new ArrayList();
             foreach (TreeNode n in node.Nodes)
             {
                 list.Add(n);
             }
             foreach (TreeNode n in list)
             {
                 if (false == this.NodeDelete(n as CameraTreeNode))
                 {
                     return(false);
                 }
             }
         }
         if (node.Nodes.Count == 0)
         {
             node.Item.Remove();
             node.Item.Clean();
             node.Remove();
             return(true);
         }
     }
     else
     {
         CameraClass c = node.Item as CameraClass;
         if (c.Capturing == true)
         {
             MessageBox.Show(string.Format(Translator.Instance.T("删除摄像头[{0}]失败! 该摄像头正在录像中, 您必须首先停止录像, 然后再删除该摄像头."), c.Name), MotionPreference.Instance.MessageBoxCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
             return(false);
         }
         CameraTreeNodeDeleteEventArgs e = new CameraTreeNodeDeleteEventArgs(c);
         this.OnCameraTreeBeforeDelete(e);
         if (e.Cancel == false)
         {
             node.Item.Remove();
             node.Item.Clean();
             node.Remove();
             this.OnCameraTreeAfterDelete(e);
             return(true);
         }
     }
     return(false);
 }
Пример #9
0
        public void SetTreeNodeAlarmCount(CameraClass c, int v)
        {
            CameraTreeNode n = this.FindCameraTreeNode(c, null);

            if (n != null)
            {
                try
                {
                    n.Text = n.Item.Name + " (" + v.ToString() + ")";
                }
                catch (System.InvalidOperationException e)
                {
                    MessageBox.Show(e.Message, MotionPreference.Instance.MessageBoxCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Пример #10
0
 public void NodeReloadGlobalSettings(CameraTreeNode p)
 {
     if (p.IsGroup())
     {
         foreach (CameraTreeNode n in p.Nodes)
         {
             this.NodeReloadGlobalSettings(n);
         }
     }
     else
     {
         CameraClass c = p.Item as CameraClass;
         if (c != null)
         {
             c.ReloadGlobalSettings();
         }
     }
 }
Пример #11
0
        public void Init(ItemClass i)
        {
            this.item               = i;
            this.Text               = this.Item.Name;
            this.ImageIndex         = this.IsGroup() ? 0 : 1;
            this.SelectedImageIndex = this.ImageIndex;
            if (this.Item is GroupClass)
            {
                return;
            }
            CameraClass c = this.Item as CameraClass;

            if (c != null)
            {
                Motion.PlugIns.IPlugInVideoSource s = c.PlugInVideoSource;
                if (s != null)
                {
                    this.ToolTipText = s.LabelText;
                }
            }
        }
Пример #12
0
        private void FillGrid(CameraClass c)
        {
            switch (this.Style)
            {
            case CameraBoardStyle.AVI:
                foreach (AVIClass v in c.AVIs)
                {
                    this.FillGrid(v);
                    this.backgroundWorker.ReportProgress(1);
                }
                break;

            case CameraBoardStyle.PIC:
                foreach (PICClass v in c.PICs)
                {
                    this.FillGrid(v);
                    this.backgroundWorker.ReportProgress(1);
                }
                break;
            }
            this.gridList.AutoSizeCells();
        }
Пример #13
0
        public void SetTreeNodeStatus(CameraClass c, int status)
        {
            CameraTreeNode n = this.FindCameraTreeNode(c, null);

            if (n != null)
            {
                CameraStatus s = new CameraStatus(status);
                if (s.IsStatusSet(CameraStatus.PAUSED))
                {
                    n.ImageIndex = 3;
                }
                else if (s.IsStatusSet(CameraStatus.STARTED))
                {
                    n.ImageIndex = 2;
                }
                else
                {
                    n.ImageIndex = 1;
                }
                n.SelectedImageIndex             = n.ImageIndex;
                this.treeViewCamera.SelectedNode = n;
            }
        }
Пример #14
0
 public bool Remove(CameraClass c)
 {
     foreach (Control t in this.CameraPanel.Controls)
     {
         IView v = t as IView;
         if (v != null)
         {
             if (false == v.Owner.ID.Equals(c.ID))
             {
                 continue;
             }
             if (v is IVideoView)
             {
                 IVideoView x = (IVideoView)v;
                 x.Stop();
             }
             this.CameraPanel.Controls.Remove(v.Me);
             this.ShortcutRemove(v);
             break;
         }
     }
     return(true);
 }
Пример #15
0
 private void FillGrid(ItemClassCollection its)
 {
     if (its == null)
     {
         return;
     }
     foreach (ItemClass i in its.Values)
     {
         CameraClass c = i as CameraClass;
         if (c != null)
         {
             this.FillGrid(c);
         }
         else
         {
             GroupClass g = i as GroupClass;
             if (g != null)
             {
                 this.FillGrid(g.Children);
             }
         }
     }
 }
Пример #16
0
 // Use this for initialization
 void Start()
 {
     controller = new Character(gameObject);
     cam        = new CameraClass(controller, CameraClass.CameraMode.Follow, 10);
     Physics.IgnoreLayerCollision(0, 9);
 }
Пример #17
0
 public CameraTreeEventArgs(CameraClass c)
 {
     this.mItem = c;
 }
Пример #18
0
 public CameraTreeNodeDeleteEventArgs(CameraClass c)
     : base(c)
 {
     this.mCancel = false;
 }
Пример #19
0
        private void toolStripButtonTest_Click(object sender, EventArgs e)
        {
            string[] j = new string[] {
                "http://61.220.38.10/axis-cgi/jpg/image.cgi?camera=1",
                "http://212.98.46.120/axis-cgi/jpg/image.cgi?resolution=352x240",
                "http://webcam.mmhk.cz/axis-cgi/jpg/image.cgi?resolution=320x240",
                "http://195.243.185.195/axis-cgi/jpg/image.cgi?camera=1"
            };
            string[] m = new string[] {
                "http://129.186.47.239/axis-cgi/mjpg/video.cgi?resolution=352x240",
                "http://195.243.185.195/axis-cgi/mjpg/video.cgi?camera=3",
                "http://195.243.185.195/axis-cgi/mjpg/video.cgi?camera=4",
                "http://chipmunk.uvm.edu/cgi-bin/webcam/nph-update.cgi?dummy=garb"
            };
            int n;

            GroupClass gc = new GroupClass();

            gc.Name = Translator.Instance.T("测试摄像头");
            CameraTreeNode g = this.NodeAdd(gc, null);

            for (n = 0; n < m.Length; n++)
            {
                CameraClass c = new CameraClass();
                c.Name   = "MJPEG " + (n + 1);
                c.Stream = "p1f25f05340a17e6e6acdf656d3360ea0";
                Motion.PlugIns.IPlugInVideoSource s = c.PlugInVideoSource;
                if (s != null)
                {
                    Motion.PlugIns.IPlugInIPCam p = s as Motion.PlugIns.IPlugInIPCam;
                    if (p != null)
                    {
                        p.Stream = Motion.PlugIns.IPCAM.MJPEG;
                        p.URL    = m[n];
                        if (null == this.NodeAdd(c, g))
                        {
                            break;
                        }
                    }
                }
            }
            if (n == m.Length)
            {
                for (n = 0; n < j.Length; n++)
                {
                    CameraClass c = new CameraClass();
                    c.Name   = "JPEG " + (n + 1);
                    c.Stream = "p1f25f05340a17e6e6acdf656d3360ea0";
                    Motion.PlugIns.IPlugInVideoSource s = c.PlugInVideoSource;
                    if (s != null)
                    {
                        Motion.PlugIns.IPlugInIPCam p = s as Motion.PlugIns.IPlugInIPCam;
                        if (p != null)
                        {
                            p.Stream = Motion.PlugIns.IPCAM.JPEG;
                            p.URL    = j[n];
                            if (null == this.NodeAdd(c, g))
                            {
                                break;
                            }
                        }
                    }
                }
            }
            RootClass.Instance.SaveConfig();
            MotionConfiguration.Instance.Save();
        }