Package geomss.geom
Class ModelNote
- java.lang.Object
-
- geomss.geom.AbstractGeomElement<T>
-
- geomss.geom.AbstractNote<GenModelNote>
-
- geomss.geom.GenModelNote
-
- geomss.geom.ModelNote
-
- All Implemented Interfaces:
GeomElement<GenModelNote>
,Transformable<GenModelNote>
,java.io.Serializable
,java.lang.Cloneable
,java.lang.Comparable
,javolution.lang.Immutable
,javolution.lang.Reusable
,javolution.lang.ValueType
,javolution.xml.XMLSerializable
public final class ModelNote extends GenModelNote implements javolution.lang.ValueType
Represents a textual note located at a point in model space with a specified size and orientation in model space.Modified by: Joseph A. Huwaldt
- Version:
- February 17, 2015
- Author:
- Joseph A. Huwaldt, Date: February 10, 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 ModelNote
changeFont(java.awt.Font font)
Return a new note object identical to this one, but with the specified font.ModelNote
changeHeight(Parameter<javax.measure.quantity.Length> height)
Return a new note object identical to this one, but with the specified height in model space.ModelNote
changeLocation(GeomPoint location)
Return a new note object identical to this one, but with the specified location in model space.ModelNote
copy()
Returns a copy of this ModelNote instanceallocated
by the calling thread (possibly on the stack).ModelNote
copyToReal()
Return a copy of this object with any transformations or subranges removed (applied).boolean
equals(java.lang.Object obj)
Compares this ModelNote against the specified object for strict equality (same values and same units).java.awt.Font
getFont()
Return the font used to display this note.Parameter<javax.measure.quantity.Length>
getHeight()
Return the height of the text box in model units.Point
getLocation()
Return the location of this note in 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 height and location are stored.Vector<javax.measure.quantity.Dimensionless>
getXHat()
Return the vector indicating the horizontal axis direction for the text.Vector<javax.measure.quantity.Dimensionless>
getYHat()
Return the vector indicating the vertical axis direction (or ascent direction) for the text.int
hashCode()
Returns the hash code for this ModelNote object.ModelNote
immutable()
Return an immutable version of this note.boolean
isValid()
Returntrue
if this ModelNote contains valid and finite numerical components.ModelNote
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.ModelNote
toDimension(int newDim)
Return the equivalent of this note converted to the specified number of physical dimensions.static ModelNote
valueOf(ModelNote note)
Returns a new ModelNote instance that is identical to the specified ModelNote.static ModelNote
valueOf(java.lang.CharSequence text, GeomPoint location, Parameter<javax.measure.quantity.Length> height)
Construct and return a new instance of a ModelNote that uses the specified text string, the default display font at the specified size, and is located parallel to the the XY plane with the xhat in the X-axis direction, yhat in the Y-axis direction.static ModelNote
valueOf(java.lang.CharSequence text, GeomVector<javax.measure.quantity.Dimensionless> xhat, GeomVector<javax.measure.quantity.Dimensionless> yhat, GeomPoint location, Parameter<javax.measure.quantity.Length> height)
Construct and return a new instance of a ModelNote that uses the specified text string, the default display font at the specified size, and is located at the location and orientation in space specified by the input plane.static ModelNote
valueOf(java.lang.CharSequence text, GeomVector<javax.measure.quantity.Dimensionless> xhat, GeomVector<javax.measure.quantity.Dimensionless> yhat, GeomPoint location, java.awt.Font font, Parameter<javax.measure.quantity.Length> height)
Construct and return a new instance of a ModelNote that uses the specified text string, the specified display font, is located at the location and orientation in space specified by the input vectors, and has the specified height in model units.static ModelNote
valueOf(java.lang.CharSequence text, Rotation orientation, GeomPoint location, Parameter<javax.measure.quantity.Length> height)
Construct and return a new instance of a ModelNote that uses the specified text string, the default display font at the specified size, and is located at the specified location with the text plane oriented using the specified orientation rotation.-
Methods inherited from class geomss.geom.GenModelNote
getBoundsMax, getBoundsMin, getLimitPoint, getNormal, getOrientation, getTransformed, getWidth, 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 ModelNote valueOf(java.lang.CharSequence text, GeomVector<javax.measure.quantity.Dimensionless> xhat, GeomVector<javax.measure.quantity.Dimensionless> yhat, GeomPoint location, java.awt.Font font, Parameter<javax.measure.quantity.Length> height)
Construct and return a new instance of a ModelNote that uses the specified text string, the specified display font, is located at the location and orientation in space specified by the input vectors, and has the specified height in model units.- Parameters:
text
- The text to be displayed in this geometry object. May not be null.xhat
- The vector indicating the direction that left-to-right text flows in space. May not be null.yhat
- The vector, orthogonal to xhat, indicating the vertical direction (or ascent) of the text. 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.height
- The height of the text box in model units. May not be null.- Returns:
- A new ModelNote using the specified inputs.
-
valueOf
public static ModelNote valueOf(java.lang.CharSequence text, GeomVector<javax.measure.quantity.Dimensionless> xhat, GeomVector<javax.measure.quantity.Dimensionless> yhat, GeomPoint location, Parameter<javax.measure.quantity.Length> height)
Construct and return a new instance of a ModelNote that uses the specified text string, the default display font at the specified size, and is located at the location and orientation in space specified by the input plane.- Parameters:
text
- The text to be displayed in this geometry object. May not be null.xhat
- The vector indicating the direction that left-to-right text flows in space. May not be null.yhat
- The vector, orthogonal to xhat, indicating the vertical direction (or ascent) of the text. May not be null.location
- The location of this geometry object in model space. May not be null.height
- The height of the text box in model units. May not be null.- Returns:
- A new ModelNote using the specified inputs.
-
valueOf
public static ModelNote valueOf(java.lang.CharSequence text, GeomPoint location, Parameter<javax.measure.quantity.Length> height)
Construct and return a new instance of a ModelNote that uses the specified text string, the default display font at the specified size, and is located parallel to the the XY plane with the xhat in the X-axis direction, yhat in the Y-axis direction.- 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.height
- The height of the text box in model units. May not be null.- Returns:
- A new ModelNote using the specified inputs.
-
valueOf
public static ModelNote valueOf(java.lang.CharSequence text, Rotation orientation, GeomPoint location, Parameter<javax.measure.quantity.Length> height)
Construct and return a new instance of a ModelNote that uses the specified text string, the default display font at the specified size, and is located at the specified location with the text plane oriented using the specified orientation rotation.- Parameters:
text
- The text to be displayed in this geometry object. May not be null.orientation
- The orientation of the text relative to X,Y & Z 3D space axes. May not be null.location
- The location of this geometry object in model space. The physical dimension must be ≤ 3. If it is less than 3, it will be increased to 3. If > 3, an exception is thrown. May not be null.height
- The height of the text box in model units. May not be null.- Returns:
- A new ModelNote using the specified inputs.
- Throws:
java.lang.IllegalArgumentException
- if the physical dimension of the input location point is greater than 3.
-
valueOf
public static ModelNote valueOf(ModelNote note)
Returns a new ModelNote instance that is identical to the specified ModelNote.- Parameters:
note
- the ModelNote to be copied into a new ModelNote. May not be null.- Returns:
- A new ModelNote identical to the input note (a copy or clone).
-
getNote
public java.lang.String getNote()
Return the text string associated with this note object.- Specified by:
getNote
in classAbstractNote<GenModelNote>
- Returns:
- The text string associated with this note object.
-
getXHat
public Vector<javax.measure.quantity.Dimensionless> getXHat()
Return the vector indicating the horizontal axis direction for the text.- Specified by:
getXHat
in classGenModelNote
- Returns:
- The vector indicating the horizontal axis direction for the text.
-
getYHat
public Vector<javax.measure.quantity.Dimensionless> getYHat()
Return the vector indicating the vertical axis direction (or ascent direction) for the text.- Specified by:
getYHat
in classGenModelNote
- Returns:
- The vector indicating the vertical axis direction (or ascent direction) for the text.
-
getLocation
public Point getLocation()
Return the location of this note in space.- Specified by:
getLocation
in classAbstractNote<GenModelNote>
- Returns:
- The location of this note in space.
-
getHeight
public Parameter<javax.measure.quantity.Length> getHeight()
Return the height of the text box in model units.- Specified by:
getHeight
in classGenModelNote
- Returns:
- The height of the text box in model units.
-
getFont
public java.awt.Font getFont()
Return the font used to display this note.- Specified by:
getFont
in classAbstractNote<GenModelNote>
- Returns:
- The font used to display this note.
-
immutable
public ModelNote immutable()
Return an immutable version of this note.- Specified by:
immutable
in classGenModelNote
- Returns:
- An immutable version of this note.
-
changeFont
public ModelNote changeFont(java.awt.Font font)
Return a new note object identical to this one, but with the specified font.- Specified by:
changeFont
in classAbstractNote<GenModelNote>
- Parameters:
font
- The font for the new copy of this note. May not be null.- Returns:
- A new note object identical to this one, but with the specified font.
-
changeLocation
public ModelNote changeLocation(GeomPoint location)
Return a new note object identical to this one, but with the specified location in model space. The returned note will have a different physical dimension from this one if the input location has a different physical dimension from the original location.- Specified by:
changeLocation
in classAbstractNote<GenModelNote>
- Parameters:
location
- The location for the new copy of this note. May note be null.- Returns:
- A new note object identical to this one, but with the specified location in model space.
-
changeHeight
public ModelNote changeHeight(Parameter<javax.measure.quantity.Length> height)
Return a new note object identical to this one, but with the specified height in model space.- Specified by:
changeHeight
in classGenModelNote
- Parameters:
height
- The height of the new copy of this note. May note be null.- Returns:
- A new note object identical to this one, but with the specified height 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 plane indicating the location and orientation of the note in space.- Specified by:
getPhyDimension
in interfaceGeomElement<GenModelNote>
- Returns:
- The number of physical dimensions of the geometry element.
-
isValid
public boolean isValid()
Returntrue
if this ModelNote 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<GenModelNote>
- Returns:
- true if this ModelNote contains valid and finite numerical components.
-
copy
public ModelNote copy()
Returns a copy of this ModelNote instanceallocated
by the calling thread (possibly on the stack).- Specified by:
copy
in interfaceGeomElement<GenModelNote>
- Specified by:
copy
in interfacejavolution.lang.ValueType
- Returns:
- an identical and independent copy of this note.
-
copyToReal
public ModelNote copyToReal()
Return a copy of this object with any transformations or subranges removed (applied).- Specified by:
copyToReal
in interfaceGeomElement<GenModelNote>
- 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 height and location are stored.- Specified by:
getUnit
in interfaceGeomElement<GenModelNote>
- Returns:
- The unit in which the note height and location are stored.
-
to
public ModelNote 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<GenModelNote>
- 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 ModelNote 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<GenModelNote>
- 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 ModelNote against the specified object for strict equality (same values and same units).- Overrides:
equals
in classAbstractGeomElement<GenModelNote>
- 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 ModelNote object.- Overrides:
hashCode
in classAbstractGeomElement<GenModelNote>
- Returns:
- the hash code value.
-
-