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:
@@ -82,13 +82,13 @@ void ViewProviderOriginFeature::attach(App::DocumentObject* pcObject)
|
||||
float sz = Size.getValue () / defaultSz;
|
||||
|
||||
// Create an external separator
|
||||
SoSeparator *sep = new SoSeparator();
|
||||
auto sep = new SoSeparator();
|
||||
|
||||
// Add material from the base class
|
||||
sep->addChild(pcShapeMaterial);
|
||||
|
||||
// Bind same material to all part
|
||||
SoMaterialBinding* matBinding = new SoMaterialBinding;
|
||||
auto matBinding = new SoMaterialBinding;
|
||||
matBinding->value = SoMaterialBinding::OVERALL;
|
||||
sep->addChild(matBinding);
|
||||
|
||||
@@ -97,12 +97,12 @@ void ViewProviderOriginFeature::attach(App::DocumentObject* pcObject)
|
||||
sep->addChild (pScale);
|
||||
|
||||
// Setup font size
|
||||
SoFont *font = new SoFont ();
|
||||
auto font = new SoFont ();
|
||||
font->size.setValue ( defaultSz/10.);
|
||||
sep->addChild ( font );
|
||||
|
||||
// Create the selection node
|
||||
SoFCSelection *highlight = new SoFCSelection ();
|
||||
auto highlight = new SoFCSelection ();
|
||||
highlight->applySettings ();
|
||||
if ( !Selectable.getValue() ) {
|
||||
highlight->selectionMode = Gui::SoFCSelection::SEL_OFF;
|
||||
@@ -112,7 +112,7 @@ void ViewProviderOriginFeature::attach(App::DocumentObject* pcObject)
|
||||
highlight->style = SoFCSelection::EMISSIVE_DIFFUSE;
|
||||
|
||||
// Style for normal (visible) lines
|
||||
SoDrawStyle* style = new SoDrawStyle ();
|
||||
auto style = new SoDrawStyle ();
|
||||
style->lineWidth = 2.0f;
|
||||
highlight->addChild ( style );
|
||||
|
||||
@@ -120,7 +120,7 @@ void ViewProviderOriginFeature::attach(App::DocumentObject* pcObject)
|
||||
highlight->addChild ( pOriginFeatureRoot );
|
||||
|
||||
// Hidden features
|
||||
SoAnnotation *hidden = new SoAnnotation ();
|
||||
auto hidden = new SoAnnotation ();
|
||||
|
||||
// Style for hidden lines
|
||||
style = new SoDrawStyle ();
|
||||
@@ -172,7 +172,7 @@ void ViewProviderOriginFeature::setDisplayMode (const char* ModeName)
|
||||
}
|
||||
|
||||
bool ViewProviderOriginFeature::onDelete(const std::vector<std::string> &) {
|
||||
App::OriginFeature *feat = static_cast <App::OriginFeature *> ( getObject() );
|
||||
auto feat = static_cast <App::OriginFeature *> ( getObject() );
|
||||
// Forbid deletion if there is an origin this feature belongs to
|
||||
|
||||
if ( feat->getOrigin () ) {
|
||||
|
||||
Reference in New Issue
Block a user