PIRect complete
This commit is contained in:
@@ -619,6 +619,16 @@ PIRectd PIVariant::toRect() const {
|
||||
}
|
||||
|
||||
|
||||
/** @brief Returns variant content as rect
|
||||
* \details In case of PILined type returns line value. \n
|
||||
* In case of other types returns empty PILined. */
|
||||
PILined PIVariant::toLine() const {
|
||||
PIByteArray ba(_content);
|
||||
if (_type == PIVariant::pivLine) {PILined r; ba >> r; return r;}
|
||||
return PILined();
|
||||
}
|
||||
|
||||
|
||||
/** @brief Returns variant content as math vector
|
||||
* \details In case of PIMathVectord type returns rect value. \n
|
||||
* In case of other types returns empty PIMathVectord. */
|
||||
|
||||
@@ -234,11 +234,12 @@ public:
|
||||
pivFile /** PIVariantTypes::File */ ,
|
||||
pivDir /** PIVariantTypes::Dir */ ,
|
||||
pivColor /** PIVariantTypes::Color */ ,
|
||||
pivPoint /** PIPoint */ ,
|
||||
pivRect /** PIRect */ ,
|
||||
pivPoint /** PIPoint<double> */ ,
|
||||
pivRect /** PIRect<double> */ ,
|
||||
pivIODevice /** PIVariantTypes::IODevice */ ,
|
||||
pivMathVector /** PIMathVectord */ ,
|
||||
pivMathMatrix /** PIMathMatrixd */ ,
|
||||
pivMathVector /** PIMathVector<double> */ ,
|
||||
pivMathMatrix /** PIMathMatrix<double> */ ,
|
||||
pivLine /** PILine<double> */ ,
|
||||
pivCustom /** Custom */ = 0xFF
|
||||
};
|
||||
|
||||
@@ -333,6 +334,9 @@ public:
|
||||
//! Constructs variant from rect
|
||||
PIVariant(const PIRectd & v) {initType(v);}
|
||||
|
||||
//! Constructs variant from line
|
||||
PIVariant(const PILined & v) {initType(v);}
|
||||
|
||||
//! Constructs variant from MathVector
|
||||
PIVariant(const PIMathVectord & v) {initType(v);}
|
||||
|
||||
@@ -424,6 +428,9 @@ public:
|
||||
//! Set variant content and type to rect
|
||||
void setValue(const PIRectd & v) {initType(v);}
|
||||
|
||||
//! Set variant content and type to line
|
||||
void setValue(const PILined & v) {initType(v);}
|
||||
|
||||
//! Set variant content and type to math vector
|
||||
void setValue(const PIMathVectord & v) {initType(v);}
|
||||
|
||||
@@ -456,6 +463,7 @@ public:
|
||||
PIVariantTypes::IODevice toIODevice() const;
|
||||
PIPointd toPoint() const;
|
||||
PIRectd toRect() const;
|
||||
PILined toLine() const;
|
||||
PIMathVectord toMathVector() const;
|
||||
PIMathMatrixd toMathMatrix() const;
|
||||
|
||||
@@ -527,6 +535,8 @@ public:
|
||||
//! Assign operator
|
||||
PIVariant & operator =(const PIRectd & v) {setValue(v); return *this;}
|
||||
//! Assign operator
|
||||
PIVariant & operator =(const PILined & v) {setValue(v); return *this;}
|
||||
//! Assign operator
|
||||
PIVariant & operator =(const PIMathVectord & v) {setValue(v); return *this;}
|
||||
//! Assign operator
|
||||
PIVariant & operator =(const PIMathMatrixd & v) {setValue(v); return *this;}
|
||||
@@ -661,6 +671,7 @@ template<> inline PIVariantTypes::Color PIVariant::value() const {return toColor
|
||||
template<> inline PIVariantTypes::IODevice PIVariant::value() const {return toIODevice();}
|
||||
template<> inline PIPointd PIVariant::value() const {return toPoint();}
|
||||
template<> inline PIRectd PIVariant::value() const {return toRect();}
|
||||
template<> inline PILined PIVariant::value() const {return toLine();}
|
||||
template<> inline PIVariant PIVariant::value() const {return *this;}
|
||||
|
||||
template<> inline PIVariant PIVariant::fromValue(const bool & v) {return PIVariant(v);}
|
||||
@@ -690,6 +701,7 @@ template<> inline PIVariant PIVariant::fromValue(const PIVariantTypes::Color & v
|
||||
template<> inline PIVariant PIVariant::fromValue(const PIVariantTypes::IODevice & v) {return PIVariant(v);}
|
||||
template<> inline PIVariant PIVariant::fromValue(const PIPointd & v) {return PIVariant(v);}
|
||||
template<> inline PIVariant PIVariant::fromValue(const PIRectd & v) {return PIVariant(v);}
|
||||
template<> inline PIVariant PIVariant::fromValue(const PILined & v) {return PIVariant(v);}
|
||||
template<> inline PIVariant PIVariant::fromValue(const PIMathVectord & v) {return PIVariant(v);}
|
||||
template<> inline PIVariant PIVariant::fromValue(const PIMathMatrixd & v) {return PIVariant(v);}
|
||||
template<> inline PIVariant PIVariant::fromValue(const PIVariant & v) {return PIVariant(v);}
|
||||
@@ -721,6 +733,7 @@ template<> inline PIVariant::Type PIVariant::getType<PIVariantTypes::Color>() {r
|
||||
template<> inline PIVariant::Type PIVariant::getType<PIVariantTypes::IODevice>() {return PIVariant::pivIODevice;}
|
||||
template<> inline PIVariant::Type PIVariant::getType<PIPointd>() {return PIVariant::pivPoint;}
|
||||
template<> inline PIVariant::Type PIVariant::getType<PIRectd>() {return PIVariant::pivRect;}
|
||||
template<> inline PIVariant::Type PIVariant::getType<PILined>() {return PIVariant::pivLine;}
|
||||
template<> inline PIVariant::Type PIVariant::getType<PIMathVectord>() {return PIVariant::pivMathVector;}
|
||||
template<> inline PIVariant::Type PIVariant::getType<PIMathMatrixd>() {return PIVariant::pivMathMatrix;}
|
||||
|
||||
@@ -751,6 +764,7 @@ REGISTER_NS_VARIANT(PIVariantTypes, Color)
|
||||
REGISTER_NS_VARIANT(PIVariantTypes, IODevice)
|
||||
REGISTER_VARIANT(PIPointd)
|
||||
REGISTER_VARIANT(PIRectd)
|
||||
REGISTER_VARIANT(PILined)
|
||||
REGISTER_VARIANT(PIMathVectord)
|
||||
REGISTER_VARIANT(PIMathMatrixd)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user