コード例 #1
0
ファイル: UmlElementDataDef.cs プロジェクト: denis554/Edi-1
        /// <summary>
        /// Create a shape viewwmodel that represents a canvas element.
        /// </summary>
        /// <param name="dropPoint"></param>
        /// <returns></returns>
        private static ShapeViewModelBase CreateAssocationShapeViewModel(Point dropPoint,
                                                                         IShapeParent parent,
                                                                         DataDef item,
                                                                         UmlTypes umlType)
        {
            var element = new UmlUseCaseShapeViewModel(parent, umlType);

            switch (umlType)
            {
            case UmlTypes.ConnectorAggregation:
                return(new UmlAssociationShapeViewModel(parent, ConnectorKeys.WhiteDiamond, ConnectorKeys.None, UmlTypes.ConnectorAggregation));

            case UmlTypes.ConnectorAssociation:
                return(new UmlAssociationShapeViewModel(parent, ConnectorKeys.None, ConnectorKeys.None, UmlTypes.ConnectorAssociation));

            case UmlTypes.ConnectorComposition:
                return(new UmlAssociationShapeViewModel(parent, ConnectorKeys.BlackDiamond, ConnectorKeys.None, UmlTypes.ConnectorComposition));

            case UmlTypes.ConnectorInheritance:
                return(new UmlAssociationShapeViewModel(parent, ConnectorKeys.None, ConnectorKeys.Triangle, UmlTypes.ConnectorInheritance));

            default:
                throw new System.NotImplementedException(umlType.ToString());
            }
        }
コード例 #2
0
ファイル: UmlElementDataDef.cs プロジェクト: denis554/Edi-1
        /// <summary>
        /// Create a shape viewwmodel that represents a canvas element.
        /// </summary>
        /// <param name="dropPoint"></param>
        /// <returns></returns>
        private static ShapeViewModelBase CreateUseCaseShapeViewModel(Point dropPoint,
                                                                      IShapeParent parent,
                                                                      DataDef item,
                                                                      UmlTypes umlType)
        {
            var element = new UmlUseCaseShapeViewModel(parent, umlType);

            element.Name            = item.ShapeName;
            element.Top             = dropPoint.Y;
            element.Left            = dropPoint.X;
            element.Width           = item.DefaultWidth;
            element.Height          = item.DefaultHeight;
            element.StrokeDashArray = (item.StrokeDashArray == null ? string.Empty : item.StrokeDashArray);

            return(element);
        }
コード例 #3
0
ファイル: UmlElementDataDef.cs プロジェクト: denis554/Edi-1
        /// <summary>
        /// Read a shapes configiration information from persistence and return the new shape view model.
        /// </summary>
        /// <param name="reader"></param>
        /// <param name="umlType"></param>
        /// <param name="parent"></param>
        /// <returns></returns>
        public static ShapeViewModelBase ReadShape(XmlReader reader, UmlTypes umlType, IShapeParent parent)
        {
            switch (umlType)
            {
            case UmlTypes.Primitive:
            case UmlTypes.DataType:
            case UmlTypes.Signal:
            case UmlTypes.Class:
            case UmlTypes.Interface:
            case UmlTypes.Table:
            case UmlTypes.Enumeration:
            case UmlTypes.Component:
                return(UmlSquareShapeViewModel.ReadDocument(reader.ReadSubtree(), parent, umlType));

            case UmlTypes.Decision:
                return(UmlDecisionShapeViewModel.ReadDocument(reader.ReadSubtree(), parent, umlType));

            case UmlTypes.Package:
                return(UmlPackageShapeViewModel.ReadDocument(reader.ReadSubtree(), parent, umlType));

            case UmlTypes.Boundary:
                return(UmlBoundaryShapeViewModel.ReadDocument(reader.ReadSubtree(), parent, umlType));

            case UmlTypes.Note:
                return(UmlNoteShapeViewModel.ReadDocument(reader.ReadSubtree(), parent, umlType));

            case UmlTypes.Node:
            case UmlTypes.Device:
            case UmlTypes.DeploymentSpec:
                return(UmlNodeShapeViewModel.ReadDocument(reader.ReadSubtree(), parent, umlType));

            case UmlTypes.Collaboration:
            case UmlTypes.UseCase:
                return(UmlUseCaseShapeViewModel.ReadDocument(reader.ReadSubtree(), parent, umlType));

            case UmlTypes.CanvasShape:
            case UmlTypes.Actor:
            case UmlTypes.Actor1:
            case UmlTypes.ActivityInitial:
            case UmlTypes.ActivityFinal:
            case UmlTypes.ActivityFlowFinal:
            case UmlTypes.ActivitySync:
            case UmlTypes.Event1:
            case UmlTypes.Event2:
            case UmlTypes.Action1:
            case UmlTypes.Action2:
            case UmlTypes.ExecutionEnvironment:
                return(UmlCanvasShapeViewModel.ReadDocument(reader.ReadSubtree(), parent, umlType));

            case UmlTypes.ConnectorAggregation:
            case UmlTypes.ConnectorAssociation:
            case UmlTypes.ConnectorComposition:
            case UmlTypes.ConnectorInheritance:
                return(UmlAssociationShapeViewModel.ReadDocument(reader.ReadSubtree(), parent, umlType));

            case UmlTypes.Undefined:
            default:
                throw new NotImplementedException(string.Format("System error: '{0}' not supported in ReadShape.", umlType));
            }

            throw new NotImplementedException(umlType.ToString());
        }