Class DefaultRulerModel

  • All Implemented Interfaces:
    RulerModel

    public final class DefaultRulerModel
    extends java.lang.Object
    implements RulerModel
    Default ruler model.
    Author:
    Pierre Lando
    • Constructor Detail

      • DefaultRulerModel

        public DefaultRulerModel()
        Default constructor.
    • Method Detail

      • getFirstValue

        public double getFirstValue()
        Description copied from interface: RulerModel
        First value getter.
        Specified by:
        getFirstValue in interface RulerModel
        Returns:
        the first values.
      • setFirstValue

        public void setFirstValue​(double firstValue)
        First value setter.
        Parameters:
        firstValue - the new first value.
      • getSecondValue

        public double getSecondValue()
        Description copied from interface: RulerModel
        Second value getter.
        Specified by:
        getSecondValue in interface RulerModel
        Returns:
        the second values.
      • setSecondValue

        public void setSecondValue​(double secondValue)
        Second value setter.
        Parameters:
        secondValue - the new second value.
      • setValues

        public void setValues​(double firstValue,
                              double secondValue)
        Set the first and second value in one call.
        Parameters:
        firstValue - the first value.
        secondValue - the second value.
      • setFirstPoint

        public void setFirstPoint​(Vector3d firstPoint)
        First point setter.
        Parameters:
        firstPoint - the new first point.
      • setSecondPoint

        public void setSecondPoint​(Vector3d secondPoint)
        Second point setter.
        Parameters:
        secondPoint - the new second point.
      • setPoints

        public void setPoints​(Vector3d firstPoint,
                              Vector3d secondPoint)
        Point setter.
        Parameters:
        firstPoint - the new first point.
        secondPoint - the new second point.
      • setTicksDirection

        public void setTicksDirection​(Vector3d ticksDirection)
        Ticks direction setter.
        Parameters:
        ticksDirection - the new ticks direction.
      • getTicksLength

        public int getTicksLength()
        Description copied from interface: RulerModel
        Ticks length getter.
        Specified by:
        getTicksLength in interface RulerModel
        Returns:
        the ticks length in pixel.
      • setTicksLength

        public void setTicksLength​(int ticksLength)
        Ticks length setter.
        Parameters:
        ticksLength - the new tick length in pixels.
      • getSubTicksLength

        public int getSubTicksLength()
        Description copied from interface: RulerModel
        Sub-ticks length getter.
        Specified by:
        getSubTicksLength in interface RulerModel
        Returns:
        the sub-ticks length in pixel.
      • setSubTicksLength

        public void setSubTicksLength​(int subTicksLength)
        Sub-ticks length setter.
        Parameters:
        subTicksLength - the new sub-tick length in pixels.
      • getGraduations

        public Graduations getGraduations()
        Description copied from interface: RulerModel
        Return used graduation to draw this ruler.
        Specified by:
        getGraduations in interface RulerModel
        Returns:
        the used graduation to draw this ruler.
      • setUserGraduation

        public void setUserGraduation​(Graduations graduations)
        User graduation setter.
        Parameters:
        graduations - the new user-defined graduations.
      • getPosition

        public Vector3d getPosition​(double value)
        Description copied from interface: RulerModel
        Return the position corresponding to the given value.
        Specified by:
        getPosition in interface RulerModel
        Parameters:
        value - the given value.
        Returns:
        the position corresponding to the given value.
      • getMargin

        public double getMargin()
        Description copied from interface: RulerModel
        Return the accepted margin (in pixel) for label drawing.
        Specified by:
        getMargin in interface RulerModel
        Returns:
        the accepted margin (in pixel) for label drawing.
      • setMargin

        public void setMargin​(double margin)
        Margin setter. The margin is minimal distance accepted between ticks labels.
        Parameters:
        margin - the new margin value.
      • isLineVisible

        public boolean isLineVisible()
        Description copied from interface: RulerModel
        Line visibility getter.
        Specified by:
        isLineVisible in interface RulerModel
        Returns:
        the line visibility status.
      • setLineVisible

        public void setLineVisible​(boolean lineVisible)
        Line visibility setter.
        Parameters:
        lineVisible - the new line visibility status.
      • isAutoTicks

        public boolean isAutoTicks()
        Description copied from interface: RulerModel
        Auto-ticking getter.
        Specified by:
        isAutoTicks in interface RulerModel
        Returns:
        the auto-ticking status.
      • setAutoTicks

        public void setAutoTicks​(boolean isAutoTicks)
        Auto-ticks parameter setter. If it set to false, the user defined graduation will be used.
        Parameters:
        isAutoTicks - the new auto-ticks status.
      • isLogarithmic

        public boolean isLogarithmic()
        Description copied from interface: RulerModel
        Logarithmic state getter.
        Specified by:
        isLogarithmic in interface RulerModel
        Returns:
        the logarithmic state
      • setLogarithmic

        public void setLogarithmic​(boolean isLogarithmic)
        Logarithmic or linear setter
        Parameters:
        isLogarithmic - the new logarithmic status.
      • getSpriteDistance

        public int getSpriteDistance()
        Description copied from interface: RulerModel
        Sprite distance getter.
        Specified by:
        getSpriteDistance in interface RulerModel
        Returns:
        the sprite distance (in pixel) between the ruler line and the sprites edges.
      • setSpriteDistance

        public void setSpriteDistance​(int spriteDistance)
        Sprite distance setter.
        Parameters:
        spriteDistance - the new sprite distance to the main ticks in pixel.
      • getMinimalSubTicksDistance

        public double getMinimalSubTicksDistance()
        Description copied from interface: RulerModel
        Minimal accepted sub-ticks distance getter.
        Specified by:
        getMinimalSubTicksDistance in interface RulerModel
        Returns:
        the minimal accepted sub-ticks distance.
      • setMinimalSubTicksDistance

        public void setMinimalSubTicksDistance​(double minimalSubTicksDistance)
        Minimal accepted distance between sub-ticks setter.
        Parameters:
        minimalSubTicksDistance - the new minimal accepted distance between sub-ticks.
      • getColor

        public Color getColor()
        Description copied from interface: RulerModel
        Color getter.
        Specified by:
        getColor in interface RulerModel
        Returns:
        the color of ruler line and ticks.
      • setColor

        public void setColor​(Color color)
        Ruler color setter.
        Parameters:
        color - the new rule color.
      • getLineWidth

        public double getLineWidth()
        Description copied from interface: RulerModel
        Line width getter.
        Specified by:
        getLineWidth in interface RulerModel
        Returns:
        the line width of ruler line, grid and ticks.
      • setLineWidth

        public void setLineWidth​(double lineWidth)
        Ruler line width setter
        Parameters:
        lineWidth - the new line width
      • getSubticksNumber

        public int getSubticksNumber()
        Description copied from interface: RulerModel
        Number of subticks.
        Specified by:
        getSubticksNumber in interface RulerModel
        Returns:
        the number of subticks or -1 if the computation is automatic.
      • setSubticksNumber

        public void setSubticksNumber​(int N)
        Set number of subticks.
        Parameters:
        N - the number of subticks or -1 if the computation is automatic.