Gui: Use auto and range-based for (#7481)
* On lines where the variable type is obvious from inspection, avoid repeating the type using auto. * When possible use a ranged for loop instead of begin() and end() iterators
This commit is contained in:
@@ -103,7 +103,7 @@ void ViewProviderVRMLObject::getResourceFile(SoNode* node, std::list<std::string
|
||||
sa.apply(node);
|
||||
const SoPathList & pathlist = sa.getPaths();
|
||||
for (int i = 0; i < pathlist.getLength(); i++ ) {
|
||||
SoFullPath * path = static_cast<SoFullPath *>(pathlist[i]);
|
||||
auto path = static_cast<SoFullPath *>(pathlist[i]);
|
||||
if (path->getTail()->isOfType(T::getClassTypeId())) {
|
||||
T * tex = static_cast<T*>(path->getTail());
|
||||
for (int j = 0; j < tex->url.getNum(); j++) {
|
||||
@@ -125,9 +125,9 @@ void ViewProviderVRMLObject::getResourceFile<SoVRMLBackground>(SoNode* node, std
|
||||
sa.apply(node);
|
||||
const SoPathList & pathlist = sa.getPaths();
|
||||
for (int i = 0; i < pathlist.getLength(); i++ ) {
|
||||
SoFullPath * path = static_cast<SoFullPath *>(pathlist[i]);
|
||||
auto path = static_cast<SoFullPath *>(pathlist[i]);
|
||||
if (path->getTail()->isOfType(SoVRMLBackground::getClassTypeId())) {
|
||||
SoVRMLBackground * vrml = static_cast<SoVRMLBackground*>(path->getTail());
|
||||
auto vrml = static_cast<SoVRMLBackground*>(path->getTail());
|
||||
// backUrl
|
||||
for (int j = 0; j < vrml->backUrl.getNum(); j++) {
|
||||
addResource(vrml->backUrl[j], resources);
|
||||
@@ -182,7 +182,7 @@ void ViewProviderVRMLObject::getLocalResources(SoNode* node, std::list<std::stri
|
||||
const SoPathList & pathlist = sa.getPaths();
|
||||
for (int i = 0; i < pathlist.getLength(); i++ ) {
|
||||
SoPath * path = pathlist[i];
|
||||
SoVRMLInline * vrml = static_cast<SoVRMLInline*>(path->getTail());
|
||||
auto vrml = static_cast<SoVRMLInline*>(path->getTail());
|
||||
const SbString& url = vrml->getFullURLName();
|
||||
if (url.getLength() > 0) {
|
||||
// add the resource file if not yet listed
|
||||
@@ -208,7 +208,7 @@ void ViewProviderVRMLObject::getLocalResources(SoNode* node, std::list<std::stri
|
||||
|
||||
void ViewProviderVRMLObject::updateData(const App::Property* prop)
|
||||
{
|
||||
App::VRMLObject* ivObj = static_cast<App::VRMLObject*>(pcObject);
|
||||
auto ivObj = static_cast<App::VRMLObject*>(pcObject);
|
||||
if (prop == &ivObj->VrmlFile) {
|
||||
// read also from file
|
||||
const char* filename = ivObj->VrmlFile.getValue();
|
||||
@@ -260,13 +260,13 @@ void ViewProviderVRMLObject::updateData(const App::Property* prop)
|
||||
// <==> (I-R) * c = 0 ==> c = 0
|
||||
// This means that the center point must be the origin!
|
||||
Base::Placement p = static_cast<const App::PropertyPlacement*>(prop)->getValue();
|
||||
float q0 = (float)p.getRotation().getValue()[0];
|
||||
float q1 = (float)p.getRotation().getValue()[1];
|
||||
float q2 = (float)p.getRotation().getValue()[2];
|
||||
float q3 = (float)p.getRotation().getValue()[3];
|
||||
float px = (float)p.getPosition().x;
|
||||
float py = (float)p.getPosition().y;
|
||||
float pz = (float)p.getPosition().z;
|
||||
auto q0 = (float)p.getRotation().getValue()[0];
|
||||
auto q1 = (float)p.getRotation().getValue()[1];
|
||||
auto q2 = (float)p.getRotation().getValue()[2];
|
||||
auto q3 = (float)p.getRotation().getValue()[3];
|
||||
auto px = (float)p.getPosition().x;
|
||||
auto py = (float)p.getPosition().y;
|
||||
auto pz = (float)p.getPosition().z;
|
||||
pcTransform->rotation.setValue(q0,q1,q2,q3);
|
||||
pcTransform->translation.setValue(px,py,pz);
|
||||
pcTransform->center.setValue(0.0f,0.0f,0.0f);
|
||||
|
||||
Reference in New Issue
Block a user