Exemplo n.º 1
0
void TreeModel::getObjectNames(const openstudio::model::ModelObject& object, QList<QVariant>& objectNames)
{


  IddObject iddObject = object.iddObject();
  QString objectName(iddObject.name().c_str());
  // object might have a name
  OptionalString optionalString = object.name();
  if(optionalString){
    QString name = optionalString.get().c_str();
    int firstIdx = name.indexOf(guidOpenCurlyBrace);
    int secondIdx = name.indexOf(guidCloseCurlyBrace);
    if(mMaskGUIDs && (firstIdx != -1) && (secondIdx != -1)){
      ///! QString::trimmed() won't work due to characters after the last curly brace
      unsigned offset = 0;
      if(firstIdx>0 && firstIdx<name.size() && name.at(firstIdx-1).isSpace()){
        offset++;
      }
      name.remove(firstIdx-offset,secondIdx-firstIdx+1+offset);
    }
    objectName += " (";
    objectName += name.toStdString().c_str();
    objectName += ")";
  }
  objectNames.push_back(objectName);
}
Exemplo n.º 2
0
void LoadsInspectorView::onSelectModelObject(const openstudio::model::ModelObject& modelObject)
{
  switch( modelObject.iddObjectType().value() )
  {
    case IddObjectType::OS_People_Definition:
      this->showPeopleDefinitionsInspector(modelObject);
      break;
    case IddObjectType::OS_Lights_Definition:
      this->showLightsDefinitionsInspector(modelObject);
      break;
    case IddObjectType::OS_Luminaire_Definition:
      this->showLuminaireDefinitionsInspector(modelObject);
      break;
    case IddObjectType::OS_ElectricEquipment_Definition:
      this->showElectricEquipmentDefinitionsInspector(modelObject);
      break;
    case IddObjectType::OS_GasEquipment_Definition:
      this->showGasEquipmentDefinitionsInspector(modelObject);
      break;
    case IddObjectType::OS_SteamEquipment_Definition:
      this->showSteamEquipmentDefinitionsInspector(modelObject);
      break;
    case IddObjectType::OS_OtherEquipment_Definition:
      this->showOtherEquipmentDefinitionsInspector(modelObject);
      break;
    case IddObjectType::OS_InternalMass_Definition:
      this->showInternalMassDefinitionsInspector(modelObject);
      break;
    case IddObjectType::OS_WaterUse_Equipment_Definition:
      this->showWaterUseEquipmentDefinitionsInspector(modelObject);
      break;
    default:
      showDefaultView();      
  }
}
void DefaultConstructionSetsController::onRemoveObject(openstudio::model::ModelObject modelObject)
{
  boost::optional<model::DefaultConstructionSet> dcs = modelObject.optionalCast<model::DefaultConstructionSet>();
  if (dcs){
    boost::optional<model::DefaultSurfaceConstructions> dsc = dcs->defaultExteriorSurfaceConstructions();
    if (dsc && (dsc->directUseCount(true) == 1)){
      dsc->remove();
    }

    dsc = dcs->defaultInteriorSurfaceConstructions();
    if (dsc && (dsc->directUseCount(true) == 1)){
      dsc->remove();
    }

    dsc = dcs->defaultGroundContactSurfaceConstructions();
    if (dsc && (dsc->directUseCount(true) == 1)){
      dsc->remove();
    }

    boost::optional<model::DefaultSubSurfaceConstructions> dssc = dcs->defaultExteriorSubSurfaceConstructions();
    if (dssc && (dssc->directUseCount(true) == 1)){
      dssc->remove();
    }

    dssc = dcs->defaultInteriorSubSurfaceConstructions();
    if (dssc && (dssc->directUseCount(true) == 1)){
      dssc->remove();
    }
  }

  modelObject.remove();
}
Exemplo n.º 4
0
void SpaceTypesController::onAddObject(const openstudio::model::ModelObject& modelObject)
{
  if (IddObjectType::OS_SpaceType == modelObject.iddObjectType().value()) {
    openstudio::model::SpaceType(this->model());
    return;
  }
  
  boost::optional<model::ParentObject> parent = modelObject.parent();
  OS_ASSERT(parent);

  // Expect a load from the gridview loads tab
  switch (modelObject.iddObjectType().value()){
    case IddObjectType::OS_People:
      openstudio::model::People(openstudio::model::PeopleDefinition(this->model())).setParent(*parent);
      break;
    case IddObjectType::OS_InternalMass:
      openstudio::model::InternalMass(openstudio::model::InternalMassDefinition(this->model())).setParent(*parent);
      break;
    case IddObjectType::OS_Lights:
      openstudio::model::Lights(openstudio::model::LightsDefinition(this->model())).setParent(*parent);
      break;
    case IddObjectType::OS_Luminaire:
      openstudio::model::Luminaire(openstudio::model::LuminaireDefinition(this->model())).setParent(*parent);
      break;
    case IddObjectType::OS_ElectricEquipment:
      openstudio::model::ElectricEquipment(openstudio::model::ElectricEquipmentDefinition(this->model())).setParent(*parent);
      break;
    case IddObjectType::OS_GasEquipment:
      openstudio::model::GasEquipment(openstudio::model::GasEquipmentDefinition(this->model())).setParent(*parent);
      break;
    case IddObjectType::OS_SteamEquipment:
      openstudio::model::SteamEquipment(openstudio::model::SteamEquipmentDefinition(this->model())).setParent(*parent);
      break;
    case IddObjectType::OS_OtherEquipment:
      openstudio::model::OtherEquipment(openstudio::model::OtherEquipmentDefinition(this->model())).setParent(*parent);
      break;
    case IddObjectType::OS_WaterUse_Equipment:
      openstudio::model::WaterUseEquipment(openstudio::model::WaterUseEquipmentDefinition(this->model())).setParent(*parent);
      break;
    default:
      // Should not get here
      OS_ASSERT(false);
      LOG_FREE(Error, "LoadsController", "Unknown IddObjectType '" << modelObject.iddObjectType().valueName() << "'");
  }

}
Exemplo n.º 5
0
void MaterialsInspectorView::onSelectModelObject(const openstudio::model::ModelObject& modelObject)
{
  switch( modelObject.iddObjectType().value() )
  {
  case IddObjectType::OS_Material:
      this->showMaterialInspectorView(modelObject);
      break;
    case IddObjectType::OS_Material_AirGap:
      this->showMaterialAirGapInspectorView(modelObject);
      break;
    case IddObjectType::OS_Material_AirWall:
      this->showMaterialAirWallInspectorView(modelObject);
      break;
    case IddObjectType::OS_Material_InfraredTransparent:
      this->showMaterialInfraredTransparentInspectorView(modelObject);
      break;
    case IddObjectType::OS_Material_NoMass:
      this->showMaterialNoMassInspectorView(modelObject);
      break;
    case IddObjectType::OS_Material_RoofVegetation:
      this->showMaterialRoofVegetationInspectorView(modelObject);
      break;
    case IddObjectType::OS_WindowMaterial_Blind:
      this->showWindowMaterialBlindInspectorView(modelObject);
      break;
    case IddObjectType::OS_WindowMaterial_Gas:
      this->showWindowMaterialGasInspectorView(modelObject);
      break;
    case IddObjectType::OS_WindowMaterial_GasMixture:
      this->showWindowMaterialGasMixtureInspectorView(modelObject);
      break;
    case IddObjectType::OS_WindowMaterial_Glazing:
      this->showWindowMaterialGlazingInspectorView(modelObject);
      break;
    case IddObjectType::OS_WindowMaterial_Glazing_RefractionExtinctionMethod:
      this->showWindowMaterialGlazingRefractionExtinctionMethodInspectorView(modelObject);
      break;
    case IddObjectType::OS_WindowMaterial_GlazingGroup_Thermochromic:
      this->showWindowMaterialGlazingGroupThermochromicInspectorView(modelObject);
      break;
    case IddObjectType::OS_WindowMaterial_Screen:
      this->showWindowMaterialScreenInspectorView(modelObject);
      break;
    case IddObjectType::OS_WindowMaterial_Shade:
      this->showWindowMaterialShadeInspectorView(modelObject);
      break;
    case IddObjectType::OS_WindowMaterial_SimpleGlazingSystem:
      this->showWindowMaterialSimpleGlazingSystemInspectorView(modelObject);
      break;      
    default:
      showDefaultView();      
  }
}
Exemplo n.º 6
0
ModelObjectItem::ModelObjectItem(const openstudio::model::ModelObject& modelObject,
                                 bool isDefaulted,
                                 OSItemType type,
                                 QWidget * parent )
  : OSItem(modelObjectToItemId(modelObject, isDefaulted), type, parent),
    m_handle(modelObject.handle()),
    m_modelObject(modelObject)
{
  this->setText(QString::fromStdString(m_modelObject.name().get()));

  connect(m_modelObject.getImpl<model::detail::ModelObject_Impl>().get(), &model::detail::ModelObject_Impl::onChange,
          this, &ModelObjectItem::onObjectChanged);

  if (!modelObject.getModelObjectSources<model::ComponentData>().empty()){
    m_measureBadge->setMeasureBadgeType(MeasureBadgeType::BCLMeasure);
  }
}
Exemplo n.º 7
0
void LoadsController::onRemoveObject(openstudio::model::ModelObject modelObject)
{
  boost::optional<model::SpaceLoadDefinition> spaceLoadDefinition = modelObject.optionalCast<model::SpaceLoadDefinition>();
  if (spaceLoadDefinition){

    unsigned numInstances = spaceLoadDefinition->instances().size();
    if (numInstances > 0){
      QMessageBox msgBox(subTabView());
      msgBox.setText("There are " + QString::number(numInstances) + " instances that reference this definition.");
      msgBox.setInformativeText("Do you want to remove this definition and all of its instances?");
      msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
      msgBox.setDefaultButton(QMessageBox::Yes);
      int ret = msgBox.exec();
      if (ret == QMessageBox::No){
        return;
      }
    }
    modelObject.remove();
  }
}
Exemplo n.º 8
0
ModelObjectItem::ModelObjectItem(const openstudio::model::ModelObject& modelObject,
                                 bool isDefaulted,
                                 OSItem::Type type,
                                 QWidget * parent )
  : OSItem(modelObjectToItemId(modelObject, isDefaulted), type, parent),
    m_handle(modelObject.handle()),
    m_modelObject(modelObject)
{
  this->setText(QString::fromStdString(m_modelObject.name().get()));

  bool isConnected = false;
  isConnected = connect( m_modelObject.getImpl<openstudio::model::detail::ModelObject_Impl>().get(),
                         SIGNAL(onChange()),
                         this,
                         SLOT(onObjectChanged()) );
  OS_ASSERT(isConnected);

  if (!modelObject.getModelObjectSources<model::ComponentData>().empty()){
    m_bclBadge->setVisible(true);
  }
}
Exemplo n.º 9
0
void ConstructionsInspectorView::onSelectModelObject(const openstudio::model::ModelObject& modelObject)
{
  switch( modelObject.iddObjectType().value() )
  {
    case IddObjectType::OS_Construction:
      this->showConstructionInspector(modelObject);
      break;
    case IddObjectType::OS_Construction_CfactorUndergroundWall:
      this->showCfactorUndergroundWallInspector(modelObject);
      break;
    case IddObjectType::OS_Construction_FfactorGroundFloor:
      this->showFfactorGroundFloorInspector(modelObject);
      break;
    case IddObjectType::OS_Construction_InternalSource:
      this->showInternalSourceInspector(modelObject);
      break;
    case IddObjectType::OS_Construction_WindowDataFile:
      this->showWindowDataFileInspector(modelObject);
      break;
    default:
      showDefaultView();      
  }
}
Exemplo n.º 10
0
void MaterialsController::onRemoveObject(openstudio::model::ModelObject modelObject)
{
  modelObject.remove();
}
Exemplo n.º 11
0
void MaterialsController::onCopyObject(const openstudio::model::ModelObject& modelObject)
{
  modelObject.clone(this->model());
}
Exemplo n.º 12
0
void SpaceTypesController::onRemoveObject(openstudio::model::ModelObject modelObject)
{
  modelObject.remove();
}
Exemplo n.º 13
0
void SpaceTypesController::onCopyObject(const openstudio::model::ModelObject& modelObject)
{
  modelObject.clone(this->model());
}
Exemplo n.º 14
0
void FacilityInspectorView::onSelectModelObject(const openstudio::model::ModelObject& modelObject)
{
  int index = 1;
  std::map<openstudio::IddObjectType, int>::const_iterator it = m_inspectorIndexMap.find(modelObject.iddObjectType());
  if (it != m_inspectorIndexMap.end()){
    index = it->second;
  }

  QWidget* widget = this->stackedWidget()->widget(index);
  ModelObjectInspectorView* modelObjectInspectorView = qobject_cast<ModelObjectInspectorView*>(widget);
  OS_ASSERT(modelObjectInspectorView);
  modelObjectInspectorView->selectModelObject(modelObject);
  this->stackedWidget()->setCurrentIndex(index);
}
Exemplo n.º 15
0
OSItemId modelObjectToItemId(const openstudio::model::ModelObject& modelObject, bool isDefaulted)
{
  std::stringstream ss;
  ss << modelObject;
  return OSItemId(modelObject.handle().toString(), modelToSourceId(modelObject.model()), isDefaulted, toQString(ss.str()));
}
Exemplo n.º 16
0
void UtilityBillsController::onRemoveObject(openstudio::model::ModelObject modelObject)
{
  modelObject.remove();
}
void ThermalZonesController::onCopyObject(const openstudio::model::ModelObject& modelObject)
{
  modelObject.clone(this->model());
}
void ThermalZonesController::onAddObject(const openstudio::model::ModelObject& modelObject)
{
  OS_ASSERT(IddObjectType::OS_ThermalZone == modelObject.iddObjectType().value());
  openstudio::model::ThermalZone(this->model());
}
void ScheduleSetsController::onRemoveObject(openstudio::model::ModelObject modelObject)
{
  modelObject.remove();
}
void ScheduleSetsController::onCopyObject(const openstudio::model::ModelObject& modelObject)
{
  modelObject.clone(this->model());
}
void DefaultConstructionSetsController::onCopyObject(const openstudio::model::ModelObject& modelObject)
{
  modelObject.clone(this->model());
}
void ThermalZonesController::onRemoveObject(openstudio::model::ModelObject modelObject)
{
  // DLM: should this check isRemovable?
  modelObject.remove();
}
void ConstructionsController::onRemoveObject(openstudio::model::ModelObject modelObject)
{
  modelObject.remove();
}