From 9d25b386870454972371d4f2218814d789a7d0f2 Mon Sep 17 00:00:00 2001 From: Adeel Asghar Date: Thu, 31 May 2018 14:48:54 +0200 Subject: [PATCH] Use oms2_setConnectorGeometry for connectors Bit of code cleanup. --- .../Annotations/PolygonAnnotation.cpp | 36 ---- .../OMEditGUI/Annotations/PolygonAnnotation.h | 4 - OMEdit/OMEditGUI/Component/Component.cpp | 166 +----------------- OMEdit/OMEditGUI/Component/Component.h | 9 - OMEdit/OMEditGUI/OMS/OMSProxy.cpp | 41 +++-- OMEdit/OMEditGUI/OMS/OMSProxy.h | 29 +-- OMEdit/OMEditGUI/OMS/OMSSimulationDialog.cpp | 3 +- 7 files changed, 51 insertions(+), 237 deletions(-) diff --git a/OMEdit/OMEditGUI/Annotations/PolygonAnnotation.cpp b/OMEdit/OMEditGUI/Annotations/PolygonAnnotation.cpp index 032831b5865..2a12f2a2c24 100644 --- a/OMEdit/OMEditGUI/Annotations/PolygonAnnotation.cpp +++ b/OMEdit/OMEditGUI/Annotations/PolygonAnnotation.cpp @@ -73,42 +73,6 @@ PolygonAnnotation::PolygonAnnotation(ShapeAnnotation *pShapeAnnotation, Graphics connect(pShapeAnnotation, SIGNAL(deleted()), this, SLOT(referenceShapeDeleted())); } -PolygonAnnotation::PolygonAnnotation(qreal x, qreal y, GraphicsView *pGraphicsView) - : ShapeAnnotation(false, pGraphicsView, 0) -{ - // set the default values - GraphicItem::setDefaults(); - FilledShape::setDefaults(); - ShapeAnnotation::setDefaults(); - // create a blue arrow - setLineColor(QColor(0, 0, 127)); - setFillColor(QColor(0, 0, 127)); - setFillPattern(StringHandler::FillSolid); - QList points; - points << QPointF(x - 10, y + 10) << QPointF(x + 10, y) << QPointF(x -10, y - 10) << QPointF(x - 10, y + 10); - setPoints(points); - setPos(mOrigin); - setRotation(mRotation); -} - -PolygonAnnotation::PolygonAnnotation(Component *pParent) - : ShapeAnnotation(pParent) -{ - // set the default values - GraphicItem::setDefaults(); - FilledShape::setDefaults(); - ShapeAnnotation::setDefaults(); - // create a blue arrow - setLineColor(QColor(0, 0, 127)); - setFillColor(QColor(0, 0, 127)); - setFillPattern(StringHandler::FillSolid); - QList points; - points << QPointF(-100, 100) << QPointF(100, 0) << QPointF(-100, -100) << QPointF(-100, 100); - setPoints(points); - setPos(mOrigin); - setRotation(mRotation); -} - void PolygonAnnotation::parseShapeAnnotation(QString annotation) { GraphicItem::parseShapeAnnotation(annotation); diff --git a/OMEdit/OMEditGUI/Annotations/PolygonAnnotation.h b/OMEdit/OMEditGUI/Annotations/PolygonAnnotation.h index bf9bfe7d601..ee09dcd111a 100644 --- a/OMEdit/OMEditGUI/Annotations/PolygonAnnotation.h +++ b/OMEdit/OMEditGUI/Annotations/PolygonAnnotation.h @@ -48,10 +48,6 @@ class PolygonAnnotation : public ShapeAnnotation PolygonAnnotation(ShapeAnnotation *pShapeAnnotation, Component *pParent); // Used for icon/diagram inherited shape PolygonAnnotation(ShapeAnnotation *pShapeAnnotation, GraphicsView *pGraphicsView); - // Used for OMSimulator Input Output signal - PolygonAnnotation(qreal x, qreal y, GraphicsView *pGraphicsView); - // Used for OMSimulator Input Output signal component - PolygonAnnotation(Component *pParent); void parseShapeAnnotation(QString annotation); QPainterPath getShape() const; QRectF boundingRect() const; diff --git a/OMEdit/OMEditGUI/Component/Component.cpp b/OMEdit/OMEditGUI/Component/Component.cpp index 2b7405b9fe0..21317e00873 100644 --- a/OMEdit/OMEditGUI/Component/Component.cpp +++ b/OMEdit/OMEditGUI/Component/Component.cpp @@ -88,8 +88,6 @@ ComponentInfo::ComponentInfo(QObject *pParent) mDimensions = 3; mTLMCausality = StringHandler::getTLMCausality(StringHandler::TLMBidirectional); mDomain = StringHandler::getTLMDomain(StringHandler::Mechanical); - mOMSCausality = oms_causality_undefined; - mOMSSignalType = oms_signal_type_real; } /*! @@ -140,8 +138,6 @@ void ComponentInfo::updateComponentInfo(const ComponentInfo *pComponentInfo) mDimensions = pComponentInfo->getDimensions(); mTLMCausality = pComponentInfo->getTLMCausality(); mDomain = pComponentInfo->getDomain(); - mOMSCausality = pComponentInfo->getOMSCausality(); - mOMSSignalType = pComponentInfo->getOMSSignalType(); } /*! @@ -381,8 +377,7 @@ bool ComponentInfo::operator==(const ComponentInfo &componentInfo) const (componentInfo.getModelFile() == this->getModelFile()) && (componentInfo.getGeometryFile() == this->getGeometryFile()) && (componentInfo.getPosition() == this->getPosition()) && (componentInfo.getAngle321() == this->getAngle321()) && (componentInfo.getDimensions() == this->getDimensions()) && (componentInfo.getTLMCausality() == this->getTLMCausality()) && - (componentInfo.getDomain() == this->getDomain()) && (componentInfo.getOMSCausality() == this->getOMSCausality()) && - (componentInfo.getOMSSignalType() == this->getOMSSignalType()); + (componentInfo.getDomain() == this->getDomain()); } /*! @@ -707,90 +702,6 @@ Component::Component(ComponentInfo *pComponentInfo, Component *pParentComponent) updateToolTip(); } -Component::Component(ComponentInfo *pComponentInfo, LibraryTreeItem *pLibraryTreeItem, Component *pParentComponent) - : QGraphicsItem(pParentComponent), mpReferenceComponent(0), mpParentComponent(pParentComponent) -{ - mpLibraryTreeItem = pLibraryTreeItem; - mpComponentInfo = pComponentInfo; - mIsInheritedComponent = false; - mComponentType = Component::Port; - mpGraphicsView = mpParentComponent->getGraphicsView(); - mTransformationString = ""; - mDialogAnnotation.clear(); - mChoicesAnnotation.clear(); - mpResizerRectangle = 0; - mpNonExistingComponentLine = 0; - mpDefaultComponentRectangle = 0; - mpDefaultComponentText = 0; - mpInputOutputComponentPolygon = new PolygonAnnotation(this); - if (mpComponentInfo->getOMSCausality() == oms_causality_input) { - switch (mpComponentInfo->getOMSSignalType()) { - case oms_signal_type_integer: - mpInputOutputComponentPolygon->setLineColor(QColor(255,127,0)); - mpInputOutputComponentPolygon->setFillColor(QColor(255,127,0)); - break; - case oms_signal_type_boolean: - mpInputOutputComponentPolygon->setLineColor(QColor(255,0,255)); - mpInputOutputComponentPolygon->setFillColor(QColor(255,0,255)); - break; - case oms_signal_type_string: - qDebug() << "Component::Component() oms_signal_type_string not implemented yet."; - break; - case oms_signal_type_enum: - qDebug() << "Component::Component() oms_signal_type_enum not implemented yet."; - break; - case oms_signal_type_bus: - qDebug() << "Component::Component() oms_signal_type_bus not implemented yet."; - break; - case oms_signal_type_real: - default: - mpInputOutputComponentPolygon->setLineColor(QColor(0, 0, 127)); - mpInputOutputComponentPolygon->setFillColor(QColor(0, 0, 127)); - break; - } - } else if (mpComponentInfo->getOMSCausality() == oms_causality_output) { - switch (mpComponentInfo->getOMSSignalType()) { - case oms_signal_type_integer: - mpInputOutputComponentPolygon->setLineColor(QColor(255,127,0)); - mpInputOutputComponentPolygon->setFillColor(QColor(255,255,255)); - break; - case oms_signal_type_boolean: - mpInputOutputComponentPolygon->setLineColor(QColor(255,0,255)); - mpInputOutputComponentPolygon->setFillColor(QColor(255,255,255)); - break; - case oms_signal_type_string: - qDebug() << "oms_signal_type_string not implemented yet."; - break; - case oms_signal_type_enum: - qDebug() << "oms_signal_type_enum not implemented yet."; - break; - case oms_signal_type_bus: - qDebug() << "oms_signal_type_bus not implemented yet."; - break; - case oms_signal_type_real: - default: - mpInputOutputComponentPolygon->setLineColor(QColor(0, 0, 127)); - mpInputOutputComponentPolygon->setFillColor(QColor(255, 255, 255)); - break; - } - } - mpStateComponentRectangle = 0; - mHasTransition = false; - mIsInitialState = false; - - // Transformation. Doesn't matter what we set here since it will be overwritten in adjustInterfacePoints(); - QString transformation = QString("Placement(true,100.0,100.0,-15.0,-15.0,15.0,15.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0)"); - mTransformation = Transformation(mpGraphicsView->getViewType(), this); - mTransformation.parseTransformationString(transformation, boundingRect().width(), boundingRect().height()); - setTransform(mTransformation.getTransformationMatrix()); - mpOriginItem = 0; - mpBottomLeftResizerItem = 0; - mpTopLeftResizerItem = 0; - mpTopRightResizerItem = 0; - mpBottomRightResizerItem = 0; - updateToolTip(); -} - /*! * \brief Component::hasShapeAnnotation * Checks if Component has any ShapeAnnotation @@ -1514,73 +1425,6 @@ void Component::adjustInterfacePoints() } } -/*! - * \brief Component::adjustOMSSignals - * Dynamically adjusts the size of OMSimulator signals. - */ -void Component::adjustOMSSignals() -{ - if (mpGraphicsView->getModelWidget()->getLibraryTreeItem()->getLibraryType() == LibraryTreeItem::OMS) { - if (!mComponentsList.isEmpty()) { - // build two lists based on inputs and outputs - QList inputComponentsList, outputComponentsList; - foreach (Component *pComponent, mComponentsList) { - if (pComponent->getComponentInfo()->getOMSCausality() == oms_causality_input) { - inputComponentsList.append(pComponent); - } else if (pComponent->getComponentInfo()->getOMSCausality() == oms_causality_output) { - outputComponentsList.append(pComponent); - } - } - // we start with default size of 30 - int inputSignalSize = 30; - // keep the separator size to 1/3. - int inputSignalSeparatorSize = (inputSignalSize / 3); - // 200 is the maximum height of submodel - while (200 <= inputComponentsList.size() * (inputSignalSize + inputSignalSeparatorSize)) { - inputSignalSize -= 1; - if (inputSignalSize <= 0) { - inputSignalSize = 1; - break; - } - inputSignalSeparatorSize = (inputSignalSize / 3); - } - // set the new transformation for each input signal. - qreal inputYPosition = 100 - (inputSignalSize / 2); - foreach (Component *pComponent, inputComponentsList) { - qreal inputXPosition = -100 - (inputSignalSize / 2); - QString transformation = QString("Placement(true,%1,%2,-%3,-%3,%3,%3,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0)").arg(inputXPosition).arg(inputYPosition) - .arg(inputSignalSize / 2); - inputYPosition -= (inputSignalSize + inputSignalSeparatorSize); - pComponent->mTransformation.parseTransformationString(transformation, boundingRect().width(), boundingRect().height()); - pComponent->setTransform(pComponent->mTransformation.getTransformationMatrix()); - } - // we start with default size of 30 - int outputSignalSize = 30; - // keep the separator size to 1/3. - int outputSignalSeparatorSize = (outputSignalSize / 3); - // 200 is the maximum height of submodel - while (200 <= outputComponentsList.size() * (outputSignalSize + outputSignalSeparatorSize)) { - outputSignalSize -= 1; - if (outputSignalSize <= 0) { - outputSignalSize = 1; - break; - } - outputSignalSeparatorSize = (outputSignalSize / 3); - } - // set the new transformation for each output signal. - qreal outputYPosition = 100 - (outputSignalSize / 2); - foreach (Component *pComponent, outputComponentsList) { - qreal outputXPosition = 100 + (outputSignalSize / 2); - QString transformation = QString("Placement(true,%1,%2,-%3,-%3,%3,%3,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0)").arg(outputXPosition).arg(outputYPosition) - .arg(outputSignalSize / 2); - outputYPosition -= (outputSignalSize + outputSignalSeparatorSize); - pComponent->mTransformation.parseTransformationString(transformation, boundingRect().width(), boundingRect().height()); - pComponent->setTransform(pComponent->mTransformation.getTransformationMatrix()); - } - } - } -} - /*! * \brief Component::createNonExistingComponent * Creates a non-existing component. @@ -2183,8 +2027,12 @@ void Component::updatePlacementAnnotation() pElementGeometry->y2 = extent2.y(); pElementGeometry->rotation = mTransformation.getRotateAngle(); OMSProxy::instance()->setElementGeometry(mpLibraryTreeItem->getNameStructure(), pElementGeometry); - } else { - qDebug() << "Component::updatePlacementAnnotation() expected to have the OMS Element."; + } else if (mpLibraryTreeItem && mpLibraryTreeItem->getOMSConnector()) { + ssd_connector_geometry_t *pConnectorGeometry = mpLibraryTreeItem->getOMSConnector()->geometry; + pConnectorGeometry->x = Utilities::mapToCoOrdinateSystem(mTransformation.getOrigin().x(), -100, 100, 0, 1); + pConnectorGeometry->y = Utilities::mapToCoOrdinateSystem(mTransformation.getOrigin().y(), -100, 100, 0, 1); + OMSProxy::instance()->setConnectorGeometry(QString("%1:%2").arg(mpLibraryTreeItem->parent()->getNameStructure()) + .arg(mpLibraryTreeItem->getName()), pConnectorGeometry); } } else { OMCProxy *pOMCProxy = MainWindow::instance()->getOMCProxy(); diff --git a/OMEdit/OMEditGUI/Component/Component.h b/OMEdit/OMEditGUI/Component/Component.h index 7ab6d2edee7..56b9cd3745a 100644 --- a/OMEdit/OMEditGUI/Component/Component.h +++ b/OMEdit/OMEditGUI/Component/Component.h @@ -122,10 +122,6 @@ class ComponentInfo : public QObject int getDimensions() const {return mDimensions;} void setTLMCausality(QString causality) {mTLMCausality = causality;} QString getTLMCausality() const {return mTLMCausality;} - void setOMSCausality(oms_causality_enu_t causality) {mOMSCausality = causality;} - oms_causality_enu_t getOMSCausality() const {return mOMSCausality;} - void setOMSSignalType(oms_signal_type_enu_t signalType) {mOMSSignalType = signalType;} - oms_signal_type_enu_t getOMSSignalType() const {return mOMSSignalType;} void setDomain(QString domain) {mDomain = domain;} QString getDomain() const {return mDomain;} // operator overloading @@ -162,8 +158,6 @@ class ComponentInfo : public QObject int mDimensions; QString mTLMCausality; QString mDomain; - oms_causality_enu_t mOMSCausality; - oms_signal_type_enu_t mOMSSignalType; bool isModiferClassRecord(QString modifierName, Component *pComponent); }; @@ -185,8 +179,6 @@ class Component : public QObject, public QGraphicsItem Component(Component *pComponent, GraphicsView *pGraphicsView); // used for interface point Component(ComponentInfo *pComponentInfo, Component *pParentComponent); - // used for OMSimulator signals - Component(ComponentInfo *pComponentInfo, LibraryTreeItem *pLibraryTreeItem, Component *pParentComponent); bool isInheritedComponent() {return mIsInheritedComponent;} bool hasShapeAnnotation(Component *pComponent); bool hasNonExistingClass(); @@ -250,7 +242,6 @@ class Component : public QObject, public QGraphicsItem void insertInterfacePoint(QString interfaceName, QString position, QString angle321, int dimensions, QString causality, QString domain); void removeInterfacePoint(QString interfaceName); void adjustInterfacePoints(); - void adjustOMSSignals(); Transformation mTransformation; Transformation mOldTransformation; diff --git a/OMEdit/OMEditGUI/OMS/OMSProxy.cpp b/OMEdit/OMEditGUI/OMS/OMSProxy.cpp index 7c2326da65c..a3b2f4987ad 100644 --- a/OMEdit/OMEditGUI/OMS/OMSProxy.cpp +++ b/OMEdit/OMEditGUI/OMS/OMSProxy.cpp @@ -313,7 +313,7 @@ bool OMSProxy::deleteSubModel(QString modelIdent, QString subModelIdent) * \param pModelName * \return */ -bool OMSProxy::loadModel(QString filename, QString *pModelName) +bool OMSProxy::loadModel(QString filename, QString* pModelName) { char* ident = NULL; oms_status_enu_t status = oms2_loadModel(filename.toStdString().c_str(), &ident); @@ -341,7 +341,7 @@ bool OMSProxy::saveModel(QString filename, QString ident) * \param pElement * \return */ -bool OMSProxy::getElement(QString cref, oms_element_t **pElement) +bool OMSProxy::getElement(QString cref, oms_element_t** pElement) { oms_status_enu_t status = oms2_getElement(cref.toStdString().c_str(), pElement); return statusToBool(status); @@ -354,7 +354,7 @@ bool OMSProxy::getElement(QString cref, oms_element_t **pElement) * \param pGeometry * \return */ -bool OMSProxy::setElementGeometry(QString cref, const ssd_element_geometry_t *pGeometry) +bool OMSProxy::setElementGeometry(QString cref, const ssd_element_geometry_t* pGeometry) { oms_status_enu_t status = oms2_setElementGeometry(cref.toStdString().c_str(), pGeometry); return statusToBool(status); @@ -367,7 +367,7 @@ bool OMSProxy::setElementGeometry(QString cref, const ssd_element_geometry_t *pG * \param pElements * \return */ -bool OMSProxy::getElements(QString cref, oms_element_t ***pElements) +bool OMSProxy::getElements(QString cref, oms_element_t*** pElements) { oms_status_enu_t status = oms2_getElements(cref.toStdString().c_str(), pElements); return statusToBool(status); @@ -380,7 +380,7 @@ bool OMSProxy::getElements(QString cref, oms_element_t ***pElements) * \param pFmuPath * \return */ -bool OMSProxy::getFMUPath(QString cref, QString *pFmuPath) +bool OMSProxy::getFMUPath(QString cref, QString* pFmuPath) { char* path = NULL; oms_status_enu_t status = oms2_getFMUPath(cref.toStdString().c_str(), &path); @@ -395,12 +395,25 @@ bool OMSProxy::getFMUPath(QString cref, QString *pFmuPath) * \param pFmuInfo * \return */ -bool OMSProxy::getFMUInfo(QString cref, const oms_fmu_info_t **pFmuInfo) +bool OMSProxy::getFMUInfo(QString cref, const oms_fmu_info_t** pFmuInfo) { oms_status_enu_t status = oms2_getFMUInfo(cref.toStdString().c_str(), pFmuInfo); return statusToBool(status); } +/*! + * \brief OMSProxy::setConnectorGeometry + * Sets the connector geometry. + * \param connector + * \param pGeometry + * \return + */ +bool OMSProxy::setConnectorGeometry(QString connector, const ssd_connector_geometry_t* pGeometry) +{ + oms_status_enu_t status = oms2_setConnectorGeometry(connector.toStdString().c_str(), pGeometry); + return statusToBool(status); +} + /*! * \brief OMSProxy::getConnections * Get the model connections @@ -408,7 +421,7 @@ bool OMSProxy::getFMUInfo(QString cref, const oms_fmu_info_t **pFmuInfo) * \param pConnections * \return */ -bool OMSProxy::getConnections(QString cref, oms_connection_t ***pConnections) +bool OMSProxy::getConnections(QString cref, oms_connection_t*** pConnections) { oms_status_enu_t status = oms2_getConnections(cref.toStdString().c_str(), pConnections); return statusToBool(status); @@ -451,7 +464,7 @@ bool OMSProxy::deleteConnection(QString cref, QString conA, QString conB) * \param pConnection * \return */ -bool OMSProxy::updateConnection(QString cref, QString conA, QString conB, const oms_connection_t *pConnection) +bool OMSProxy::updateConnection(QString cref, QString conA, QString conB, const oms_connection_t* pConnection) { oms_status_enu_t status = oms2_updateConnection(cref.toStdString().c_str(), conA.toStdString().c_str(), conB.toStdString().c_str(), pConnection); @@ -477,7 +490,7 @@ bool OMSProxy::initialize(QString ident) * \param terminate * \return */ -bool OMSProxy::simulate_asynchronous(QString ident/*, int *terminate*/) +bool OMSProxy::simulate_asynchronous(QString ident/*, int* terminate*/) { oms_status_enu_t status = oms2_simulate_asynchronous(ident.toStdString().c_str(), /*terminate,*/ simulateCallback); return statusToBool(status); @@ -554,7 +567,7 @@ void OMSProxy::setWorkingDirectory(QString path) * \param pValue * \return */ -bool OMSProxy::getRealParameter(QString signal, double *pValue) +bool OMSProxy::getRealParameter(QString signal, double* pValue) { oms_status_enu_t status = oms2_getRealParameter(signal.toStdString().c_str(), pValue); return statusToBool(status); @@ -580,7 +593,7 @@ bool OMSProxy::setRealParameter(const char* signal, double value) * \param pValue * \return */ -bool OMSProxy::getIntegerParameter(QString signal, int *pValue) +bool OMSProxy::getIntegerParameter(QString signal, int* pValue) { oms_status_enu_t status = oms2_getIntegerParameter(signal.toStdString().c_str(), pValue); return statusToBool(status); @@ -606,7 +619,7 @@ bool OMSProxy::setIntegerParameter(const char* signal, int value) * \param pValue * \return */ -bool OMSProxy::getBooleanParameter(QString signal, bool *pValue) +bool OMSProxy::getBooleanParameter(QString signal, bool* pValue) { oms_status_enu_t status = oms2_getBooleanParameter(signal.toStdString().c_str(), pValue); return statusToBool(status); @@ -632,7 +645,7 @@ bool OMSProxy::setBooleanParameter(const char* signal, bool value) * \param startTime * \return */ -bool OMSProxy::getStartTime(QString cref, double *startTime) +bool OMSProxy::getStartTime(QString cref, double* startTime) { oms_status_enu_t status = oms2_getStartTime(cref.toStdString().c_str(), startTime); return statusToBool(status); @@ -658,7 +671,7 @@ bool OMSProxy::setStartTime(QString cref, double startTime) * \param stopTime * \return */ -bool OMSProxy::getStopTime(QString cref, double *stopTime) +bool OMSProxy::getStopTime(QString cref, double* stopTime) { oms_status_enu_t status = oms2_getStopTime(cref.toStdString().c_str(), stopTime); return statusToBool(status); diff --git a/OMEdit/OMEditGUI/OMS/OMSProxy.h b/OMEdit/OMEditGUI/OMS/OMSProxy.h index cd652ab803d..a6006cdb040 100644 --- a/OMEdit/OMEditGUI/OMS/OMSProxy.h +++ b/OMEdit/OMEditGUI/OMS/OMSProxy.h @@ -66,34 +66,35 @@ class OMSProxy : public QObject bool addFMU(QString modelIdent, QString fmuPath, QString fmuIdent); bool deleteSubModel(QString modelIdent, QString subModelIdent); bool rename(QString identOld, QString identNew); - bool loadModel(QString filename, QString *pModelName); + bool loadModel(QString filename, QString* pModelName); bool saveModel(QString filename, QString ident); - 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 getFMUInfo(QString cref, const oms_fmu_info_t **pFmuInfo); - bool getConnections(QString cref, oms_connection_t ***pConnections); + 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 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); bool addConnection(QString cref, QString conA, QString conB); bool deleteConnection(QString cref, QString conA, QString conB); - bool updateConnection(QString cref, QString conA, QString conB, const oms_connection_t *pConnection); + bool updateConnection(QString cref, QString conA, QString conB, const oms_connection_t* pConnection); bool initialize(QString ident); - bool simulate_asynchronous(QString ident/*, int *terminate*/); + bool simulate_asynchronous(QString ident/*, int* terminate*/); bool reset(QString ident); bool terminate(QString ident); void setLoggingLevel(int logLevel); void setLogFile(QString filename); void setTempDirectory(QString path); void setWorkingDirectory(QString path); - bool getRealParameter(QString signal, double *pValue); + bool getRealParameter(QString signal, double* pValue); bool setRealParameter(const char* signal, double value); - bool getIntegerParameter(QString signal, int *pValue); + bool getIntegerParameter(QString signal, int* pValue); bool setIntegerParameter(const char* signal, int value); - bool getBooleanParameter(QString signal, bool *pValue); + bool getBooleanParameter(QString signal, bool* pValue); bool setBooleanParameter(const char* signal, bool value); - bool getStartTime(QString cref, double *startTime); + bool getStartTime(QString cref, double* startTime); bool setStartTime(QString cref, double startTime); - bool getStopTime(QString cref, double *stopTime); + bool getStopTime(QString cref, double* stopTime); bool setStopTime(QString cref, double stopTime); bool setCommunicationInterval(QString cref, double communicationInterval); bool setResultFile(QString cref, QString filename); diff --git a/OMEdit/OMEditGUI/OMS/OMSSimulationDialog.cpp b/OMEdit/OMEditGUI/OMS/OMSSimulationDialog.cpp index 14e22b10134..ea73c8d2a0d 100644 --- a/OMEdit/OMEditGUI/OMS/OMSSimulationDialog.cpp +++ b/OMEdit/OMEditGUI/OMS/OMSSimulationDialog.cpp @@ -218,10 +218,11 @@ void OMSSimulationDialog::initializeFields() setWindowTitle(QString("%1 - %2 - %3").arg(Helper::applicationName, Helper::OMSSimulationSetup, mpLibraryTreeItem->getNameStructure())); mpSimulationHeading->setText(QString("%1 - %2").arg(Helper::OMSSimulationSetup, mpLibraryTreeItem->getNameStructure())); // read the simulation start and stop time - double startTime, stopTime; + double startTime = 0; if (OMSProxy::instance()->getStartTime(mpLibraryTreeItem->getNameStructure(), &startTime)) { mpStartTimeTextBox->setText(QString::number(startTime)); } + double stopTime = 1; if (OMSProxy::instance()->getStopTime(mpLibraryTreeItem->getNameStructure(), &stopTime)) { mpStopTimeTextBox->setText(QString::number(stopTime)); }