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

            sender.OnManipulationStateChanged(oldValue);
        }
Esempio n. 2
0
 protected override void CloneTo(DDObject target)
 {
     base.CloneTo(target);
     foreach (DDNodeWithHandles node in Nodes)
     {
         (target as DDNodeObject).Nodes.Add(node.Clone());
     }
 }
Esempio n. 3
0
 public bool Contains(DDObject o)
 {
     foreach (DDObjectTC otc in _data)
     {
         if (otc.Target == o)
         {
             return(true);
         }
     }
     return(false);
 }
Esempio n. 4
0
 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");
 }
Esempio n. 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!
 }
Esempio n. 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);
        }
Esempio n. 7
0
        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);
                }
            }
        }
Esempio n. 8
0
        private static void AnyBoundsPropertyChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs args)
        {
            DDObject sender = (DDObject)d;

            sender.OnBoundsChanged();
        }