Class Glyph

java.lang.Object
ucar.unidata.ui.drawing.Glyph
All Implemented Interfaces:
Cloneable
Direct Known Subclasses:
LineGlyph, PolyGlyph, RectangleGlyph

public abstract class Glyph extends Object implements Cloneable
Base (abstract) class for representing things that are drawn on the screen. Holds some basic attributes (but no positional attrs) and has a facility for recreating itself via xml.
  • Field Details

  • Constructor Details

    • Glyph

      public Glyph()
      _more_
  • Method Details

    • getCursor

      public static Cursor getCursor(String rectPoint)
      _more_
      Parameters:
      rectPoint - _more_
      Returns:
      _more_
    • getRectPointName

      public static String getRectPointName(String rectPoint)
      _more_
      Parameters:
      rectPoint -
      Returns:
      _more_
    • paintSelectionPoints

      public static void paintSelectionPoints(Graphics g, RectangularShape r, int size)
      By default paint little black rectangles at the corners and the sides
      Parameters:
      g - The graphics to paint into
      r - The rectangle to decorate
      size - Box size
    • flipY

      public static String flipY(String pt)
      _more_
      Parameters:
      pt -
      Returns:
      _more_
    • getPointOnRect

      public static Point2D getPointOnRect(String pt, Rectangle2D r)
      _more_
      Parameters:
      pt -
      r -
      Returns:
      _more_
    • toRect

      public static Rectangle toRect(RectangularShape r)
      _more_
      Parameters:
      r - _more_
      Returns:
      _more_
    • getStretchPoint

      public static String getStretchPoint(RectangularShape r, int x, int y)
      _more_
      Parameters:
      r - _more_
      x -
      y -
      Returns:
      _more_
    • getPointOnRect

      public static Point2D getPointOnRect(String pt, Rectangle2D r, Point2D point)
      _more_
      Parameters:
      pt - The point spec
      r - The rectangle
      point - The point to set
      Returns:
      _more_
    • stretchTo

      public static String stretchTo(Rectangle bounds, int x, int y, String pt)
      _more_
      Parameters:
      bounds -
      x -
      y -
      pt -
      Returns:
      _more_
    • stretchTo

      public static String stretchTo(Rectangle bounds, int x, int y, String pt, boolean correct, boolean symetric, boolean equalSides)
      _more_
      Parameters:
      bounds - _more_
      x -
      y -
      pt -
      correct -
      symetric - _more_
      equalSides - _more_
      Returns:
      _more_
    • getStretchy

      public boolean getStretchy()
      _more_
      Returns:
      _more_
    • setStretchy

      public void setStretchy(boolean b)
      _more_
      Parameters:
      b -
    • setBeingCreated

      public void setBeingCreated(boolean b)
      _more_
      Parameters:
      b -
    • getBeingCreated

      public boolean getBeingCreated()
      _more_
      Returns:
      _more_
    • initDone

      public void initDone()
      _more_
    • setId

      public void setId(String newId)
      _more_
      Parameters:
      newId -
    • getId

      public String getId()
      _more_
      Returns:
      _more_
    • doRemove

      public void doRemove()
      _more_
    • setParent

      public void setParent(CompositeGlyph newParent)
      _more_
      Parameters:
      newParent -
    • pickable

      public boolean pickable()
      _more_
      Returns:
      _more_
    • notifyChange

      public void notifyChange()
      _more_
    • getCreateCommand

      public CanvasCommand getCreateCommand(DisplayCanvas canvas, AWTEvent event, int x, int y)
      _more_
      Parameters:
      canvas -
      event -
      x -
      y -
      Returns:
      _more_
    • getMoveCommand

      public CanvasCommand getMoveCommand(DisplayCanvas canvas, AWTEvent event, int x, int y)
      _more_
      Parameters:
      canvas -
      event -
      x -
      y -
      Returns:
      _more_
    • clone

      protected Object clone() throws CloneNotSupportedException
      _more_
      Overrides:
      clone in class Object
      Returns:
      _more_
      Throws:
      CloneNotSupportedException
    • getPersistent

      public boolean getPersistent()
      _more_
      Returns:
      _more_
    • canStretch

      public boolean canStretch()
      _more_
      Returns:
      _more_
    • boundsChanged

      public void boundsChanged()
      Hook for when the size or position of this glyph is changed
    • setPoints

      public void setPoints(int[] p, int cnt)
      Hook for setting points from the attribute line
      Parameters:
      p -
      cnt -
    • setForeground

      public void setForeground(Color c)
      _more_
      Parameters:
      c -
    • getForeground

      public Color getForeground()
      _more_
      Returns:
      _more_
    • setBackground

      public void setBackground(Color c)
      _more_
      Parameters:
      c -
    • getBackground

      public Color getBackground()
      _more_
      Returns:
      _more_
    • getBackground

      public Color getBackground(Color dflt)
      _more_
      Parameters:
      dflt -
      Returns:
      _more_
    • setLineWidth

      public void setLineWidth(int value)
      _more_
      Parameters:
      value -
    • getLineWidth

      public int getLineWidth()
      _more_
      Returns:
      _more_
    • setFilled

      public void setFilled(boolean c)
      _more_
      Parameters:
      c -
    • getFilled

      public boolean getFilled()
      _more_
      Returns:
      _more_
    • processAttrs

      public void processAttrs(String s)
      A Glyph can write out a persistent copy of itself as a set of attribute/value pairs. This method parses the line of attr/values of the form: ATTR=VALUE;ATTR=VALUE;
      Parameters:
      s -
    • setAttr

      public void setAttr(String name, String value)
      set my named atttribute to value
      Parameters:
      name -
      value -
    • getXml

      public String getXml()
      Return the string used to recreate me
      Returns:
      _more_
    • makeAttr

      public String makeAttr(String name, String value)
      _more_
      Parameters:
      name -
      value -
      Returns:
      _more_
    • getAttrs

      public String getAttrs()
      _more_
      Returns:
      _more_
    • paint

      public void paint(Graphics g, DisplayCanvas c)
      _more_
      Parameters:
      g -
      c -
    • paintSelection

      public void paintSelection(Graphics g, DisplayCanvas c)
      By default paint little black rectangles at the corners and the sides
      Parameters:
      g -
      c -
    • paintHighlight

      public void paintHighlight(Graphics g, DisplayCanvas c)
      _more_
      Parameters:
      g -
      c -
    • distance

      public abstract double distance(int x, int y)
      _more_
      Parameters:
      x -
      y -
      Returns:
      _more_
    • moveBy

      public abstract void moveBy(int x, int y)
      _more_
      Parameters:
      x -
      y -
    • moveTo

      public abstract void moveTo(int x, int y)
      _more_
      Parameters:
      x -
      y -
    • getBounds

      public abstract Rectangle getBounds()
      _more_
      Returns:
      _more_
    • getRepaintBounds

      public Rectangle getRepaintBounds()
      _more_
      Returns:
      _more_
    • getStretchPoint

      public String getStretchPoint(int x, int y)
      _more_
      Parameters:
      x -
      y -
      Returns:
      _more_
    • stretchTo

      public String stretchTo(int x, int y, String pt, boolean correct)
      _more_
      Parameters:
      x -
      y -
      pt -
      correct -
      Returns:
      _more_
    • distance

      public static double distance(int x1, int y1, int x2, int y2)
      Utility method for distance between two points
      Parameters:
      x1 -
      y1 -
      x2 -
      y2 -
      Returns:
      _more_
    • transformOutputX

      public int transformOutputX(DisplayCanvas canvas, int x)
      _more_
      Parameters:
      canvas -
      x -
      Returns:
      _more_
    • transformOutputY

      public int transformOutputY(DisplayCanvas canvas, int x)
      _more_
      Parameters:
      canvas -
      x -
      Returns:
      _more_
    • transformOutput

      public Rectangle transformOutput(DisplayCanvas canvas, Rectangle r)
      _more_
      Parameters:
      canvas -
      r -
      Returns:
      _more_
    • transformOutput

      public Point transformOutput(DisplayCanvas canvas, Point r)
      _more_
      Parameters:
      canvas -
      r -
      Returns:
      _more_