コード例 #1
0
        private void CreateGroup(int row, int col, AbilitiesMask protection)
        {
            // create a group
            NGroup group = new NGroup();

            group.Protection = new NAbilities(protection);

            // add two rectangle shapes in it
            group.Shapes.AddChild(new NRectangleShape(new NRectangleF(0, 0, 1, 1)));
            group.Shapes.AddChild(new NRectangleShape(new NRectangleF(2, 2, 1, 1)));

            // update the group model bounds to fit the shapes
            group.UpdateModelBounds();

            // transform the group to fit in the specified bounds
            group.Bounds = base.GetGridCell(row, col);

            // create the labels shape element
            group.CreateShapeElements(ShapeElementsMask.Labels);

            // create the default label
            NRotatedBoundsLabel label = new NRotatedBoundsLabel("", group.UniqueId, new Nevron.Diagram.NMargins(0));

            group.Labels.AddChild(label);
            group.Labels.DefaultLabelUniqueId = label.UniqueId;

            // assign text to the group
            group.Text = "Protected from: " + protection.ToString();

            // add the group to the active layer
            document.ActiveLayer.AddChild(group);
        }
コード例 #2
0
        private void CreateRectangle(int row, int col, AbilitiesMask protection)
        {
            // create a rectangle
            NRectangleShape rect = new NRectangleShape(base.GetGridCell(row, col));

            rect.Protection = new NAbilities(protection);
            rect.Text       = "Protected from: " + protection.ToString();

            document.ActiveLayer.AddChild(rect);
        }
コード例 #3
0
        private void CreateLine(int row, int col, AbilitiesMask protection)
        {
            // create a line
            NRectangleF rect = base.GetGridCell(row, col);
            NLineShape  line = new NLineShape(rect.X, rect.Y, rect.Right, rect.Bottom);

            line.Protection = new NAbilities(protection);
            line.Text       = "Protected from: " + protection.ToString();

            document.ActiveLayer.AddChild(line);
        }
コード例 #4
0
        private void CreateTwoRectangles(int row, int col, AbilitiesMask protection)
        {
            // create the first rectangle shape
            NRectangleF rect = base.GetGridCell(row, col);

            rect = new NRectangleF(rect.X, rect.Y, rect.Width / 2, rect.Height / 2);

            NRectangleShape rect1 = new NRectangleShape(rect);

            rect1.Protection = new NAbilities(protection);
            rect1.Text       = "Protected from: " + protection.ToString();
            document.ActiveLayer.AddChild(rect1);

            // create the second rectangle shape
            rect = base.GetGridCell(row, col);
            rect = new NRectangleF(rect.X + rect.Width / 2, rect.Y + rect.Height / 2, rect.Width / 2, rect.Height / 2);

            NRectangleShape rect2 = new NRectangleShape(rect);

            rect2.Protection = new NAbilities(protection);
            rect2.Text       = "Protected from: " + protection.ToString();
            document.ActiveLayer.AddChild(rect2);
        }
コード例 #5
0
        private void CreateCompositeShape(int row, int col, AbilitiesMask protection)
        {
            // create a composite shape
            NCompositeShape shape = new NCompositeShape();

            shape.Protection = new NAbilities(protection);
            shape.Text       = "Protected from: " + protection.ToString();

            shape.Primitives.AddChild(new NRectanglePath(new NRectangleF(0, 0, 1, 1)));
            shape.Primitives.AddChild(new NRectanglePath(new NRectangleF(2, 2, 1, 1)));

            shape.UpdateModelBounds();
            shape.Bounds = base.GetGridCell(row, col);

            document.ActiveLayer.AddChild(shape);
        }