Points: modernize C++: use range-based for loop

This commit is contained in:
wmayer
2023-08-15 15:28:17 +02:00
committed by wwmayer
parent f24ada3151
commit 9f42af487b
7 changed files with 122 additions and 117 deletions

View File

@@ -112,8 +112,9 @@ Base::BoundBox3d PointKernel::getBoundBox()const
bnd.Add(lbb);
});
#else
for (const_point_iterator it = begin(); it != end(); ++it)
bnd.Add(*it);
for (const auto & it : *this) {
bnd.Add(it);
}
#endif
return bnd;
}
@@ -135,11 +136,12 @@ unsigned int PointKernel::getMemSize () const
PointKernel::size_type PointKernel::countValid() const
{
size_type num = 0;
for (const_point_iterator it = begin(); it != end(); ++it) {
if (!(boost::math::isnan(it->x) ||
boost::math::isnan(it->y) ||
boost::math::isnan(it->z)))
for (const auto & it : *this) {
if (!(boost::math::isnan(it.x) ||
boost::math::isnan(it.y) ||
boost::math::isnan(it.z))) {
num++;
}
}
return num;
}
@@ -148,14 +150,15 @@ std::vector<PointKernel::value_type> PointKernel::getValidPoints() const
{
std::vector<PointKernel::value_type> valid;
valid.reserve(countValid());
for (const_point_iterator it = begin(); it != end(); ++it) {
if (!(boost::math::isnan(it->x) ||
boost::math::isnan(it->y) ||
boost::math::isnan(it->z)))
for (const auto & it : *this) {
if (!(boost::math::isnan(it.x) ||
boost::math::isnan(it.y) ||
boost::math::isnan(it.z))) {
valid.emplace_back(
static_cast<float_type>(it->x),
static_cast<float_type>(it->y),
static_cast<float_type>(it->z));
static_cast<float_type>(it.x),
static_cast<float_type>(it.y),
static_cast<float_type>(it.z));
}
}
return valid;
}
@@ -175,8 +178,8 @@ void PointKernel::SaveDocFile (Base::Writer &writer) const
uint32_t uCt = (uint32_t)size();
str << uCt;
// store the data without transforming it
for (std::vector<value_type>::const_iterator it = _Points.begin(); it != _Points.end(); ++it) {
str << it->x << it->y << it->z;
for (const auto& pnt : _Points) {
str << pnt.x << pnt.y << pnt.z;
}
}
@@ -204,7 +207,9 @@ void PointKernel::RestoreDocFile(Base::Reader &reader)
str >> uCt;
_Points.resize(uCt);
for (unsigned long i=0; i < uCt; i++) {
float x, y, z;
float x;
float y;
float z;
str >> x >> y >> z;
_Points[i].Set(x,y,z);
}
@@ -224,8 +229,8 @@ void PointKernel::load(const char* file)
void PointKernel::save(std::ostream& out) const
{
out << "# ASCII" << std::endl;
for (std::vector<value_type>::const_iterator it = _Points.begin(); it != _Points.end(); ++it) {
out << it->x << " " << it->y << " " << it->z << std::endl;
for (const auto& pnt : _Points) {
out << pnt.x << " " << pnt.y << " " << pnt.z << std::endl;
}
}

View File

@@ -761,30 +761,30 @@ std::size_t PlyReader::readHeader(std::istream& in,
number.push_back(list[1]);
}
for (std::list<std::string>::iterator it = number.begin(); it != number.end(); ++it) {
for (const auto & it : number) {
int size = 0;
if (*it == "char" || *it == "int8") {
if (it == "char" || it == "int8") {
size = 1;
}
else if (*it == "uchar" || *it == "uint8") {
else if (it == "uchar" || it == "uint8") {
size = 1;
}
else if (*it == "short" || *it == "int16") {
else if (it == "short" || it == "int16") {
size = 2;
}
else if (*it == "ushort" || *it == "uint16") {
else if (it == "ushort" || it == "uint16") {
size = 2;
}
else if (*it == "int" || *it == "int32") {
else if (it == "int" || it == "int32") {
size = 4;
}
else if (*it == "uint" || *it == "uint32") {
else if (it == "uint" || it == "uint32") {
size = 4;
}
else if (*it == "float" || *it == "float32") {
else if (it == "float" || it == "float32") {
size = 4;
}
else if (*it == "double" || *it == "float64") {
else if (it == "double" || it == "float64") {
size = 8;
}
else {
@@ -795,7 +795,7 @@ std::size_t PlyReader::readHeader(std::istream& in,
if (element == "vertex") {
// store the property name and type
fields.push_back(name);
types.push_back(*it);
types.push_back(it);
sizes.push_back(size);
}
else if (!count_props.empty()) {
@@ -1980,8 +1980,8 @@ void PlyWriter::write(const std::string& filename)
out << "element vertex " << numValid << std::endl;
// the properties
for (std::list<std::string>::iterator it = properties.begin(); it != properties.end(); ++it)
out << "property " << *it << std::endl;
for (const auto & prop : properties)
out << "property " << prop << std::endl;
out << "end_header" << std::endl;
for (std::size_t r=0; r<numPoints; r++) {
@@ -2128,8 +2128,8 @@ void PcdWriter::write(const std::string& filename)
// the fields
out << "FIELDS";
for (std::list<std::string>::iterator it = fields.begin(); it != fields.end(); ++it)
out << " " << *it;
for (const auto & field : fields)
out << " " << field;
out << std::endl;
// the sizes
@@ -2140,8 +2140,8 @@ void PcdWriter::write(const std::string& filename)
// the types
out << "TYPE";
for (std::list<std::string>::iterator it = types.begin(); it != types.end(); ++it)
out << " " << *it;
for (const auto & type : types)
out << " " << type;
out << std::endl;
// the count

View File

@@ -74,8 +74,8 @@ PointsGrid::PointsGrid (const PointKernel &rclM, double fGridLen)
_fMinX(0.0f), _fMinY(0.0f), _fMinZ(0.0f)
{
Base::BoundBox3d clBBPts;// = _pclPoints->GetBoundBox();
for (PointKernel::const_iterator it = _pclPoints->begin(); it != _pclPoints->end(); ++it )
clBBPts.Add(*it);
for (const auto & pnt : *_pclPoints)
clBBPts.Add(pnt);
Rebuild(std::max<unsigned long>((unsigned long)(clBBPts.LengthX() / fGridLen), 1),
std::max<unsigned long>((unsigned long)(clBBPts.LengthY() / fGridLen), 1),
std::max<unsigned long>((unsigned long)(clBBPts.LengthZ() / fGridLen), 1));
@@ -131,8 +131,8 @@ void PointsGrid::InitGrid ()
//
{
Base::BoundBox3d clBBPts;// = _pclPoints->GetBoundBox();
for (PointKernel::const_iterator it = _pclPoints->begin(); it != _pclPoints->end(); ++it )
clBBPts.Add(*it);
for (const auto & pnt : *_pclPoints)
clBBPts.Add(pnt);
double fLengthX = clBBPts.LengthX();
double fLengthY = clBBPts.LengthY();
@@ -289,8 +289,8 @@ void PointsGrid::CalculateGridLength (unsigned long ulCtGrid, unsigned long ulMa
// There should be about 10 (?!?!) facets per grid
// or max grids should not exceed 10000
Base::BoundBox3d clBBPtsEnlarged;// = _pclPoints->GetBoundBox();
for (PointKernel::const_iterator it = _pclPoints->begin(); it != _pclPoints->end(); ++it )
clBBPtsEnlarged.Add(*it);
for (const auto & pnt : *_pclPoints)
clBBPtsEnlarged.Add(pnt);
double fVolElem;
if (_ulCtElements > (ulMaxGrids * ulCtGrid))
@@ -326,8 +326,8 @@ void PointsGrid::CalculateGridLength (int iCtGridPerAxis)
// There should be about 10 (?!?!) facets per grid
// or max grids should not exceed 10000
Base::BoundBox3d clBBPts;// = _pclPoints->GetBoundBox();
for (PointKernel::const_iterator it = _pclPoints->begin(); it != _pclPoints->end(); ++it )
clBBPts.Add(*it);
for (const auto & pnt : *_pclPoints)
clBBPts.Add(pnt);
double fLenghtX = clBBPts.LengthX();
double fLenghtY = clBBPts.LengthY();
@@ -669,9 +669,9 @@ bool PointsGrid::Verify() const
{
std::vector<unsigned long> aulElements;
it.GetElements( aulElements );
for ( std::vector<unsigned long>::iterator itP = aulElements.begin(); itP != aulElements.end(); ++itP )
for (unsigned long element : aulElements)
{
const Base::Vector3d& cP = _pclPoints->getPoint(*itP);
const Base::Vector3d& cP = _pclPoints->getPoint(element);
if (!it.GetBoundBox().IsInBox(cP))
return false; // point doesn't lie inside the grid element
}
@@ -689,9 +689,9 @@ void PointsGrid::RebuildGrid ()
// Fill data structure
unsigned long i = 0;
for (PointKernel::const_iterator it = _pclPoints->begin(); it != _pclPoints->end(); ++it )
for (const auto & pnt : *_pclPoints)
{
AddPoint(*it, i++);
AddPoint(pnt, i++);
}
}

View File

@@ -130,8 +130,8 @@ PyObject* PointsPy::writeInventor(PyObject * args)
std::vector<Base::Vector3f> points;
PointKernel* kernel = getPointKernelPtr();
points.reserve(kernel->size());
for (Points::PointKernel::const_iterator it = kernel->begin(); it != kernel->end(); ++it) {
points.push_back(Base::convertTo<Base::Vector3f>(*it));
for (const auto & it : *kernel) {
points.push_back(Base::convertTo<Base::Vector3f>(it));
}
builder.addNode(Base::Coordinate3Item{points});
builder.addNode(Base::PointSetItem{});
@@ -210,9 +210,9 @@ PyObject* PointsPy::fromValid(PyObject * args)
const PointKernel* points = getPointKernelPtr();
std::unique_ptr<PointKernel> pts(new PointKernel());
pts->reserve(points->size());
for (PointKernel::const_iterator it = points->begin(); it != points->end(); ++it) {
if (!boost::math::isnan(it->x) && !boost::math::isnan(it->y) && !boost::math::isnan(it->z))
pts->push_back(*it);
for (const auto & point : *points) {
if (!boost::math::isnan(point.x) && !boost::math::isnan(point.y) && !boost::math::isnan(point.z))
pts->push_back(point);
}
return new PointsPy(pts.release());
@@ -232,8 +232,8 @@ Py::List PointsPy::getPoints() const
{
Py::List PointList;
const PointKernel* points = getPointKernelPtr();
for (PointKernel::const_point_iterator it = points->begin(); it != points->end(); ++it) {
PointList.append(Py::asObject(new Base::VectorPy(*it)));
for (const auto & point : *points) {
PointList.append(Py::asObject(new Base::VectorPy(point)));
}
return PointList;
}

View File

@@ -156,8 +156,8 @@ void PropertyGreyValueList::SaveDocFile (Base::Writer &writer) const
Base::OutputStream str(writer.Stream());
uint32_t uCt = (uint32_t)getSize();
str << uCt;
for (std::vector<float>::const_iterator it = _lValueList.begin(); it != _lValueList.end(); ++it) {
str << *it;
for (float it : _lValueList) {
str << it;
}
}
@@ -167,8 +167,8 @@ void PropertyGreyValueList::RestoreDocFile(Base::Reader &reader)
uint32_t uCt=0;
str >> uCt;
std::vector<float> values(uCt);
for (std::vector<float>::iterator it = values.begin(); it != values.end(); ++it) {
str >> *it;
for (float & value : values) {
str >> value;
}
setValues(values);
}
@@ -330,8 +330,8 @@ void PropertyNormalList::SaveDocFile (Base::Writer &writer) const
Base::OutputStream str(writer.Stream());
uint32_t uCt = (uint32_t)getSize();
str << uCt;
for (std::vector<Base::Vector3f>::const_iterator it = _lValueList.begin(); it != _lValueList.end(); ++it) {
str << it->x << it->y << it->z;
for (const auto& it : _lValueList) {
str << it.x << it.y << it.z;
}
}
@@ -341,8 +341,8 @@ void PropertyNormalList::RestoreDocFile(Base::Reader &reader)
uint32_t uCt=0;
str >> uCt;
std::vector<Base::Vector3f> values(uCt);
for (std::vector<Base::Vector3f>::iterator it = values.begin(); it != values.end(); ++it) {
str >> it->x >> it->y >> it->z;
for (auto & value : values) {
str >> value.x >> value.y >> value.z;
}
setValues(values);
}
@@ -466,35 +466,35 @@ std::vector<float> PropertyCurvatureList::getCurvature( int mode ) const
// Mean curvature
if (mode == MeanCurvature) {
for (std::vector<Points::CurvatureInfo>::const_iterator it=fCurvInfo.begin();it!=fCurvInfo.end(); ++it) {
fValues.push_back( 0.5f*(it->fMaxCurvature+it->fMinCurvature) );
for (const auto & it : fCurvInfo) {
fValues.push_back( 0.5f*(it.fMaxCurvature+it.fMinCurvature) );
}
}
// Gaussian curvature
else if (mode == GaussCurvature) {
for (std::vector<Points::CurvatureInfo>::const_iterator it=fCurvInfo.begin();it!=fCurvInfo.end(); ++it) {
fValues.push_back( it->fMaxCurvature * it->fMinCurvature );
for (const auto & it : fCurvInfo) {
fValues.push_back( it.fMaxCurvature * it.fMinCurvature );
}
}
// Maximum curvature
else if (mode == MaxCurvature) {
for (std::vector<Points::CurvatureInfo>::const_iterator it=fCurvInfo.begin();it!=fCurvInfo.end(); ++it) {
fValues.push_back( it->fMaxCurvature );
for (const auto & it : fCurvInfo) {
fValues.push_back( it.fMaxCurvature );
}
}
// Minimum curvature
else if (mode == MinCurvature) {
for (std::vector<Points::CurvatureInfo>::const_iterator it=fCurvInfo.begin();it!=fCurvInfo.end(); ++it) {
fValues.push_back( it->fMinCurvature );
for (const auto & it : fCurvInfo) {
fValues.push_back( it.fMinCurvature );
}
}
// Absolute curvature
else if (mode == AbsCurvature) {
for (std::vector<Points::CurvatureInfo>::const_iterator it=fCurvInfo.begin();it!=fCurvInfo.end(); ++it) {
if (fabs(it->fMaxCurvature) > fabs(it->fMinCurvature))
fValues.push_back( it->fMaxCurvature );
for (const auto & it : fCurvInfo) {
if (fabs(it.fMaxCurvature) > fabs(it.fMinCurvature))
fValues.push_back( it.fMaxCurvature );
else
fValues.push_back( it->fMinCurvature );
fValues.push_back( it.fMinCurvature );
}
}
@@ -597,10 +597,10 @@ void PropertyCurvatureList::SaveDocFile (Base::Writer &writer) const
uint32_t uCt = (uint32_t)getSize();
str << uCt;
if (uCt > 0)
for (std::vector<CurvatureInfo>::const_iterator it = _lValueList.begin(); it != _lValueList.end(); ++it) {
str << it->fMaxCurvature << it->fMinCurvature;
str << it->cMaxCurvDir.x << it->cMaxCurvDir.y << it->cMaxCurvDir.z;
str << it->cMinCurvDir.x << it->cMinCurvDir.y << it->cMinCurvDir.z;
for (const auto & it : _lValueList) {
str << it.fMaxCurvature << it.fMinCurvature;
str << it.cMaxCurvDir.x << it.cMaxCurvDir.y << it.cMaxCurvDir.z;
str << it.cMinCurvDir.x << it.cMinCurvDir.y << it.cMinCurvDir.z;
}
}
@@ -610,10 +610,10 @@ void PropertyCurvatureList::RestoreDocFile(Base::Reader &reader)
uint32_t uCt=0;
str >> uCt;
std::vector<CurvatureInfo> values(uCt);
for (std::vector<CurvatureInfo>::iterator it = values.begin(); it != values.end(); ++it) {
str >> it->fMaxCurvature >> it->fMinCurvature;
str >> it->cMaxCurvDir.x >> it->cMaxCurvDir.y >> it->cMaxCurvDir.z;
str >> it->cMinCurvDir.x >> it->cMinCurvDir.y >> it->cMinCurvDir.z;
for (auto & value : values) {
str >> value.fMaxCurvature >> value.fMinCurvature;
str >> value.cMaxCurvDir.x >> value.cMaxCurvDir.y >> value.cMaxCurvDir.z;
str >> value.cMinCurvDir.x >> value.cMinCurvDir.y >> value.cMinCurvDir.z;
}
setValues(values);

View File

@@ -123,7 +123,7 @@ void CmdPointsExport::activated(int iMsg)
addModule(Command::App, "Points");
std::vector<App::DocumentObject*> points = getSelection().getObjectsOfType(Points::Feature::getClassTypeId());
for (std::vector<App::DocumentObject*>::const_iterator it = points.begin(); it != points.end(); ++it) {
for (auto point : points) {
QString fn = Gui::FileDialog::getSaveFileName(Gui::getMainWindow(),
QString(), QString(), QString::fromLatin1("%1 (*.asc *.pcd *.ply);;%2 (*.*)")
.arg(QObject::tr("Point formats"), QObject::tr("All Files")));
@@ -133,7 +133,7 @@ void CmdPointsExport::activated(int iMsg)
if (!fn.isEmpty()) {
fn = Base::Tools::escapeEncodeFilename(fn);
doCommand(Command::Doc, "Points.export([App.ActiveDocument.%s], \"%s\")",
(*it)->getNameInDocument(), fn.toUtf8().data());
point->getNameInDocument(), fn.toUtf8().data());
}
}
}

View File

@@ -118,8 +118,8 @@ void ViewProviderPoints::setVertexColorMode(App::PropertyColorList* pcProperty)
SbColor* col = pcColorMat->diffuseColor.startEditing();
std::size_t i=0;
for (std::vector<App::Color>::const_iterator it = val.begin(); it != val.end(); ++it) {
col[i++].setValue(it->r, it->g, it->b);
for (const auto& it : val) {
col[i++].setValue(it.r, it.g, it.b);
}
pcColorMat->diffuseColor.finishEditing();
@@ -133,8 +133,8 @@ void ViewProviderPoints::setVertexGreyvalueMode(Points::PropertyGreyValueList* p
SbColor* col = pcColorMat->diffuseColor.startEditing();
std::size_t i=0;
for (std::vector<float>::const_iterator it = val.begin(); it != val.end(); ++it) {
col[i++].setValue(*it, *it, *it);
for (float it : val) {
col[i++].setValue(it, it, it);
}
pcColorMat->diffuseColor.finishEditing();
@@ -148,8 +148,8 @@ void ViewProviderPoints::setVertexNormalMode(Points::PropertyNormalList* pcPrope
SbVec3f* norm = pcPointsNormal->vector.startEditing();
std::size_t i=0;
for (std::vector<Base::Vector3f>::const_iterator it = val.begin(); it != val.end(); ++it) {
norm[i++].setValue(it->x, it->y, it->z);
for (const auto& it : val) {
norm[i++].setValue(it.x, it.y, it.z);
}
pcPointsNormal->vector.finishEditing();
@@ -162,10 +162,10 @@ void ViewProviderPoints::setDisplayMode(const char* ModeName)
if (strcmp("Color",ModeName) == 0) {
std::map<std::string,App::Property*> Map;
pcObject->getPropertyMap(Map);
for (std::map<std::string,App::Property*>::iterator it = Map.begin(); it != Map.end(); ++it) {
Base::Type type = it->second->getTypeId();
for (auto & it : Map) {
Base::Type type = it.second->getTypeId();
if (type == App::PropertyColorList::getClassTypeId()) {
App::PropertyColorList* colors = static_cast<App::PropertyColorList*>(it->second);
App::PropertyColorList* colors = static_cast<App::PropertyColorList*>(it.second);
if (numPoints != colors->getSize()) {
#ifdef FC_DEBUG
SoDebugError::postWarning("ViewProviderPoints::setDisplayMode",
@@ -185,10 +185,10 @@ void ViewProviderPoints::setDisplayMode(const char* ModeName)
else if (strcmp("Intensity",ModeName) == 0) {
std::map<std::string,App::Property*> Map;
pcObject->getPropertyMap(Map);
for (std::map<std::string,App::Property*>::iterator it = Map.begin(); it != Map.end(); ++it) {
Base::Type type = it->second->getTypeId();
for (const auto& it : Map) {
Base::Type type = it.second->getTypeId();
if (type == Points::PropertyGreyValueList::getClassTypeId()) {
Points::PropertyGreyValueList* greyValues = static_cast<Points::PropertyGreyValueList*>(it->second);
Points::PropertyGreyValueList* greyValues = static_cast<Points::PropertyGreyValueList*>(it.second);
if (numPoints != greyValues->getSize()) {
#ifdef FC_DEBUG
SoDebugError::postWarning("ViewProviderPoints::setDisplayMode",
@@ -198,7 +198,7 @@ void ViewProviderPoints::setDisplayMode(const char* ModeName)
setDisplayMaskMode("Point");
}
else {
setVertexGreyvalueMode((Points::PropertyGreyValueList*)it->second);
setVertexGreyvalueMode((Points::PropertyGreyValueList*)it.second);
setDisplayMaskMode("Color");
}
break;
@@ -208,10 +208,10 @@ void ViewProviderPoints::setDisplayMode(const char* ModeName)
else if (strcmp("Shaded",ModeName) == 0) {
std::map<std::string,App::Property*> Map;
pcObject->getPropertyMap(Map);
for (std::map<std::string,App::Property*>::iterator it = Map.begin(); it != Map.end(); ++it) {
Base::Type type = it->second->getTypeId();
for (const auto& it : Map) {
Base::Type type = it.second->getTypeId();
if (type == Points::PropertyNormalList::getClassTypeId()) {
Points::PropertyNormalList* normals = static_cast<Points::PropertyNormalList*>(it->second);
Points::PropertyNormalList* normals = static_cast<Points::PropertyNormalList*>(it.second);
if (numPoints != normals->getSize()) {
#ifdef FC_DEBUG
SoDebugError::postWarning("ViewProviderPoints::setDisplayMode",
@@ -327,8 +327,8 @@ void ViewProviderPoints::clipPointsCallback(void *, SoEventCallback * n)
clPoly.push_back(clPoly.front());
std::vector<Gui::ViewProvider*> views = view->getViewProvidersOfType(ViewProviderPoints::getClassTypeId());
for (std::vector<Gui::ViewProvider*>::iterator it = views.begin(); it != views.end(); ++it) {
ViewProviderPoints* that = static_cast<ViewProviderPoints*>(*it);
for (auto it : views) {
ViewProviderPoints* that = static_cast<ViewProviderPoints*>(it);
if (that->getEditingMode() > -1) {
that->finishEditing();
that->cut(clPoly, *view);
@@ -424,8 +424,8 @@ void ViewProviderScattered::cut(const std::vector<SbVec2f>& picked, Gui::View3DI
{
// create the polygon from the picked points
Base::Polygon2d cPoly;
for (std::vector<SbVec2f>::const_iterator it = picked.begin(); it != picked.end(); ++it) {
cPoly.Add(Base::Vector2d((*it)[0],(*it)[1]));
for (const auto& it : picked) {
cPoly.Add(Base::Vector2d(it[0],it[1]));
}
// get a reference to the point feature
@@ -461,17 +461,17 @@ void ViewProviderScattered::cut(const std::vector<SbVec2f>& picked, Gui::View3DI
std::map<std::string,App::Property*> Map;
pcObject->getPropertyMap(Map);
for (std::map<std::string,App::Property*>::iterator it = Map.begin(); it != Map.end(); ++it) {
Base::Type type = it->second->getTypeId();
for (const auto& it : Map) {
Base::Type type = it.second->getTypeId();
if (type == Points::PropertyNormalList::getClassTypeId()) {
static_cast<Points::PropertyNormalList*>(it->second)->removeIndices(removeIndices);
static_cast<Points::PropertyNormalList*>(it.second)->removeIndices(removeIndices);
}
else if (type == Points::PropertyGreyValueList::getClassTypeId()) {
static_cast<Points::PropertyGreyValueList*>(it->second)->removeIndices(removeIndices);
static_cast<Points::PropertyGreyValueList*>(it.second)->removeIndices(removeIndices);
}
else if (type == App::PropertyColorList::getClassTypeId()) {
//static_cast<App::PropertyColorList*>(it->second)->removeIndices(removeIndices);
const std::vector<App::Color>& colors = static_cast<App::PropertyColorList*>(it->second)->getValues();
const std::vector<App::Color>& colors = static_cast<App::PropertyColorList*>(it.second)->getValues();
if (removeIndices.size() > colors.size())
break;
@@ -490,7 +490,7 @@ void ViewProviderScattered::cut(const std::vector<SbVec2f>& picked, Gui::View3DI
++pos;
}
static_cast<App::PropertyColorList*>(it->second)->setValues(remainValue);
static_cast<App::PropertyColorList*>(it.second)->setValues(remainValue);
}
}
@@ -576,8 +576,8 @@ void ViewProviderStructured::cut(const std::vector<SbVec2f>& picked, Gui::View3D
{
// create the polygon from the picked points
Base::Polygon2d cPoly;
for (std::vector<SbVec2f>::const_iterator it = picked.begin(); it != picked.end(); ++it) {
cPoly.Add(Base::Vector2d((*it)[0],(*it)[1]));
for (const auto& it : picked) {
cPoly.Add(Base::Vector2d(it[0],it[1]));
}
// get a reference to the point feature
@@ -593,11 +593,11 @@ void ViewProviderStructured::cut(const std::vector<SbVec2f>& picked, Gui::View3D
bool invalidatePoints = false;
double nan = std::numeric_limits<double>::quiet_NaN();
for (Points::PointKernel::const_iterator jt = points.begin(); jt != points.end(); ++jt) {
for (const auto & point : points) {
// valid point?
Base::Vector3d vec(*jt);
if (!(boost::math::isnan(jt->x) || boost::math::isnan(jt->y) || boost::math::isnan(jt->z))) {
SbVec3f pt(jt->x,jt->y,jt->z);
Base::Vector3d vec(point);
if (!(boost::math::isnan(point.x) || boost::math::isnan(point.y) || boost::math::isnan(point.z))) {
SbVec3f pt(point.x,point.y,point.z);
// project from 3d to 2d
vol.projectToScreen(pt, pt);
@@ -703,8 +703,8 @@ void ViewProviderPointsBuilder::createPoints(const App::Property* prop, SoCoordi
idx=0;
points->coordIndex.setNum(indices.size());
int32_t* pos = points->coordIndex.startEditing();
for (std::vector<int32_t>::iterator it = indices.begin(); it != indices.end(); ++it) {
pos[idx++] = *it;
for (int32_t index : indices) {
pos[idx++] = index;
}
points->coordIndex.finishEditing();
}