Package org.cip4.jdflib.datatypes
Class JDFRectangle
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
java.util.Vector<Object>
org.cip4.jdflib.datatypes.JDFNumList
org.cip4.jdflib.datatypes.JDFRectangle
- All Implemented Interfaces:
Serializable,Cloneable,Iterable<Object>,Collection<Object>,List<Object>,RandomAccess,JDFBaseDataTypes
This class represents a rectangle JDFRectangle) consisting of a lower left x value (llx), a lower left y value (lly), an upper right x value (urx) and an upper right y value (ury) all values are
Double types.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.cip4.jdflib.datatypes.JDFNumList
JDFNumList.NormComparator, JDFNumList.VolumeComparatorNested classes/interfaces inherited from interface org.cip4.jdflib.datatypes.JDFBaseDataTypes
JDFBaseDataTypes.EnumFitsValue -
Field Summary
Fields inherited from class java.util.Vector
capacityIncrement, elementCount, elementDataFields inherited from class java.util.AbstractList
modCountFields inherited from interface org.cip4.jdflib.datatypes.JDFBaseDataTypes
EPSILON, MAX_CMYK_COLOR, MAX_LAB_COLOR, MAX_MATRIX_DIMENSION, MAX_RECTANGLE_DIMENSION, MAX_RGB_COLOR, MAX_SHAPE_DIMENSION, MAX_XY_DIMENSION -
Constructor Summary
ConstructorsConstructorDescriptionconstructs a rectangle with all 4 values set to 0.0 DoubleJDFRectangle(double llx, double lly, double urx, double ury) constructs a new JDFRectangle with the given double valuesconstructs a rectangle with all values set via a StringDeprecated.use typesafe constructorsconstructs a rectangle with all values set via a JDFNumberListJDFRectangle(JDFRectangle rec) constructs a rectangle with all values set via a JDFRectangleJDFRectangle(JDFXYPair size) constructs a rectangle with all values set via a JDFRectangleJDFRectangle(JDFXYPair ll, JDFXYPair ur) -
Method Summary
Modifier and TypeMethodDescriptionclone()static JDFRectanglefactory for JDFRectangle that silently returns null in case of illegal stringsdoublegetArea()get the common (intersected area) of this with rdoublegetHeight - returns the height of the rectangle, the difference between upper right y value and lower left y value as an absolute valueget the common (intersected area) of this with rgetLL()doublegetLlx()getLlx - returns the lower left x coordinatedoublegetLly()getLly - returns the lower left y coordinategetSize()getUR()doublegetUrx()getUrx - returns the upper right x coordinatedoublegetUry()getUry - returns the upper right y coordinatedoublegetWidth()getWidth - returns the width of the rectangle, the difference between upper right x value and lower left x value as an absolute valuebooleanisGreater - equality operator >booleanisGreaterOrEqual - equality operator >=booleanisInside - true it the point is inside thisbooleanisLess - equality operator <booleanisLessOrEqual - equality operator <=booleanisValid()isValid - true if the size of the vector is 4 and all instances are Double typesensures the right points e.g after a rotationvoidsetLlx(double x) setLlx - sets the lower left x coordinatevoidsetLlxMm(double mmX) setLlXMm - sets the lower left x coordinate in millimetervoidsetLly(double y) setLly - sets the lower left y coordinatevoidsetLlyMm(double mmY) setLlyMm - sets the lower left y coordinate in millimetervoidsetUrx(double x) setUrx - sets the upper right x coordinatevoidsetUrxMm(double mmX) setUrxMm - sets the upper right x coordinate in millimetervoidsetUry(double y) setUry - sets the upper right y coordinatevoidsetUryMm(double mmY) setUryMm - sets the upper right y coordinate in millimetervoidshift(double tx, double ty) shifts this by the amount specifiedvoidshifts this by the amount specifiedMethods inherited from class org.cip4.jdflib.datatypes.JDFNumList
abs, contains, containsAll, copyNumList, doubleAt, elementAt, equals, getDouble, getDoubleList, getDoubleVector, getIntArray, getString, getString, hashCode, intAt, isValidString, matches, max, min, norm, removeElementAt, replaceElementAt, scale, scale, scaleFromCM, scaleFromCM, scaleFromMM, scaleFromMM, scaleToCM, scaleToCM, scaleToMM, scaleToMM, set, setString, setX, shift, sort, subtract, toString, unify, volumeMethods inherited from class java.util.Vector
add, add, addAll, addAll, addElement, capacity, clear, contains, containsAll, copyInto, elements, ensureCapacity, firstElement, forEach, get, indexOf, indexOf, insertElementAt, isEmpty, iterator, lastElement, lastIndexOf, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeAllElements, removeElement, removeIf, removeRange, replaceAll, retainAll, set, setElementAt, setSize, size, sort, spliterator, subList, toArray, toArray, trimToSizeMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, stream, toArray
-
Constructor Details
-
JDFRectangle
public JDFRectangle()constructs a rectangle with all 4 values set to 0.0 Double -
JDFRectangle
Deprecated.use typesafe constructorsconstructs a rectangle with all values set via a Vector of Double objects- Parameters:
v- the given Vector with MAX_RECTANGLE_DIMENSION objects of type Double- Throws:
DataFormatException- - if the Vector has not a valid format
-
JDFRectangle
constructs a rectangle with all values set via a String- Parameters:
s- the given String, blank separated numbers- Throws:
DataFormatException- - if the String has not a valid format
-
JDFRectangle
constructs a rectangle with all values set via a JDFRectangle- Parameters:
rec- the given rectangle
-
JDFRectangle
constructs a rectangle with all values set via a JDFRectangle- Parameters:
rec- the given rectangle
-
JDFRectangle
constructs a rectangle with all values set via a JDFNumberList- Parameters:
nl- the given number list- Throws:
DataFormatException- - if the JDFNumberList has not a valid format
-
JDFRectangle
public JDFRectangle(double llx, double lly, double urx, double ury) constructs a new JDFRectangle with the given double values- Parameters:
llx- lower left x coordinatelly- lower left y coordinateurx- lower left x coordinateury- lower left y coordinate
-
JDFRectangle
- Parameters:
ll-ur-
-
-
Method Details
-
clone
- Overrides:
clonein classJDFNumList- See Also:
-
createRectangle
factory for JDFRectangle that silently returns null in case of illegal strings- Parameters:
s- the string to parse- Returns:
- the JDFRectangle, null if s is not compatible
-
isValid
isValid - true if the size of the vector is 4 and all instances are Double types- Specified by:
isValidin classJDFNumList- Returns:
- boolean - true if all instances are Double or Integer types
- Throws:
DataFormatException- - if the Vector has not a valid format
-
getLlx
public double getLlx()getLlx - returns the lower left x coordinate- Returns:
- double - the lower left x coordinate
-
setLlx
public void setLlx(double x) setLlx - sets the lower left x coordinate- Parameters:
x- the lower left x coordinate
-
setLlxMm
public void setLlxMm(double mmX) setLlXMm - sets the lower left x coordinate in millimeter- Parameters:
mmX- the lower left x coordinate in millimeter
-
getLly
public double getLly()getLly - returns the lower left y coordinate- Returns:
- double - the lower left y coordinate
-
setLly
public void setLly(double y) setLly - sets the lower left y coordinate- Parameters:
y- the lower left y coordinate
-
setLlyMm
public void setLlyMm(double mmY) setLlyMm - sets the lower left y coordinate in millimeter- Parameters:
mmY- the lower left y coordinate in millimeter
-
getUrx
public double getUrx()getUrx - returns the upper right x coordinate- Returns:
- double - the upper right x coordinate
-
setUrx
public void setUrx(double x) setUrx - sets the upper right x coordinate- Parameters:
x- the upper right x coordinate
-
setUrxMm
public void setUrxMm(double mmX) setUrxMm - sets the upper right x coordinate in millimeter- Parameters:
mmX- the upper right x coordinate in millimeter
-
getUry
public double getUry()getUry - returns the upper right y coordinate- Returns:
- double - the upper right y coordinate
-
setUry
public void setUry(double y) setUry - sets the upper right y coordinate- Parameters:
y- the upper right y coordinate
-
setUryMm
public void setUryMm(double mmY) setUryMm - sets the upper right y coordinate in millimeter- Parameters:
mmY- the upper right y coordinate in millimeter
-
getWidth
public double getWidth()getWidth - returns the width of the rectangle, the difference between upper right x value and lower left x value as an absolute value- Returns:
- double - the width of the rectangle
-
getHeight
public double getHeight()getHeight - returns the height of the rectangle, the difference between upper right y value and lower left y value as an absolute value- Returns:
- double - the height of the rectangle
-
isGreater
isGreater - equality operator >- Parameters:
r- the JDFRectangle object to compare to- Returns:
- boolean - true if
this > r
-
getInterSection
get the common (intersected area) of this with r- Parameters:
r- the new rect, null if r=null- Returns:
-
getBoundingRect
get the common (intersected area) of this with r- Parameters:
r- the new rect, null if r=null- Returns:
-
shift
public void shift(double tx, double ty) shifts this by the amount specified- Parameters:
tx- shift in x directionty- shift in y direction
-
normalize
ensures the right points e.g after a rotation -
getCenter
- Returns:
-
setCenter
- Parameters:
c-- Returns:
-
scale
- Parameters:
scaleFactor-- Returns:
-
shift
shifts this by the amount specified- Parameters:
shift- in x and y direction
-
isGreaterOrEqual
isGreaterOrEqual - equality operator >=- Parameters:
r- the JDFRectangle object to compare to- Returns:
- boolean - true if
this >= r
-
isInside
isInside - true it the point is inside this- Parameters:
p- the pount to check- Returns:
- boolean - true if
this < r
-
isLess
isLess - equality operator <- Parameters:
r- the JDFRectangle object to compare to- Returns:
- boolean - true if
this < r
-
isLessOrEqual
isLessOrEqual - equality operator <=- Parameters:
r- the JDFRectangle object to compare to- Returns:
- boolean - true if
this <= r
-
getLL
- Returns:
- the lower left pout
-
getUR
- Returns:
- the upper right point
-
getSize
- Returns:
- the width and height
-
getArea
public double getArea()- Returns:
- the area
-