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.

AFPObjectAreaInfo.java 3.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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. *
  9. * 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. /* $Id$ */
  18. package org.apache.fop.afp;
  19. /**
  20. * A common class used to convey locations,
  21. * dimensions and resolutions of data objects.
  22. */
  23. public class AFPObjectAreaInfo {
  24. private final int x;
  25. private final int y;
  26. private final int width;
  27. private final int height;
  28. private int widthRes;
  29. private int heightRes;
  30. private final int rotation;
  31. /**
  32. * Constructor
  33. *
  34. * @param x the x coordinate
  35. * @param y the y coordinate
  36. * @param width the width
  37. * @param height the height
  38. * @param resolution the resolution (sets both width and height resolutions)
  39. * @param rotation the rotation angle
  40. */
  41. public AFPObjectAreaInfo(int x, int y, int width, int height, int resolution, int rotation) {
  42. this.x = x;
  43. this.y = y;
  44. this.width = width;
  45. this.height = height;
  46. this.rotation = rotation;
  47. this.widthRes = resolution;
  48. this.heightRes = resolution;
  49. }
  50. /**
  51. * Sets both the width and the height resolutions.
  52. *
  53. * @param resolution the resolution
  54. */
  55. public void setResolution(int resolution) {
  56. this.widthRes = resolution;
  57. this.heightRes = resolution;
  58. }
  59. /**
  60. * Sets the width resolution.
  61. *
  62. * @param resolution the resolution
  63. */
  64. public void setWidthRes(int resolution) {
  65. this.widthRes = resolution;
  66. }
  67. /**
  68. * Sets the height resolution.
  69. *
  70. * @param resolution the resolution
  71. */
  72. public void setHeightRes(int resolution) {
  73. this.heightRes = resolution;
  74. }
  75. /**
  76. * Returns the x coordinate of this data object
  77. *
  78. * @return the x coordinate of this data object
  79. */
  80. public int getX() {
  81. return x;
  82. }
  83. /**
  84. * Returns the y coordinate of this data object
  85. *
  86. * @return the y coordinate of this data object
  87. */
  88. public int getY() {
  89. return y;
  90. }
  91. /**
  92. * Returns the width of this data object
  93. *
  94. * @return the width of this data object
  95. */
  96. public int getWidth() {
  97. return width;
  98. }
  99. /**
  100. * Returns the height of this data object
  101. *
  102. * @return the height of this data object
  103. */
  104. public int getHeight() {
  105. return height;
  106. }
  107. /**
  108. * Returns the width resolution of this data object
  109. *
  110. * @return the resolution of this data object
  111. */
  112. public int getWidthRes() {
  113. return widthRes;
  114. }
  115. /**
  116. * Returns the height resolution of this data object
  117. *
  118. * @return the resolution of this data object
  119. */
  120. public int getHeightRes() {
  121. return heightRes;
  122. }
  123. /**
  124. * Returns the rotation of this data object
  125. *
  126. * @return the rotation of this data object
  127. */
  128. public int getRotation() {
  129. return rotation;
  130. }
  131. /** {@inheritDoc} */
  132. public String toString() {
  133. return "x=" + x
  134. + ", y=" + y
  135. + ", width=" + width
  136. + ", height=" + height
  137. + ", widthRes=" + widthRes
  138. + ", heigtRes=" + heightRes
  139. + ", rotation=" + rotation;
  140. }
  141. }