示例#1
0
bool OSDocument::fromComponentLibrary(const OSItemId& itemId) const
{
  bool fromCompLibrary = (itemId.sourceId() == modelToSourceId(m_compLibrary));
  bool fromHVACCompLibrary = (itemId.sourceId() == modelToSourceId(m_hvacCompLibrary));
  bool fromCombinedCompLibrary = (itemId.sourceId() == modelToSourceId(m_combinedCompLibrary));
  bool result = (fromCompLibrary || fromHVACCompLibrary || fromCombinedCompLibrary);
  return result;
}
示例#2
0
boost::optional<model::ModelObject> OSDocument::getModelObject(const OSItemId& itemId) const
{
  if (fromModel(itemId)){
    Handle handle(itemId.itemId());
    return m_model.getModelObject<model::ModelObject>(handle);
  }else if (fromComponentLibrary(itemId)){
    if (itemId.sourceId() == modelToSourceId(m_compLibrary)){
      Handle handle(itemId.itemId());
      return m_compLibrary.getModelObject<model::ModelObject>(handle);
    }else if (itemId.sourceId() == modelToSourceId(m_hvacCompLibrary)){
      Handle handle(itemId.itemId());
      return m_hvacCompLibrary.getModelObject<model::ModelObject>(handle);
    }else if (itemId.sourceId() == modelToSourceId(m_combinedCompLibrary)){
      Handle handle(itemId.itemId());
      return m_combinedCompLibrary.getModelObject<model::ModelObject>(handle);
    }
  }

  return boost::none;
}
示例#3
0
void VRFController::refreshNow()
{
  if( ! m_dirty ) return;

  if( m_detailView )
  {
    m_detailView->setId(OSItemId());
    m_detailView->removeAllVRFTerminalViews();

    if( m_currentSystem )
    {
      m_detailView->setId(OSItemId(m_currentSystem->handle().toString(),modelToSourceId(m_currentSystem->model()),false));

      connect(m_detailView.data(), &VRFSystemView::inspectClicked, this, &VRFController::inspectOSItem);

      std::vector<model::ZoneHVACTerminalUnitVariableRefrigerantFlow> terminals = m_currentSystem->terminals();
      for(std::vector<model::ZoneHVACTerminalUnitVariableRefrigerantFlow>::iterator it = terminals.begin();
          it != terminals.end();
          ++it)
      {
        VRFTerminalView * vrfTerminalView = new VRFTerminalView();
        vrfTerminalView->setId(OSItemId(it->handle().toString(),modelToSourceId(it->model()),false));
        m_detailView->addVRFTerminalView(vrfTerminalView);
        connect(vrfTerminalView, &VRFTerminalView::componentDroppedOnZone, this, &VRFController::onVRFTerminalViewDrop);
        connect(vrfTerminalView, &VRFTerminalView::removeZoneClicked, this, &VRFController::onRemoveZoneClicked);
        connect(vrfTerminalView, &VRFTerminalView::removeTerminalClicked, this, &VRFController::onRemoveTerminalClicked);
        connect(vrfTerminalView, &VRFTerminalView::terminalIconClicked, this, &VRFController::inspectOSItem);
        if( boost::optional<model::ThermalZone> zone = it->thermalZone() )
        {
          vrfTerminalView->zoneDropZone->setHasZone(true);
          vrfTerminalView->removeZoneButtonItem->setVisible(true);
          QString zoneName = QString::fromStdString(zone->name().get());
          vrfTerminalView->zoneDropZone->setText(zoneName);
          vrfTerminalView->zoneDropZone->setToolTip(zoneName);
        }
      }
    }
  }

  m_dirty = false;
}
示例#4
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()));
}
示例#5
0
bool OSDocument::fromModel(const OSItemId& itemId) const
{
  return (itemId.sourceId() == modelToSourceId(m_model));
}