예제 #1
0
        /// <summary>
        /// Creates a polygon
        /// </summary>
        /// <param name="anchor">the client anchor describes how this Group Is attached
        /// to the sheet.</param>
        /// <returns>the newly Created shape.</returns>
        public HSSFPolygon CreatePolygon(HSSFChildAnchor anchor)
        {
            HSSFPolygon shape = new HSSFPolygon(this, anchor);

            shape.Anchor = anchor;
            shapes.Add(shape);
            return(shape);
        }
예제 #2
0
        /// <summary>
        /// Creates a polygon
        /// </summary>
        /// <param name="anchor">the client anchor describes how this Group is attached
        /// to the sheet.</param>
        /// <returns>the newly Created shape.</returns>
        public HSSFPolygon CreatePolygon(IClientAnchor anchor)
        {
            HSSFPolygon shape = new HSSFPolygon(null, (HSSFAnchor)anchor);

            shape.Anchor = (HSSFAnchor)anchor;
            AddShape(shape);
            return(shape);
        }
예제 #3
0
        /**
         * Fills a (closed) polygon, as defined by a pair of arrays, which
         *  hold the <i>x</i> and <i>y</i> coordinates.
         *
         * This Draws the polygon, with <c>nPoint</c> line segments.
         * The first <c>nPoint - 1</c> line segments are
         *  Drawn between sequential points
         *  (<c>xPoints[i],yPoints[i],xPoints[i+1],yPoints[i+1]</c>).
         * The line segment Is a closing one, from the last point to
         *  the first (assuming they are different).
         *
         * The area inside of the polygon Is defined by using an
         *  even-odd Fill rule (also known as the alternating rule), and
         *  the area inside of it Is Filled.
         * @param xPoints array of the <c>x</c> coordinates.
         * @param yPoints array of the <c>y</c> coordinates.
         * @param nPoints the total number of points in the polygon.
         * @see   java.awt.Graphics#DrawPolygon(int[], int[], int)
         */
        public void FillPolygon(int[] xPoints, int[] yPoints,
                                int nPoints)
        {
            int         right  = FindBiggest(xPoints);
            int         bottom = FindBiggest(yPoints);
            int         left   = FindSmallest(xPoints);
            int         top    = FindSmallest(yPoints);
            HSSFPolygon shape  = escherGroup.CreatePolygon(new HSSFChildAnchor(left, top, right, bottom));

            shape.SetPolygonDrawArea(right - left, bottom - top);
            shape.SetPoints(AddToAll(xPoints, -left), AddToAll(yPoints, -top));
            shape.SetLineStyleColor(foreground.R, foreground.G, foreground.B);
            shape.SetFillColor(foreground.R, foreground.G, foreground.B);
        }