コード例 #1
0
ファイル: CondInfo.cs プロジェクト: Easy-DDI-Organizer/EDO
        public static List<CondInfo> Create(IfThenElseVM ifThenElse)
        {
            List<CondInfo> condInfos = new List<CondInfo>();
            IfThenElse ifThenElseModel = (IfThenElse)ifThenElse.Model;
            ConstructVM construct = ifThenElse.FindConstruct(ifThenElseModel.ThenConstructId);
            if (construct != null)
            {
                CondInfo condInfo = new CondInfo();
                condInfo.TargetConstructId = construct.Id;
                condInfo.Code = ifThenElseModel.IfCondition.Code;
                condInfos.Add(condInfo);
            }

            foreach (ElseIf elseIf in ifThenElseModel.ElseIfs)
            {
                construct = ifThenElse.FindConstruct(elseIf.ThenConstructId);
                if (construct != null)
                {
                    CondInfo condInfo = new CondInfo();
                    condInfo.TargetConstructId = construct.Id;
                    condInfo.Code = elseIf.IfCondition.Code;
                    condInfos.Add(condInfo);
                }
            }

            construct = ifThenElse.FindConstruct(ifThenElseModel.ElseConstructId);
            if (construct != null)
            {
                CondInfo condInfo = new CondInfo();
                condInfo.TargetConstructId = ifThenElseModel.ElseConstructId;
                condInfo.Code = "ELSE";
                condInfos.Add(condInfo);
            }
            return condInfos;
        }
コード例 #2
0
        public static List <CondInfo> Create(IfThenElseVM ifThenElse)
        {
            List <CondInfo> condInfos       = new List <CondInfo>();
            IfThenElse      ifThenElseModel = (IfThenElse)ifThenElse.Model;
            ConstructVM     construct       = ifThenElse.FindConstruct(ifThenElseModel.ThenConstructId);

            if (construct != null)
            {
                CondInfo condInfo = new CondInfo();
                condInfo.TargetConstructId = construct.Id;
                condInfo.Code = ifThenElseModel.IfCondition.Code;
                condInfos.Add(condInfo);
            }

            foreach (ElseIf elseIf in ifThenElseModel.ElseIfs)
            {
                construct = ifThenElse.FindConstruct(elseIf.ThenConstructId);
                if (construct != null)
                {
                    CondInfo condInfo = new CondInfo();
                    condInfo.TargetConstructId = construct.Id;
                    condInfo.Code = elseIf.IfCondition.Code;
                    condInfos.Add(condInfo);
                }
            }

            construct = ifThenElse.FindConstruct(ifThenElseModel.ElseConstructId);
            if (construct != null)
            {
                CondInfo condInfo = new CondInfo();
                condInfo.TargetConstructId = ifThenElseModel.ElseConstructId;
                condInfo.Code = "ELSE";
                condInfos.Add(condInfo);
            }
            return(condInfos);
        }
コード例 #3
0
        private List <NodeInfo> CreateNodeInfos()
        {
            // 第一段階として各ノードの位置とサイズを決定する
            List <NodeInfo> nodeInfos = new List <NodeInfo>();
            ObservableCollection <ConstructVM> constructs = viewModel.Constructs;
            double y   = MARGIN_Y;
            double gap = NODE_GAP;

            for (int i = 0; i < constructs.Count; i++)
            {
                ConstructVM construct = constructs[i];
                NodeInfo    nodeInfo  = null;
                if (construct as QuestionConstructVM != null)
                {
                    //質問ノード
                    QuestionConstructVM questionConstruct = (QuestionConstructVM)construct;
                    nodeInfo        = new NodeInfo(NodeType.NodeTypeQuestion, questionConstruct);
                    nodeInfo.X      = MARGIN_X;
                    nodeInfo.Y      = y;
                    nodeInfo.Width  = NODE_WIDTH;
                    nodeInfo.Height = NODE_HEIGHT;
                    gap             = NODE_GAP;
                }
                else if (construct as QuestionGroupConstructVM != null)
                {
                    QuestionGroupConstructVM questionGroupConstruct = (QuestionGroupConstructVM)construct;
                    nodeInfo        = new NodeInfo(NodeType.NodeTypeQuestionGroup, questionGroupConstruct);
                    nodeInfo.X      = MARGIN_X;
                    nodeInfo.Y      = y;
                    nodeInfo.Width  = NODE_WIDTH;
                    nodeInfo.Height = NODE_HEIGHT;
                    gap             = NODE_GAP;
                }
                else if (construct as StatementVM != null)
                {
                    //説明文ノード
                    StatementVM statement = (StatementVM)construct;
                    nodeInfo        = new NodeInfo(NodeType.NodeTypeStatement, statement);
                    nodeInfo.X      = MARGIN_X;
                    nodeInfo.Y      = y;
                    nodeInfo.Width  = NODE_WIDTH;
                    nodeInfo.Height = NODE_HEIGHT;
                    gap             = NODE_GAP;
                }
                else if (construct as IfThenElseVM != null)
                {
                    //分岐ノード(分岐ノードの高さは、矢印部分の最後の水平線の位置を含める)
                    IfThenElseVM ifThenElse = (IfThenElseVM)construct;
                    nodeInfo                 = new NodeInfo(NodeType.NodeTypeBranch, ifThenElse);
                    nodeInfo.X               = MARGIN_X;
                    nodeInfo.Y               = y;
                    nodeInfo.Width           = NODE_WIDTH;
                    nodeInfo.ContainerHeight = NODE_HEIGHT; //ContainerHeight=菱形の高さ
                    //分岐の考慮
                    List <CondInfo> condInfos = CondInfo.Create(ifThenElse);
                    nodeInfo.CondInfos.AddRange(condInfos);
                    //分岐シェイプの高さは矢印の水平線の高さを含める(条件の数分水平線がでるのでその分拡張する)
                    nodeInfo.Height = nodeInfo.ContainerHeight + LINE_GAP_HEIGHT * condInfos.Count;
                    gap             = LINE_GAP_HEIGHT;
                }
                nodeInfos.Add(nodeInfo);
                y += nodeInfo.Height + gap;
            }
            return(nodeInfos);
        }