Esempio n. 1
0
 void VisitShapeGroup(ShapeGroup shapeGroup)
 {
     foreach (var content in shapeGroup.Contents)
     {
         VisitShapeLayerContent(content);
     }
 }
Esempio n. 2
0
 private void method_24(ShapeBase A_0)
 {
     if (A_0.IsGroup)
     {
         ShapeGroup group = (ShapeGroup)A_0;
         for (int i = 0; i < group.ChildObjects.Count; i++)
         {
             this.method_24(group.ChildObjects[i] as ShapeBase);
         }
     }
     else
     {
         Class761 class3 = this.class764_0.method_19(this.subDocumentType_0).method_6(A_0.Id);
         if ((class3 != null) && (class3.method_6() > 0))
         {
             ShapeObject obj2 = (ShapeObject)A_0;
             if (obj2.ShapeType != ShapeType.OleObject)
             {
                 obj2.IsTextbox = true;
             }
             this.class764_0.method_43().imethod_19(obj2);
             new Class1108(this.class764_0, Class813.smethod_21(this.subDocumentType_0)).method_4(class3.method_2(), class3.method_6());
             this.class764_0.method_43().imethod_20(obj2);
         }
     }
 }
Esempio n. 3
0
        public FormVisitorPattern()
        {
            Drawing = new ShapeGroup();

            // Head
            Head = new Circle(400, 100, 100);
            Drawing.AddShape(Head);

            // Body
            Body = new Rectangle(400, 200, 100, 100);
            Drawing.AddShape(Body);

            // Legs
            Legs = new ShapeGroup(100, 100);
            Legs.AddShape(new Rectangle(410, 300, 100, 10));
            Legs.AddShape(new Rectangle(480, 300, 100, 10));
            Drawing.AddShape(Legs);

            // Arms
            Arms = new ShapeGroup();
            Arms.AddShape(new Rectangle(320, 200, 10, 80));
            Arms.AddShape(new Rectangle(500, 200, 10, 80));
            Drawing.AddShape(Arms);

            InitializeComponent();
        }
Esempio n. 4
0
        YamlObject FromShapeGroup(ShapeGroup content, YamlMap superclassContent)
        {
            var result = superclassContent;

            result.Add(nameof(content.Contents), FromSpan(content.Contents, FromShapeLayerContent));
            return(result);
        }
Esempio n. 5
0
        public static void Test3()
        {
            Console.WriteLine("_________________________________________");
            var group1  = new ShapeGroup("*");
            var circle1 = new Circle(2);
            var sphere1 = new Sphere(2);
            var square1 = new Square(3);

            group1.AddToGroup(circle1);
            group1.AddToGroup(sphere1);
            group1.AddToGroup(square1);

            var group2  = new ShapeGroup("+");
            var square2 = new Square(1);
            var sphere2 = new Sphere(1);

            group2.AddToGroup(square2);
            group2.AddToGroup(sphere2);
            group2.AddToGroup(group1);

            var group3  = new ShapeGroup("*");
            var square3 = new Square(1);
            var sphere3 = new Sphere(2);

            group3.AddToGroup(square3);
            group3.AddToGroup(sphere3);
            group3.AddToGroup(group2);

            group3.About();
            Console.WriteLine("_________________________________________");
        }
Esempio n. 6
0
    private static void smethod_2(Class857 A_0, ShapeGroup A_1)
    {
        int      num    = 1;
        Class396 class2 = A_0.method_11();
        string   str    = "";

        while (class2.method_19())
        {
            string str2;
            if ((!A_0.method_4(class2) && !Class857.smethod_6(A_0, A_1.ShapePr)) && ((str2 = class2.method_1()) != null))
            {
                if (!(str2 == BookmarkStart.b("崦Ш䈪䌬䬮吰䬲", num)))
                {
                    if (str2 == BookmarkStart.b("匦嬨䨪䌬尮地尲䜴娶", num))
                    {
                        str = class2.method_3();
                    }
                }
                else
                {
                    A_1.ShapePr.SetAttr(0x103a, (long)class2.method_4());
                }
            }
        }
        Class857.smethod_4(A_1.ShapePr, str);
    }
        YamlObject FromShapeGroup(ShapeGroup content, YamlMap superclassContent)
        {
            var result = superclassContent;

            result.Add("Items", FromSpan(content.Items, FromShapeLayerContent));
            return(result);
        }
