11package jtamaro .graphic ;
22
3- import java .awt .Color ;
43import java .awt .Graphics2D ;
54import java .awt .geom .Path2D ;
65import java .awt .geom .Rectangle2D ;
@@ -67,10 +66,18 @@ protected Graphic(Path2D.Double path, Point pinPoint) {
6766
6867 /* **** Location **** */
6968
69+ /**
70+ * Get pinning point of the graphic.
71+ *
72+ * @see Point
73+ */
7074 public Point getPin () {
7175 return pinPoint ;
7276 }
7377
78+ /**
79+ * Get the (tight) bounding box of this graphic.
80+ */
7481 Rectangle2D getBBox () {
7582 return bbox ;
7683 }
@@ -95,6 +102,11 @@ public final double getBoundsMinY() {
95102 return getBBox ().getMinY ();
96103 }
97104
105+ /**
106+ * Get the relative location for the given point with respect to this graphic.
107+ *
108+ * @implNote The location is computed with respect to the origin point of this graphic.
109+ */
98110 RelativeLocation getLocation (Point point ) {
99111 /*
100112 * switch (point.x) {
@@ -136,7 +148,7 @@ RelativeLocation getLocation(Point point) {
136148 * Return the location coordinates relative to the (child) graphic corresponding to the given
137149 * absolute coordinates.
138150 *
139- * <p> The two coordinates must be given with respect to the origin point of the graphic.
151+ * @apiNote The two coordinates must be given with respect to the origin point of the graphic.
140152 */
141153 Option <RelativeLocation > relativeLocationOf (double x , double y ) {
142154 return path .contains (x , y )
@@ -147,33 +159,46 @@ Option<RelativeLocation> relativeLocationOf(double x, double y) {
147159 /* **** Rendering **** */
148160
149161 /**
150- * Render this Graphic into the given Graphics2D graphics context, using the given RenderOptions.
162+ * Render this Graphic into the given {@link Graphics2D} graphics context, using the given
163+ * {@link RenderOptions}.
151164 *
152165 * <p>The context can represent a GUI component (used when visualizing the graphic), or a bitmap
153166 * (used when writing the graphic into a bitmap file).
154167 */
155168 protected abstract void render (Graphics2D g2d , RenderOptions options );
156169
170+ /**
171+ * Draw debug information for this graphic on the given {@link Graphics2D} graphics context.
172+ */
157173 final void drawDebugInfo (Graphics2D g2d ) {
158174 GraphicsDebugInfo .render (g2d , getPath (), getBBox ());
159175 }
160176
177+ /**
178+ * Get the path of this graphic.
179+ */
161180 Path2D .Double getPath () {
162181 return path ;
163182 }
164183
184+ /**
185+ * Get the width of this graphic.
186+ *
187+ * @implNote Computed using the tight bounding box.
188+ */
165189 public double getWidth () {
166190 return bbox .getWidth ();
167191 }
168192
193+ /**
194+ * Get the height of this graphic.
195+ *
196+ * @implNote Computed using the tight bounding box.
197+ */
169198 public double getHeight () {
170199 return bbox .getHeight ();
171200 }
172201
173- public static Color renderableColor (jtamaro .graphic .Color color ) {
174- return new Color (color .red (), color .green (), color .blue (), color .alpha ());
175- }
176-
177202 /**
178203 * Return an <b>ordered</b> map that contains children (and their "names" as key) of this
179204 * graphic.
0 commit comments