version 5.2.1
fix potentially errors in PIConstChars compare methods PIHIDevice::open() for open last device PIVariant::toPoint() now can cast from PIMathVectord
This commit is contained in:
@@ -1754,16 +1754,24 @@ PIVariantTypes::IODevice PIVariant::toIODevice() const {
|
||||
//!
|
||||
PIPointd PIVariant::toPoint() const {
|
||||
PIByteArray ba(_content);
|
||||
if (_type == PIVariant::pivPoint) {
|
||||
PIPointd r;
|
||||
ba >> r;
|
||||
return r;
|
||||
}
|
||||
if (_type == PIVariant::pivString) {
|
||||
PIString r;
|
||||
ba >> r;
|
||||
PIStringList l = r.split(';');
|
||||
if (l.size() >= 2) return PIPointd(l[0].toDouble(), l[1].toDouble());
|
||||
}
|
||||
if (_type == PIVariant::pivPoint) {
|
||||
PIPointd r;
|
||||
if (_type == PIVariant::pivMathVector) {
|
||||
PIMathVectord r;
|
||||
ba >> r;
|
||||
return r;
|
||||
PIPointd ret;
|
||||
if (r.size() > 0) ret.x = r[0];
|
||||
if (r.size() > 1) ret.y = r[1];
|
||||
return ret;
|
||||
}
|
||||
return PIPointd();
|
||||
}
|
||||
@@ -1880,6 +1888,14 @@ PIMathVectord PIVariant::toMathVector() const {
|
||||
ba >> r;
|
||||
return r;
|
||||
}
|
||||
if (_type == PIVariant::pivPoint) {
|
||||
PIPointd r;
|
||||
ba >> r;
|
||||
PIMathVectord ret(2);
|
||||
ret[0] = r.x;
|
||||
ret[1] = r.y;
|
||||
return ret;
|
||||
}
|
||||
return PIMathVectord();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user