Ejemplo n.º 1
0
        public override void Activate(VrSession session)
        {
            var stn = Station.ActiveStation;

            if (stn == null)
            {
                return;
            }

            var tasks = stn.Irc5Controllers.SelectMany(t => t.Tasks).ToList();

            tasks.Add(stn.DefaultTask);

            foreach (var task in tasks)
            {
                foreach (RsPathProcedure p in task.PathProcedures)
                {
                    if (!p.ShowSpeeds)
                    {
                        p.ShowSpeeds = true;
                        _restoreShowSpeeds.Add(p);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public override void Activate(VrSession session)
        {
            var stn = Station.ActiveStation;

            if (stn == null)
            {
                return;
            }

            _detector = new PathObjectDetector(stn);

            var tasks = stn.Irc5Controllers.SelectMany(t => t.Tasks).ToList();

            tasks.Add(stn.DefaultTask);

            foreach (var task in tasks)
            {
                foreach (RsPathProcedure p in task.PathProcedures)
                {
                    if (p.ZoneVisualization != ZoneVisualization.Programmed)
                    {
                        p.ZoneVisualization = ZoneVisualization.Programmed; // actual?
                        _restoreShowZones.Add(p);
                    }
                }
            }
        }
Ejemplo n.º 3
0
        RsMoveInstruction GetPickedMoveInstruction(VrSession session)
        {
            var pd = _picker.PickNearest(session);

            _pickPreview.Update(session, pd);
            return(pd.selectedObject as RsMoveInstruction);
        }
Ejemplo n.º 4
0
        public override void Activate(VrSession session)
        {
            PathEditingHelper.EnsurePath();

            //:TODO: Update if active tool changes
            CreateToolGraphics();
        }
Ejemplo n.º 5
0
 public override void Deactivate(VrSession session)
 {
     foreach (var p in _restoreShowZones)
     {
         p.ZoneVisualization = ZoneVisualization.None;
     }
     _restoreShowZones.Clear();
 }
Ejemplo n.º 6
0
 public override void Deactivate(VrSession session)
 {
     _pickPreview.Clear();
     foreach (var p in _restoreShowSpeeds)
     {
         p.ShowSpeeds = false;
     }
     _restoreShowSpeeds.Clear();
 }
Ejemplo n.º 7
0
        public override void Deactivate(VrSession session)
        {
            if (_brushSelector != null)
            {
                _brushSelector.Dispose();
                _brushSelector = null;
            }

            DeleteBrushTempGfx();
        }
Ejemplo n.º 8
0
        private void UpdatePreview(VrSession session)
        {
            if (_paintCone != null)
            {
                _paintCone.Delete();
            }
            var mesh = _painter.CreatePreviewGraphics();
            var pm   = session.RightController.PointerOffsetTransform;

            _paintCone = session.RightController.TemporaryGraphics.DrawMesh(pm, mesh);
        }
Ejemplo n.º 9
0
 public override void Deactivate(VrSession session)
 {
     foreach (var g in _toolGfx)
     {
         g.Delete();
     }
     if (_previewTrace != null)
     {
         _previewTrace.Delete();
     }
     _toolGfx.Clear();
 }
Ejemplo n.º 10
0
        public override void Deactivate(VrSession session)
        {
            Station station = Project.ActiveProject as Station;

            if (RecData.JointValuesList.Count > 0)
            {
                RecData.ResetPos();
            }
            RecData.resetList();
            DeleteGfx();
            station.ActiveTask.ActivePathProcedure.Visible = true;
            Graph.DeleteChart();
        }
Ejemplo n.º 11
0
        public override void Activate(VrSession session)
        {
            base.Activate(session);

            PathEditingHelper.EnsurePath();

            _controller = session.RightController;
            AddGfx();
            //Click += HandleClick;
            AlternateClick += HandleAlternateClick;
            DeltaDrag      += HandleDeltaDrag;
            BeginDrag      += HandleBeginDrag;
            EndDrag        += HandleDeltaDrag;
            HoverObject    += HandleHover;
        }
Ejemplo n.º 12
0
        public override void Deactivate(VrSession session)
        {
            if (_painter != null)
            {
                _painter.Dispose();
                _painter = null;
            }

            if (_paintCone != null)
            {
                _paintCone.Delete();
                _paintCone = null;
            }

            _part = null;
        }
Ejemplo n.º 13
0
        public override void Activate(VrSession session)
        {
            Station station = Project.ActiveProject as Station;
            Light   light   = station.Lights[0];

            light.CastShadows = false;
            Light light2 = station.Lights[1];

            light2.CastShadows = false;
            _rcontroller       = session.RightController;
            _lcontroller       = session.LeftController;
            SetCurrentSignal(0);
            new RecData().RunPos();
            atTrack       = true;
            press         = false;
            _recSig       = true;
            currentSignal = 0;
        }
Ejemplo n.º 14
0
        public override void Activate(VrSession session)
        {
            //:TODO: How to determine which part to paint?
            var part = Station.ActiveStation.FindGraphicComponentsByType(typeof(Part)).OfType <Part>().FirstOrDefault(p => p.Name == "PaintPart");

            if (part != null)
            {
                _painter          = new GfxTexturePainter(part);
                _painter.Range    = 0.500;
                _painter.SizeX    = 0.150;
                _painter.SizeY    = 0.400;
                _painter.Strength = 0.1;
                _painter.ShowPaint(true);
                _part = part;

                UpdatePreview(session);
            }
        }
Ejemplo n.º 15
0
        public override void Update(VrSession session)
        {
            var ctrl = session.RightController;

            if (_dragMoveInstr != null)
            {
                if (ctrl.InputState.TriggerPressed)
                {
                    //double newZoneVal =
                }
                else
                {
                    _dragMoveInstr = null;
                }
            }

            var ctrlPos   = ctrl.PointerTransform.Translation;
            var hitResult = _detector.DetectMoveInstruction(ctrlPos) as HitResult <RsMoveInstruction>;

            if (hitResult != null)
            {
                //:TODO: Update some preview

                if (ctrl.InputState.TriggerPressed && !ctrl.PreviousInputState.TriggerPressed)
                {
                    // Improve?
                    _zoneArg = hitResult.HitObject.InstructionArguments["Z"];
                    if (_zoneArg == null)
                    {
                        return;
                    }
                    int zoneVal = 0;
                    if (_zoneArg.Name.StartsWith("z") && _zoneArg.Enabled)
                    {
                        int.TryParse(_zoneArg.Value, out zoneVal);
                    }
                    _distOffset    = ctrlPos.Distance(hitResult.HitPoint) - zoneVal;
                    _dragMoveInstr = hitResult.HitObject;
                }
            }
        }
Ejemplo n.º 16
0
        public override void Deactivate(VrSession session)
        {
            base.Deactivate(session);
            DeleteGfx();
            _controller = null;
            //Click -= HandleClick;
            AlternateClick -= HandleAlternateClick;
            DeltaDrag      -= HandleDeltaDrag;
            BeginDrag      -= HandleBeginDrag;
            EndDrag        -= HandleEndDrag;

            //:TODO:
            //view.OpenVRRemoveAttachedLine(_pointerToSelGfx);

            ClearHover();

            if (_pointerToSelGfx != IntPtr.Zero)
            {
                var view = (GraphicView)GraphicControl.ActiveGraphicControl.GetView();
                view.OpenVRRemoveAttachedLine(_pointerToSelGfx);
                _pointerToSelGfx = IntPtr.Zero;
            }
        }
Ejemplo n.º 17
0
        // 1. Attatch random object to right controller:
        public void Attatch()
        {
            VrSession session = VrEnvironment.Session;

            _controller = session.RightController;
        }
Ejemplo n.º 18
0
 public override void Deactivate(VrSession session)
 {
     _objectDetector = null;
 }
Ejemplo n.º 19
0
 public override void Activate(VrSession session)
 {
     _controller = session.RightController;
     AddGfx();
 }
Ejemplo n.º 20
0
 public override void Deactivate(VrSession session)
 {
     DeleteGfx();
 }
Ejemplo n.º 21
0
 public override void Activate(VrSession session)
 {
     _detector = new PathObjectDetector(Station.ActiveStation);
 }