Exemple #1
0
        protected virtual void UpdateEdgePoints()
        {
            if (EdgePoints == null)
            {
                this.edgePointsVM = new ObservableCollection <EdgePointViewModel>();
            }

            EdgePoints.Clear();
            for (int i = 0; i < this.ShapeElement.EdgePoints.Count; i++)
            {
                EdgePointVMType t = EdgePointVMType.Normal;
                if (i == 0)
                {
                    t = EdgePointVMType.Start;
                }
                else if (i == this.ShapeElement.EdgePoints.Count - 1)
                {
                    t = EdgePointVMType.End;
                }
                else
                {
                    continue;   // TODO
                }
                EdgePointViewModel vm = new EdgePointViewModel(this.ViewModelStore, this.ShapeElement.EdgePoints[i], t);
                if (i > 0 && i < this.ShapeElement.EdgePoints.Count - 1)
                {
                    //vm.EdgePointOperation = EdgePointVMOperation.m
                }
                else
                {
                    RectangleD bounds;
                    if (t == EdgePointVMType.Start)
                    {
                        bounds = this.ShapeElement.FromShape.AbsoluteBounds;
                    }
                    else
                    {
                        bounds = this.ShapeElement.ToShape.AbsoluteBounds;
                    }

                    EdgePoint     p         = this.ShapeElement.EdgePoints[i];
                    LinkPlacement placement = LinkShape.GetLinkPlacement(bounds, new PointD(p.X, p.Y));
                    switch (placement)
                    {
                    case LinkPlacement.Bottom:
                        vm.EdgePointSide = EdgePointVMSide.Bottom;
                        break;

                    case LinkPlacement.Left:
                        vm.EdgePointSide = EdgePointVMSide.Left;
                        break;

                    case LinkPlacement.Right:
                        vm.EdgePointSide = EdgePointVMSide.Right;
                        break;

                    case LinkPlacement.Top:
                        vm.EdgePointSide = EdgePointVMSide.Top;
                        break;
                    }
                }
                EdgePoints.Add(vm);
            }

            OnPropertyChanged("EdgePoints");
            OnPropertyChanged("StartEdgePoint");
            OnPropertyChanged("EndEdgePoint");
            OnPropertyChanged("MiddleEdgePoint");
        }
Exemple #2
0
        /// <summary>
        /// Constuctor.
        /// </summary>
        /// <param name="viewModelStore">The store this view model belongs to.</param>
        /// <param name="edgePoint">Edge point.</param>
        /// <param name="edgePointType">EdgePointVMType.</param>
        public EdgePointViewModel(ViewModelStore viewModelStore, EdgePoint edgePoint, EdgePointVMType edgePointType)
            : base(viewModelStore)
        {
            this.EdgePoint          = edgePoint;
            this.EdgePointType      = edgePointType;
            this.EdgePointSide      = EdgePointVMSide.None;
            this.EdgePointOperation = EdgePointVMOperation.Move;

            this.TranslateX = 0;
            this.TranslateY = 0;

            UpdateTranslateCoordinates();
        }
        /// <summary>
        /// Constuctor.
        /// </summary>
        /// <param name="viewModelStore">The store this view model belongs to.</param>
        /// <param name="edgePoint">Edge point.</param>
        /// <param name="edgePointType">EdgePointVMType.</param>
        public EdgePointViewModel(ViewModelStore viewModelStore, EdgePoint edgePoint, EdgePointVMType edgePointType)
            : base(viewModelStore)
        {
            this.EdgePoint = edgePoint;
            this.EdgePointType = edgePointType;
            this.EdgePointSide = EdgePointVMSide.None;
            this.EdgePointOperation = EdgePointVMOperation.Move;

            this.TranslateX = 0;
            this.TranslateY = 0;

            UpdateTranslateCoordinates();
        }