fix -Wextra in Mesh

This commit is contained in:
wmayer
2016-09-23 17:24:00 +02:00
parent d88ecd5f56
commit f6e1cb6025
33 changed files with 646 additions and 574 deletions

View File

@@ -39,15 +39,15 @@
# include <algorithm>
# include <sstream>
# include <QEvent>
# include <QMenu>
# include <QMessageBox>
# include <QMenu>
# include <QMessageBox>
# include <QCursor>
# include <QToolTip>
# include <QWhatsThis>
#endif
# include <iomanip>
# include <ios>
# include <iomanip>
# include <ios>
// Here the FreeCAD includes sorted by Base,App,Gui......
#include <Base/Console.h>
@@ -87,12 +87,12 @@ PROPERTY_SOURCE(MeshGui::ViewProviderMeshCurvature, Gui::ViewProviderDocumentObj
ViewProviderMeshCurvature::ViewProviderMeshCurvature()
{
pcColorRoot = new SoSeparator();
pcColorRoot->ref();
pcColorRoot = new SoSeparator();
pcColorRoot->ref();
pcColorMat = new SoMaterial;
pcColorMat->ref();
pcColorStyle = new SoDrawStyle();
pcColorRoot->addChild(pcColorStyle);
pcColorStyle = new SoDrawStyle();
pcColorRoot->addChild(pcColorStyle);
// simple color bar
pcColorBar = new Gui::SoFCColorBar;
pcColorBar->Attach(this);
@@ -101,7 +101,7 @@ ViewProviderMeshCurvature::ViewProviderMeshCurvature()
pcLinkRoot = new SoGroup;
pcLinkRoot->ref();
App::Material mat;
App::Material mat;
const SbColor* cols;
if (pcColorMat->ambientColor.getNum() == 1) {
cols = pcColorMat->ambientColor.getValues(0);
@@ -127,44 +127,44 @@ ViewProviderMeshCurvature::ViewProviderMeshCurvature()
const float* trans = pcColorMat->transparency.getValues(0);
mat.transparency = trans[0];
}
ADD_PROPERTY(TextureMaterial,(mat));
ADD_PROPERTY(TextureMaterial,(mat));
}
ViewProviderMeshCurvature::~ViewProviderMeshCurvature()
{
pcColorRoot->unref();
pcColorRoot->unref();
pcColorMat->unref();
pcColorBar->Detach(this);
pcColorBar->unref();
pcLinkRoot->unref();
}
void ViewProviderMeshCurvature::onChanged(const App::Property* prop)
{
if (prop == &TextureMaterial) {
const App::Material& Mat = TextureMaterial.getValue();
pcColorMat->ambientColor.setValue(Mat.ambientColor.r,Mat.ambientColor.g,Mat.ambientColor.b);
pcColorMat->specularColor.setValue(Mat.specularColor.r,Mat.specularColor.g,Mat.specularColor.b);
pcColorMat->emissiveColor.setValue(Mat.emissiveColor.r,Mat.emissiveColor.g,Mat.emissiveColor.b);
pcColorMat->shininess.setValue(Mat.shininess);
pcColorMat->transparency.setValue(Mat.transparency);
}
ViewProviderDocumentObject::onChanged(prop);
}
void ViewProviderMeshCurvature::hide(void)
{
inherited::hide();
pcColorStyle->style = SoDrawStyle::INVISIBLE;
}
void ViewProviderMeshCurvature::show(void)
{
inherited::show();
pcColorStyle->style = SoDrawStyle::FILLED;
}
void ViewProviderMeshCurvature::onChanged(const App::Property* prop)
{
if (prop == &TextureMaterial) {
const App::Material& Mat = TextureMaterial.getValue();
pcColorMat->ambientColor.setValue(Mat.ambientColor.r,Mat.ambientColor.g,Mat.ambientColor.b);
pcColorMat->specularColor.setValue(Mat.specularColor.r,Mat.specularColor.g,Mat.specularColor.b);
pcColorMat->emissiveColor.setValue(Mat.emissiveColor.r,Mat.emissiveColor.g,Mat.emissiveColor.b);
pcColorMat->shininess.setValue(Mat.shininess);
pcColorMat->transparency.setValue(Mat.transparency);
}
ViewProviderDocumentObject::onChanged(prop);
}
void ViewProviderMeshCurvature::hide(void)
{
inherited::hide();
pcColorStyle->style = SoDrawStyle::INVISIBLE;
}
void ViewProviderMeshCurvature::show(void)
{
inherited::show();
pcColorStyle->style = SoDrawStyle::FILLED;
}
void ViewProviderMeshCurvature::init(const Mesh::PropertyCurvatureList* pCurvInfo)
{
@@ -281,8 +281,8 @@ void ViewProviderMeshCurvature::attach(App::DocumentObject *pcFeat)
pcColorBar->unref();
pcColorBar = pcBar;
}
pcColorRoot->addChild(pcColorBar);
pcColorRoot->addChild(pcColorBar);
}
void ViewProviderMeshCurvature::updateData(const App::Property* prop)
@@ -399,7 +399,7 @@ std::vector<std::string> ViewProviderMeshCurvature::getDisplayModes(void) const
return StrList;
}
void ViewProviderMeshCurvature::OnChange(Base::Subject<int> &rCaller,int rcReason)
void ViewProviderMeshCurvature::OnChange(Base::Subject<int> &/*rCaller*/,int /*rcReason*/)
{
setActiveMode();
}
@@ -479,22 +479,22 @@ void ViewProviderMeshCurvature::curvatureInfoCallback(void * ud, SoEventCallback
n->getAction()->setHandled();
if (mbe->getButton() == SoMouseButtonEvent::BUTTON2 && mbe->getState() == SoButtonEvent::UP) {
n->setHandled();
// context-menu
QMenu menu;
QAction* fl = menu.addAction(QObject::tr("Annotation"));
fl->setCheckable(true);
fl->setChecked(addflag);
QAction* cl = menu.addAction(QObject::tr("Leave info mode"));
QAction* id = menu.exec(QCursor::pos());
if (fl == id) {
addflag = fl->isChecked();
}
else if (cl == id) {
view->setEditing(false);
view->getWidget()->setCursor(QCursor(Qt::ArrowCursor));
// context-menu
QMenu menu;
QAction* fl = menu.addAction(QObject::tr("Annotation"));
fl->setCheckable(true);
fl->setChecked(addflag);
QAction* cl = menu.addAction(QObject::tr("Leave info mode"));
QAction* id = menu.exec(QCursor::pos());
if (fl == id) {
addflag = fl->isChecked();
}
else if (cl == id) {
view->setEditing(false);
view->getWidget()->setCursor(QCursor(Qt::ArrowCursor));
view->setRedirectToSceneGraph(false);
view->removeEventCallback(SoEvent::getClassTypeId(), curvatureInfoCallback);
}
view->removeEventCallback(SoEvent::getClassTypeId(), curvatureInfoCallback, ud);
}
}
else if (mbe->getButton() == SoMouseButtonEvent::BUTTON1 && mbe->getState() == SoButtonEvent::UP) {
const SoPickedPoint * point = n->getPickedPoint();
@@ -524,17 +524,17 @@ void ViewProviderMeshCurvature::curvatureInfoCallback(void * ud, SoEventCallback
if (addflag) {
SbVec3f pt = point->getPoint();
SbVec3f nl = point->getNormal();
Annotation* anno = new Annotation(self, text, pt, nl);
SoIdleSensor* sensor = new SoIdleSensor(Annotation::run, anno);
sensor->schedule();
}
else {
Annotation* anno = new Annotation(self, text, pt, nl);
SoIdleSensor* sensor = new SoIdleSensor(Annotation::run, anno);
sensor->schedule();
}
else {
Gui::ToolTip::showText(QCursor::pos(), text);
}
}
}
}
else if (ev->getTypeId().isDerivedFrom(SoLocation2Event::getClassTypeId())) {
else if (ev->getTypeId().isDerivedFrom(SoLocation2Event::getClassTypeId())) {
const SoPickedPoint * point = n->getPickedPoint();
if (point == NULL)
return;
@@ -557,7 +557,7 @@ void ViewProviderMeshCurvature::curvatureInfoCallback(void * ud, SoEventCallback
std::string info = that->curvatureInfo(false, index1, index2, index3);
Gui::getMainWindow()->setPaneText(1,QString::fromLatin1(info.c_str()));
}
}
}
}
std::string ViewProviderMeshCurvature::curvatureInfo(bool detail, int index1, int index2, int index3) const
@@ -608,8 +608,8 @@ std::string ViewProviderMeshCurvature::curvatureInfo(bool detail, int index1, in
str << mode << ": <" << fVal1 << ", " << fVal2 << ", " << fVal3 << ">";
}
else {
str.setf(std::ios::fixed | std::ios::showpoint);
str.precision(5);
str.setf(std::ios::fixed | std::ios::showpoint);
str.precision(5);
str << mode << std::endl
<< "v1: " << std::setw(5) << fVal1 << std::endl
<< "v2: " << std::setw(5) << fVal2 << std::endl