You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

HSSFPolygon.java 2.6KB

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