Package geomss.geom
Class Note
- java.lang.Object
-
- geomss.geom.AbstractGeomElement<T>
-
- geomss.geom.AbstractNote<GenScreenNote>
-
- geomss.geom.GenScreenNote
-
- geomss.geom.Note
-
- All Implemented Interfaces:
GeomElement<GenScreenNote>
,Transformable<GenScreenNote>
,java.io.Serializable
,java.lang.Cloneable
,java.lang.Comparable
,javolution.lang.Immutable
,javolution.lang.Reusable
,javolution.lang.ValueType
,javolution.xml.XMLSerializable
public final class Note extends GenScreenNote implements javolution.lang.ValueType
Represents a textual note located at a point in model space with a fixed size and orientation on the screen.Modified by: Joseph A. Huwaldt
- Version:
- November 26, 2015
- Author:
- Joseph A. Huwaldt, Date: February 5, 2014
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class geomss.geom.AbstractNote
DEFAULT_FONT
-
Fields inherited from class geomss.geom.AbstractGeomElement
RESOURCES
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Note
changeFont(java.awt.Font font)
Return a new note object identical to this one, but with the specified font.Note
changeLocation(GeomPoint location)
Return a new note object identical to this one, but with the specified location in model space.Note
copy()
Returns a copy of this Note instanceallocated
by the calling thread (possibly on the stack).Note
copyToReal()
Return a copy of this object with any transformations or subranges removed (applied).boolean
equals(java.lang.Object obj)
Compares this Note against the specified object for strict equality (same values and same units).java.awt.Font
getFont()
Return the font used to display this note.Point
getLocation()
Return the location of this note in model space.java.lang.String
getNote()
Return the text string associated with this note object.int
getPhyDimension()
Returns the number of physical dimensions of the geometry element.javax.measure.unit.Unit<javax.measure.quantity.Length>
getUnit()
Returns the unit in which the note location Point is stored.int
hashCode()
Returns the hash code for this Note object.Note
immutable()
Return an immutable version of this note.boolean
isValid()
Returntrue
if this Note contains valid and finite numerical components.Note
to(javax.measure.unit.Unit<javax.measure.quantity.Length> unit)
Returns the equivalent to this note but with the location stated in the specified unit.Note
toDimension(int newDim)
Return the equivalent of this note converted to the specified number of physical dimensions.static Note
valueOf(Note note)
Returns a new Note instance that is identical to the specified Note.static Note
valueOf(java.lang.CharSequence text, GeomPoint location)
Construct and return a new instance of a Note that uses the specified text string, the default display font, and is located at the specified location in space.static Note
valueOf(java.lang.CharSequence text, GeomPoint location, int fontPoints)
Construct and return a new instance of a Note that uses the specified text string, the default display font at the specified size, and is located at the specified location in space.static Note
valueOf(java.lang.CharSequence text, GeomPoint location, java.awt.Font font)
Construct and return a new instance of a Note that uses the specified text string, the specified display font, and is located at the specified location in space.-
Methods inherited from class geomss.geom.GenScreenNote
getBoundsMax, getBoundsMin, getLimitPoint, getTransformed, size, toText
-
Methods inherited from class geomss.geom.AbstractNote
getParDimension, length
-
Methods inherited from class geomss.geom.AbstractGeomElement
addChangeListener, clone, compareTo, getAllUserData, getID, getName, getUserData, putAllUserData, putUserData, removeChangeListener, removeUserData, reset, setName, toString
-
Methods inherited from interface geomss.geom.GeomElement
addChangeListener, getAllUserData, getID, getName, getParDimension, getUserData, putAllUserData, putUserData, removeChangeListener, removeUserData, setName
-
-
-
-
Method Detail
-
valueOf
public static Note valueOf(java.lang.CharSequence text, GeomPoint location, java.awt.Font font)
Construct and return a new instance of a Note that uses the specified text string, the specified display font, and is located at the specified location in space.- Parameters:
text
- The text to be displayed in this geometry object. May not be null.location
- The location of this geometry object in model space. May not be null.font
- The font used to display this note. May not be null.- Returns:
- A new Note using the specified inputs.
-
valueOf
public static Note valueOf(java.lang.CharSequence text, GeomPoint location, int fontPoints)
Construct and return a new instance of a Note that uses the specified text string, the default display font at the specified size, and is located at the specified location in space.- Parameters:
text
- The text to be displayed in this geometry object. May not be null.location
- The location of this geometry object in model space. May not be null.fontPoints
- The size of the default font in pixels.- Returns:
- A new Note using the specified inputs.
-
valueOf
public static Note valueOf(java.lang.CharSequence text, GeomPoint location)
Construct and return a new instance of a Note that uses the specified text string, the default display font, and is located at the specified location in space.- Parameters:
text
- The text to be displayed in this geometry object. May not be null.location
- The location of this geometry object in model space. May not be null.- Returns:
- A new Note using the specified inputs.
-
valueOf
public static Note valueOf(Note note)
Returns a new Note instance that is identical to the specified Note.- Parameters:
note
- the Note to be copied into a new Note. May not be null.- Returns:
- A new not identical to the input note.
-
getNote
public java.lang.String getNote()
Return the text string associated with this note object.- Specified by:
getNote
in classAbstractNote<GenScreenNote>
- Returns:
- The text string associated with this note object.
-
getLocation
public Point getLocation()
Return the location of this note in model space.- Specified by:
getLocation
in classAbstractNote<GenScreenNote>
- Returns:
- The location of this note in model space.
-
getFont
public java.awt.Font getFont()
Return the font used to display this note.- Specified by:
getFont
in classAbstractNote<GenScreenNote>
- Returns:
- The font used to display this note.
-
immutable
public Note immutable()
Return an immutable version of this note.- Specified by:
immutable
in classGenScreenNote
- Returns:
- An immutable version of this note.
-
changeFont
public Note changeFont(java.awt.Font font)
Return a new note object identical to this one, but with the specified font.- Specified by:
changeFont
in classAbstractNote<GenScreenNote>
- Parameters:
font
- The font to use in the copy of this note returned. May not be null.- Returns:
- A new note object identical to this one, but with the specified font.
-
changeLocation
public Note changeLocation(GeomPoint location)
Return a new note object identical to this one, but with the specified location in model space.- Specified by:
changeLocation
in classAbstractNote<GenScreenNote>
- Parameters:
location
- The location for the copy of this note returned. May not be null.- Returns:
- A new note object identical to this one, but with the specified location in model space.
-
getPhyDimension
public int getPhyDimension()
Returns the number of physical dimensions of the geometry element. This implementation will return the physical dimensions of the point indicating the location of the note in space.- Specified by:
getPhyDimension
in interfaceGeomElement<GenScreenNote>
- Returns:
- The number of physical dimensions of the geometry element.
-
isValid
public boolean isValid()
Returntrue
if this Note contains valid and finite numerical components. A value offalse
will be returned if any of the location coordinate values are NaN or Inf.- Specified by:
isValid
in interfaceGeomElement<GenScreenNote>
- Returns:
- true if this Note contains valid and finite numerical components.
-
copy
public Note copy()
Returns a copy of this Note instanceallocated
by the calling thread (possibly on the stack).- Specified by:
copy
in interfaceGeomElement<GenScreenNote>
- Specified by:
copy
in interfacejavolution.lang.ValueType
- Returns:
- an identical and independent copy of this note.
-
copyToReal
public Note copyToReal()
Return a copy of this object with any transformations or subranges removed (applied).- Specified by:
copyToReal
in interfaceGeomElement<GenScreenNote>
- Returns:
- A copy of this object with any transformations or subranges removed.
-
getUnit
public final javax.measure.unit.Unit<javax.measure.quantity.Length> getUnit()
Returns the unit in which the note location Point is stored.- Specified by:
getUnit
in interfaceGeomElement<GenScreenNote>
- Returns:
- The unit in which the note location Point is stored.
-
to
public Note to(javax.measure.unit.Unit<javax.measure.quantity.Length> unit) throws javax.measure.converter.ConversionException
Returns the equivalent to this note but with the location stated in the specified unit.- Specified by:
to
in interfaceGeomElement<GenScreenNote>
- Parameters:
unit
- the length unit of the note to be returned. May not be null.- Returns:
- an equivalent of this note but with location stated in the specified unit.
- Throws:
javax.measure.converter.ConversionException
- if the the input unit is not a length unit.
-
toDimension
public Note toDimension(int newDim)
Return the equivalent of this note converted to the specified number of physical dimensions. If the number of dimensions is greater than this element, then zeros are added to the additional dimensions. If the number of dimensions is less than this element, then the extra dimensions are simply dropped (truncated). If the new dimensions are the same as the dimension of this element, then this element is simply returned.- Specified by:
toDimension
in interfaceGeomElement<GenScreenNote>
- Parameters:
newDim
- The dimension of the note to return.- Returns:
- The equivalent to this note converted to the new dimensions.
-
equals
public boolean equals(java.lang.Object obj)
Compares this Note against the specified object for strict equality (same values and same units).- Overrides:
equals
in classAbstractGeomElement<GenScreenNote>
- Parameters:
obj
- the object to compare with.- Returns:
true
if this note is identical to that note;false
otherwise.
-
hashCode
public int hashCode()
Returns the hash code for this Note object.- Overrides:
hashCode
in classAbstractGeomElement<GenScreenNote>
- Returns:
- the hash code value.
-
-