void ModelSubTabController::onReplaceItem(OSItem* item, const OSItemId& replacementItemId) { ModelObjectItem* modelObjectItem = qobject_cast<ModelObjectItem*>(item); OS_ASSERT(modelObjectItem); model::ModelObject modelObject = modelObjectItem->modelObject(); if (!modelObject.handle().isNull()){ onReplaceObject(modelObject, replacementItemId); } }
boost::optional<openstudio::model::ModelObject> UtilityBillFuelTypeListView::selectedModelObject() const { OSItem* selectedItem = this->selectedItem(); ModelObjectItem* modelObjectItem = qobject_cast<ModelObjectItem*>(selectedItem); if (modelObjectItem){ return modelObjectItem->modelObject(); } return boost::none; }
void ModelSubTabController::onRemoveItem(OSItem* item) { ModelObjectItem* modelObjectItem = qobject_cast<ModelObjectItem*>(item); OS_ASSERT(modelObjectItem); model::ModelObject modelObject = modelObjectItem->modelObject(); if (!modelObject.handle().isNull()){ onRemoveObject(modelObject); } }
void BuildingStorySpacesVectorController::onRemoveItem(OSItem* item) { ModelObjectItem* modelObjectItem = qobject_cast<ModelObjectItem*>(item); if (modelObjectItem){ boost::optional<model::Space> space = modelObjectItem->modelObject().optionalCast<model::Space>(); if (space){ space->resetBuildingStory(); } } }
void ModelSubTabController::onRemoveItem(OSItem* item) { // get selected items auto modelSubTabView = qobject_cast<ModelSubTabView *>(subTabView()); auto modelObjectInspectorView = modelSubTabView->modelObjectInspectorView(); if (modelObjectInspectorView->supportsMultipleObjectSelection()) { for (auto &obj : modelObjectInspectorView->selectedObjects()) { onRemoveObject(obj); } } else { ModelObjectItem* modelObjectItem = qobject_cast<ModelObjectItem*>(item); OS_ASSERT(modelObjectItem); model::ModelObject modelObject = modelObjectItem->modelObject(); if (!modelObject.handle().isNull()){ onRemoveObject(modelObject); } } }
void ModelObjectInspectorView::onSelectItem(OSItem *item) { ModelObjectItem* modelObjectItem = qobject_cast<ModelObjectItem*>(item); OS_ASSERT(modelObjectItem); selectModelObject(modelObjectItem->modelObject()); }