Merge pull request #11891 from ctrlaltdavid/21625

Add missing line3d overlay property getters and setters
This commit is contained in:
Brad Hefta-Gaub 2017-12-02 12:52:44 -08:00 committed by GitHub
commit 314265fa86
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -166,26 +166,36 @@ void Line3DOverlay::setProperties(const QVariantMap& originalProperties) {
bool newEndSet { false }; bool newEndSet { false };
auto start = properties["start"]; auto start = properties["start"];
// if "start" property was not there, check to see if they included aliases: startPoint // If "start" property was not there, check to see if they included aliases: startPoint, p1
if (!start.isValid()) { if (!start.isValid()) {
start = properties["startPoint"]; start = properties["startPoint"];
} }
if (!start.isValid()) {
start = properties["p1"];
}
if (start.isValid()) { if (start.isValid()) {
newStart = vec3FromVariant(start); newStart = vec3FromVariant(start);
newStartSet = true; newStartSet = true;
} }
properties.remove("start"); // so that Base3DOverlay doesn't respond to it properties.remove("start"); // so that Base3DOverlay doesn't respond to it
properties.remove("startPoint");
properties.remove("p1");
auto end = properties["end"]; auto end = properties["end"];
// if "end" property was not there, check to see if they included aliases: endPoint // If "end" property was not there, check to see if they included aliases: endPoint, p2
if (!end.isValid()) { if (!end.isValid()) {
end = properties["endPoint"]; end = properties["endPoint"];
} }
if (!end.isValid()) {
end = properties["p2"];
}
if (end.isValid()) { if (end.isValid()) {
newEnd = vec3FromVariant(end); newEnd = vec3FromVariant(end);
newEndSet = true; newEndSet = true;
} }
properties.remove("end"); // so that Base3DOverlay doesn't respond to it properties.remove("end"); // so that Base3DOverlay doesn't respond to it
properties.remove("endPoint");
properties.remove("p2");
auto length = properties["length"]; auto length = properties["length"];
if (length.isValid()) { if (length.isValid()) {
@ -252,14 +262,23 @@ QVariant Line3DOverlay::getProperty(const QString& property) {
if (property == "end" || property == "endPoint" || property == "p2") { if (property == "end" || property == "endPoint" || property == "p2") {
return vec3toVariant(getEnd()); return vec3toVariant(getEnd());
} }
if (property == "length") {
return QVariant(getLength());
}
if (property == "endParentID") {
return _endParentID;
}
if (property == "endParentJointIndex") {
return _endParentJointIndex;
}
if (property == "localStart") { if (property == "localStart") {
return vec3toVariant(getLocalStart()); return vec3toVariant(getLocalStart());
} }
if (property == "localEnd") { if (property == "localEnd") {
return vec3toVariant(getLocalEnd()); return vec3toVariant(getLocalEnd());
} }
if (property == "length") { if (property == "glow") {
return QVariant(getLength()); return getGlow();
} }
if (property == "lineWidth") { if (property == "lineWidth") {
return _lineWidth; return _lineWidth;