public override void InputEvent(int evId)
        {
            base.InputEvent(evId);
            if (evId != 4)
            {
                return;
            }
            ShowInfo(2, "Отметьте точку на окружности");
            if (center == IntPtr.Zero)
            {
                center = CoreWrapper.nodeFactory(X, Y);
            }
            if (point == IntPtr.Zero)
            {
                point = CoreWrapper.nodeFactory(X, Y);
            }
            else
            {
                point = CoreWrapper.nodeFactory(X, Y);

                if (newLineGen != IntPtr.Zero)
                {
                    CoreWrapper.detachFromBase(CurrentSession, CurrentDocument, lineId);
                }

                newLineGen = CoreWrapper.genericFactory(CoreWrapper.circleFactory(center, point), (uint)0);
                lineId     = CoreWrapper.attachToBase(CurrentSession, CurrentDocument, newLineGen);

                CoreWrapper.commit(CurrentSession, CurrentDocument);
                FinilizeOperation();
            }
        }
        public override void InputEvent(int evId)
        {
            base.InputEvent(evId);
            if (evId != 4)
            {
                return;
            }
            ShowInfo(2, "Отметьте конец линии");
            if (start == IntPtr.Zero)
            {
                start = CoreWrapper.nodeFactory(X, Y);
            }
            if (end == IntPtr.Zero)
            {
                end = CoreWrapper.nodeFactory(X, Y);
            }
            else
            {
                end = CoreWrapper.nodeFactory(X, Y);

                if (newLineGen != IntPtr.Zero)
                {
                    CoreWrapper.detachFromBase(CurrentSession, CurrentDocument, lineId);
                }

                newLineGen = CoreWrapper.genericFactory(CoreWrapper.lineFactory(start, end), (uint)0);
                lineId     = CoreWrapper.attachToBase(CurrentSession, CurrentDocument, newLineGen);

                CoreWrapper.commit(CurrentSession, CurrentDocument);
                FinilizeOperation();
            }
        }
 public override void CancelOperation()
 {
     base.CancelOperation();
     if (newLineGen != IntPtr.Zero)
     {
         CoreWrapper.detachFromBase(CurrentSession, CurrentDocument, lineId);
     }
 }
        public override void MouseMove(double x, double y)
        {
            base.MouseMove(x, y);
            if (center != IntPtr.Zero)
            {
                //CoreWrapper.Destroy(end)
                point = CoreWrapper.nodeFactory(X, Y);

                if (newLineGen != IntPtr.Zero)
                {
                    CoreWrapper.detachFromBase(CurrentSession, CurrentDocument, lineId);
                }

                newLineGen = CoreWrapper.genericFactory(CoreWrapper.circleFactory(center, point), (uint)0);
                lineId     = CoreWrapper.attachToBase(CurrentSession, CurrentDocument, newLineGen);
            }
        }
        public override unsafe Status OpenSession(Dictionary <string, Callback> delegates)
        {
            int count = delegates.Count;

            string [] names     = new string[count];
            IntPtr [] functions = new IntPtr[count];
            int       index     = 0;

            foreach (var pair in delegates)
            {
                names[index]     = pair.Key;
                functions[index] = Marshal.GetFunctionPointerForDelegate(pair.Value);
                index++;
            }
            CurrentSession = CoreWrapper.sessionFactory(functions, names, count);

            return(base.OpenSession(delegates));
        }
        public override Status Operation(int opId)
        {
            if (_currentOperation != null)
            {
                _currentOperation.CancelOperation();
                //corewrapper.clean(...);
            }
            switch ((UniversalOperations)opId)
            {
            case UniversalOperations.NewDocument:
                IntPtr document = CoreWrapper.documentFactory(IntPtr.Zero);
                CurrentDocument = CoreWrapper.attachDocument(CurrentSession, document);
                UnmanagedArray <int> udata = new UnmanagedArray <int>(new[] { 0, 1 });
                CoreWrapper.setLayers(CurrentSession, CurrentDocument, udata, udata.Size);
                break;

            case UniversalOperations.OpenDocument:
                break;

            case UniversalOperations.SaveDocument:
                break;

            case UniversalOperations.rename_document:
                break;

            case UniversalOperations.copy_document:
                break;

            case UniversalOperations.close_document:
                break;

            case UniversalOperations.close_all_docs:
                break;

            case UniversalOperations.StepBackward:
                break;

            case UniversalOperations.StepForward:
                break;

            case UniversalOperations.Pen:
                break;

            case UniversalOperations.Line1:
                _currentOperation = new OpLineCreate(this._delegates);
                break;

            case UniversalOperations.Line2:
                break;

            case UniversalOperations.Line3:
                break;

            case UniversalOperations.Line4:
                break;

            case UniversalOperations.Arc1:
                break;

            case UniversalOperations.Arc2:
                break;

            case UniversalOperations.Circle1:
                _currentOperation = new OpCircleCreate(this._delegates);
                break;

            case UniversalOperations.Circle2:
                break;

            case UniversalOperations.BrokenLine:
                break;

            case UniversalOperations.Spline:
                break;

            case UniversalOperations.Eraser:
                break;

            case UniversalOperations.Trimming:
                break;

            case UniversalOperations.EnlargeElement:
                break;

            case UniversalOperations.LinkLines:
                break;

            case UniversalOperations.DestroyLine:
                break;

            case UniversalOperations.Correct:
                break;

            case UniversalOperations.CreateNode:
                break;

            case UniversalOperations.DeleteNode:
                break;

            case UniversalOperations.Measure:
                break;

            case UniversalOperations.Protractor:
                break;

            case UniversalOperations.copy_object:
                break;

            case UniversalOperations.cut_object:
                break;

            case UniversalOperations.paste_object:
                break;

            case UniversalOperations.move_object:
                break;

            case UniversalOperations.rotate_object:
                break;

            case UniversalOperations.display_in_circle_object:
                break;

            case UniversalOperations.display_symmetyrically_object:
                break;

            case UniversalOperations.scale_object:
                break;

            case UniversalOperations.MoveView:
                break;

            case UniversalOperations.EnlargeView:
                break;

            case UniversalOperations.DiminishView:
                break;

            case UniversalOperations.ShowAll:
                break;

            case UniversalOperations.AddLayer:
                break;

            case UniversalOperations.rename_layer:
                break;

            case UniversalOperations.DeleteLayer:
                break;

            case UniversalOperations.set_active_layer:
                break;

            case UniversalOperations.set_visible_layers:
                break;

            case UniversalOperations.set_invisible_layers:
                break;

            case UniversalOperations.Count:
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(opId), opId, null);
            }
            _currentOperation?.Init(() =>
            {
                _currentOperation = null;
                ShowInfo(1, "");
                ShowInfo(2, "");
            }, CurrentSession, CurrentDocument);
            return(base.Operation(opId));
        }