Package geomss.geom

Class 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
    • 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 class AbstractNote<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 class GenModelNote
        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 class GenModelNote
        Returns:
        The vector indicating the vertical axis direction (or ascent direction) for the text.
      • getHeight

        public Parameter<javax.measure.quantity.Length> getHeight()
        Return the height of the text box in model units.
        Specified by:
        getHeight in class GenModelNote
        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 class AbstractNote<GenModelNote>
        Returns:
        The font used to display 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 class AbstractNote<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 class AbstractNote<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 class GenModelNote
        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 interface GeomElement<GenModelNote>
        Returns:
        The number of physical dimensions of the geometry element.
      • isValid

        public boolean isValid()
        Return true if this ModelNote contains valid and finite numerical components. A value of false will be returned if any of the location coordinate values are NaN or Inf.
        Specified by:
        isValid in interface GeomElement<GenModelNote>
        Returns:
        true if this ModelNote contains valid and finite numerical components.
      • copy

        public ModelNote copy()
        Returns a copy of this ModelNote instance allocated by the calling thread (possibly on the stack).
        Specified by:
        copy in interface GeomElement<GenModelNote>
        Specified by:
        copy in interface javolution.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 interface GeomElement<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 interface GeomElement<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 interface GeomElement<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 interface GeomElement<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 class AbstractGeomElement<GenModelNote>
        Parameters:
        obj - the object to compare with.
        Returns:
        true if this note is identical to that note; false otherwise.