std::vector<OSItemId> UtilityBillFuelTypeListController::makeVector()
{
  std::vector<OSItemId> result;

  // get objects by type
  std::vector<WorkspaceObject> workspaceObjects = m_model.getObjectsByType(m_iddObjectType);

  // sort by name
  std::sort(workspaceObjects.begin(), workspaceObjects.end(), WorkspaceObjectNameGreater());

  BOOST_FOREACH(WorkspaceObject workspaceObject,workspaceObjects){
    if (!workspaceObject.handle().isNull()){
      openstudio::model::ModelObject modelObject = workspaceObject.cast<openstudio::model::ModelObject>();
      if(boost::optional<model::UtilityBill> utilityBill = modelObject.optionalCast<model::UtilityBill>()){
        if(utilityBill.get().fuelType() == m_fuelType){
          result.push_back(modelObjectToItemId(modelObject, false));
          // becasue there is no more than 1 utility bill per fuel type...
          // TODO break;
        }
      }
    }
  }

  return result;
}
std::vector<OSItemId> ModelObjectListController::makeVector()
{
  std::vector<OSItemId> result;

  if( m_showLocalBCL )
  {
    std::vector<std::pair<std::string, std::string> > pairs;
    pairs.push_back(std::make_pair<std::string,std::string>("OpenStudio Type",m_iddObjectType.valueDescription()));

    // get BCL results
    std::vector<BCLComponent> bclresults = LocalBCL::instance().componentAttributeSearch(pairs); 

    // sort by name
    std::sort(bclresults.begin(), bclresults.end(), BCLComponentNameGreater());

    for( auto it = bclresults.begin(); 
         it != bclresults.end();
         ++it )
    {
      result.push_back(bclComponentToItemId(*it));
    }
  }

  // get objects by type
  std::vector<WorkspaceObject> workspaceObjects = m_model.getObjectsByType(m_iddObjectType);

  // sort by name
  std::sort(workspaceObjects.begin(), workspaceObjects.end(), WorkspaceObjectNameGreater());

  for (WorkspaceObject workspaceObject : workspaceObjects){
    if (!workspaceObject.handle().isNull()){
      openstudio::model::ModelObject modelObject = workspaceObject.cast<openstudio::model::ModelObject>();
      if(boost::optional<model::HVACComponent> hvacComponent = modelObject.optionalCast<model::HVACComponent>()) {
        if( (! hvacComponent->containingHVACComponent()) && (! hvacComponent->containingZoneHVACComponent()) ) {
          result.push_back(modelObjectToItemId(hvacComponent.get(), false));
        }
      } else {
        result.push_back(modelObjectToItemId(modelObject, false));
      }
    }
  }

  return result;
}
std::vector<OSItemId> ConstructionObjectVectorController::makeVector()
{
  std::vector<OSItemId> result;
  if(m_modelObject){
    model::LayeredConstruction construction = m_modelObject->cast<model::LayeredConstruction>();
    std::vector<model::Material> layers = construction.layers();
    BOOST_FOREACH(model::Material layer, layers){
      result.push_back(modelObjectToItemId(layer, false));
    }
  }
std::vector<OSItemId> BuildingStorySpacesVectorController::makeVector()
{
  std::vector<OSItemId> result;
  if (m_modelObject){
    model::BuildingStory buildingStory = m_modelObject->cast<model::BuildingStory>();
    BOOST_FOREACH(const model::Space& space, buildingStory.spaces()){
      result.push_back(modelObjectToItemId(space, false));
    }
  }
  return result;
}
std::vector<OSItemId> TargetTemperatureScheduleVC::makeVector()
{
  std::vector<OSItemId> result;
  if ( boost::optional<model::WaterUseEquipmentDefinition> waterUseEquipmentDefinition = this->waterUseEquipmentDefinition() ){
    boost::optional<model::Schedule> schedule = waterUseEquipmentDefinition->targetTemperatureSchedule();
    if (schedule){
      result.push_back(modelObjectToItemId(*schedule, false));
    }
  }
  return result;
}
std::vector<OSItemId> SpaceSpaceInfiltrationDesignFlowRateVectorController::makeVector()
{
    std::vector<OSItemId> result;
    if (m_modelObject) {
        model::Space space = m_modelObject->cast<model::Space>();

        // inherited
        if (space.spaceType()) {
            BOOST_FOREACH(const model::SpaceInfiltrationDesignFlowRate& spaceInfiltrationDesignFlowRate, space.spaceType()->spaceInfiltrationDesignFlowRates()) {
                OSItemId itemId = modelObjectToItemId(spaceInfiltrationDesignFlowRate, true);
                result.push_back(itemId);
            }
        }

        // direct
        BOOST_FOREACH(const model::SpaceInfiltrationDesignFlowRate& spaceInfiltrationDesignFlowRate, space.spaceInfiltrationDesignFlowRates()) {
            OSItemId itemId = modelObjectToItemId(spaceInfiltrationDesignFlowRate, false);
            result.push_back(itemId);
        }
    }
std::vector<OSItemId> OtherEquipmentScheduleVC::makeVector()
{
  std::vector<OSItemId> result;
  if (m_modelObject){
    model::DefaultScheduleSet defaultScheduleSet = m_modelObject->cast<model::DefaultScheduleSet>();
    boost::optional<model::Schedule> schedule = defaultScheduleSet.otherEquipmentSchedule();
    if (schedule){
      result.push_back(modelObjectToItemId(*schedule, false));
    }
  }
  return result;
}
std::vector<OSItemId> SpaceThermalZoneVectorController::makeVector()
{
    std::vector<OSItemId> result;
    if (m_modelObject) {
        model::Space space = m_modelObject->cast<model::Space>();
        boost::optional<model::ThermalZone> thermalZone = space.thermalZone();
        if (thermalZone) {
            result.push_back(modelObjectToItemId(*thermalZone, false));
        }
    }
    return result;
}
std::vector<OSItemId> HoursOfOperationVC::makeVector()
{
  std::vector<OSItemId> result;
  if (m_modelObject){
    model::DefaultScheduleSet defaultScheduleSet = m_modelObject->cast<model::DefaultScheduleSet>();
    boost::optional<model::Schedule> schedule = defaultScheduleSet.hoursofOperationSchedule();
    if (schedule){
      result.push_back(modelObjectToItemId(*schedule, false));
    }
  }
  return result;
}
std::vector<OSItemId> BuildingStoryUnassignedSpacesVectorController::makeVector()
{
  std::vector<OSItemId> result;
  BOOST_FOREACH(const model::Space& space, m_model->getModelObjects<model::Space>()){
    if (!space.handle().isNull()){
      if (!space.buildingStory()){
        result.push_back(modelObjectToItemId(space, false));
      }
    }
  }
  return result;
}
std::vector<OSItemId> SubSurfaceOutsideBoundaryConditionObjectVectorController::makeVector()
{
  std::vector<OSItemId> result;
  if (m_modelObject){
    model::SubSurface subSurface = m_modelObject->cast<model::SubSurface>();
    boost::optional<model::SubSurface> adjacentSubSurface = subSurface.adjacentSubSurface();
    if (adjacentSubSurface){
      result.push_back(modelObjectToItemId(*adjacentSubSurface, false));
    }
  }
  return result;
}
std::vector<OSItemId> BuildingStoryDefaultScheduleSetVectorController::makeVector()
{
  std::vector<OSItemId> result;
  if (m_modelObject){
    model::BuildingStory buildingStory = m_modelObject->cast<model::BuildingStory>();
    boost::optional<model::DefaultScheduleSet> defaultScheduleSet = buildingStory.defaultScheduleSet();
    if (defaultScheduleSet){
      result.push_back(modelObjectToItemId(*defaultScheduleSet, false));
    }
  }
  return result;
}
std::vector<OSItemId> SpaceDefaultScheduleSetVectorController::makeVector()
{
    std::vector<OSItemId> result;
    if (m_modelObject) {
        model::Space space = m_modelObject->cast<model::Space>();
        boost::optional<model::DefaultScheduleSet> defaultScheduleSet = space.defaultScheduleSet();
        if (defaultScheduleSet) {
            result.push_back(modelObjectToItemId(*defaultScheduleSet, false));
        }
    }
    return result;
}
std::vector<OSItemId> SubSurfaceConstructionVectorController::makeVector()
{
  std::vector<OSItemId> result;
  if (m_modelObject){
    model::SubSurface subSurface = m_modelObject->cast<model::SubSurface>();
    boost::optional<model::ConstructionBase> construction = subSurface.construction();
    if (construction){
      bool isDefaulted = subSurface.isConstructionDefaulted();
      OSItemId itemId = modelObjectToItemId(*construction, isDefaulted);
      result.push_back(itemId);
    }
  }
  return result;
}
std::vector<OSItemId> InternalMassDefinitionInspectorView::ConstructionVectorController::makeVector()
{
  std::vector<OSItemId> result;

  if( boost::optional<model::InternalMassDefinition> mo = internalMassDefinition() )
  {
    if( boost::optional<model::ConstructionBase> c = mo->construction() )
    {
      result.push_back(modelObjectToItemId(c.get(), false)); 
    }
  }

  return result;
}
std::vector<OSItemId> SpaceSpaceTypeVectorController::makeVector()
{
    std::vector<OSItemId> result;
    if (m_modelObject) {
        model::Space space = m_modelObject->cast<model::Space>();
        boost::optional<model::SpaceType> spaceType = space.spaceType();
        if (spaceType) {
            bool isDefaulted = space.isSpaceTypeDefaulted();
            OSItemId itemId = modelObjectToItemId(*spaceType, isDefaulted);
            result.push_back(itemId);
        }
    }
    return result;
}
std::vector<OSItemId> SpaceDesignSpecificationOutdoorAirVectorController::makeVector()
{
    std::vector<OSItemId> result;
    if (m_modelObject) {
        model::Space space = m_modelObject->cast<model::Space>();
        boost::optional<model::DesignSpecificationOutdoorAir> designSpecificationOutdoorAir = space.designSpecificationOutdoorAir();
        if (designSpecificationOutdoorAir) {
            bool isDefaulted = space.isDesignSpecificationOutdoorAirDefaulted();
            OSItemId itemId = modelObjectToItemId(*designSpecificationOutdoorAir, isDefaulted);
            result.push_back(itemId);
        }
    }
    return result;
}
Exemple #18
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);
  }
}
Exemple #19
0
void OSLineEdit2::emitItemClicked()
{
  // This m_item code is only relevant if we are building in
  // the context of openstudio_lib
#ifdef openstudio_lib_EXPORTS
  if (!m_item && m_modelObject) {
    m_item = OSItem::makeItem(modelObjectToItemId(*m_modelObject, false));
    OS_ASSERT(m_item);
    m_item->setParent(this);
    connect(m_item, &OSItem::itemRemoveClicked, this, &OSLineEdit2::onItemRemoveClicked);
  }

  if (m_item){
    // Tell EditView to display this object
    emit itemClicked(m_item);
  }
#endif
}
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);
  }
}