Class AbstractParticleObject

    • Constructor Detail

      • AbstractParticleObject

        protected AbstractParticleObject()
        Default.
    • Method Detail

      • isPaintArrow

        public boolean isPaintArrow()
        Determines whether the arrow property of this particle object is set or not.
        Returns:
        The arrow property of this particle object.
      • setPaintArrow

        public void setPaintArrow​(boolean arr)
        Sets the arrow property of this particle object.
        Parameters:
        arr - The arrow property of this particle object.
      • isFlip

        public boolean isFlip()
        Returns the flip property of this particle object.
        Returns:
        The flip property of this particle object.
      • setFlip

        public void setFlip​(boolean newFlip)
        Sets the flip property of this particle object.
        Parameters:
        newFlip - The flip property of this particle object.
      • getArrowPosition

        public float getArrowPosition()
        Returns the arrowPosition property of this particle object.
        Returns:
        The arrowPosition property of this particle object.
      • setArrowPosition

        public void setArrowPosition​(float newArrowPosition)
        Sets the arrowPosition property of this particle object. Throws IllegalArgumentException if the parameter is not between 0 and 1.
        Parameters:
        newArrowPosition - The new arrowPosition property measured as a float number between 0 and 1.
      • getArrowCount

        public int getArrowCount()
        The number of arrows in this particle object.
        Returns:
        defaults to 1.
      • setArrowCount

        public void setArrowCount​(int newArrowCount)
        Set the number of arrows in this particle object.
        Parameters:
        newArrowCount - a positive number.
      • setDoubleLine

        public void setDoubleLine​(boolean dline)
        Sets the double line property.
        Parameters:
        dline - The double line boolean variable.
      • isDoubleLine

        public boolean isDoubleLine()
        Returns the double line property.
        Returns:
        The double line boolean variable of this object.
      • setDLSeparation

        public void setDLSeparation​(float dlsep)
        Sets the double line separation property.
        Parameters:
        dlsep - The double line separation to be set.
      • getDLSeparation

        public float getDLSeparation()
        Returns the double line separation of this object.
        Returns:
        The double line separation.
      • getArrow

        public JaxoArrow getArrow()
        Returns the arrow of this particle object.
        Returns:
        The arrow of this particle object.
      • setArrow

        public void setArrow​(JaxoArrow newArrow)
        Sets the dash property of this particle object.
        Parameters:
        newArrow - The arrow of this particle object.
      • isCopy

        public boolean isCopy​(JaxoObject obj)
        Determines if this JaxoObject is a copy of the specified one.

        Two JaxoObjects are copies of each other if all their editable properties are equal. This method should be synchronized with JaxoObject.copy() such that for any non-null JaxoObject ob, a call like isCopy(ob.copy()) must return true.

        Finally, this method implements an equivalence relation on non-null object references, it should satisfy the same constraints as the Object.equals(java.lang.Object) method.

        Specified by:
        isCopy in interface JaxoObject
        Overrides:
        isCopy in class AbstractExtendedObject
        Parameters:
        obj - The JaxoObject to compare against. May be null in which case false is returned.
        Returns:
        True if this JaxoObject is a copy of the given one, false otherwise.
        See Also:
        JaxoObject.copy()
      • copyFrom

        protected void copyFrom​(AbstractParticleObject temp)
        Sets all parameters from the given object to the current one.
        Parameters:
        temp - The object to copy from.
      • length

        public abstract double length()
        Calculates the length of this particle object.

        The result depends on the number of points this object has.

        Returns:
        The length of this particle object.
      • dlSepIs

        public boolean dlSepIs​(float comp)
        Compares the dlSeparation of this AbstractParticleObject to the given float, taking into account a 0.1% error margin.
        Parameters:
        comp - The float to compare to.
        Returns:
        True, if the dlSeparation matches within 0.1%.
      • arrowPositionIs

        public boolean arrowPositionIs​(float comp)
        Compares the arrowPosition of this AbstractParticleObject to the given float, taking into account a 0.1% error margin.
        Parameters:
        comp - The float to compare to.
        Returns:
        True, if the arrowPosition matches within 0.1%.
      • paintArrow

        protected void paintArrow​(Graphics2D g2)
        Paints an arrow on this object.
        Parameters:
        g2 - The graphics context.
      • arrowBounds

        protected Rectangle arrowBounds()
        Bounding box of arrows.
        Returns:
        the bounding box, or null if arrows are not painted.
      • isPaintable

        public boolean isPaintable()
        Specify whether the object is actually paintable in a specific configuration.

        For some parameter values the object might not be reasonably represented on screen, or produce no visible output, e.g. a text with zero length, a singular arc, or a line with equal end points, etc. Such objects may be removed from a graph.

        Specified by:
        isPaintable in interface JaxoObject
        Overrides:
        isPaintable in class AbstractExtendedObject
        Returns:
        true if the object in the current state is paintable.
      • paint

        public void paint​(Graphics2D g2)
        The method that paints the JaxoObject.
        Parameters:
        g2 - The graphics context where the object has to be painted.
      • getObjectPath

        protected abstract GeneralPath getObjectPath()
        Get the GeneralPath that paints this object.

        This is used for painting and bounding box calculation.

        Returns:
        GeneralPath. May be null for an object that cannot be painted.
      • linepath

        protected GeneralPath linepath()
        Return a Path that is a line from the first Point to the last click Point of this Object.
        Returns:
        a GeneralPath. Not null.
      • arrowCoordinates

        public abstract JaxoArrow.Coordinates arrowCoordinates​(int number)
        Returns the coordinates of the arrow of the current object.
        Parameters:
        number - the number of the arrow to be returned. Has to be between 1 and arrowCount.
        Returns:
        The coordinates of the arrow of the current object.