コード例 #1
0
        protected override void SourceOnData(object data)
        {
            var mouseData = data as Mouse3dPosition;

            // Pass the coordinates through the solver
            // Check if there are any magic points around
            Double x = mouseData.Point.X(), y = mouseData.Point.Y();
            var    geometry = _solver.GetInterestingCloseGeometry(new OCgp_Pnt(x, y, 0));

            if (geometry.Count > 0)
            {
                OCgp_Pnt point = geometry[0].NaroNode.Children[0].Get <GeometryInterpreter>().Value;
                x = point.X();
                y = point.Y();

                // Display the magic point
                MagicPointType magicPointType = geometry[0].MagicPointType;
                if (_solverDrawer.Show(_context2d, magicPointType, x, y, 0))
                {
                    // It returns true if the view needs update
                    _view2d.Update();
                }
            }
            else
            {
                // Hide the magic point
                if (_solverDrawer.Show(_context2d, MagicPointType.None, mouseData.Point.X(), mouseData.Point.Y(), mouseData.Point.Z()))
                {
                    _view2d.Update();
                }
            }

            // Notiffy listeners
            AddData(new Mouse3dPosition(new OCgp_Pnt(x, y, 0), mouseData.IsMouseDown));
        }
コード例 #2
0
        private SolverPreviewObject ShowSolverGeometry(int index)
        {
            if (_solverGeometry.Count == 0)
            {
                return(null);
            }
            var solverPreviewObject = _solverGeometry[index];

            _solverDrawer.Show(solverPreviewObject);
            return(solverPreviewObject);
        }