+ improve whitespaces

This commit is contained in:
wmayer 2016-01-15 23:20:52 +01:00
parent 372704f44b
commit 1027801be6

View File

@ -231,7 +231,7 @@ public:
} catch (Base::Exception &e) {
Base::Console().Warning("Failed to TuneWindowsGestures. Error: %s\n",e.what());
v->winGestureTuneState = View3DInventorViewer::ewgtsDisabled;
} catch (...){
} catch (...) {
Base::Console().Warning("Failed to TuneWindowsGestures. Unknown error.\n");
v->winGestureTuneState = View3DInventorViewer::ewgtsDisabled;
}
@ -752,14 +752,14 @@ bool View3DInventorViewer::hasGradientBackground() const
}
void View3DInventorViewer::setGradientBackgroundColor(const SbColor& fromColor,
const SbColor& toColor)
const SbColor& toColor)
{
pcBackGround->setColorGradient(fromColor, toColor);
}
void View3DInventorViewer::setGradientBackgroundColor(const SbColor& fromColor,
const SbColor& toColor,
const SbColor& midColor)
const SbColor& toColor,
const SbColor& midColor)
{
pcBackGround->setColorGradient(fromColor, toColor, midColor);
}
@ -1094,7 +1094,7 @@ std::vector<SbVec2f> View3DInventorViewer::getGLPolygon(const std::vector<SbVec2
std::vector<SbVec2f> poly;
for(std::vector<SbVec2s>::const_iterator it = pnts.begin(); it != pnts.end(); ++it) {
for (std::vector<SbVec2s>::const_iterator it = pnts.begin(); it != pnts.end(); ++it) {
SbVec2s loc = *it - op;
SbVec2f pos((float)loc[0]/(float)sp[0], (float)loc[1]/(float)sp[1]);
float pX,pY;
@ -1102,7 +1102,7 @@ std::vector<SbVec2f> View3DInventorViewer::getGLPolygon(const std::vector<SbVec2
// now calculate the real points respecting aspect ratio information
//
if(fRatio > 1.0f) {
if (fRatio > 1.0f) {
pX = (pX - 0.5f*dX) * fRatio + 0.5f*dX;
pos.setValue(pX,pY);
}
@ -1420,7 +1420,7 @@ void View3DInventorViewer::renderScene(void)
}
catch(const Base::MemoryException&) {
// FIXME: If this exception appears then the background and camera position get broken somehow. (Werner 2006-02-01)
for(std::set<ViewProvider*>::iterator it = _ViewProviderSet.begin(); it != _ViewProviderSet.end(); ++it)
for (std::set<ViewProvider*>::iterator it = _ViewProviderSet.begin(); it != _ViewProviderSet.end(); ++it)
(*it)->hide();
inherited::actualRedraw();
@ -1484,7 +1484,7 @@ void View3DInventorViewer::setSeekMode(SbBool on)
// Note: this method is almost identical to the setSeekMode() in the
// SoQtFlyViewer and SoQtPlaneViewer, so migrate any changes.
if(this->isAnimating()) {
if (this->isAnimating()) {
this->stopAnimating();
}
@ -1498,11 +1498,11 @@ void View3DInventorViewer::printDimension()
{
SoCamera* cam = getSoRenderManager()->getCamera();
if(!cam) return; // no camera there
if (!cam) return; // no camera there
SoType t = getSoRenderManager()->getCamera()->getTypeId();
if(t.isDerivedFrom(SoOrthographicCamera::getClassTypeId())) {
if (t.isDerivedFrom(SoOrthographicCamera::getClassTypeId())) {
const SbViewportRegion& vp = getSoRenderManager()->getViewportRegion();
const SbVec2s& size = vp.getWindowSize();
short dimX, dimY;
@ -1520,19 +1520,19 @@ void View3DInventorViewer::printDimension()
int nExp = int(fLog);
QString unit;
if(nExp >= 6) {
if (nExp >= 6) {
fFac = 1.0e+6f;
unit = QLatin1String("km");
}
else if(nExp >= 3) {
else if (nExp >= 3) {
fFac = 1.0e+3f;
unit = QLatin1String("m");
}
else if((nExp >= 0) && (fLog > 0.0f)) {
else if ((nExp >= 0) && (fLog > 0.0f)) {
fFac = 1.0e+0f;
unit = QLatin1String("mm");
}
else if(nExp >= -3) {
else if (nExp >= -3) {
fFac = 1.0e-3f;
unit = QLatin1String("um");
}
@ -1555,12 +1555,12 @@ void View3DInventorViewer::selectAll()
{
std::vector<App::DocumentObject*> objs;
for(std::set<ViewProvider*>::iterator it = _ViewProviderSet.begin(); it != _ViewProviderSet.end(); ++it) {
if((*it)->getTypeId().isDerivedFrom(ViewProviderDocumentObject::getClassTypeId())) {
for (std::set<ViewProvider*>::iterator it = _ViewProviderSet.begin(); it != _ViewProviderSet.end(); ++it) {
if ((*it)->getTypeId().isDerivedFrom(ViewProviderDocumentObject::getClassTypeId())) {
ViewProviderDocumentObject* vp = static_cast<ViewProviderDocumentObject*>(*it);
App::DocumentObject* obj = vp->getObject();
if(obj) objs.push_back(obj);
if (obj) objs.push_back(obj);
}
}
@ -1571,7 +1571,7 @@ void View3DInventorViewer::selectAll()
bool View3DInventorViewer::processSoEvent(const SoEvent* ev)
{
if(isRedirectedToSceneGraph()) {
if (isRedirectedToSceneGraph()) {
SbBool processed = inherited::processSoEvent(ev);
if(!processed)
@ -1580,7 +1580,7 @@ bool View3DInventorViewer::processSoEvent(const SoEvent* ev)
return processed;
}
if(ev->getTypeId().isDerivedFrom(SoKeyboardEvent::getClassTypeId())) {
if (ev->getTypeId().isDerivedFrom(SoKeyboardEvent::getClassTypeId())) {
// filter out 'Q' and 'ESC' keys
const SoKeyboardEvent* const ke = static_cast<const SoKeyboardEvent*>(ev);
@ -1626,7 +1626,7 @@ SbVec3f View3DInventorViewer::getUpDirection() const
{
SoCamera* cam = this->getSoRenderManager()->getCamera();
if(!cam) return SbVec3f(0,1,0);
if (!cam) return SbVec3f(0,1,0);
SbRotation camrot = cam->orientation.getValue();
SbVec3f upvec(0, 1, 0); // init to default up vector
@ -1677,7 +1677,7 @@ SbVec3f View3DInventorViewer::getPointOnScreen(const SbVec2s& pnt) const
float farDist = pCam->farDistance.getValue();
float focalDist = pCam->focalDistance.getValue();
if(focalDist < nearDist || focalDist > farDist)
if (focalDist < nearDist || focalDist > farDist)
focalDist = 0.5f*(nearDist + farDist);
SbLine line;
@ -1875,7 +1875,7 @@ void View3DInventorViewer::moveCameraTo(const SbRotation& rot, const SbVec3f& po
timer.setSingleShot(true);
QObject::connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit()));
for(int i=0; i<steps; i++) {
for (int i=0; i<steps; i++) {
float s = float(i)/float(steps);
SbVec3f curpos = campos * (1.0f-s) + pos * s;
SbRotation currot = SbRotation::slerp(camrot, rot, s);
@ -1902,7 +1902,7 @@ void View3DInventorViewer::animatedViewAll(int steps, int ms)
action.apply(this->getSoRenderManager()->getSceneGraph());
SbBox3f box = action.getBoundingBox();
if(box.isEmpty())
if (box.isEmpty())
return;
SbSphere sphere;
@ -1921,7 +1921,7 @@ void View3DInventorViewer::animatedViewAll(int steps, int ms)
diff = sphere.getRadius() * 2 - height;
pos = (box.getCenter() - direction * sphere.getRadius());
}
else if(cam->isOfType(SoPerspectiveCamera::getClassTypeId())) {
else if (cam->isOfType(SoPerspectiveCamera::getClassTypeId())) {
float movelength = sphere.getRadius()/float(tan(static_cast<SoPerspectiveCamera*>
(cam)->heightAngle.getValue() / 2.0));
pos = box.getCenter() - direction * movelength;
@ -1932,10 +1932,10 @@ void View3DInventorViewer::animatedViewAll(int steps, int ms)
timer.setSingleShot(true);
QObject::connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit()));
for(int i=0; i<steps; i++) {
for (int i=0; i<steps; i++) {
float s = float(i)/float(steps);
if(isOrthographic) {
if (isOrthographic) {
static_cast<SoOrthographicCamera*>(cam)->height.setValue(height + diff * s);
}
@ -1951,22 +1951,21 @@ extern View3DInventorRiftViewer* oculusStart(void);
extern bool oculusUp (void);
extern void oculusStop (void);
void oculusSetTestScene(View3DInventorRiftViewer *window);
#endif
#endif
void View3DInventorViewer::viewVR(void)
{
#if BUILD_VR
if(oculusUp())
oculusStop();
else{
View3DInventorRiftViewer* riftWin = oculusStart();
riftWin->setSceneGraph(pcViewProviderRoot);
}
if (oculusUp()) {
oculusStop();
}
else {
View3DInventorRiftViewer* riftWin = oculusStart();
riftWin->setSceneGraph(pcViewProviderRoot);
}
#endif
}
void View3DInventorViewer::boxZoom(const SbBox2s& box)
{
navigation->boxZoom(box);
@ -1983,7 +1982,7 @@ void View3DInventorViewer::viewAll()
sa.apply(this->getSoRenderManager()->getSceneGraph());
const SoPathList& pathlist = sa.getPaths();
for(int i = 0; i < pathlist.getLength(); i++) {
for (int i = 0; i < pathlist.getLength(); i++) {
SoPath* path = pathlist[i];
SoSkipBoundingGroup* group = static_cast<SoSkipBoundingGroup*>(path->getTail());
group->mode = SoSkipBoundingGroup::EXCLUDE_BBOX;
@ -2001,9 +2000,8 @@ void View3DInventorViewer::viewAll()
// make sure everything is visible
if (cam)
cam->viewAll(getSoRenderManager()->getSceneGraph(), this->getSoRenderManager()->getViewportRegion());
for(int i = 0; i < pathlist.getLength(); i++) {
for (int i = 0; i < pathlist.getLength(); i++) {
SoPath* path = pathlist[i];
SoSkipBoundingGroup* group = static_cast<SoSkipBoundingGroup*>(path->getTail());
group->mode = SoSkipBoundingGroup::INCLUDE_BBOX;
@ -2037,7 +2035,7 @@ void View3DInventorViewer::viewAll(float factor)
float minx,miny,minz,maxx,maxy,maxz;
box.getBounds(minx,miny,minz,maxx,maxy,maxz);
for(int i = 0; i < pathlist.getLength(); i++) {
for (int i = 0; i < pathlist.getLength(); i++) {
SoPath* path = pathlist[i];
SoSkipBoundingGroup* group = static_cast<SoSkipBoundingGroup*>(path->getTail());
group->mode = SoSkipBoundingGroup::INCLUDE_BBOX;
@ -2083,15 +2081,14 @@ void View3DInventorViewer::viewSelection()
SoPath* path = paths[i];
SoNode* node = path->getTail();
if(!node || node->getTypeId() != SoFCSelection::getClassTypeId())
if (!node || node->getTypeId() != SoFCSelection::getClassTypeId())
continue; // should not happen
SoFCSelection* select = static_cast<SoFCSelection*>(node);
// Check only document and object name but not sub-element name
if(Selection().isSelected(select->documentName.getValue().getString(),
select->objectName.getValue().getString())
) {
if (Selection().isSelected(select->documentName.getValue().getString(),
select->objectName.getValue().getString())) {
root->addChild(select);
}
}
@ -2102,10 +2099,10 @@ void View3DInventorViewer::viewSelection()
std::vector<App::DocumentObject*> selection = Selection().getObjectsOfType(App::DocumentObject::getClassTypeId());
for(std::vector<App::DocumentObject*>::iterator it = selection.begin(); it != selection.end(); ++it) {
for (std::vector<App::DocumentObject*>::iterator it = selection.begin(); it != selection.end(); ++it) {
ViewProvider* vp = Application::Instance->getViewProvider(*it);
if(vp) {
if (vp) {
root->addChild(vp->getRoot());
}
}
@ -2113,8 +2110,8 @@ void View3DInventorViewer::viewSelection()
#endif
SoCamera* cam = this->getSoRenderManager()->getCamera();
if(cam) cam->viewAll(root, this->getSoRenderManager()->getViewportRegion());
if (cam)
cam->viewAll(root, this->getSoRenderManager()->getViewportRegion());
root->unref();
}