void SpacesSubtabGridView::initializeSpaceTypeFilter()
 {
   m_spaceTypeFilter->clear();
   m_spaceTypeFilter->addItem(ALL);
   auto spacetypes = this->m_model.getConcreteModelObjects<model::SpaceType>();
   std::sort(spacetypes.begin(), spacetypes.end(), ModelObjectNameSorter());
   for (auto st : spacetypes)
   {
     QString temp("unnamed");
     if (st.name()) {
       temp = st.name().get().c_str();
     }
     m_spaceTypeFilter->addItem(temp);
   }
 }
 void SpacesSubtabGridView::initializeInteriorPartitionGroupFilter()
 {
   m_interiorPartitionGroupFilter->clear();
   m_interiorPartitionGroupFilter->addItem(ALL);
   auto interiorPartitions = this->m_model.getConcreteModelObjects<model::InteriorPartitionSurface>();
   std::sort(interiorPartitions.begin(), interiorPartitions.end(), ModelObjectNameSorter());
   for (auto ip : interiorPartitions)
   {
     QString temp("unnamed");
     if (ip.name()) {
       temp = ip.name().get().c_str();
     }
     m_interiorPartitionGroupFilter->addItem(temp);
   }
 }
 void SpacesSubtabGridView::initializeThermalZoneFilter()
 {
   m_thermalZoneFilter->clear();
   m_thermalZoneFilter->addItem(ALL);
   m_thermalZoneFilter->addItem(UNASSIGNED);
   auto thermalZones = this->m_model.getConcreteModelObjects<model::ThermalZone>();
   std::sort(thermalZones.begin(), thermalZones.end(), ModelObjectNameSorter());
   for (auto tz : thermalZones)
   {
     QString temp("unnamed");
     if (tz.name()) {
       temp = tz.name().get().c_str();
     }
     m_thermalZoneFilter->addItem(temp);
   }
 }
 void SpacesSubtabGridView::initializeStoryFilter()
 {
   m_storyFilter->clear();
   m_storyFilter->addItem(ALL);
   m_storyFilter->addItem(UNASSIGNED);
   auto buildingStories = this->m_model.getConcreteModelObjects<model::BuildingStory>();
   std::sort(buildingStories.begin(), buildingStories.end(), ModelObjectNameSorter());
   for (auto bd : buildingStories)
   {
     QString temp("unnamed");
     if (bd.name()) {
       temp = bd.name().get().c_str();
     }
     m_storyFilter->addItem(temp);
   }
 }
 void SpacesInteriorPartitionsGridController::refreshModelObjects()
 {
   m_modelObjects = subsetCastVector<model::ModelObject>(m_model.getConcreteModelObjects<model::Space>());
   std::sort(m_modelObjects.begin(), m_modelObjects.end(), ModelObjectNameSorter());
 }
  FacilityShadingGridView::FacilityShadingGridView(bool isIP, const model::Model & model, QWidget * parent)
    : GridViewSubTab(isIP, model, parent)
  {
    auto modelObjects = subsetCastVector<model::ModelObject>(model.getModelObjects<model::ShadingSurfaceGroup>());
    std::sort(modelObjects.begin(), modelObjects.end(), ModelObjectNameSorter());

    m_gridController = new FacilityShadingGridController(isIP, "Shading Surface Group", IddObjectType::OS_ShadingSurfaceGroup, model, modelObjects);
    m_gridView = new OSGridView(m_gridController, "Shading Surface Group", "Drop\nShading Surface Group", false, parent);

    setGridController(m_gridController);
    setGridView(m_gridView);

    // Filters

    QLabel * label = nullptr;

    QVBoxLayout * layout = nullptr;

    auto filterGridLayout = new QGridLayout();
    filterGridLayout->setContentsMargins(7, 4, 0, 8);
    filterGridLayout->setSpacing(5);

    label = new QLabel();
    label->setText("Filters:");
    label->setObjectName("H2");
    filterGridLayout->addWidget(label, filterGridLayout->rowCount(), filterGridLayout->columnCount(), Qt::AlignTop | Qt::AlignLeft);

    // SHADINGSURFACEGROUPNAME

    layout = new QVBoxLayout();

    label = new QLabel();
    label->setText(SHADINGSURFACENAME);
    label->setObjectName("H3");
    layout->addWidget(label, Qt::AlignTop | Qt::AlignLeft);

    m_nameFilter = new QLineEdit();
    m_nameFilter->setFixedWidth(OSItem::ITEM_WIDTH);
    // Evan note: there are issues with using the signal textChanged or textEdited, related to the design and updating of the gridview (loss of focus, and updates per key stroke)
    connect(m_nameFilter, &QLineEdit::editingFinished, this, &openstudio::FacilityShadingGridView::nameFilterChanged);

    QRegExp nameRegex("^\\S.*");
    auto nameValidator = new QRegExpValidator(nameRegex, this);
    m_nameFilter->setValidator(nameValidator);

    layout->addWidget(m_nameFilter, Qt::AlignTop | Qt::AlignLeft);
    layout->addStretch();
    filterGridLayout->addLayout(layout, filterGridLayout->rowCount() - 1, filterGridLayout->columnCount());

    // SHADINGSURFACETYPE

    layout = new QVBoxLayout();

    label = new QLabel();
    label->setText(SHADINGSURFACETYPE);
    label->setObjectName("H3");
    layout->addWidget(label, Qt::AlignTop | Qt::AlignLeft);

    m_typeFilter = new QComboBox();
    m_typeFilter->addItem("Site");
    m_typeFilter->addItem("Building");
    m_typeFilter->addItem("Space");
    m_typeFilter->setFixedWidth(OSItem::ITEM_WIDTH);
    connect(m_typeFilter, &QComboBox::currentTextChanged, this, &openstudio::FacilityShadingGridView::typeFilterChanged);

    layout->addWidget(m_typeFilter, Qt::AlignTop | Qt::AlignLeft);
    layout->addStretch();
    filterGridLayout->addLayout(layout, filterGridLayout->rowCount() - 1, filterGridLayout->columnCount());

    // TILTGREATERTHAN

    layout = new QVBoxLayout();

    label = new QLabel();
    label->setText(TILTGREATERTHAN);
    label->setObjectName("H3");
    layout->addWidget(label, Qt::AlignTop | Qt::AlignLeft);

    m_tiltGreaterThanFilter = new QLineEdit();
    m_tiltGreaterThanFilter->setFixedWidth(OSItem::ITEM_WIDTH);
    connect(m_tiltGreaterThanFilter, &QLineEdit::editingFinished, this, &openstudio::FacilityShadingGridView::tiltFilterChanged);

    QRegExp regex("^(-?\\d*\\.?\\d+)?$");
    auto validator = new QRegExpValidator(regex, this);
    m_tiltGreaterThanFilter->setValidator(validator);

    layout->addWidget(m_tiltGreaterThanFilter, Qt::AlignTop | Qt::AlignLeft);
    layout->addStretch();
    filterGridLayout->addLayout(layout, filterGridLayout->rowCount() - 1, filterGridLayout->columnCount());

    //TILTLESSTHAN

    layout = new QVBoxLayout();

    label = new QLabel();
    label->setText(TILTLESSTHAN);
    label->setObjectName("H3");
    layout->addWidget(label, Qt::AlignTop | Qt::AlignLeft);

    m_tiltLessThanFilter = new QLineEdit();
    m_tiltLessThanFilter->setFixedWidth(OSItem::ITEM_WIDTH);
    // Evan note: there are issues with using the signal textChanged or textEdited, related to the design and updating of the gridview (loss of focus, and updates per key stroke)
    connect(m_tiltLessThanFilter, &QLineEdit::editingFinished, this, &openstudio::FacilityShadingGridView::tiltFilterChanged);

    validator = new QRegExpValidator(regex, this);
    m_tiltLessThanFilter->setValidator(validator);

    layout->addWidget(m_tiltLessThanFilter, Qt::AlignTop | Qt::AlignLeft);
    layout->addStretch();
    filterGridLayout->addLayout(layout, filterGridLayout->rowCount() - 1, filterGridLayout->columnCount());

    // ORIENTATIONGREATERTHAN

    layout = new QVBoxLayout();

    label = new QLabel();
    label->setText(ORIENTATIONGREATERTHAN);
    label->setObjectName("H3");
    layout->addWidget(label, Qt::AlignTop | Qt::AlignLeft);

    m_orientationGreaterThanFilter = new QLineEdit();
    m_orientationGreaterThanFilter->setFixedWidth(OSItem::ITEM_WIDTH);
    connect(m_orientationGreaterThanFilter, &QLineEdit::editingFinished, this, &openstudio::FacilityShadingGridView::orientationFilterChanged);

    validator = new QRegExpValidator(regex, this);
    m_orientationGreaterThanFilter->setValidator(validator);

    layout->addWidget(m_orientationGreaterThanFilter, Qt::AlignTop | Qt::AlignLeft);
    layout->addStretch();
    filterGridLayout->addLayout(layout, filterGridLayout->rowCount() - 1, filterGridLayout->columnCount());

    // ORIENTATIONLESSTHAN

    layout = new QVBoxLayout();

    label = new QLabel();
    label->setText(ORIENTATIONLESSTHAN);
    label->setObjectName("H3");
    layout->addWidget(label, Qt::AlignTop | Qt::AlignLeft);

    m_orientationLessThanFilter = new QLineEdit();
    m_orientationLessThanFilter->setFixedWidth(OSItem::ITEM_WIDTH);
    // Evan note: there are issues with using the signal textChanged or textEdited, related to the design and updating of the gridview (loss of focus, and updates per key stroke)
    connect(m_orientationLessThanFilter, &QLineEdit::editingFinished, this, &openstudio::FacilityShadingGridView::orientationFilterChanged);

    validator = new QRegExpValidator(regex, this);
    m_orientationLessThanFilter->setValidator(validator);

    layout->addWidget(m_orientationLessThanFilter, Qt::AlignTop | Qt::AlignLeft);
    layout->addStretch();
    filterGridLayout->addLayout(layout, filterGridLayout->rowCount() - 1, filterGridLayout->columnCount());

    filterGridLayout->setRowStretch(filterGridLayout->rowCount(), 100);
    filterGridLayout->setColumnStretch(filterGridLayout->columnCount(), 100);

    m_gridView->m_contentLayout->addLayout(filterGridLayout);

    m_gridView->m_contentLayout->addSpacing(7);
  }
 void FacilityShadingGridController::refreshModelObjects()
 {
   m_modelObjects = subsetCastVector<model::ModelObject>(m_model.getModelObjects<model::ShadingSurfaceGroup>());
   std::sort(m_modelObjects.begin(), m_modelObjects.end(), ModelObjectNameSorter());
 }