Esempio n. 8
0
        static CompositionShape TranslateGroupShapeContent(ShapeContext context, ShapeGroup group)
        {
            var result = TranslateShapeLayerContents(context, group.Contents);

            result.SetDescription(context, () => $"ShapeGroup: {group.Name}");
            return(result);
        }
Esempio n. 9
0
    private Class673 method_1(DocumentObject A_0)
    {
        if (A_0.DocumentObjectType == DocumentObjectType.Shape)
        {
            return(this.method_1(A_0.ParentObject));
        }
        ShapeGroup group = (A_0.DocumentObjectType == DocumentObjectType.ShapeGroup) ? ((ShapeGroup)A_0) : null;

        if (group == null)
        {
            return(Class673.smethod_0());
        }
        DocumentObject parentObject = group.ParentObject;
        Class673       class2       = Class673.smethod_0();

        if ((parentObject != null) && (parentObject.DocumentObjectType == DocumentObjectType.ShapeGroup))
        {
            class2 = this.method_1(parentObject);
        }
        SizeF size = group.Size;
        spr➂  r➂   = Class316.smethod_9(group, size, false);

        r➂.ᜀ(class2.method_0(), MatrixOrder.Append);
        Class316.smethod_9(group, size, true).ᜀ(class2.method_0(), MatrixOrder.Append);
        SizeF ef2    = Class316.smethod_0(group, class2.method_1(), class2.method_2());
        float width  = ef2.Width;
        float height = ef2.Height;
        float num3   = (size.Width / ((float)group.CoordSizeWidth)) * width;
        float num4   = (size.Height / ((float)group.CoordSizeHeight)) * height;

        return(new Class673(r➂, num3, num4, ((float)group.Rotation) + class2.method_3()));
    }
Esempio n. 10
0
        internal ShapeLayer(ILottieDrawable lottieDrawable, Layer layerModel) : base(lottieDrawable, layerModel)
        {
            // Naming this __container allows it to be ignored in KeyPath matching.
            ShapeGroup shapeGroup = new ShapeGroup("__container", layerModel.Shapes, false);

            _contentGroup = new ContentGroup(lottieDrawable, this, shapeGroup);
            _contentGroup.SetContents(new List <IContent>(), new List <IContent>());
        }
Esempio n. 11
0
        public void Contains_PointInGroup()
        {
            ShapeGroup shapeGroup = new ShapeGroup();

            shapeGroup.Add(new Circle(0, 0, 0));

            Assert.That(shapeGroup.Contains(0, 0), Is.True);
        }
Esempio n. 12
0
        public void Contains_ShapeInGroup()
        {
            ShapeGroup shapeGroup = new ShapeGroup();
            Circle     c          = new Circle(0, 0, 0);

            shapeGroup.Add(c);

            Assert.That(shapeGroup.Contains(c), Is.True);
        }
Esempio n. 13
0
        public void Add_WithoutReadOnly()
        {
            ShapeGroup shapeGroup = new ShapeGroup();

            shapeGroup.SetReadOnly(false);

            shapeGroup.Add(new Circle(0, 0, 0));

            Assert.That(shapeGroup.size, Is.EqualTo(1));
        }
Esempio n. 14
0
    private List <ShapeGroup> AllGroupsGUI(List <ShapeGroup> shapeGroups)
    {
        EditorGUILayout.LabelField("Shape groups", EditorStyles.boldLabel);

        foreach (ShapeGroup shapeGroup in shapeGroups)
        {
            EditorGUILayout.BeginHorizontal();

            string buttonLabel = shapeGroup.ID + ": ";
            if (shapeGroup.label == "")
            {
                buttonLabel += "(Untitled)";
            }
            else
            {
                buttonLabel += shapeGroup.label;
            }

            bool buttonOn = false;
            if (selectedGroup == shapeGroup)
            {
                buttonOn = true;
            }

            if (GUILayout.Toggle(buttonOn, buttonLabel, "Button"))
            {
                if (selectedGroup != shapeGroup)
                {
                    selectedGroup = shapeGroup;
                    selectedKey   = null;
                }
            }

            if (GUILayout.Button("-", GUILayout.Width(20f), GUILayout.Height(15f)))
            {
                shapeGroups.Remove(shapeGroup);
                selectedGroup = null;
                selectedKey   = null;
                break;
            }

            EditorGUILayout.EndHorizontal();
        }

        if (GUILayout.Button("Create new shape group"))
        {
            ShapeGroup newShapeGroup = new ShapeGroup(GetIDArray(shapeGroups));
            shapeGroups.Add(newShapeGroup);
            selectedGroup = newShapeGroup;
            selectedKey   = null;
        }

        return(shapeGroups);
    }
