Package org.jxmapviewer.util
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.ShapegeneratePolygon(int sides, int outsideRadius, boolean normalize)Generates a polygon with an inside radius of 0.static java.awt.ShapegeneratePolygon(int sides, int outsideRadius, int insideRadius)Generates a polygonstatic java.awt.ShapegeneratePolygon(int sides, int outsideRadius, int insideRadius, boolean normalize)Generates a polygonstatic java.awt.ShapegenerateShapeFromText(java.awt.Font font, char ch)static java.awt.ShapegenerateShapeFromText(java.awt.Font font, java.lang.String string)static java.awt.ShapemergeClip(java.awt.Graphics g, java.awt.Shape clip)Sets the clip on a graphics object by merging a supplied clip with the existing one.
-
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 sidesoutsideRadius- the outside radiusnormalize- 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 sidesoutsideRadius- the outside radiusinsideRadius- the inside radiusnormalize- 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 sidesoutsideRadius- the outside radiusinsideRadius- the inside radius- Returns:
- the generated shape
-
generateShapeFromText
public static java.awt.Shape generateShapeFromText(java.awt.Font font, char ch)- Parameters:
font- the fontch- a single character- Returns:
- the shape
-
generateShapeFromText
public static java.awt.Shape generateShapeFromText(java.awt.Font font, java.lang.String string)- Parameters:
font- the fontstring- 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 updateclip- a new clipping region to add to the graphics clip.- Returns:
- the current clipping region of the supplied graphics object. This may return
nullif the current clip isnull. - Throws:
java.lang.NullPointerException- if any parameter isnull
-