Skip to content

Commit

Permalink
Use oms2_getSubModelPath for tables
Browse files Browse the repository at this point in the history
  • Loading branch information
adeas31 committed Aug 17, 2018
1 parent 6920ca9 commit 9199a1a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
13 changes: 13 additions & 0 deletions OMEdit/OMEditGUI/Modeling/LibraryTreeWidget.cpp
Expand Up @@ -2387,6 +2387,19 @@ LibraryTreeItem* LibraryTreeModel::createOMSLibraryTreeItemImpl(QString name, QS
if (fmuFileInfo.isRelative()) {
QFileInfo fileInfo(pParentLibraryTreeItem->getFileName());
pLibraryTreeItem->setFileName(QString("%1/%2").arg(fileInfo.absoluteDir().absolutePath(), pFMUInfo->path));
} else {
pLibraryTreeItem->setFileName(QString(pFMUInfo->path));
}
}
} else if (pParentLibraryTreeItem && pLibraryTreeItem->getOMSElement() && pLibraryTreeItem->getOMSElement()->type == oms_component_table) {
QString path;
if (OMSProxy::instance()->getSubModelPath(pLibraryTreeItem->getNameStructure(), &path)) {
QFileInfo tableFileInfo(path);
if (tableFileInfo.isRelative()) {
QFileInfo fileInfo(pParentLibraryTreeItem->getFileName());
pLibraryTreeItem->setFileName(QString("%1/%2").arg(fileInfo.absoluteDir().absolutePath(), path));
} else {
pLibraryTreeItem->setFileName(path);
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions OMEdit/OMEditGUI/OMS/OMSProxy.cpp
Expand Up @@ -391,16 +391,16 @@ bool OMSProxy::getElements(QString cref, oms_element_t*** pElements)

/*!
* \brief OMSProxy::getFMUPath
* Returns the FMU path.
* Returns the submodel path.
* \param cref
* \param pFmuPath
* \param pPath
* \return
*/
bool OMSProxy::getFMUPath(QString cref, QString* pFmuPath)
bool OMSProxy::getSubModelPath(QString cref, QString* pPath)
{
char* path = NULL;
oms_status_enu_t status = oms2_getFMUPath(cref.toStdString().c_str(), &path);
*pFmuPath = QString(path);
oms_status_enu_t status = oms2_getSubModelPath(cref.toStdString().c_str(), &path);
*pPath = QString(path);
return statusToBool(status);
}

Expand Down
2 changes: 1 addition & 1 deletion OMEdit/OMEditGUI/OMS/OMSProxy.h
Expand Up @@ -72,7 +72,7 @@ class OMSProxy : public QObject
bool getElement(QString cref, oms_element_t** pElement);
bool setElementGeometry(QString cref, const ssd_element_geometry_t* pGeometry);
bool getElements(QString cref, oms_element_t*** pElements);
bool getFMUPath(QString cref, QString* pFmuPath);
bool getSubModelPath(QString cref, QString* pPath);
bool getFMUInfo(QString cref, const oms_fmu_info_t** pFmuInfo);
bool setConnectorGeometry(QString connector, const ssd_connector_geometry_t* pGeometry);
bool getConnections(QString cref, oms_connection_t*** pConnections);
Expand Down

0 comments on commit 9199a1a

Please sign in to comment.