コード例 #1
0
 public override void AddToTree(Shape s, bool allowAddOfSubpart)
 {
     if (ForceConcernComponent.IsForceConcern(s.Name))
     {
         ForceConcernComponent com = new ForceConcernComponent(Page, s);
         if (com.Index == Index)
         {
             Children.Add(com);
         }
     }
     else if (ForceDescriptionComponent.IsForceDescription(s.Name))
     {
         ForceDescriptionComponent com = new ForceDescriptionComponent(Page, s);
         if (com.Index == Index)
         {
             Children.Add(com);
         }
     }
     else if (ForceValueComponent.IsForceValue(s.Name))
     {
         ForceValueComponent com = new ForceValueComponent(Page, s);
         if (com.Index == Index)
         {
             Children.Add(com);
         }
     }
 }
コード例 #2
0
        public ForceContainer(Page page, Shape forceContainer) : base(page, false)
        {
            Shape = forceContainer;
            Array                    ident                 = forceContainer.ContainerProperties.GetMemberShapes((int)VisContainerFlags.visContainerFlagsExcludeNested);
            List <Shape>             shapes                = new List <int>((int[])ident).Select(i => page.Shapes.ItemFromID[i]).ToList();
            string                   concern               = null;
            string                   description           = null;
            Dictionary <int, string> forceValuesDictionary = new Dictionary <int, string>();

            if (Children.Count == 0)
            {
                foreach (Shape shape in shapes)
                {
                    if (ForceConcernComponent.IsForceConcern(shape.Name))
                    {
                        Children.Add(new ForceConcernComponent(page, shape));
                        concern = shape.Text;
                    }
                    else if (ForceDescriptionComponent.IsForceDescription(shape.Name))
                    {
                        Children.Add(new ForceDescriptionComponent(page, shape));
                        description = shape.Text;
                    }
                    else if (ForceValueComponent.IsForceValue(shape.Name))
                    {
                        ForceValueComponent comp = new ForceValueComponent(page, shape);
                        Children.Add(comp);
                        forceValuesDictionary.Add(comp.ForceAlternativeId, comp.Text);
                    }
                }

                if ((concern != null) && (description != null))
                {
                    Force correspondingForce = new Force(concern, description, forceValuesDictionary, Id);
                    if (Index <= Globals.RationallyAddIn.Model.Forces.Count)
                    {
                        Globals.RationallyAddIn.Model.Forces.Insert(Index, correspondingForce);
                    }
                    else
                    {
                        Globals.RationallyAddIn.Model.Forces.Add(correspondingForce);
                    }
                }
            }
            UsedSizingPolicy |= SizingPolicy.ExpandXIfNeeded | SizingPolicy.ShrinkYIfNeeded;
            LayoutManager     = new InlineLayout(this);
        }
コード例 #3
0
        public override void AddToTree(Shape s, bool allowAddOfSubpart)
        {
            //make s into an rcomponent for access to wrapper
            VisioShape shapeComponent = new VisioShape(Page)
            {
                Shape = s
            };

            if (ForceContainer.IsForceContainer(s.Name))
            {
                if (Children.Where(c => c is ForceContainer || c is ForceStubContainer).All(c => c.Index != shapeComponent.Index)) //there is no forcecontainer stub with this index
                {
                    ForceContainer con = new ForceContainer(Page, s);
                    Children.Insert(con.Index + 1, con); //after header
                }
                else
                {
                    //remove stub, insert s as the shape of the stub wrapper
                    ForceStubContainer stub = (ForceStubContainer)Children.Where(c => c is ForceStubContainer).First(c => c.Index == shapeComponent.Index);
                    Children.Remove(stub);
                    ForceContainer con = new ForceContainer(Page, s);
                    Children.Insert(con.Index + 1, con); //after header
                }
            }
            else
            {
                bool isForceChild = ForceConcernComponent.IsForceConcern(s.Name) || ForceDescriptionComponent.IsForceDescription(s.Name) || ForceValueComponent.IsForceValue(s.Name);

                if (isForceChild && Children.Where(c => c is ForceContainer || c is ForceStubContainer).All(c => c.Index != shapeComponent.Index)) //if parent not exists
                {
                    ForceStubContainer stub = new ForceStubContainer(Page, shapeComponent.Index);
                    Children.Insert(shapeComponent.Index + 1, stub); //after header
                    Children.ForEach(r => r.AddToTree(s, allowAddOfSubpart));
                }
                else
                {
                    //default case
                    Children.ForEach(r => r.AddToTree(s, allowAddOfSubpart));
                }
            }
        }
コード例 #4
0
        public ForceContainer(Page page, int index, int forceId) : base(page)
        {
            Index = index;
            Id    = forceId;
            ForceConcernComponent concern = new ForceConcernComponent(page, index);

            Children.Add(concern);

            ForceDescriptionComponent description = new ForceDescriptionComponent(page, index);

            Children.Add(description);
            RationallyType = "forceContainer";
            Name           = "ForceContainer";

            AddAction("addForce", "QUEUEMARKEREVENT(\"add\")", "Add force", false);
            AddAction("deleteForce", "QUEUEMARKEREVENT(\"delete\")", "Delete this force", false);

            MsvSdContainerLocked = true;
            Height            = 0.33;
            UsedSizingPolicy |= SizingPolicy.ExpandXIfNeeded;
            InitStyle();
        }