Beispiel #1
0
 public GrSplineBase(IGrObj parent)
     : base(parent)
 {
     Name = "Сплайн";
     this.DrawningRegion.DrawningContours.Add(
         new BasicContour()
     );
 }
Beispiel #2
0
        public GrPoint(IGrObj parent, int x, int y)
            : base(parent)
        {
            BasicContour contour = new BasicContour();
            contour.DrawningPoints.Add(new Point(0, 0));
            this.DrawningRegion.DrawningContours.Add(contour);
            this.Trans.Move(x, y, false);

            Name = "Точка";
        }
Beispiel #3
0
        protected internal override void OnObjectAdd(IGrObj grobj)
        {
            if (grobj is GrPoint)
            {
                _points.Add(grobj as GrPoint);
                _lpx = new double[_points.Count];
                _lpy = new double[_points.Count];

                base.OnObjectAdd(grobj);
            }
        }
Beispiel #4
0
        public GrHermite(IGrObj parent, GrLine line1, GrLine line2)
            : base(parent)
        {
            _line1 = line1;
            _line2 = line2;

            Objects.Add(_line1);
            Objects.Add(_line2);

            Name = "Кривая Эрмита";
        }
Beispiel #5
0
        public GrLine(IGrObj parent, GrPoint p1, GrPoint p2)
            : base(parent)
        {
            this.DrawningRegion.DrawningContours.Add(new BasicContour());

            _p1 = p1;
            _p2 = p2;

            Objects.Add(_p1);
            Objects.Add(_p2);

            Name = "Отрезок";
        }
Beispiel #6
0
 public TreePath GetPath(IGrObj node)
 {
     if (node == _root)
         return TreePath.Empty;
     else
     {
         Stack<object> stack = new Stack<object>();
         while (node != _root)
         {
             stack.Push(node);
             node = node.Parent;
         }
         return new TreePath(stack.ToArray());
     }
 }
Beispiel #7
0
 public GrContour(IGrObj parent)
     : base(parent)
 {
     Name = "Контур";
     _pen = new Pen(Color.Black);
 }
Beispiel #8
0
 public DrawEventArgs(DrawEventArgs args)
 {
     _gr = args._gr;
     _edited = args._edited;
     _draw = args._draw;
 }
Beispiel #9
0
 public DrawEventArgs(Graphics gr, IGrObj edited, bool draw)
 {
     _gr = gr;
     _edited = edited;
     _draw = draw;
 }
Beispiel #10
0
 public GrTso(IGrObj parent)
     : base(parent)
 {
     Name = "ТМО";
 }
Beispiel #11
0
 public GrBesie(IGrObj parent)
     : base(parent)
 {
     Name = "Кривая Безье";
 }
Beispiel #12
0
 public void RemoveFromSelected(IGrObj grobj)
 {
     _sel.Remove(grobj);
     _grid.SelectedObjects = _sel.ToArray();
 }
Beispiel #13
0
 public void AddToSelected(IGrObj grobj)
 {
     _sel.Add(grobj);
     _grid.SelectedObjects = _sel.ToArray();
 }
Beispiel #14
0
 private IGrObj FindNode(IGrObj root, TreePath path, int level)
 {
     foreach (IGrObj node in root.Objects)
         if (node == path.FullPath[level])
         {
             if (level == path.FullPath.Length - 1)
                 return node;
             else
                 return FindNode(node, path, level + 1);
         }
     return null;
 }
Beispiel #15
0
 internal void OnNodeRemoved(IGrObj parent, int index, IGrObj node)
 {
     if (NodesRemoved != null)
     {
         TreeModelEventArgs args = new TreeModelEventArgs(GetPath(parent), new int[] { index }, new object[] { node });
         NodesRemoved(this, args);
     }
 }