01: /* ====================================================================
02: Licensed to the Apache Software Foundation (ASF) under one or more
03: contributor license agreements. See the NOTICE file distributed with
04: this work for additional information regarding copyright ownership.
05: The ASF licenses this file to You under the Apache License, Version 2.0
06: (the "License"); you may not use this file except in compliance with
07: the License. You may obtain a copy of the License at
08:
09: http://www.apache.org/licenses/LICENSE-2.0
10:
11: Unless required by applicable law or agreed to in writing, software
12: distributed under the License is distributed on an "AS IS" BASIS,
13: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: See the License for the specific language governing permissions and
15: limitations under the License.
16: ==================================================================== */
17:
18: package org.apache.poi.hssf.usermodel;
19:
20: /**
21: * @author Glen Stampoultzis (glens at superlinksoftware.com)
22: */
23: public class HSSFPolygon extends HSSFShape {
24: int[] xPoints;
25: int[] yPoints;
26: int drawAreaWidth = 100;
27: int drawAreaHeight = 100;
28:
29: HSSFPolygon(HSSFShape parent, HSSFAnchor anchor) {
30: super (parent, anchor);
31: }
32:
33: public int[] getXPoints() {
34: return xPoints;
35: }
36:
37: public int[] getYPoints() {
38: return yPoints;
39: }
40:
41: public void setPoints(int[] xPoints, int[] yPoints) {
42: this .xPoints = cloneArray(xPoints);
43: this .yPoints = cloneArray(yPoints);
44: }
45:
46: private int[] cloneArray(int[] a) {
47: int[] result = new int[a.length];
48: for (int i = 0; i < a.length; i++)
49: result[i] = a[i];
50:
51: return result;
52: }
53:
54: /**
55: * Defines the width and height of the points in the polygon
56: * @param width
57: * @param height
58: */
59: public void setPolygonDrawArea(int width, int height) {
60: this .drawAreaWidth = width;
61: this .drawAreaHeight = height;
62: }
63:
64: public int getDrawAreaWidth() {
65: return drawAreaWidth;
66: }
67:
68: public int getDrawAreaHeight() {
69: return drawAreaHeight;
70: }
71:
72: }
|