diff --git a/SmootherObject.cc b/SmootherObject.cc index dd0d70b16b880079f831da399f9bd8b972321a9b..4262c6669a53f425d6873321ed554bb037ed9914 100644 --- a/SmootherObject.cc +++ b/SmootherObject.cc @@ -44,10 +44,10 @@ SmootherObject::SmootherObject(TriMesh* _mesh){ - smoother = new OpenMesh::Smoother::JacobiLaplaceSmootherT< TriMesh >( *_mesh ); + smoother_ = std::tr1::shared_ptr< SmootherType >( new SmootherType( *_mesh ) ); + } SmootherObject::~SmootherObject(){ - delete smoother; } diff --git a/SmootherObject.hh b/SmootherObject.hh index 3e789ebeccbafb7463c9bd944ab4fb9ea1fbf40e..23c5af32bb2ae399006802ea5f19ee67b5086bbd 100644 --- a/SmootherObject.hh +++ b/SmootherObject.hh @@ -46,12 +46,23 @@ #include #include +#ifndef WIN32 + #include +#endif + class SmootherObject : public PerObjectData { public: + + typedef OpenMesh::Smoother::JacobiLaplaceSmootherT< TriMesh > SmootherType; + + SmootherObject(TriMesh* _mesh); ~SmootherObject(); - OpenMesh::Smoother::JacobiLaplaceSmootherT< TriMesh >* smoother; + SmootherType* smoother() { return smoother_.get(); }; + + private: + std::tr1::shared_ptr< SmootherType > smoother_; }; diff --git a/SmootherPlugin.cc b/SmootherPlugin.cc index 8431b6b4b90cade014253429812908cc6987e9d1..289232d8c5491936db1266cbf56081e7cad84304 100644 --- a/SmootherPlugin.cc +++ b/SmootherPlugin.cc @@ -166,17 +166,17 @@ slot_smooth() double absoluteError = value.toDouble(&ok); if ( ok ) - data->smoother->set_absolute_local_error( absoluteError ); + data->smoother()->set_absolute_local_error( absoluteError ); else emit log(LOGWARN , "Unable to read distance error from LineEdit"); jobDescription += ",max_error: " + QString::number(absoluteError); } - data->smoother->initialize(component,continuity ); - data->smoother->skip_features(tool_->respectFeatures->isChecked()); + data->smoother()->initialize(component,continuity ); + data->smoother()->skip_features(tool_->respectFeatures->isChecked()); - data->smoother->smooth( tool_->sB_iter->value() ); + data->smoother()->smooth( tool_->sB_iter->value() ); jobDescription += ") " + QString::number(tool_->sB_iter->value()) + " iterations"; @@ -263,14 +263,14 @@ void SmootherPlugin::smooth(int _objectId , int _iterations , QString _direction } if ( _maxDistance > 0.0) { - data->smoother->set_absolute_local_error( _maxDistance ); + data->smoother()->set_absolute_local_error( _maxDistance ); jobDescription += ",max_error: " + QString::number(_maxDistance); } else - data->smoother->set_absolute_local_error( FLT_MAX ); + data->smoother()->set_absolute_local_error( FLT_MAX ); - data->smoother->initialize(component,continuity); + data->smoother()->initialize(component,continuity); - data->smoother->smooth( _iterations ); + data->smoother()->smooth( _iterations ); TriMesh* mesh = PluginFunctions::triMesh(object); jobDescription += ") " + QString::number(_iterations) + " iterations";