Class SpatialUnit

java.lang.Object
mgui.util.Unit
mgui.util.ScaledUnit
mgui.geometry.util.SpatialUnit
All Implemented Interfaces:
java.lang.Comparable<Unit>

public class SpatialUnit
extends ScaledUnit
Specifies a spatial unit, with respect to the default Java3D unit (meter). All subclasses must implement the convert method from the Unit interface. SpatialUnit specifies no setter functions; the unit should be set from the constructor and not changed.
Since:
1.0
Version:
1.0
Author:
Andrew Reid
  • Field Summary

    Fields inherited from class mgui.util.ScaledUnit

    conversion_factor, name, short_name
  • Constructor Summary

    Constructors
    Constructor Description
    SpatialUnit​(java.lang.String long_name, java.lang.String short_name, double factor)  
  • Method Summary

    Modifier and Type Method Description
    double convert​(Unit unit, double value)
    Converts value, specified with unit, to its equivalent in this Unit.

    Methods inherited from class mgui.util.ScaledUnit

    getConversionToMeter, getName, getShortName

    Methods inherited from class mgui.util.Unit

    compareTo, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • SpatialUnit

      public SpatialUnit​(java.lang.String long_name, java.lang.String short_name, double factor)
  • Method Details

    • convert

      public double convert​(Unit unit, double value) throws UnitConversionException
      Converts value, specified with unit, to its equivalent in this Unit.
      Overrides:
      convert in class ScaledUnit
      Parameters:
      unit - the unit in which value is currently specified
      value - the value to convert
      Returns:
      the equivalent of value in this unit
      Throws:
      UnitConversionException