Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to OS SDK 3.1.0 #235

Closed
1 task
jmarrec opened this issue Sep 17, 2020 · 2 comments · May be fixed by #236
Closed
1 task

Update to OS SDK 3.1.0 #235

jmarrec opened this issue Sep 17, 2020 · 2 comments · May be fixed by #236

Comments

@jmarrec
Copy link
Collaborator

jmarrec commented Sep 17, 2020

Issue overview

This issue aims to list changes to the OS SDK 3.1.0 that will affect the OpenStudioApplication and will require adjustment:

@jmarrec jmarrec added the Triage Issue needs to be assessed and labeled, further information on reported might be needed label Sep 17, 2020
@jmarrec
Copy link
Collaborator Author

jmarrec commented Sep 17, 2020

NREL/OpenStudio#4066:

SpacesSubSurfacesGridView will not compile, and I don't think we have a precedent anywhere in the OSApp for something like this, where we list Space, then multiple subSurfaces in second column THEN you have multiple sub "loads"/children.

Also, while the API was preserved in a backwards compatible way for ruby users for eg (SubSurface::shadingControl(), SubSurface::setShadingControl, SubSurface:resetShadingControl are left but marked OS_DEPRECATED), the ABI was broken for SubSurface::setShadingControl and it will affect us.

Before you had SubSurface::setShadingControl(const ShadingControl&) but now you have SubSurface::setShadingControl(ShadingControl&) because it has to call ShadingControl::addSubSurface(const SubSurface&) (which is non const, logically) since it's now the ShadingControl that has extensible fields to reference the SubSurfaces and not the SubSurface which has a single field to reference the ShadingControl. And our addDropZoneColumn excepts a const ValueType&

I actually think ShadingControl cannot live under the Space tab anymore. I suppose it could be a new subtab under "Facility". The leftmost column would be the ShadingControl name, then you would have the possibility of adding new SubSurfaces to it, and to tweak its fields.

Blocks that need update:

std::function<std::vector<boost::optional<model::ModelObject>>(const model::Space&)> allShadingControls(
[allSubSurfaces](const model::Space& t_space) {
std::vector<boost::optional<model::ModelObject>> allModelObjects;
std::vector<boost::optional<model::ShadingControl>> allShadingControls;
for (auto subSurface : allSubSurfaces(t_space)) {
auto shadingControl = subSurface.cast<model::SubSurface>().shadingControl();
if (shadingControl) {
allShadingControls.push_back(shadingControl);
} else {
allShadingControls.push_back(boost::optional<model::ShadingControl>());
}
}
allModelObjects.insert(allModelObjects.end(), allShadingControls.begin(), allShadingControls.end());
return allModelObjects;
});

} else if (field == SHADINGCONTROLNAME) {
addDropZoneColumn(Heading(QString(SHADINGCONTROLNAME)), CastNullAdapter<model::SubSurface>(&model::SubSurface::shadingControl),
CastNullAdapter<model::SubSurface>(&model::SubSurface::setShadingControl),
boost::optional<std::function<void(model::SubSurface*)>>(NullAdapter(&model::SubSurface::resetShadingControl)),
boost::optional<std::function<bool(model::SubSurface*)>>(), DataSource(allSubSurfaces, true));

Compiler output

/home/julien/Software/Others/OpenStudioApplication/src/openstudio_lib/SpacesSubsurfacesGridView.cpp: In lambda function:
/home/julien/Software/Others/OpenStudioApplication/src/openstudio_lib/SpacesSubsurfacesGridView.cpp:350:87: warning: ‘boost::optional<openstudio::model::ShadingControl> openstudio::model::SubSurface::shadingControl() const’ is deprecated [-Wdeprecated-declarations]
             auto shadingControl = subSurface.cast<model::SubSurface>().shadingControl();
                                                                                       ^
In file included from /home/julien/Software/Others/OpenStudioApplication/src/openstudio_lib/SpacesSubsurfacesGridView.cpp:53:0:
/home/julien/Software/Others/OS-build/_CPack_Packages/Linux/TGZ/OpenStudio-3.1.0-alpha+81589881a6-Linux/usr/local/openstudio-3.1.0-alpha/include/openstudio/model/SubSurface.hpp:96:49: note: declared here
   OS_DEPRECATED boost::optional<ShadingControl> shadingControl() const;
                                                 ^~~~~~~~~~~~~~
/home/julien/Software/Others/OpenStudioApplication/src/openstudio_lib/SpacesSubsurfacesGridView.cpp: In member function ‘virtual void openstudio::SpacesSubsurfacesGridController::addColumns(const QString&, std::vector<QString>&)’:
/home/julien/Software/Others/OpenStudioApplication/src/openstudio_lib/SpacesSubsurfacesGridView.cpp:434:120: warning: ‘boost::optional<openstudio::model::ShadingControl> openstudio::model::SubSurface::shadingControl() const’ is deprecated [-Wdeprecated-declarations]
         addDropZoneColumn(Heading(QString(SHADINGCONTROLNAME)), CastNullAdapter<model::SubSurface>(&model::SubSurface::shadingControl),
                                                                                                                        ^~~~~~~~~~~~~~
In file included from /home/julien/Software/Others/OpenStudioApplication/src/openstudio_lib/SpacesSubsurfacesGridView.cpp:53:0:
/home/julien/Software/Others/OS-build/_CPack_Packages/Linux/TGZ/OpenStudio-3.1.0-alpha+81589881a6-Linux/usr/local/openstudio-3.1.0-alpha/include/openstudio/model/SubSurface.hpp:96:49: note: declared here
   OS_DEPRECATED boost::optional<ShadingControl> shadingControl() const;
                                                 ^~~~~~~~~~~~~~
/home/julien/Software/Others/OpenStudioApplication/src/openstudio_lib/SpacesSubsurfacesGridView.cpp:435:82: warning: ‘bool openstudio::model::SubSurface::setShadingControl(openstudio::model::ShadingControl&)’ is deprecated [-Wdeprecated-declarations]
                           CastNullAdapter<model::SubSurface>(&model::SubSurface::setShadingControl),
                                                                                  ^~~~~~~~~~~~~~~~~
In file included from /home/julien/Software/Others/OpenStudioApplication/src/openstudio_lib/SpacesSubsurfacesGridView.cpp:53:0:
/home/julien/Software/Others/OS-build/_CPack_Packages/Linux/TGZ/OpenStudio-3.1.0-alpha+81589881a6-Linux/usr/local/openstudio-3.1.0-alpha/include/openstudio/model/SubSurface.hpp:134:22: note: declared here
   OS_DEPRECATED bool setShadingControl(ShadingControl& shadingControl);
                      ^~~~~~~~~~~~~~~~~
/home/julien/Software/Others/OpenStudioApplication/src/openstudio_lib/SpacesSubsurfacesGridView.cpp:436:116: warning: ‘void openstudio::model::SubSurface::resetShadingControl()’ is deprecated [-Wdeprecated-declarations]
                           boost::optional<std::function<void(model::SubSurface*)>>(NullAdapter(&model::SubSurface::resetShadingControl)),
                                                                                                                    ^~~~~~~~~~~~~~~~~~~
In file included from /home/julien/Software/Others/OpenStudioApplication/src/openstudio_lib/SpacesSubsurfacesGridView.cpp:53:0:
/home/julien/Software/Others/OS-build/_CPack_Packages/Linux/TGZ/OpenStudio-3.1.0-alpha+81589881a6-Linux/usr/local/openstudio-3.1.0-alpha/include/openstudio/model/SubSurface.hpp:137:22: note: declared here
   OS_DEPRECATED void resetShadingControl();
                      ^~~~~~~~~~~~~~~~~~~
/home/julien/Software/Others/OpenStudioApplication/src/openstudio_lib/SpacesSubsurfacesGridView.cpp:437:119: error: no matching function for call to ‘openstudio::SpacesSubsurfacesGridController::addDropZoneColumn(openstudio::Heading, std::function<boost::optional<openstudio::model::ShadingControl>(openstudio::model::SubSurface*)>, std::function<bool(openstudio::model::SubSurface*, openstudio::model::ShadingControl)>, boost::optional<std::function<void(openstudio::model::SubSurface*)> >, boost::optional<std::function<bool(openstudio::model::SubSurface*)> >, openstudio::DataSource)’
                           boost::optional<std::function<bool(model::SubSurface*)>>(), DataSource(allSubSurfaces, true));
                                                                                                                       ^
In file included from /home/julien/Software/Others/OpenStudioApplication/src/openstudio_lib/SpacesSubsurfacesGridView.hpp:33:0,
                 from /home/julien/Software/Others/OpenStudioApplication/src/openstudio_lib/SpacesSubsurfacesGridView.cpp:30:
/home/julien/Software/Others/OpenStudioApplication/src/openstudio_lib/../shared_gui_components/OSGridController.hpp:452:8: note: candidate: template<class ValueType, class DataSourceType> void openstudio::OSGridController::addDropZoneColumn(const openstudio::Heading&, std::function<boost::optional<T>(DataSourceType*)>, std::function<bool(DataSourceType*, const ValueType&)>, boost::optional<std::function<void(DataSourceType*)> >, boost::optional<std::function<bool(DataSourceType*)> >, const boost::optional<openstudio::DataSource>&)
   void addDropZoneColumn(const Heading& heading, std::function<boost::optional<ValueType>(DataSourceType*)> getter,
        ^~~~~~~~~~~~~~~~~
/home/julien/Software/Others/OpenStudioApplication/src/openstudio_lib/../shared_gui_components/OSGridController.hpp:452:8: note:   template argument deduction/substitution failed:
/home/julien/Software/Others/OpenStudioApplication/src/openstudio_lib/SpacesSubsurfacesGridView.cpp:437:119: note:   mismatched types ‘const ValueType&’ and ‘openstudio::model::ShadingControl’
                           boost::optional<std::function<bool(model::SubSurface*)>>(), DataSource(allSubSurfaces, true));

@jmarrec jmarrec self-assigned this Sep 17, 2020
jmarrec added a commit that referenced this issue Sep 17, 2020
jmarrec added a commit that referenced this issue Sep 17, 2020
jmarrec added a commit that referenced this issue Sep 17, 2020
@jmarrec jmarrec added Developer Issue 🤓 and removed Triage Issue needs to be assessed and labeled, further information on reported might be needed labels Oct 6, 2020
@jmarrec
Copy link
Collaborator Author

jmarrec commented Oct 8, 2020

Fixed. The Shading COntrol thing was moved to another issue at #239

@jmarrec jmarrec closed this as completed Oct 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants