Skip to content

Commit

Permalink
Make ExactStep false as default and an optional attribute.
Browse files Browse the repository at this point in the history
  • Loading branch information
adeas31 committed Sep 20, 2016
1 parent b2c63fa commit 3aded14
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 12 deletions.
12 changes: 7 additions & 5 deletions OMEdit/OMEditGUI/Editors/MetaModelEditor.cpp
Expand Up @@ -227,7 +227,6 @@ void MetaModelEditor::setMetaModelName(QString name)
* \brief MetaModelEditor::addSubModel
* Adds a SubModel tag with Annotation tag as child of it.
* \param name
* \param exactStep
* \param modelFile
* \param startCommand
* \param visible
Expand All @@ -236,14 +235,13 @@ void MetaModelEditor::setMetaModelName(QString name)
* \param rotation
* \return
*/
bool MetaModelEditor::addSubModel(QString name, QString exactStep, QString modelFile, QString startCommand, QString visible, QString origin,
QString extent, QString rotation)
bool MetaModelEditor::addSubModel(QString name, QString modelFile, QString startCommand, QString visible, QString origin,
QString extent, QString rotation)
{
QDomElement subModels = getSubModelsElement();
if (!subModels.isNull()) {
QDomElement subModel = mXmlDocument.createElement("SubModel");
subModel.setAttribute("Name", name);
subModel.setAttribute("ExactStep", exactStep);
subModel.setAttribute("ModelFile", modelFile);
subModel.setAttribute("StartCommand", startCommand);
// create Annotation Element
Expand Down Expand Up @@ -328,7 +326,11 @@ void MetaModelEditor::updateSubModelParameters(QString name, QString startComman
QDomElement subModel = subModelList.at(i).toElement();
if (subModel.attribute("Name").compare(name) == 0) {
subModel.setAttribute("StartCommand", startCommand);
subModel.setAttribute("ExactStep", exactStepFlag);
if (exactStepFlag.compare("true") == 0) {
subModel.setAttribute("ExactStep", exactStepFlag);
} else if (subModel.hasAttribute("ExactStep")) {
subModel.removeAttribute("ExactStep");
}
setPlainText(mXmlDocument.toString());
return;
}
Expand Down
2 changes: 1 addition & 1 deletion OMEdit/OMEditGUI/Editors/MetaModelEditor.h
Expand Up @@ -75,7 +75,7 @@ class MetaModelEditor : public BaseEditor
QDomNodeList getConnections();
QDomElement getSubModelElement(QString name);
void setMetaModelName(QString name);
bool addSubModel(QString name, QString exactStep, QString modelFile, QString startCommand, QString visible, QString origin, QString extent,
bool addSubModel(QString name, QString modelFile, QString startCommand, QString visible, QString origin, QString extent,
QString rotation);
void createAnnotationElement(QDomElement subModel, QString visible, QString origin, QString extent, QString rotation);
void updateSubModelPlacementAnnotation(QString name, QString visible, QString origin, QString extent, QString rotation);
Expand Down
7 changes: 3 additions & 4 deletions OMEdit/OMEditGUI/Modeling/ModelWidgetContainer.cpp
Expand Up @@ -401,7 +401,7 @@ void GraphicsView::addComponentToClass(Component *pComponent)
QString visible = pComponent->mTransformation.getVisible() ? "true" : "false";
// add SubModel Element
MetaModelEditor *pMetaModelEditor = dynamic_cast<MetaModelEditor*>(mpModelWidget->getEditor());
pMetaModelEditor->addSubModel(pComponent->getName(), "false", pComponent->getComponentInfo()->getModelFile(),
pMetaModelEditor->addSubModel(pComponent->getName(), pComponent->getComponentInfo()->getModelFile(),
pComponent->getComponentInfo()->getStartCommand(), visible, pComponent->getTransformationOrigin(),
pComponent->getTransformationExtent(), QString::number(pComponent->mTransformation.getRotateAngle()));
}
Expand Down Expand Up @@ -3733,9 +3733,8 @@ void ModelWidget::getMetaModelSubModels()
pComponentInfo->setName(subModel.attribute("Name"));
pComponentInfo->setStartCommand(subModel.attribute("StartCommand"));
bool exactStep;
if (subModel.attribute("ExactStep").toLower().compare("1") == 0) {
exactStep = true;
} else if (subModel.attribute("ExactStep").toLower().compare("true") == 0) {
if ((subModel.attribute("ExactStep").toLower().compare("1") == 0)
|| (subModel.attribute("ExactStep").toLower().compare("true") == 0)) {
exactStep = true;
} else {
exactStep = false;
Expand Down
Expand Up @@ -103,7 +103,7 @@
</xs:sequence>
<xs:attribute name="Name" type="xs:string" use="required"/>
<xs:attribute name="StartCommand" type="xs:string" use="required"/>
<xs:attribute name="ExactStep" type="xs:boolean" use="required"/>
<xs:attribute name="ExactStep" type="xs:boolean" use="optional"/>
<xs:attribute name="ModelFile" type="xs:string" use="required"/>
<xs:attribute name="Position" type="xs:string" use="optional"/>
<xs:attribute name="Angle321" type="xs:string" use="optional"/>
Expand Down
2 changes: 1 addition & 1 deletion OMEdit/OMEditGUI/TLM/TLMCoSimulationThread.cpp
Expand Up @@ -53,7 +53,7 @@ void TLMCoSimulationThread::run()

/*!
* \brief TLMCoSimulationThread::removeGeneratedFiles
* Removes the files that TLMPlugin generates during co-simulation.
* Removes the generated files before each new TLM co-simulation.
*/
void TLMCoSimulationThread::removeGeneratedFiles()
{
Expand Down

0 comments on commit 3aded14

Please sign in to comment.