Beispiel #1
0
        /// <summary>
        /// Arranges the shapes.
        /// </summary>
        public void ArrangeShapes()
        {
            List <ShapeElement> externalComponents = new List <ShapeElement>();
            List <ShapeElement> component          = new List <ShapeElement>();

            foreach (PresentationElement elem in this.NestedChildShapes)
            {
                ShapeElement shape = elem as ShapeElement;
                if (shape == null)
                {
                    continue;
                }

                if (shape.ModelElement is SoftwareComponent)
                {
                    component.Add(shape);
                }
                else
                {
                    externalComponents.Add(shape);
                }
            }
            PointD startPoint = new PointD(0.1, 0.1);

            if (component.Count > 0)
            {
                ShapeHelper.ArrangeChildShapes(this, component, 0, 1, startPoint, 0.2, 0);
                startPoint = new PointD(component[0].AbsoluteBoundingBox.Right + 0.4, component[0].AbsoluteBoundingBox.Location.Y);
            }

            ShapeHelper.ArrangeChildShapes(this, externalComponents, 0, 1, startPoint, 0, 0.4);
        }
Beispiel #2
0
 /// <summary>
 /// Alerts listeners that the shape has been assigned as a child shape to a parent shape.
 /// </summary>
 public override void OnShapeInserted()
 {
     base.OnShapeInserted();
     using (Transaction transaction = Store.TransactionManager.BeginTransaction("Adjust size"))
     {
         ShapeHelper.ResizeToContent(this);
         IsExpanded = false;
         transaction.Commit();
     }
 }
Beispiel #3
0
        /// <summary>
        /// Alerts listeners when the mouse is double-clicked over the shape.
        /// </summary>
        /// <param name="e">The diagram point event arguments.</param>
        public override void OnDoubleClick(DiagramPointEventArgs e)
        {
            base.OnDoubleClick(e);

            using (Transaction transaction = Store.TransactionManager.BeginTransaction("Adjust size"))
            {
                ShapeHelper.ResizeToContent(this);
                transaction.Commit();
            }
        }
 /// <summary>
 /// Alerts listeners that the shape has been assigned as a child shape to a parent shape.
 /// </summary>
 public override void OnShapeInserted()
 {
     base.OnShapeInserted();
     if (!Store.InUndoRedoOrRollback)
     {
         using (Transaction transaction = Store.TransactionManager.BeginTransaction("Adjust size"))
         {
             ShapeHelper.ResizeToContent(this);
             transaction.Commit();
         }
     }
 }
Beispiel #5
0
        /// <summary>
        /// Alerts listeners when the mouse is double-clicked over the shape.
        /// </summary>
        /// <param name="e">The diagram point event arguments.</param>
        public override void OnDoubleClick(DiagramPointEventArgs e)
        {
            base.OnDoubleClick(e);

            if (Utils.IsKeyPressed(Keys.Shift))
            {
                using (Transaction transaction = Store.TransactionManager.BeginTransaction("Adjust size"))
                {
                    ShapeHelper.ResizeToContent(this);
                    transaction.Commit();
                }
                return;
            }

            Entity entity = ModelElement as Entity;

            if (entity != null)
            {
                Mapper.Instance.ShowCode(entity.Id, entity.Name, null);
            }
        }
        /// <summary>
        /// Alerts listeners when the mouse is double-clicked over the shape.
        /// </summary>
        /// <param name="e">The diagram point event arguments.</param>
        public override void OnDoubleClick(DiagramPointEventArgs e)
        {
            base.OnDoubleClick(e);

            // Avec shift = AdjustSize
            if (Utils.IsKeyPressed(Keys.Shift))
            {
                using (Transaction transaction = Store.TransactionManager.BeginTransaction("Adjust size"))
                {
                    ShapeHelper.ResizeToContent(this);
                    transaction.Commit();
                }
                return;
            }

            ClassImplementation clazz = ModelElement as ClassImplementation;

            if (clazz != null)
            {
                Mapper.Instance.ShowCode(clazz.Id, clazz.Name, null);
            }
        }
Beispiel #7
0
        /// <summary>
        /// Arranges the shapes.
        /// </summary>
        public void ArrangeShapes()
        {
            double verticalStartPoint = 0.4;

            BinaryComponent component = ModelElement as BinaryComponent;

            if (component == null)
            {
                return;
            }
            Dictionary <ShapeElement, bool> shapes = new Dictionary <ShapeElement, bool>();

            foreach (ShapeElement shape in NestedChildShapes)
            {
                if (shape is NodeShape)
                {
                    shapes.Add(shape, false);
                }
            }

            ShapeHelper.ArrangeChildShapes(this, NestedChildShapes, AbsoluteBounds.Width, 0,
                                           new PointD(0.2, verticalStartPoint), 0.3, 0.5);
        }
 /// <summary>
 /// Arranges the shapes.
 /// </summary>
 public void ArrangeShapes()
 {
     ShapeHelper.ResizeToContent(this);
 }
Beispiel #9
0
 /// <summary>
 /// Arranges the shapes.
 /// </summary>
 public new void ArrangeShapes()
 {
     ShapeHelper.ArrangeChildShapes(this, this.NestedChildShapes, 12, 0, new PointD(0.2, 0.5), 0.2, 0.2);
 }
Beispiel #10
0
 /// <summary>
 /// Arranges the shapes.
 /// </summary>
 public void ArrangeShapes()
 {
     ShapeHelper.ArrangeChildShapes(this, NestedChildShapes, 0, 3, new PointD(0.2, 0.2), 0.1, 0.1);
 }