Esempio n. 15
0
        public static void Test0()
        {
            Console.WriteLine("_________________________________________");
            var group1 = new ShapeGroup("*");

            group1.About();
            var group2 = new ShapeGroup("+");

            group2.About();
            Console.WriteLine("_________________________________________");
        }
Esempio n. 16
0
    /**
     * Construct Java Graphics object which translates graphic calls in ppt Drawing layer.
     *
     * @param group           The shape group to write the graphics calls into.
     */
    public PPGraphics2D(ShapeGroup group){
        this._group = group;

        _transform = new AffineTransform();
        _stroke = new BasicStroke();
        _paint = Color.black;
        _font = new Font("Arial", Font.PLAIN, 12);
        _background = Color.black;
        _foreground = Color.white;
        _hints = new RenderingHints(null);
    }
Esempio n. 17
0
        public void TooXml()
        {
            ShapeGroup shapeGroup = new ShapeGroup();

            shapeGroup.Add(new Rectangle(0, 0, 2, 1));

            string xml = shapeGroup.ToXml();

            Assert.That(
                xml, Is.EqualTo(
                    "<shapegroup>\n<rectangle x=\"0\" y=\"0\" width=\"2\" height=\"1\" />\n</shapegroup>\n"));
        }
Esempio n. 18
0
    private ShapeGroup method_2(Class277 A_0)
    {
        ShapeGroup group = new ShapeGroup(this.class658_0.document_0);

        this.method_5((Class273)A_0.method_9(0), group);
        for (int i = 1; i < A_0.method_8(); i++)
        {
            ShapeBase base2 = this.method_0(A_0.method_9(i));
            group.method_13(base2);
        }
        return(group);
    }
Esempio n. 19
0
        /// <summary>
        /// This sample shows how to work with shape groups.
        /// </summary>
        /// <remarks>
        /// Details: https://sautinsoft.com/products/document/help/net/developer-guide/shape-groups.php
        /// </remarks>
        public static void ShapeGroups()
        {
            string pictPath     = @"..\..\image1.jpg";
            string documentPath = @"ShapeGroups.docx";

            // Let's create a document.
            DocumentCore dc = new DocumentCore();

            // Create floating layout.
            HorizontalPosition hp = new HorizontalPosition(HorizontalPositionType.Center, HorizontalPositionAnchor.Page);
            VerticalPosition   vp = new VerticalPosition(5f, LengthUnit.Centimeter, VerticalPositionAnchor.TopMargin);
            FloatingLayout     fl = new FloatingLayout(hp, vp, new Size(300, 300));

            // Create group.
            ShapeGroup group = new ShapeGroup(dc, fl);

            // Specify the size dimensions of the child extents rectangle.
            group.ChildSize = new Size(100, 100);

            // Create a child shape#1 (inside group) with preset geometry.
            // Specify shape's size and offset relative to group's ChildSize (100x100).
            Shape shape1 = new Shape(dc, new GroupLayout(new Point(0, 0), new Size(50, 50)));

            // Specify outline and fill.
            shape1.Outline.Fill.SetSolid(new Color("#358CCB"));
            shape1.Outline.Width = 2;
            shape1.Fill.SetSolid(Color.Orange);

            // Shape will be rectangle.
            shape1.Geometry.SetPreset(Figure.Rectangle);

            // Create picture and add it into the group.
            Picture picture = new Picture(dc, Layout.Group(new Point(50, 50), new Size(50, 50)), pictPath);

            // Specify picture fill mode.
            picture.ImageData.FillMode = PictureFillMode.Stretch;

            // Add shape and picture into our group.
            group.ChildShapes.Add(shape1);
            group.ChildShapes.Add(picture);

            // Add our group into the document.
            dc.Content.End.Insert(group.Content);

            // Save our document into DOCX format.
            dc.Save(documentPath);

            // Open the result for demonstration purposes.
            System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(documentPath)
            {
                UseShellExecute = true
            });
        }
        private Shape HexagonSide()
        {
            var side = new ShapeGroup()
            {
                InheritMaterial = true
            };

            side.AddChild(HexagonCorner());
            side.AddChild(HexagonEdge());

            return(side);
        }
