示例#1
0
        private void OnMouseMove3dAction(Mouse3dPosition point)
        {
            if (_points.Count != 1)
            {
                return;
            }

            Double xMin = _points[0].X();
            Double yMin = _points[0].Y();

            // Build/regenerate the line with the new coordinates
            if (_line == null)
            {
                _line = new Line2D(Context2d, xMin, yMin, point.Point.X(), point.Point.Y());
            }
            else
            {
                _line.SetEndpoints(xMin, yMin, point.Point.X(), point.Point.Y());
            }

            _line.Display(true);
        }
示例#2
0
        private void OnMouseClick3dAction(Mouse3dPosition point)
        {
            if (point.IsMouseDown == false)
            {
                AddToPointList(point.Point);
            }
            _label = null;

            // Finished building the line
            if (_points.Count >= 2)
            {
                // Remove the realtime drawn line
                Context2d.Erase(_line, true, false);

                // Build the final line translated to the drawing plane
                var line = new Line2D(Context2d, _points[0].X(), _points[0].Y(), _points[1].X(), _points[1].Y());

                // Add the line to the OCAF data hierarchy and also display it
                _document.Transact();

                // Save the new shape into the Ocaf data structure
                int result = AddToOcaf(line, Ax2);

                // Attach an integer attribute to L to memorize it's not displayed
                _label.Update <IntegerInterpreter>().Value = (int)OcafObjectVisibility.ToBeDisplayed;

                _document.Commit("Draw line");
                line.Display(true);

                // Inform the listeners that a new shape was generated
                Inputs[ActionNames.SolverDrawerPipe].OnNotification("Draw Line", line);
                Inputs[ActionNames.EditDetectionPipe].OnNotification("Draw Line", line);

                // Clear the list and get ready for drawing a new line
                _points.Clear();
            }
        }