本文整理汇总了C++中cclib::ScalarField::setName方法的典型用法代码示例。如果您正苦于以下问题:C++ ScalarField::setName方法的具体用法?C++ ScalarField::setName怎么用?C++ ScalarField::setName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cclib::ScalarField
的用法示例。
在下文中一共展示了ScalarField::setName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadFile
//.........这里部分代码省略.........
/* SCALAR FIELD (SF) */
unsigned numberOfScalars=0;
if (sfIndex>0)
{
plyProperty& pp = stdProperties[sfIndex-1];
numberOfScalars = pointElements[pp.elemIndex].elementInstances;
//does the number of scalars matches the number of points?
if (numberOfPoints != numberOfScalars)
{
ccConsole::Error("The number of scalars doesn't match the number of points (they will be ignored)!");
ccConsole::Warning("[PLY] Scalar field ignored!");
numberOfScalars = 0;
}
else if (!cloud->enableScalarField())
{
ccConsole::Error("Not enough memory to load scalar field (they will be ignored)!");
ccConsole::Warning("[PLY] Scalar field ignored!");
numberOfScalars = 0;
}
else
{
CCLib::ScalarField* sf = cloud->getCurrentInScalarField();
if (sf)
{
QString qPropName(pp.propName);
if (qPropName.startsWith("scalar_") && qPropName.length()>7)
{
//remove the 'scalar_' prefix added when saving SF with CC!
qPropName = qPropName.mid(7).replace('_',' ');
sf->setName(qPrintable(qPropName));
}
else
{
sf->setName(pp.propName);
}
}
ply_set_read_cb(ply, pointElements[pp.elemIndex].elementName, pp.propName, scalar_cb, cloud, 1);
}
cloud->showSF(true);
}
/* MESH FACETS (TRI) */
ccMesh* mesh = 0;
unsigned numberOfFacets=0;
if (facesIndex>0)
{
plyProperty& pp = listProperties[facesIndex-1];
assert(pp.type==16); //we only accept PLY_LIST here!
mesh = new ccMesh(cloud);
numberOfFacets = meshElements[pp.elemIndex].elementInstances;
if (!mesh->reserve(numberOfFacets))
{
ccConsole::Error("Not enough memory to load facets (they will be ignored)!");
ccConsole::Warning("[PLY] Mesh ignored!");
delete mesh;
mesh = 0;
numberOfFacets = 0;
示例2: if
//.........这里部分代码省略.........
++parts;
sprintf(partName,"%s.part_%i",cloudName,parts);
loadedCloud = new ccPointCloud(partName);
loadedCloud->reserveThePointsTable(fileChunkSize);
if (header.colors)
{
loadedCloud->reserveTheRGBTable();
loadedCloud->showColors(true);
}
if (header.normals)
{
loadedCloud->reserveTheNormsTable();
loadedCloud->showNormals(true);
}
if (header.scalarField)
loadedCloud->enableScalarField();
}
float Pf[3];
if (in.read((char*)Pf,sizeof(float)*3) < 0)
{
//Console::print("[BinFilter::loadModelFromBinaryFile] Error reading the %ith entity point !\n",k);
return CC_FERR_READING;
}
loadedCloud->addPoint(CCVector3::fromArray(Pf));
if (header.colors)
{
unsigned char C[3];
if (in.read((char*)C,sizeof(ColorCompType)*3) < 0)
{
//Console::print("[BinFilter::loadModelFromBinaryFile] Error reading the %ith entity colors !\n",k);
return CC_FERR_READING;
}
loadedCloud->addRGBColor(C);
}
if (header.normals)
{
CCVector3 N;
if (in.read((char*)N.u,sizeof(float)*3) < 0)
{
//Console::print("[BinFilter::loadModelFromBinaryFile] Error reading the %ith entity norms !\n",k);
return CC_FERR_READING;
}
loadedCloud->addNorm(N);
}
if (header.scalarField)
{
double D;
if (in.read((char*)&D,sizeof(double)) < 0)
{
//Console::print("[BinFilter::loadModelFromBinaryFile] Error reading the %ith entity distance!\n",k);
return CC_FERR_READING;
}
ScalarType d = static_cast<ScalarType>(D);
loadedCloud->setPointScalarValue(i,d);
}
lineRead++;
if (parameters.alwaysDisplayLoadDialog && !nprogress.oneStep())
{
loadedCloud->resize(i+1-fileChunkPos);
k=nbScansTotal;
i=nbOfPoints;
}
}
if (parameters.alwaysDisplayLoadDialog)
{
pdlg.stop();
QApplication::processEvents();
}
if (header.scalarField)
{
CCLib::ScalarField* sf = loadedCloud->getCurrentInScalarField();
assert(sf);
sf->setName(sfName);
//replace HIDDEN_VALUES by NAN_VALUES
for (unsigned i=0; i<sf->currentSize(); ++i)
{
if (sf->getValue(i) == FORMER_HIDDEN_POINTS)
sf->setValue(i,NAN_VALUE);
}
sf->computeMinAndMax();
loadedCloud->setCurrentDisplayedScalarField(loadedCloud->getCurrentInScalarFieldIndex());
loadedCloud->showSF(true);
}
container.addChild(loadedCloud);
}
return CC_FERR_NO_ERROR;
}
示例3: if
//.........这里部分代码省略.........
loadedCloud->getCurrentInScalarField()->computeMinAndMax();
container.addChild(loadedCloud);
fileChunkPos = lineReaded;
fileChunkSize = ccMin(nbOfPoints-lineReaded,CC_MAX_NUMBER_OF_POINTS_PER_CLOUD);
char partName[64];
++parts;
sprintf(partName,"%s.part_%i",cloudName,parts);
loadedCloud = new ccPointCloud(partName);
loadedCloud->reserveThePointsTable(fileChunkSize);
if (header.colors)
{
loadedCloud->reserveTheRGBTable();
loadedCloud->showColors(true);
}
if (header.normals)
{
loadedCloud->reserveTheNormsTable();
loadedCloud->showNormals(true);
}
if (header.scalarField)
loadedCloud->enableScalarField();
}
if (in.read((char*)P.u,sizeof(float)*3)<0)
{
//Console::print("[BinFilter::loadModelFromBinaryFile] Error reading the %ith entity point !\n",k);
return CC_FERR_READING;
}
loadedCloud->addPoint(P);
if (header.colors)
{
if (in.read((char*)C,sizeof(colorType)*3)<0)
{
//Console::print("[BinFilter::loadModelFromBinaryFile] Error reading the %ith entity colors !\n",k);
return CC_FERR_READING;
}
loadedCloud->addRGBColor(C);
}
if (header.normals)
{
if (in.read((char*)P.u,sizeof(float)*3)<0)
{
//Console::print("[BinFilter::loadModelFromBinaryFile] Error reading the %ith entity norms !\n",k);
return CC_FERR_READING;
}
loadedCloud->addNorm(P.u);
}
if (header.scalarField)
{
if (in.read((char*)&D,sizeof(double))<0)
{
//Console::print("[BinFilter::loadModelFromBinaryFile] Error reading the %ith entity distance !\n",k);
return CC_FERR_READING;
}
DistanceType d = (DistanceType)D;
//if there are negative values, we test if they are particular values (HIDDEN_VALUE, etc.)
//or not particular (in which case we have a non strictly positive SF)
if (d<0.0 && !negSF)
{
//we must test if the value is a particular one
if (d != HIDDEN_VALUE &&
d != OUT_VALUE &&
d != SEGMENTED_VALUE)
negSF = true;
}
loadedCloud->setPointScalarValue(i,d);
}
lineReaded++;
if (!nprogress.oneStep())
{
loadedCloud->resize(i+1-fileChunkPos);
k=nbScansTotal;
i=nbOfPoints;
}
}
if (header.scalarField)
{
CCLib::ScalarField* sf = loadedCloud->getCurrentInScalarField();
assert(sf);
sf->setName(sfName);
sf->setPositive(!negSF);
sf->computeMinAndMax();
loadedCloud->setCurrentDisplayedScalarField(loadedCloud->getCurrentInScalarFieldIndex());
loadedCloud->showSF(true);
}
container.addChild(loadedCloud);
}
return CC_FERR_NO_ERROR;
}