Class ShapeUtils

java.lang.Object
org.jxmapviewer.util.ShapeUtils

public final class ShapeUtils
extends java.lang.Object
  • Method Summary

    Modifier and Type Method Description
    static java.awt.Shape generatePolygon​(int sides, int outsideRadius, boolean normalize)
    Generates a polygon with an inside radius of 0.
    static java.awt.Shape generatePolygon​(int sides, int outsideRadius, int insideRadius)
    Generates a polygon
    static java.awt.Shape generatePolygon​(int sides, int outsideRadius, int insideRadius, boolean normalize)
    Generates a polygon
    static java.awt.Shape generateShapeFromText​(java.awt.Font font, char ch)  
    static java.awt.Shape generateShapeFromText​(java.awt.Font font, java.lang.String string)  
    static java.awt.Shape mergeClip​(java.awt.Graphics g, java.awt.Shape clip)
    Sets the clip on a graphics object by merging a supplied clip with the existing one.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • generatePolygon

      public static java.awt.Shape generatePolygon​(int sides, int outsideRadius, boolean normalize)
      Generates a polygon with an inside radius of 0.
      Parameters:
      sides - number of sides
      outsideRadius - the outside radius
      normalize - normalize
      Returns:
      the generated shape
    • generatePolygon

      public static java.awt.Shape generatePolygon​(int sides, int outsideRadius, int insideRadius, boolean normalize)
      Generates a polygon
      Parameters:
      sides - number of sides
      outsideRadius - the outside radius
      insideRadius - the inside radius
      normalize - normalize
      Returns:
      the generated shape
    • generatePolygon

      public static java.awt.Shape generatePolygon​(int sides, int outsideRadius, int insideRadius)
      Generates a polygon
      Parameters:
      sides - number of sides
      outsideRadius - the outside radius
      insideRadius - the inside radius
      Returns:
      the generated shape
    • generateShapeFromText

      public static java.awt.Shape generateShapeFromText​(java.awt.Font font, char ch)
      Parameters:
      font - the font
      ch - a single character
      Returns:
      the shape
    • generateShapeFromText

      public static java.awt.Shape generateShapeFromText​(java.awt.Font font, java.lang.String string)
      Parameters:
      font - the font
      string - the text string
      Returns:
      the shape
    • mergeClip

      public static java.awt.Shape mergeClip​(java.awt.Graphics g, java.awt.Shape clip)
      Sets the clip on a graphics object by merging a supplied clip with the existing one. The new clip will be an intersection of the old clip and the supplied clip. The old clip shape will be returned. This is useful for resetting the old clip after an operation is performed.
      Parameters:
      g - the graphics object to update
      clip - a new clipping region to add to the graphics clip.
      Returns:
      the current clipping region of the supplied graphics object. This may return null if the current clip is null.
      Throws:
      java.lang.NullPointerException - if any parameter is null