コード例 #1
0
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);
  }
}
コード例 #2
0
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;
}
コード例 #3
0
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);
  }
}
コード例 #4
0
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();
    }
  }
}
コード例 #5
0
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);
    }
  }

}
コード例 #6
0
void ModelObjectInspectorView::onSelectItem(OSItem *item)
{
  ModelObjectItem* modelObjectItem = qobject_cast<ModelObjectItem*>(item);
  OS_ASSERT(modelObjectItem);
  selectModelObject(modelObjectItem->modelObject());
}