本文整理汇总了C++中cchobject::Container::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ Container::clear方法的具体用法?C++ Container::clear怎么用?C++ Container::clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cchobject::Container
的用法示例。
在下文中一共展示了Container::clear方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getAllEntitiesThatHaveMetaData
void BaseFilter::getAllEntitiesThatHaveMetaData(QString key, ccHObject::Container &entities)
{
entities.clear(); //better be sure
ccHObject::Container tempContainer;
getAllEntitiesOfType(CC_TYPES::HIERARCHY_OBJECT, tempContainer);
for (ccHObject::Container::const_iterator it = tempContainer.begin(); it != tempContainer.end(); ++it )
{
if ((*it)->hasMetaData(key))
entities.push_back(*it);
}
}
示例2: GetSupportedShapes
void GetSupportedShapes(ccHObject* baseEntity, ccHObject::Container& shapes, ESRI_SHAPE_TYPE& shapeType)
{
shapeType = SHP_NULL_SHAPE;
if (!baseEntity)
{
assert(false);
shapes.clear();
return;
}
switch (baseEntity->getClassID())
{
case CC_TYPES::POINT_CLOUD:
{
unsigned count = ccHObjectCaster::ToGenericPointCloud(baseEntity)->size();
if (count != 0)
{
shapeType = SHP_MULTI_POINT_Z;
shapes.push_back(baseEntity);
}
}
break;
//DGM: TODO
//case CC_MESH:
//case CC_SUB_MESH:
// {
// unsigned count = ccHObjectCaster::ToGenericMesh(baseEntity)->size();
// if (count != 0)
// {
// shapeType = SHP_MULTI_PATCH;
// shapes.push_back(baseEntity);
// }
// }
// break;
case CC_TYPES::POLY_LINE:
{
ccPolyline* poly = static_cast<ccPolyline*>(baseEntity);
shapeType = poly->is2DMode() ? SHP_POLYLINE : SHP_POLYLINE_Z;
shapes.push_back(baseEntity);
break;
}
case CC_TYPES::HIERARCHY_OBJECT:
//we only allow groups with children of the same type!
if (baseEntity->getChildrenNumber())
{
ccHObject* child = baseEntity->getChild(0);
assert(child);
if (!child)
return;
//first we check that all entities have the same type
{
for (unsigned i=1; i<baseEntity->getChildrenNumber(); ++i)
{
if (baseEntity->getChild(i) && baseEntity->getChild(i)->getClassID() != child->getClassID())
{
//mixed shapes are not allowed in shape files (yet?)
return;
}
}
}
//call the same method on the first child so as to get its type
GetSupportedShapes(child,shapes,shapeType/*,closedPolylinesAsPolygons*/);
if (shapeType == SHP_NULL_SHAPE)
return;
//then add the remaining children
{
for (unsigned i=1; i<baseEntity->getChildrenNumber(); ++i)
{
ESRI_SHAPE_TYPE otherShapeType = SHP_NULL_SHAPE;
ccHObject* child = baseEntity->getChild(i);
if (child)
GetSupportedShapes(child,shapes,otherShapeType);
if (otherShapeType != shapeType)
{
if (child)
ccLog::Warning(QString("[SHP] Entity %1 has not the same type (%1) as the others in the selection (%2)! Can't mix types...")
.arg(child->getName())
.arg(ToString(otherShapeType))
.arg(ToString(shapeType)));
//mixed shapes are not allowed in shape files (yet?)
shapes.clear();
return;
}
}
}
}
break;
default:
//nothing to do
break;
}
}