本文整理汇总了C++中ccHObject::getChild方法的典型用法代码示例。如果您正苦于以下问题:C++ ccHObject::getChild方法的具体用法?C++ ccHObject::getChild怎么用?C++ ccHObject::getChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ccHObject
的用法示例。
在下文中一共展示了ccHObject::getChild方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadFile
//.........这里部分代码省略.........
{
int cMin = (int)field.sf->getMin();
int cMax = (int)field.sf->getMax();
field.sf->setColorRampSteps(std::min<int>(cMax-cMin+1,256));
//classifSF->setMinSaturation(cMin);
}
else if (field.type == LAS_INTENSITY)
{
field.sf->setColorScale(ccColorScalesManager::GetDefaultScale(ccColorScalesManager::GREY));
}
int sfIndex = loadedCloud->addScalarField(field.sf);
if (!loadedCloud->hasDisplayedScalarField())
{
loadedCloud->setCurrentDisplayedScalarField(sfIndex);
loadedCloud->showSF(!thisChunkHasColors);
}
field.sf->release();
field.sf=0;
}
else
{
ccLog::Warning(QString("[LAS FILE] All '%1' values were the same (%2)! We ignored them...").arg(LAS_FIELD_NAMES[field.type]).arg(field.firstValue));
}
fieldsToLoad.pop_back();
}
//if we have reserved too much memory
if (loadedCloud->size() < loadedCloud->capacity())
loadedCloud->resize(loadedCloud->size());
QString chunkName("unnamed - Cloud");
unsigned n = container.getChildrenNumber();
if (n!=0) //if we have more than one cloud, we append an index
{
if (n==1) //we must also update the first one!
container.getChild(0)->setName(chunkName+QString(" #1"));
chunkName += QString(" #%1").arg(n+1);
}
loadedCloud->setName(chunkName);
container.addChild(loadedCloud);
loadedCloud=0;
}
else
{
//empty cloud?!
delete loadedCloud;
loadedCloud=0;
}
}
if (!newPointAvailable)
break; //end of the file (or cancel requested)
//otherwise, we must create a new cloud
fileChunkPos = pointsRead;
fileChunkSize = std::min(nbOfPoints-pointsRead,CC_MAX_NUMBER_OF_POINTS_PER_CLOUD);
loadedCloud = new ccPointCloud();
if (!loadedCloud->reserveThePointsTable(fileChunkSize))
{
ccLog::Warning("[LASFilter::loadFile] Not enough memory!");
delete loadedCloud;
delete reader;
ifs.close();
示例2: loadFile
//.........这里部分代码省略.........
}
else
{
ccLog::Warning(QString("[LAS FILE] All timestamps were the same (%1)! We ignored them...").arg(firstTime));
}
}
if (hasReturnNumber)
{
if (returnNumberSF)
{
returnNumberSF->computeMinAndMax();
int rMin = (int)returnNumberSF->getMin();
int rMax = (int)returnNumberSF->getMax();
returnNumberSF->setColorRampSteps(rMax-rMin);
int sfIndex = loadedCloud->addScalarField(returnNumberSF);
if (!loadedCloud->hasDisplayedScalarField())
{
loadedCloud->setCurrentDisplayedScalarField(sfIndex);
loadedCloud->showSF(!thisChunkHasColors);
}
}
else
{
ccLog::Warning(QString("[LAS FILE] All return numbers were the same (%1)! We ignored them...").arg(firstReturnNumber));
}
}
//if we have reserved too much memory
if (loadedCloud->size() < loadedCloud->capacity())
loadedCloud->resize(loadedCloud->size());
QString chunkName("unnamed - Cloud");
unsigned n = container.getChildrenNumber();
if (n!=0) //if we have more than one cloud, we append an index
{
if (n==1) //we must also update the first one!
container.getChild(0)->setName(chunkName+QString(" #1"));
chunkName += QString(" #%1").arg(n+1);
}
loadedCloud->setName(chunkName);
container.addChild(loadedCloud);
loadedCloud=0;
}
else
{
//empty cloud?!
delete loadedCloud;
loadedCloud=0;
}
if (classifSF)
classifSF->release();
classifSF=0;
if (intensitySF)
intensitySF->release();
intensitySF=0;
if (returnNumberSF)
returnNumberSF->release();
returnNumberSF=0;
if (timeSF)
timeSF->release();
timeSF=0;
}
示例3: loadFile
CC_FILE_ERROR PTXFilter::loadFile( QString filename,
ccHObject& container,
LoadParameters& parameters)
{
//open ASCII file for reading
QFile file(filename);
if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
{
return CC_FERR_READING;
}
QTextStream inFile(&file);
CCVector3d PshiftTrans(0,0,0);
CCVector3d PshiftCloud(0,0,0);
CC_FILE_ERROR result = CC_FERR_NO_LOAD;
ScalarType minIntensity = 0;
ScalarType maxIntensity = 0;
//progress dialog
ccProgressDialog pdlg(true, parameters.parentWidget);
pdlg.setMethodTitle(QObject::tr("Loading PTX file"));
pdlg.setAutoClose(false);
//progress dialog (for normals computation)
ccProgressDialog normalsProgressDlg(true, parameters.parentWidget);
normalsProgressDlg.setAutoClose(false);
for (unsigned cloudIndex = 0; result == CC_FERR_NO_ERROR || result == CC_FERR_NO_LOAD; cloudIndex++)
{
unsigned width = 0, height = 0;
ccGLMatrixd sensorTransD, cloudTransD;
//read header
{
QString line = inFile.readLine();
if (line.isNull() && container.getChildrenNumber() != 0) //end of file?
break;
//read the width (number of columns) and the height (number of rows) on the two first lines
//(DGM: we transpose the matrix right away)
bool ok;
height = line.toUInt(&ok);
if (!ok)
return CC_FERR_MALFORMED_FILE;
line = inFile.readLine();
width = line.toUInt(&ok);
if (!ok)
return CC_FERR_MALFORMED_FILE;
ccLog::Print(QString("[PTX] Scan #%1 - grid size: %2 x %3").arg(cloudIndex+1).arg(height).arg(width));
//read sensor transformation matrix
for (int i=0; i<4; ++i)
{
line = inFile.readLine();
QStringList tokens = line.split(" ",QString::SkipEmptyParts);
if (tokens.size() != 3)
return CC_FERR_MALFORMED_FILE;
double* colDest = 0;
if (i == 0)
{
//Translation
colDest = sensorTransD.getTranslation();
}
else
{
//X, Y and Z axis
colDest = sensorTransD.getColumn(i-1);
}
for (int j=0; j<3; ++j)
{
assert(colDest);
colDest[j] = tokens[j].toDouble(&ok);
if (!ok)
return CC_FERR_MALFORMED_FILE;
}
}
//make the transform a little bit cleaner (necessary as it's read from ASCII!)
CleanMatrix(sensorTransD);
//read cloud transformation matrix
for (int i=0; i<4; ++i)
{
line = inFile.readLine();
QStringList tokens = line.split(" ",QString::SkipEmptyParts);
if (tokens.size() != 4)
return CC_FERR_MALFORMED_FILE;
double* col = cloudTransD.getColumn(i);
for (int j=0; j<4; ++j)
{
col[j] = tokens[j].toDouble(&ok);
if (!ok)
return CC_FERR_MALFORMED_FILE;
}
}
//.........这里部分代码省略.........