public class MeasureUnit
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static MeasureUnit |
Centimeter |
static MeasureUnit |
Document
Specifies document units (1/300 inch) as the unit of measure.
|
static MeasureUnit |
Inch
Specifies inches as the unit of measure.
|
static MeasureUnit |
Millimeter
Specifies millimeters as the unit of measure.
|
static MeasureUnit |
Percent
Specifies percents as the unit of measure.
|
static MeasureUnit |
Pixel
Specifies device pixels as the unit of measure.
|
static MeasureUnit |
Point
Specifies printer's points (1/72 inch) as the unit of measure.
|
static MeasureUnit |
WpfPoint
Specifies device-independent pixels (1/96 inch) as the unit of measure.
|
| Constructor and Description |
|---|
MeasureUnit(java.lang.String name,
double unitsPerInch)
Initializes a new instance of the
MeasureUnit class with
the specified amount. |
MeasureUnit(java.lang.String name,
double unitsPerInch,
int standardDivisions)
Initializes a new instance of the
MeasureUnit class with
the specified amount. |
MeasureUnit(java.lang.String name,
MeasureUnit baseUnit,
double scale)
Initializes a new instance of the
MeasureUnit class with
the specified unit of measure as a base. |
MeasureUnit(java.lang.String name,
MeasureUnit baseUnit,
double scale,
int standardDivisions)
Initializes a new instance of the
MeasureUnit class with
the specified unit of measure as a base. |
| Modifier and Type | Method and Description |
|---|---|
double |
convert(double value,
MeasureUnit targetUnit,
DiagramView view)
Converts the specified value from this unit to the specified unit.
|
java.awt.geom.Point2D |
convert(java.awt.geom.Point2D p,
MeasureUnit targetUnit,
DiagramView view)
Converts the specified point from this unit to the specified unit.
|
java.awt.geom.Rectangle2D |
convert(java.awt.geom.Rectangle2D r,
MeasureUnit targetUnit,
DiagramView view)
Converts the specified rectangle from this unit to the specified unit.
|
boolean |
equals(java.lang.Object obj)
Object.equals(java.lang.Object) override. |
static MeasureUnit |
fromGraphicsUnit(GraphicsUnit unit)
Returns the measure unit corresponding to the specified graphics unit.
|
static MeasureUnit |
fromId(GraphicsUnit id)
Returns a
MeasureUnit from its integer identifier. |
static MeasureUnit |
fromId(int id) |
double |
getAmount()
Gets the unit's amount.
|
int |
getId()
Gets the unit identifier.
|
java.lang.String |
getName()
Gets the name of the unit.
|
int |
hashCode()
Object.hashCode() override. |
static boolean |
op_Equality(MeasureUnit a,
MeasureUnit b)
Compares two
MeasureUnit objects for equality. |
static boolean |
op_Inequality(MeasureUnit a,
MeasureUnit b)
Compares two
MeasureUnit objects for inequality. |
java.lang.String |
toString()
Object.toString() override. |
public static final MeasureUnit Centimeter
public static final MeasureUnit Millimeter
public static final MeasureUnit Inch
public static final MeasureUnit Point
public static final MeasureUnit Pixel
public static final MeasureUnit Document
public static final MeasureUnit WpfPoint
public static final MeasureUnit Percent
public MeasureUnit(java.lang.String name,
MeasureUnit baseUnit,
double scale)
MeasureUnit class with
the specified unit of measure as a base.name - The name of the new unit.baseUnit - The base of the new unit.scale - The scale of the new unit, relatively to the base.public MeasureUnit(java.lang.String name,
MeasureUnit baseUnit,
double scale,
int standardDivisions)
MeasureUnit class with
the specified unit of measure as a base.name - The name of the new unit.baseUnit - The base of the new unit.scale - The scale of the new unit, relatively to the base.standardDivisions - The number of divisions of the new unit.public MeasureUnit(java.lang.String name,
double unitsPerInch)
MeasureUnit class with
the specified amount.name - The name of the new unit.unitsPerInch - The amount of the new unit that is equal to one inch.public MeasureUnit(java.lang.String name,
double unitsPerInch,
int standardDivisions)
MeasureUnit class with
the specified amount.name - The name of the new unit.unitsPerInch - The amount of the new unit that is equal to one inch.standardDivisions - The number of divisions of the new unit.public java.lang.String toString()
Object.toString() override.toString in class java.lang.Objectpublic int hashCode()
Object.hashCode() override.hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
Object.equals(java.lang.Object) override.equals in class java.lang.Objectobj - The object to compare with the current unit.true if the specified object is the same as or
is equal to the current unit; otherwise, false.public static boolean op_Equality(MeasureUnit a, MeasureUnit b)
MeasureUnit objects for equality.a - The first MeasureUnit to compare.b - The second MeasureUnit to compare.true if the specified arguments are equal; otherwise, false.public static boolean op_Inequality(MeasureUnit a, MeasureUnit b)
MeasureUnit objects for inequality.a - The first MeasureUnit to compare.b - The second MeasureUnit to compare.true if the specified arguments are not equal; otherwise, false.public double convert(double value,
MeasureUnit targetUnit,
DiagramView view)
value - The value to convert, expressed in the current measure unit.targetUnit - The target measure unit.view - A parameter that is used when converting to special units
(such as percents).public java.awt.geom.Point2D convert(java.awt.geom.Point2D p,
MeasureUnit targetUnit,
DiagramView view)
p - The point to convert, expressed in the current measure unit.targetUnit - The target measure unit.view - A parameter that is used when converting to special units
(such as percents).public java.awt.geom.Rectangle2D convert(java.awt.geom.Rectangle2D r,
MeasureUnit targetUnit,
DiagramView view)
r - The rectangle to convert, expressed in the current measure unit.targetUnit - The target measure unit.view - A parameter that is used when converting to special units
(such as percents).public static MeasureUnit fromId(GraphicsUnit id)
MeasureUnit from its integer identifier.id - The identifier of one of the built-in measure units.MeasureUnit corresponding to the specified identifier.public static MeasureUnit fromId(int id)
public static MeasureUnit fromGraphicsUnit(GraphicsUnit unit)
unit - One of the GraphicsUnit values.MeasureUnit corresponding to the specified
graphics unit. If unit is World, this method
returns null. If unit is Display,
this method returns Pixel.public int getId()
This property returns -1 for custom MeasureUnit objects.
public java.lang.String getName()
public double getAmount()