Esempio n. 21
0
        public void Add_SameElementTwice()
        {
            ShapeGroup shapeGroup = new ShapeGroup();

            shapeGroup.SetReadOnly(false);

            Circle circle = new Circle(0, 0, 0);

            shapeGroup.Add(circle);
            shapeGroup.Add(circle);

            Assert.That(shapeGroup.size, Is.EqualTo(1));
        }
Esempio n. 22
0
    private Class277 method_3(ShapeGroup A_0, EscherShapeKind A_1)
    {
        Class277 class2 = new Class277();
        Class273 class3 = this.method_6(A_0, A_1);

        class2.method_7().Add(class3);
        for (IDocumentObject obj2 = A_0.FirstChild; obj2 != null; obj2 = obj2.NextSibling)
        {
            Class266 class4 = this.method_1((ShapeBase)obj2, EscherShapeKind.Child);
            class2.method_7().Add(class4);
        }
        return(class2);
    }
Esempio n. 23
0
        public void Add_InternalArraySizeExceeded()
        {
            ShapeGroup shapeGroup = new ShapeGroup();

            shapeGroup.SetReadOnly(false);

            for (int i = 0; i < 11; i++)
            {
                shapeGroup.Add(new Circle(0, 0, 0));
            }

            Assert.That(shapeGroup.size, Is.EqualTo(11));
        }
        private Shape Hexagon()
        {
            var hexagon = new ShapeGroup();

            for (int n = 0; n < 6; n++)
            {
                var side = HexagonSide();
                side.Transform = new Transform()
                                 .RotateY(n * Math.PI / 3);
                hexagon.AddChild(side);
            }

            return(hexagon);
        }
Esempio n. 25
0
    public override void OnInspectorGUI()
    {
        Shapeable _target = (Shapeable)target;

        _target.shapeGroups = AllGroupsGUI(_target.shapeGroups);

        if (selectedGroup != null)
        {
            selectedGroup = GroupGUI(selectedGroup);
        }

        if (GUI.changed)
        {
            EditorUtility.SetDirty(_target);
        }
    }
Esempio n. 26
0
        XElement FromShapeGroup(ShapeGroup content)
        {
            return(new XElement("Group", GetContents()));

            IEnumerable <XObject> GetContents()
            {
                foreach (var item in GetShapeLayerContentContents(content))
                {
                    yield return(item);
                }

                for (var i = 0; i < content.Contents.Length; i++)
                {
                    yield return(FromShapeLayerContent(content.Contents[i]));
                }
            }
        }
Esempio n. 27
0
    private static void smethod_3(Class857 A_0, ShapeGroup A_1, CharacterFormat A_2)
    {
        int      num    = 9;
        Class396 class2 = A_0.method_11();

        while (class2.method_10(BookmarkStart.b("䠮", num), XmlDocumentTextHandling.TextAndSignificantAndIgnorable))
        {
            if (Class857.smethod_10(A_0, A_1, A_2, null))
            {
                A_0.method_41(true);
            }
            else
            {
                A_0.method_5(A_1.ShapePr);
            }
        }
    }
Esempio n. 28
0
    private ShapeGroup GroupGUI(ShapeGroup shapeGroup)
    {
        EditorGUILayout.Space();

        EditorGUILayout.BeginVertical("Button");
        EditorGUILayout.LabelField("Shape group " + shapeGroup.label, EditorStyles.boldLabel);

        shapeGroup.label = EditorGUILayout.TextField("Group label:", shapeGroup.label);

        shapeGroup.shapeKeys = AllKeysGUI(shapeGroup.shapeKeys);

        if (selectedKey != null && shapeGroup.shapeKeys.Contains(selectedKey))
        {
            selectedKey = KeyGUI(selectedKey);
        }

        EditorGUILayout.EndVertical();

        return(shapeGroup);
    }
