예제 #1
0
        private static void StatePropertyChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs args)
        {
            DDObject            sender   = (DDObject)d;
            DDManipulationState oldValue = (DDManipulationState)args.OldValue;

            sender.OnManipulationStateChanged(oldValue);
        }
예제 #2
0
 protected override void CloneTo(DDObject target)
 {
     base.CloneTo(target);
     foreach (DDNodeWithHandles node in Nodes)
     {
         (target as DDNodeObject).Nodes.Add(node.Clone());
     }
 }
예제 #3
0
파일: Misc.cs 프로젝트: panta82/delta_draw
 public bool Contains(DDObject o)
 {
     foreach (DDObjectTC otc in _data)
     {
         if (otc.Target == o)
         {
             return(true);
         }
     }
     return(false);
 }
예제 #4
0
파일: Misc.cs 프로젝트: panta82/delta_draw
 public void Add(DDObject newObject)
 {
     TargetBoundsCache = null;
     if (newObject is DDNodeObject)
     {
         _data.Add(DDNodeObjectTC.CreateInitializedInstance <DDNodeObjectTC>(newObject));
     }
     else
     {
         _data.Add(DDObjectTC.CreateInitializedInstance <DDObjectTC>(newObject));
     }
     OnPropertyChanged("Count");
 }
예제 #5
0
 protected virtual void CloneTo(DDObject target)
 {
     target.X      = X;
     target.Y      = Y;
     target.Width  = Width;
     target.Height = Height;
     if (Fill != null)
     {
         target.Fill = Fill.Clone();
     }
     if (Stroke != null)
     {
         target.Stroke = Stroke.Clone();
     }
     target.StrokeThickness = StrokeThickness;
     //TODO: Add more when needed!
 }
예제 #6
0
        public static DDObject TryCreateFromCLR(object clrSource)
        {
            if (!(clrSource is Shape))
            {
                return(null);
            }

            DDObject newObject = null;

            if (clrSource is Path)
            {
                if (((clrSource as Path).Data is PathGeometry) &&
                    (((clrSource as Path).Data as PathGeometry).Figures.Count > 0))
                {
                    if (((clrSource as Path).Data as PathGeometry).Figures[0].IsFilled)
                    {
                        newObject = new DDPolygon();
                    }
                    else
                    {
                        newObject = new DDPolyline();
                    }
                }
            }
            if (clrSource is Rectangle)
            {
                newObject = new DDRectangle();
            }
            if (clrSource is Ellipse)
            {
                newObject = new DDEllipse();
            }

            if (newObject != null)
            {
                if (newObject.SetFromCLR(clrSource as Shape))
                {
                    return(newObject);
                }
            }

            return(null);
        }
예제 #7
0
파일: Misc.cs 프로젝트: panta82/delta_draw
        public void SetFromCanvas(Canvas source)
        {
            Width  = source.Width;
            Height = source.Height;
            if (source.Background != null)
            {
                Background = source.Background.Clone();
            }
            else
            {
                Background = null;
            }
            // TODO: Add more if needed

            foreach (UIElement element in source.Children)
            {
                DDObject newObject = DDObject.TryCreateFromCLR(element);
                if (newObject != null)
                {
                    Children.Add(newObject);
                }
            }
        }
예제 #8
0
        private static void AnyBoundsPropertyChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs args)
        {
            DDObject sender = (DDObject)d;

            sender.OnBoundsChanged();
        }