Ejemplo n.º 1
0
        public Section(XmlNode sectionNode)
            : this()
        {
            if (!sectionNode.LocalName.Equals("g"))
                throw new Exception("sectionNode is not a 'g' node");

            this.id = Utils.GetAttributeValueFromNode(sectionNode, "id");

            //this.shapesInSection = new List<IShape>();
            IShape shape = null;

            foreach(XmlNode childNode in sectionNode.ChildNodes) {
                // Check the type of the node
                if (Table.IsTable(childNode))
                    shape = new Table(childNode);

                else if (Line.IsLine(childNode))
                    shape = new Line(childNode);

                else if (Rectangle.IsRectangle(childNode))
                    shape = new Rectangle(childNode);

                else if (Text.IsText(childNode))
                    shape = new Text(childNode);

                else
                    throw new Exception("No other type of shape available");

                this.shapesInSection.Add(shape);
            }
        }
Ejemplo n.º 2
0
        public object Clone()
        {
            Text newText = new Text();

            newText.id = this.id;
            newText.textValue = this.textValue;
            newText.size = this.size;
            newText.style = this.style;
            newText.family = this.family;
            newText.alignment = this.alignment;

            newText.x = this.x;
            newText.y = this.y;

            newText.color = (double[])this.color.Clone();
            newText.opacity = this.opacity;

            return newText;
        }
Ejemplo n.º 3
0
        public static int GetPixelHeightSize(Text aText, Pango.Layout layout)
        {
            layout.SetText(aText.TextValue);
            layout.FontDescription = Pango.FontDescription.FromString(aText.FontDescription);

            int pixelSizeWidth, pixelSizeHeight;
            layout.GetPixelSize(out pixelSizeWidth, out pixelSizeHeight);

            return pixelSizeHeight;
        }