Esempio n. 29
0
            internal static FontCharacter NewInstance(JsonObject json, LottieComposition composition)
            {
                var character  = json.GetNamedString("ch").ElementAt(0);
                var size       = (int)json.GetNamedNumber("size", 0);
                var width      = json.GetNamedNumber("w", 0);
                var style      = json.GetNamedString("style", "");
                var fontFamily = json.GetNamedString("fFamily", "");
                var shapesJson = json.GetNamedObject("data", null)?.GetNamedArray("shapes", null);
                var shapes     = new List <ShapeGroup>();

                if (shapesJson != null)
                {
                    shapes = new List <ShapeGroup>(shapesJson.Count);
                    for (uint i = 0; i < shapesJson.Count; i++)
                    {
                        shapes.Add((ShapeGroup)ShapeGroup.ShapeItemWithJson(shapesJson.GetObjectAt(i), composition));
                    }
                }
                return(new FontCharacter(shapes, character, size, width, style, fontFamily));
            }
Esempio n. 30
0
    internal static void smethod_0(Class857 A_0, DocumentObject A_1, CharacterFormat A_2)
    {
        ShapeGroup group = new ShapeGroup(A_0.method_9());

        smethod_2(A_0, group);
        Class98 class2 = (Class98)A_0.method_13().method_2(A_0.method_16(), BookmarkStart.b("嘰䄲吴䜶儸刺帼", 11), A_0.method_20(), true);

        if ((class2 != null) && (class2.method_45() != null))
        {
            class2.method_45().method_37(group.ShapePr);
        }
        if (A_2 != null)
        {
            A_2.method_37(group.CharacterFormat);
        }
        smethod_3(A_0, group, A_2);
        if ((group.ChildObjects.Count > 0) || !(A_1 is ShapeGroup))
        {
            smethod_1(group);
            A_1.method_13(group);
        }
    }
Esempio n. 31
0
        public void CreateGroupAndFindMeasure()
        {
            var rand     = _rand.Next(1, 50) + _rand.NextDouble();
            var rand2    = _rand.Next(1, 50) + _rand.NextDouble();
            var ellipse  = new Ellipse(new Point(0, 0), rand, rand2, new Perimeter());
            var tryangle = new Tryangle(new Point(0, 0), rand, rand2, new Perimeter());
            var square   = new Square(new Point(0, 0), rand, new Perimeter());
            ShapeGroup <IMeasurable> sg = new ShapeGroup <IMeasurable>(new GroupMeasure(new AddOperator()));

            sg.Add(ellipse);
            sg.Add(tryangle);
            sg.Add(square);
            var groupMeasure = sg.GetMeasure();

            Assert.AreEqual(ellipse.GetMeasure() + tryangle.GetMeasure() + square.GetMeasure(), groupMeasure);
            var anotherGroup = new ShapeGroup <IMeasurable>(new GroupMeasure(new AddOperator()));

            anotherGroup.Add(ellipse);
            anotherGroup.Add(tryangle);
            anotherGroup.Add(square);
            sg.Add(anotherGroup);
            Assert.AreEqual(groupMeasure + anotherGroup.GetMeasure(), sg.GetMeasure());
        }
Esempio n. 32
0
    public static ShapeGroup CreateShapeGroup(EscherContainerRecord spContainer, Shape parent){
        ShapeGroup group = null;
        EscherRecord opt = Shape.GetEscherChild((EscherContainerRecord)spContainer.GetChild(0), (short)0xF122);
        if(opt != null){
            try {
                EscherPropertyFactory f = new EscherPropertyFactory();
                List props = f.CreateProperties( opt.Serialize(), 8, opt.GetInstance() );
                EscherSimpleProperty p = (EscherSimpleProperty)props.Get(0);
                if(p.GetPropertyNumber() == 0x39F && p.GetPropertyValue() == 1){
                    group = new Table(spContainer, parent);
                } else {
                    group = new ShapeGroup(spContainer, parent);
                }
            } catch (Exception e){
                logger.log(POILogger.WARN, e.GetMessage());
                group = new ShapeGroup(spContainer, parent);
            }
        }  else {
            group = new ShapeGroup(spContainer, parent);
        }

        return group;
     }