OCC.Core.Quantity module¶
Quantity module, see official documentation at https://www.opencascade.com/doc/occt-7.4.0/refman/html/package_quantity.html
-
class
Quantity_Array1OfColor
(*args)¶ Bases:
object
-
Assign
()¶
-
ChangeFirst
()¶
-
ChangeLast
()¶
-
ChangeValue
()¶
-
First
()¶
-
Init
()¶
-
IsAllocated
()¶
-
IsDeletable
()¶
-
IsEmpty
()¶
-
Last
()¶
-
Length
()¶
-
Lower
()¶
-
Move
()¶
-
Resize
()¶
-
Set
()¶
-
SetValue
()¶
-
Size
()¶
-
Upper
()¶
-
Value
()¶
-
begin
()¶
-
cbegin
()¶
-
cend
()¶
-
end
()¶
-
next
()¶
-
property
thisown
¶ The membership flag
-
-
class
Quantity_Array2OfColor
(*args)¶ Bases:
object
-
Assign
()¶
-
ChangeValue
()¶
-
ColLength
()¶
-
Init
()¶
-
IsDeletable
()¶
-
Length
()¶
-
LowerCol
()¶
-
LowerRow
()¶
-
Move
()¶
-
NbColumns
()¶
-
NbRows
()¶
-
Resize
()¶
-
RowLength
()¶
-
Set
()¶
-
SetValue
()¶
-
Size
()¶
-
UpperCol
()¶
-
UpperRow
()¶
-
Value
()¶
-
property
thisown
¶ The membership flag
-
-
class
Quantity_Color
(*args)¶ Bases:
object
- Creates Quantity_NOC_YELLOW color.
- rtype
None* Creates the color from enumeration value.
- param AName
- type AName
Quantity_NameOfColor
- rtype
None* Creates a color according to the definition system theType. Quantity_TOC_RGB: - theR1 the value of Red within range [0.0; 1.0] - theR2 the value of Green within range [0.0; 1.0] - theR3 the value of Blue within range [0.0; 1.0] //! Quantity_TOC_HLS: - theR1 is the Hue (H) angle in degrees within range [0.0; 360.0], 0.0 being Red. Value -1.0 is a special value reserved for grayscale color (S should be 0.0). - theR2 is the Lightness (L) within range [0.0; 1.0] - theR3 is the Saturation (S) within range [0.0; 1.0]
- param theR1
- type theR1
float
- param theR2
- type theR2
float
- param theR3
- type theR3
float
- param theType
- type theType
Quantity_TypeOfColor
- rtype
None* Define color from RGB values.
- param theRgb
- type theRgb
NCollection_Vec3<float>
- rtype
None
-
static
Argb2color
()¶ - Convert integer ARGB value to Color. Alpha bits are ignored
- param theARGB
- type theARGB
int
- param theColor
- type theColor
Quantity_Color
- rtype
void
-
Blue
()¶ - Returns the Blue component (quantity of blue) of the color within range [0.0; 1.0].
- rtype
float
-
ChangeContrast
()¶ - Increases or decreases the contrast by <ADelta>. <ADelta> is a percentage. Any value greater than zero will increase the contrast. The variation is expressed as a percentage of the current value. It is a variation of the saturation.
- param ADelta
- type ADelta
float
- rtype
None
-
ChangeIntensity
()¶ - Increases or decreases the intensity by <ADelta>. <ADelta> is a percentage. Any value greater than zero will increase the intensity. The variation is expressed as a percentage of the current value. It is a variation of the lightness.
- param ADelta
- type ADelta
float
- rtype
None
-
static
Color2argb
()¶ - Convert the Color value to ARGB integer value. theARGB has Alpha equal to zero, so the output is formatted as 0x00RRGGBB
- param theColor
- type theColor
Quantity_Color
- param theARGB
- type theARGB
int
- rtype
void
-
static
ColorFromHex
()¶ - Parses the string as a hex color (like ‘#FF0’ for short RGB color, or ‘#FFFF00’ for RGB color) @param theHexColorString the string to be parsed @param theColor a color that is a result of parsing returns true if parsing was successful, or false otherwise
- param theHexColorString
- type theHexColorString
char *
- param theColor
- type theColor
Quantity_Color
- rtype
bool
-
static
ColorFromName
()¶ - Finds color from predefined names. For example, the name of the color which corresponds to ‘BLACK’ is Quantity_NOC_BLACK. Returns false if name is unknown.
- param theName
- type theName
char *
- param theColor
- type theColor
Quantity_NameOfColor
- rtype
bool* Finds color from predefined names. For example, the name of the color which corresponds to ‘BLACK’ is Quantity_NOC_BLACK. Returns false if name is unknown. @param theColorNameString the color name @param theColor a found color returns false if the color name is unknown, or true if the search by color name was successful
- param theColorNameString
- type theColorNameString
char *
- param theColor
- type theColor
Quantity_Color
- rtype
bool
-
static
ColorToHex
()¶ - Returns hex sRGB string in format ‘#FFAAFF’.
- param theColor
- type theColor
Quantity_Color
- param theToPrefixHash
default value is true
- type theToPrefixHash
bool
- rtype
TCollection_AsciiString
-
Delta
()¶ - Returns the percentage change of contrast and intensity between <self> and <AColor>. <DC> and <DI> are percentages, either positive or negative. The calculation is with respect to the current value of <self> If <DC> is positive then <self> is more contrasty. If <DI> is positive then <self> is more intense.
- param AColor
- type AColor
Quantity_Color
- param DC
- type DC
float
- param DI
- type DI
float
- rtype
None
-
Distance
()¶ - Returns the distance between two colours. It’s a value between 0 and the square root of 3 (the black/white distance)
- param AColor
- type AColor
Quantity_Color
- rtype
float
-
DumpJsonToString
(Quantity_Color self, int depth=-1) → std::string¶
-
static
Epsilon
()¶ - Returns the specified value used to compare <self> and an other color in IsDifferent and in IsEqual methods.
- rtype
float
-
Green
()¶ - Returns the Green component (quantity of green) of the color within range [0.0; 1.0].
- rtype
float
-
static
HlsRgb
()¶ - Converts HLS components into RGB ones.
- param H
- type H
float
- param L
- type L
float
- param S
- type S
float
- param R
- type R
float
- param G
- type G
float
- param B
- type B
float
- rtype
void
-
Hue
()¶ - Returns the Hue component (hue angle) of the color in degrees within range [0.0; 360.0], 0.0 being Red. -1.0 is a special value reserved for grayscale color (S should be 0.0)
- rtype
float
-
IsDifferent
()¶ - Returns Standard_True if the distance between <self> and <Other> is greater than Epsilon ().
- param Other
- type Other
Quantity_Color
- rtype
bool
-
IsEqual
()¶ - Returns true if the Other color is - different from, or - equal to this color. Two colors are considered to be equal if their distance is no greater than Epsilon(). These methods are aliases of operator != and operator ==.
- param Other
- type Other
Quantity_Color
- rtype
bool
-
Light
()¶ - Returns the Light component (value of the lightness) of the color within range [0.0; 1.0].
- rtype
float
-
static
Name
()¶ - Returns the name of the color defined by its quantities of red R, green G and blue B; more precisely this is the nearest color from the Quantity_NameOfColor enumeration. Exceptions Standard_OutOfRange if R, G or B is less than 0. or greater than 1.
- rtype
Quantity_NameOfColor* Returns the name of the colour for which the RGB components are nearest to <R>, <G> and <B>.
- param R
- type R
float
- param G
- type G
float
- param B
- type B
float
- rtype
Quantity_NameOfColor
-
Red
()¶ - Returns the Red component (quantity of red) of the color within range [0.0; 1.0].
- rtype
float
-
static
RgbHls
()¶ - Converts RGB components into HLS ones.
- param R
- type R
float
- param G
- type G
float
- param B
- type B
float
- param H
- type H
float
- param L
- type L
float
- param S
- type S
float
- rtype
void
-
Saturation
()¶ - Returns the Saturation component (value of the saturation) of the color within range [0.0; 1.0].
- rtype
float
-
static
SetEpsilon
()¶ - Sets the specified value used to compare <self> and an other color in IsDifferent and in IsEqual methods. Warning: The default value is 0.0001
- param AnEpsilon
- type AnEpsilon
float
- rtype
void
-
SetValues
()¶ - Updates the colour <self> from the definition of the colour <AName>.
- param AName
- type AName
Quantity_NameOfColor
- rtype
None* Updates a color according to the mode specified by theType. Quantity_TOC_RGB: - theR1 the value of Red within range [0.0; 1.0] - theR2 the value of Green within range [0.0; 1.0] - theR3 the value of Blue within range [0.0; 1.0] //! Quantity_TOC_HLS: - theR1 is the Hue (H) angle in degrees within range [0.0; 360.0], 0.0 being Red. -1.0 is a special value reserved for grayscale color (S should be 0.0). - theR2 is the Lightness (L) within range [0.0; 1.0] - theR3 is the Saturation (S) within range [0.0; 1.0]
- param theR1
- type theR1
float
- param theR2
- type theR2
float
- param theR3
- type theR3
float
- param theType
- type theType
Quantity_TypeOfColor
- rtype
None
-
SquareDistance
()¶ - Returns the square of distance between two colours.
- param AColor
- type AColor
Quantity_Color
- rtype
float
-
static
StringName
()¶ - Returns the name of the color identified by AName in the Quantity_NameOfColor enumeration. For example, the name of the color which corresponds to Quantity_NOC_BLACK is ‘BLACK’. Exceptions Standard_OutOfRange if AName in not known in the Quantity_NameOfColor enumeration.
- param AColor
- type AColor
Quantity_NameOfColor
- rtype
char *
-
static
Test
()¶ - Internal test
- rtype
void
-
Values
()¶ - Returns in theR1, theR2 and theR3 the components of this color according to the color system definition theType. If theType is Quantity_TOC_RGB: - theR1 the value of Red between 0.0 and 1.0 - theR2 the value of Green between 0.0 and 1.0 - theR3 the value of Blue between 0.0 and 1.0 If theType is Quantity_TOC_HLS: - theR1 is the Hue (H) angle in degrees within range [0.0; 360.0], 0.0 being Red. -1.0 is a special value reserved for grayscale color (S should be 0.0). - theR2 is the Lightness (L) within range [0.0; 1.0] - theR3 is the Saturation (S) within range [0.0; 1.0]
- param theR1
- type theR1
float
- param theR2
- type theR2
float
- param theR3
- type theR3
float
- param theType
- type theType
Quantity_TypeOfColor
- rtype
None
-
property
thisown
¶ The membership flag
-
class
Quantity_ColorHasher
¶ Bases:
object
-
static
HashCode
()¶ - Returns hash code for the given RGB color, in the range [1, theUpperBound] @param theColor the RGB color object which hash code is to be computed @param theUpperBound the upper bound of the range a computing range must be within returns a computed hash code, in the range [1, theUpperBound]
- param theColor
- type theColor
Quantity_Color
- param theUpperBound
- type theUpperBound
int
- rtype
int
-
static
IsEqual
()¶ - Returns true if two colors are equal.
- param theColor1
- type theColor1
Quantity_Color
- param theColor2
- type theColor2
Quantity_Color
- rtype
bool
-
property
thisown
¶ The membership flag
-
static
-
class
Quantity_ColorRGBA
(*args)¶ Bases:
object
- Creates a color with the default value.
- rtype
None* Creates the color with specified RGB value.
- param theRgb
- type theRgb
Quantity_Color
- rtype
None* Creates the color with specified RGBA values.
- param theRgb
- type theRgb
Quantity_Color
- param theAlpha
- type theAlpha
float
- rtype
None* Creates the color from RGBA vector.
- param theRgba
- type theRgba
NCollection_Vec4<float>
- rtype
None* Creates the color from RGBA values.
- param theRed
- type theRed
float
- param theGreen
- type theGreen
float
- param theBlue
- type theBlue
float
- param theAlpha
- type theAlpha
float
- rtype
None
-
Alpha
()¶ - Return alpha value (1.0 means opaque, 0.0 means fully transparent).
- rtype
Standard_ShortReal
-
ChangeRGB
()¶ - Modify RGB color components without affecting alpha value.
- rtype
Quantity_Color
-
static
ColorFromHex
()¶ - Parses the string as a hex color (like ‘#FF0’ for short RGB color, ‘#FF0F’ for short RGBA color, ‘#FFFF00’ for RGB color, or ‘#FFFF00FF’ for RGBA color) @param theHexColorString the string to be parsed @param theColor a color that is a result of parsing @param theAlphaComponentIsOff the flag that indicates if a color alpha component is presented in the input string (false) or not (true) returns true if parsing was successful, or false otherwise
- param theHexColorString
- type theHexColorString
char *
- param theColor
- type theColor
Quantity_ColorRGBA
- param theAlphaComponentIsOff
default value is false
- type theAlphaComponentIsOff
bool
- rtype
bool
-
static
ColorFromName
()¶ - Finds color from predefined names. For example, the name of the color which corresponds to ‘BLACK’ is Quantity_NOC_BLACK. Returns false if name is unknown. An alpha component is set to 1.0. @param theColorNameString the color name @param theColor a found color returns false if the color name is unknown, or true if the search by color name was successful
- param theColorNameString
- type theColorNameString
char *
- param theColor
- type theColor
Quantity_ColorRGBA
- rtype
bool
-
static
ColorToHex
()¶ - Returns hex sRGBA string in format ‘#RRGGBBAA’.
- param theColor
- type theColor
Quantity_ColorRGBA
- param theToPrefixHash
default value is true
- type theToPrefixHash
bool
- rtype
TCollection_AsciiString
-
DumpJsonToString
(Quantity_ColorRGBA self, int depth=-1) → std::string¶
-
GetRGB
()¶ - Return RGB color value.
- rtype
Quantity_Color
-
IsDifferent
()¶ - Returns true if the distance between colors is greater than Epsilon().
- param theOther
- type theOther
Quantity_ColorRGBA
- rtype
bool
-
IsEqual
()¶ - Two colors are considered to be equal if their distance is no greater than Epsilon().
- param theOther
- type theOther
Quantity_ColorRGBA
- rtype
bool
-
SetAlpha
()¶ - Assign the alpha value.
- param theAlpha
- type theAlpha
Standard_ShortReal
- rtype
None
-
SetRGB
()¶ - Assign RGB color components without affecting alpha value.
- param theRgb
- type theRgb
Quantity_Color
- rtype
None
-
SetValues
()¶ - Assign new values to the color.
- param theRed
- type theRed
float
- param theGreen
- type theGreen
float
- param theBlue
- type theBlue
float
- param theAlpha
- type theAlpha
float
- rtype
None
-
property
thisown
¶ The membership flag
-
class
Quantity_ColorRGBAHasher
¶ Bases:
object
-
static
HashCode
()¶ - Returns hash code for the given RGBA color, in the range [1, theUpperBound] @param theColor the RGBA color object which hash code is to be computed @param theUpperBound the upper bound of the range a computing hash code must be within returns a computed hash code, in the range [1, theUpperBound]
- param theColor
- type theColor
Quantity_ColorRGBA
- param theUpperBound
- type theUpperBound
int
- rtype
int
-
static
IsEqual
()¶ - Returns true if two colors are equal.
- param theColor1
- type theColor1
Quantity_ColorRGBA
- param theColor2
- type theColor2
Quantity_ColorRGBA
- rtype
bool
-
property
thisown
¶ The membership flag
-
static
-
class
Quantity_Date
(*args)¶ Bases:
object
- Constructs a default date (00:00 GMT, January 1, 1979 (zero hour)); use the function SetValues to define the required date; or
- rtype
None* Constructs a date from the year yyyy, the month mm, the day dd, the hour hh, the minute mn, the second ss, the millisecond mis (defaulted to 0) and the microsecond mics (defaulted to 0).. With: 1 <= mm <= 12 1 <= dd <= max number of days of <mm> 1979 <= yyyy 0 <= hh <= 23 0 <= mn <= 59 0 <= ss <= 59 0 <= mis <= 999 0 <= mics <= 999 Exceptions Quantity_DateDefinitionError if mm, dd, hh, mn, ss, mis and mics are not the components of the valid date.
- param mm
- type mm
int
- param dd
- type dd
int
- param yyyy
- type yyyy
int
- param hh
- type hh
int
- param mn
- type mn
int
- param ss
- type ss
int
- param mis
default value is 0
- type mis
int
- param mics
default value is 0
- type mics
int
- rtype
None
-
Add
()¶ - Adds a Period to a Date and returns the new Date.
- param aPeriod
- type aPeriod
Quantity_Period
- rtype
Quantity_Date
-
Day
()¶ - Returns Day of a Date.
- rtype
int
-
Difference
()¶ - Subtracts one Date from another one to find the period between and returns the value. The result is the absolute value between the difference of two dates.
- param anOther
- type anOther
Quantity_Date
- rtype
Quantity_Period
-
Hour
()¶ - Returns Hour of a Date.
- rtype
int
-
IsEarlier
()¶ - Returns True if <self> is earlier than <other>.
- param anOther
- type anOther
Quantity_Date
- rtype
bool
-
IsEqual
()¶ - Returns True if both <self> and <other> are equal. This method is an alias of operator ==.
- param anOther
- type anOther
Quantity_Date
- rtype
bool
-
IsLater
()¶ - Returns True if <self> is later then <other>.
- param anOther
- type anOther
Quantity_Date
- rtype
bool
-
static
IsLeap
()¶ - Returns true if a year is a leap year. The leap years are divisable by 4 and not by 100 except the years divisable by 400.
- param yy
- type yy
int
- rtype
bool
-
static
IsValid
()¶ - Checks the validity of a date - returns true if a date defined from the year yyyy, the month mm, the day dd, the hour hh, the minute mn, the second ss, the millisecond mis (defaulted to 0) and the microsecond mics (defaulted to 0) is valid. A date must satisfy the conditions above: - yyyy is greater than or equal to 1979, - mm lies within the range [1, 12] (with 1 corresponding to January and 12 to December), - dd lies within a valid range for the month mm (from 1 to 28, 29, 30 or 31 depending on mm and whether yyyy is a leap year or not), - hh lies within the range [0, 23], - mn lies within the range [0, 59], - ss lies within the range [0, 59], - mis lies within the range [0, 999], - mics lies within the range [0, 999].C
- param mm
- type mm
int
- param dd
- type dd
int
- param yy
- type yy
int
- param hh
- type hh
int
- param mn
- type mn
int
- param ss
- type ss
int
- param mis
default value is 0
- type mis
int
- param mics
default value is 0
- type mics
int
- rtype
bool
-
MicroSecond
()¶ - Returns microsecond of a Date.
- rtype
int
-
MilliSecond
()¶ - Returns millisecond of a Date.
- rtype
int
-
Minute
()¶ - Returns minute of a Date.
- rtype
int
-
Month
()¶ - Returns month of a Date.
- rtype
int
-
Second
()¶ - Returns seconde of a Date.
- rtype
int
-
SetValues
()¶ - Assigns to this date the year yyyy, the month mm, the day dd, the hour hh, the minute mn, the second ss, the millisecond mis (defaulted to 0) and the microsecond mics (defaulted to 0). Exceptions Quantity_DateDefinitionError if mm, dd, hh, mn, ss, mis and mics are not components of a valid date.
- param mm
- type mm
int
- param dd
- type dd
int
- param yy
- type yy
int
- param hh
- type hh
int
- param mn
- type mn
int
- param ss
- type ss
int
- param mis
default value is 0
- type mis
int
- param mics
default value is 0
- type mics
int
- rtype
None
-
Subtract
()¶ - Subtracts a period from a Date and returns the new Date. Raises an exception if the result date is anterior to Jan 1, 1979.
- param aPeriod
- type aPeriod
Quantity_Period
- rtype
Quantity_Date
-
Values
()¶ - Gets a complete Date. - in mm - the month, - in dd - the day, - in yyyy - the year, - in hh - the hour, - in mn - the minute, - in ss - the second, - in mis - the millisecond, and - in mics - the microsecond
- param mm
- type mm
int
- param dd
- type dd
int
- param yy
- type yy
int
- param hh
- type hh
int
- param mn
- type mn
int
- param ss
- type ss
int
- param mis
- type mis
int
- param mics
- type mics
int
- rtype
None
-
Year
()¶ - Returns year of a Date.
- rtype
int
-
property
thisown
¶ The membership flag
-
class
Quantity_HArray1OfColor
(*args)¶ Bases:
OCC.Core.Quantity.Quantity_Array1OfColor
,OCC.Core.Standard.Standard_Transient
Empty constructor
- Return type
None* Copy constructor – does nothing
- Parameters
& (Standard_Transient) –
- Return type
-
Array1
()¶
-
ChangeArray1
()¶
-
static
DownCast
(t)¶
-
property
thisown
¶ The membership flag
-
class
Quantity_Period
(*args)¶ Bases:
object
- Creates a Period With: 0 <= dd 0 <= hh 0 <= mn 0 <= ss 0 <= mis 0 <= mics
- param dd
- type dd
int
- param hh
- type hh
int
- param mn
- type mn
int
- param ss
- type ss
int
- param mis
default value is 0
- type mis
int
- param mics
default value is 0
- type mics
int
- rtype
None* Creates a Period with a number of seconds and microseconds. Exceptions Quantity_PeriodDefinitionError: - if the number of seconds expressed either by: - dd days, hh hours, mn minutes and ss seconds, or - Ss is less than 0. - if the number of microseconds expressed either by: - mis milliseconds and mics microseconds, or - Mics is less than 0.
- param ss
- type ss
int
- param mics
default value is 0
- type mics
int
- rtype
None
-
Add
()¶ - Adds one Period to another one.
- param anOther
- type anOther
Quantity_Period
- rtype
Quantity_Period
-
IsEqual
()¶ - Returns True if both <self> and <other> are equal.
- param anOther
- type anOther
Quantity_Period
- rtype
bool
-
IsLonger
()¶ - Returns True if <self> is longer then <other>.
- param anOther
- type anOther
Quantity_Period
- rtype
bool
-
IsShorter
()¶ - Returns True if <self> is shorter than <other>.
- param anOther
- type anOther
Quantity_Period
- rtype
bool
-
static
IsValid
()¶ - Checks the validity of a Period in form (dd,hh,mn,ss,mil,mic) With: 0 <= dd 0 <= hh 0 <= mn 0 <= ss 0 <= mis 0 <= mics
- param dd
- type dd
int
- param hh
- type hh
int
- param mn
- type mn
int
- param ss
- type ss
int
- param mis
default value is 0
- type mis
int
- param mics
default value is 0
- type mics
int
- rtype
bool* Checks the validity of a Period in form (ss,mic) With: 0 <= ss 0 <= mics
- param ss
- type ss
int
- param mics
default value is 0
- type mics
int
- rtype
bool
-
SetValues
()¶ - Assigns to this period the time interval defined - with dd days, hh hours, mn minutes, ss seconds, mis (defaulted to 0) milliseconds and mics (defaulted to 0) microseconds; or
- param dd
- type dd
int
- param hh
- type hh
int
- param mn
- type mn
int
- param ss
- type ss
int
- param mis
default value is 0
- type mis
int
- param mics
default value is 0
- type mics
int
- rtype
None* Assigns to this period the time interval defined - with Ss seconds and Mics (defaulted to 0) microseconds. Exceptions Quantity_PeriodDefinitionError: - if the number of seconds expressed either by: - dd days, hh hours, mn minutes and ss seconds, or - Ss is less than 0. - if the number of microseconds expressed either by: - mis milliseconds and mics microseconds, or - Mics is less than 0.
- param ss
- type ss
int
- param mics
default value is 0
- type mics
int
- rtype
None
-
Subtract
()¶ - Subtracts one Period from another and returns the difference.
- param anOther
- type anOther
Quantity_Period
- rtype
Quantity_Period
-
Values
()¶ - Decomposes this period into a number of days,hours, minutes,seconds,milliseconds and microseconds Example of return values: 2 days, 15 hours, 0 minute , 0 second 0 millisecond and 0 microsecond
- param dd
- type dd
int
- param hh
- type hh
int
- param mn
- type mn
int
- param ss
- type ss
int
- param mis
- type mis
int
- param mics
- type mics
int
- rtype
None* Returns the number of seconds in Ss and the number of remainding microseconds in Mics of this period. Example of return values: 3600 seconds and 0 microseconds
- param ss
- type ss
int
- param mics
- type mics
int
- rtype
None
-
property
thisown
¶ The membership flag