本文整理汇总了C++中DeviceList::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ DeviceList::empty方法的具体用法?C++ DeviceList::empty怎么用?C++ DeviceList::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DeviceList
的用法示例。
在下文中一共展示了DeviceList::empty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initialize
void BasicSensorSimulationHelper::initialize(Body* body, double timeStep, const Vector3& gravityAcceleration)
{
isActive_ = false;
DeviceList<> devices = body->devices();
if(!devices.empty()){
forceSensors_.extractFrom(devices);
rateGyroSensors_.extractFrom(devices);
accelerationSensors_.extractFrom(devices);
if(!forceSensors_.empty() ||
!rateGyroSensors_.empty() ||
!accelerationSensors_.empty()){
impl->initialize(body, timeStep, gravityAcceleration);
isActive_ = true;
}
}
}
示例2: onPositionChanged
void SensorVisualizerItemImpl::onPositionChanged()
{
BodyItem* newBodyItem = self->findOwnerItem<BodyItem>();
if(newBodyItem != bodyItem){
bodyItem = newBodyItem;
for(size_t i=0; i < subItems.size(); i++){
subItems[i]->detachFromParentItem();
}
subItems.clear();
int n = restoredSubItems.size();
int j = 0;
if(bodyItem){
Body* body = bodyItem->body();
DeviceList<ForceSensor> forceSensors = body->devices<ForceSensor>();
if(!forceSensors.empty()){
ForceSensorVisualizerItem* forceSensorVisualizerItem= 0;
if(j<n){
forceSensorVisualizerItem = dynamic_cast<ForceSensorVisualizerItem*>(restoredSubItems[j++].get());
} else {
forceSensorVisualizerItem = new ForceSensorVisualizerItem();
}
if(forceSensorVisualizerItem){
forceSensorVisualizerItem->setBodyItem(bodyItem);
self->addSubItem(forceSensorVisualizerItem);
subItems.push_back(forceSensorVisualizerItem);
}
}
DeviceList<RangeCamera> rangeCameras = body->devices<RangeCamera>();
for(size_t i=0; i < rangeCameras.size(); ++i){
PointCloudVisualizerItem* pointCloudVisualizerItem =
j<n ? dynamic_cast<PointCloudVisualizerItem*>(restoredSubItems[j++].get()) : new PointCloudVisualizerItem();
if(pointCloudVisualizerItem){
pointCloudVisualizerItem->setBodyItem(bodyItem, rangeCameras[i]);
self->addSubItem(pointCloudVisualizerItem);
subItems.push_back(pointCloudVisualizerItem);
}
}
DeviceList<RangeSensor> rangeSensors = body->devices<RangeSensor>();
for(size_t i=0; i < rangeSensors.size(); ++i){
RangeSensorVisualizerItem* rangeSensorVisualizerItem =
j<n ? dynamic_cast<RangeSensorVisualizerItem*>(restoredSubItems[j++].get()) : new RangeSensorVisualizerItem();
if(rangeSensorVisualizerItem){
rangeSensorVisualizerItem->setBodyItem(bodyItem, rangeSensors[i]);
self->addSubItem(rangeSensorVisualizerItem);
subItems.push_back(rangeSensorVisualizerItem);
}
}
DeviceList<Camera> cameras = body->devices<Camera>();
for(size_t i=0; i < cameras.size(); ++i){
if(cameras[i]->imageType()!=Camera::NO_IMAGE){
CameraImageVisualizerItem* cameraImageVisualizerItem =
j<n ? dynamic_cast<CameraImageVisualizerItem*>(restoredSubItems[j++].get()) : new CameraImageVisualizerItem();
if(cameraImageVisualizerItem){
cameraImageVisualizerItem->setBodyItem(bodyItem, cameras[i]);
self->addSubItem(cameraImageVisualizerItem);
subItems.push_back(cameraImageVisualizerItem);
}
}
}
}
restoredSubItems.clear();
}
}