本文整理汇总了C++中ccHObject::getChildrenNumber方法的典型用法代码示例。如果您正苦于以下问题:C++ ccHObject::getChildrenNumber方法的具体用法?C++ ccHObject::getChildrenNumber怎么用?C++ ccHObject::getChildrenNumber使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ccHObject
的用法示例。
在下文中一共展示了ccHObject::getChildrenNumber方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadFile
CC_FILE_ERROR DxfFilter::loadFile(const char* filename, ccHObject& container, bool alwaysDisplayLoadDialog/*=true*/, bool* coordinatesShiftEnabled/*=0*/, double* coordinatesShift/*=0*/)
{
#ifdef CC_DXF_SUPPORT
DxfImporter importer(&container);
if (!DL_Dxf().in(qPrintable(filename), &importer))
{
return CC_FERR_READING;
}
#else
ccLog::Error("[DXF] Not supported in this version!");
#endif
return container.getChildrenNumber() == 0 ? CC_FERR_NO_LOAD : CC_FERR_NO_ERROR;
}
示例2: handler
CC_FILE_ERROR X3DFilter::loadFile(QString filename, ccHObject& container, LoadParameters& parameters)
{
XIOT::X3DLoader loader;
X3DXIOTNodeHandler handler(&container);
loader.setNodeHandler(&handler);
try
{
loader.load(qPrintable(filename));
}
catch (XIOT::X3DParseException& e)
{
ccLog::Error("[X3DFilter] Error: '%s' (line: %i, col.: %i)\n",e.getMessage().c_str(),e.getLineNumber(),e.getColumnNumber());
return CC_FERR_READING;
}
if (container.getChildrenNumber() == 0)
return CC_FERR_NO_LOAD;
return CC_FERR_NO_ERROR;
}
示例3: 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;
}
示例4: loadFile
//.........这里部分代码省略.........
FbxScene* lScene = FbxScene::Create(lSdkManager,"myScene");
// Import the contents of the file into the scene.
if (lImporter->Import(lScene))
{
// Print the nodes of the scene and their attributes recursively.
// Note that we are not printing the root node because it should
// not contain any attributes.
FbxNode* lRootNode = lScene->GetRootNode();
std::vector<FbxNode*> nodes;
nodes.push_back(lRootNode);
while (!nodes.empty())
{
FbxNode* lNode = nodes.back();
nodes.pop_back();
const char* nodeName = lNode->GetName();
#ifdef _DEBUG
ccLog::Print(QString("Node: %1 - %2 properties").arg(nodeName).arg(lNode->GetNodeAttributeCount()));
#endif
// scan the node's attributes.
for(int i=0; i<lNode->GetNodeAttributeCount(); i++)
{
FbxNodeAttribute* pAttribute = lNode->GetNodeAttributeByIndex(i);
FbxNodeAttribute::EType type = pAttribute->GetAttributeType();
#ifdef _DEBUG
ccLog::Print(QString("\tProp. #%1").arg(GetAttributeTypeName(type)));
#endif
switch(type)
{
case FbxNodeAttribute::eMesh:
{
ccMesh* mesh = FromFbxMesh(static_cast<FbxMesh*>(pAttribute),alwaysDisplayLoadDialog,coordinatesShiftEnabled,coordinatesShift);
if (mesh)
{
//apply transformation
FbxAMatrix& transform = lNode->EvaluateGlobalTransform();
ccGLMatrix mat;
float* data = mat.data();
for (int c=0; c<4; ++c)
{
FbxVector4 C = transform.GetColumn(c);
*data++ = static_cast<float>(C[0]);
*data++ = static_cast<float>(C[1]);
*data++ = static_cast<float>(C[2]);
*data++ = static_cast<float>(C[3]);
}
mesh->applyGLTransformation_recursive(&mat);
if (mesh->getName().isEmpty())
mesh->setName(nodeName);
container.addChild(mesh);
}
}
break;
case FbxNodeAttribute::eUnknown:
case FbxNodeAttribute::eNull:
case FbxNodeAttribute::eMarker:
case FbxNodeAttribute::eSkeleton:
case FbxNodeAttribute::eNurbs:
case FbxNodeAttribute::ePatch:
case FbxNodeAttribute::eCamera:
case FbxNodeAttribute::eCameraStereo:
case FbxNodeAttribute::eCameraSwitcher:
case FbxNodeAttribute::eLight:
case FbxNodeAttribute::eOpticalReference:
case FbxNodeAttribute::eOpticalMarker:
case FbxNodeAttribute::eNurbsCurve:
case FbxNodeAttribute::eTrimNurbsSurface:
case FbxNodeAttribute::eBoundary:
case FbxNodeAttribute::eNurbsSurface:
case FbxNodeAttribute::eShape:
case FbxNodeAttribute::eLODGroup:
case FbxNodeAttribute::eSubDiv:
default:
//not handled yet
break;
}
}
// Recursively add the children.
for(int j=0; j<lNode->GetChildCount(); j++)
{
nodes.push_back(lNode->GetChild(j));
}
}
}
}
// The file is imported, so get rid of the importer.
lImporter->Destroy();
// Destroy the SDK manager and all the other objects it was handling.
lSdkManager->Destroy();
return container.getChildrenNumber() == 0 ? CC_FERR_NO_LOAD : CC_FERR_NO_ERROR;
}
示例5: 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();
示例6: 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;
}
}
//.........这里部分代码省略.........