コード例 #1
0
ファイル: MetSymbol.java プロジェクト: nbearson/IDV
 /**
  * Get the bounds for this <code>MetSymbol</code> relative to the point specified.
  *
  * @param loc Java coordinates to draw at
  * @return Rectangle based on that point, the offset and the width and height of the symbol.
  */
 public Rectangle getBounds(Point2D loc) {
   if (offset != null) {
     bounds.x = offset.x + (int) loc.getX() - bounds.width / 2;
     bounds.y = offset.y + (int) loc.getY() - bounds.height / 2;
   } else {
     bounds.x = (int) loc.getX();
     bounds.y = (int) loc.getY();
   }
   return bounds;
 }
コード例 #2
0
ファイル: MetSymbol.java プロジェクト: nbearson/IDV
 /**
  * Paint a rectangle point
  *
  * @param g Graphics to use for painting
  * @param c DisplayCanvas to paint on
  */
 private void paintRectPoint(Graphics g, DisplayCanvas c) {
   Rectangle nb = transformOutput(c, getBounds());
   g.setColor(Color.red);
   Point2D rp = getPointOnRect(rectPoint, nb);
   g.fillRect((int) rp.getX() - 3, (int) rp.getY() - 3, 6, 6);
 }