From 42dd3b1156354ee9a4b075dc4602560d64ba000f Mon Sep 17 00:00:00 2001 From: Ole Albers Date: Mon, 15 Dec 2025 14:12:00 +0100 Subject: [PATCH 01/26] add wing options --- .../ModificatorDisplayOptionsWidget.cpp | 62 ++++++++++++++++++- .../ModificatorDisplayOptionsWidget.h | 6 ++ .../ModificatorDisplayOptionsWidget.ui | 41 +++++++----- 3 files changed, 90 insertions(+), 19 deletions(-) diff --git a/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp b/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp index 7d9d656f7..dee5c7929 100644 --- a/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp +++ b/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp @@ -30,6 +30,7 @@ #include "TIGLCreatorMaterials.h" #include "../TIGLCreatorContext.h" #include "ui_ModificatorDisplayOptionsWidget.h" +#include "TIGLCreatorWindow.h" #define BTN_STYLE "#%2 {background-color: %1; color: black; border: 1px solid black; border-radius: 5px;} #%2:hover {border: 1px solid white;}" @@ -53,11 +54,13 @@ ModificatorDisplayOptionsWidget::ModificatorDisplayOptionsWidget(QWidget* parent materialCombo->addItem(kv.first); } - // interactions + // General Display Options connect(transparencySlider, SIGNAL(valueChanged(int)), this, SLOT(onTransparencyChanged(int))); connect(renderingModeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(onRenderingModeChanged(int))); connect(materialCombo, SIGNAL(currentTextChanged(const QString &)), this, SLOT(onMaterialChanged(const QString &))); connect(buttonColorChoser, SIGNAL(clicked()), this, SLOT(onColorChosen())); + + // Wing draw actions are invoked via the drawOptionsCombo callbacks (set in setFromItem) } ModificatorDisplayOptionsWidget::~ModificatorDisplayOptionsWidget() = default; @@ -78,9 +81,11 @@ void ModificatorDisplayOptionsWidget::setFromItem(cpcr::CPACSTreeItem* item, TIG ui->transparencySlider->setVisible(false); ui->labelRenderingMode->setVisible(false); ui->renderingModeCombo->setVisible(false); + ui->labelColor->setVisible(false); ui->buttonColorChoser->setVisible(false); ui->labelMaterial->setVisible(false); ui->materialCombo->setVisible(false); + ui->drawOptionsCombo->setVisible(false); } currentItem = nullptr; return; @@ -92,12 +97,14 @@ void ModificatorDisplayOptionsWidget::setFromItem(cpcr::CPACSTreeItem* item, TIG ui->transparencySlider->setVisible(true); ui->labelRenderingMode->setVisible(true); ui->renderingModeCombo->setVisible(true); + ui->labelColor->setVisible(true); ui->buttonColorChoser->setVisible(true); ui->labelMaterial->setVisible(true); ui->materialCombo->setVisible(true); + ui->drawOptionsCombo->setVisible(true); } - const QString type = QString::fromStdString(item->getType()); + // const QString type = QString::fromStdString(item->getType()); const QString uid = QString::fromStdString(item->getUid()); @@ -126,6 +133,57 @@ void ModificatorDisplayOptionsWidget::setFromItem(cpcr::CPACSTreeItem* item, TIG } materialCombo->setCurrentIndex(0); + // Populate draw options combo when the selected item is a wing (type or uid == "wing"). + ui->drawOptionsCombo->clear(); + drawCallbacks.clear(); + auto type = doc->GetConfiguration().GetUIDManager().GetGeometricComponent(uid.toStdString()).GetComponentType(); + + if (type == TIGL_COMPONENT_WING) { + // Add entries and store callbacks that call the document drawing functions + ui->drawOptionsCombo->addItem(tr("Profiles")); + drawCallbacks.push_back([doc]() { if (doc) doc->drawWingProfiles(); }); + + ui->drawOptionsCombo->addItem(tr("Overlay profile points")); + drawCallbacks.push_back([doc]() { if (doc) doc->drawWingOverlayProfilePoints(); }); + + ui->drawOptionsCombo->addItem(tr("Guide curves")); + drawCallbacks.push_back([doc]() { if (doc) doc->drawWingGuideCurves(); }); + + ui->drawOptionsCombo->addItem(tr("Wing")); + drawCallbacks.push_back([doc]() { if (doc) doc->drawWing(); }); + + ui->drawOptionsCombo->addItem(tr("Triangulation")); + drawCallbacks.push_back([doc]() { if (doc) doc->drawWingTriangulation(); }); + + ui->drawOptionsCombo->addItem(tr("Sample points")); + drawCallbacks.push_back([doc]() { if (doc) doc->drawWingSamplePoints(); }); + + ui->drawOptionsCombo->addItem(tr("Fused wing")); + drawCallbacks.push_back([doc]() { if (doc) doc->drawFusedWing(); }); + + ui->drawOptionsCombo->addItem(tr("Component segment")); + drawCallbacks.push_back([doc]() { if (doc) doc->drawWingComponentSegment(); }); + + ui->drawOptionsCombo->addItem(tr("Component segment points")); + drawCallbacks.push_back([doc]() { if (doc) doc->drawWingComponentSegmentPoints(); }); + + ui->drawOptionsCombo->addItem(tr("Shells")); + drawCallbacks.push_back([doc]() { if (doc) doc->drawWingShells(); }); + + ui->drawOptionsCombo->addItem(tr("Structure")); + drawCallbacks.push_back([doc]() { if (doc) doc->drawWingStructure(); }); + + ui->drawOptionsCombo->addItem(tr("Flaps")); + drawCallbacks.push_back([doc]() { if (doc) doc->drawWingFlaps(); }); + + // Trigger the corresponding callback when an item is activated. Use UniqueConnection to avoid duplicate connections. + connect(ui->drawOptionsCombo, QOverload::of(&QComboBox::activated), this, + [this](int idx) { + if (idx >= 0 && idx < static_cast(drawCallbacks.size()) && drawCallbacks[idx]) { + drawCallbacks[idx](); + } + }, Qt::UniqueConnection); + } } diff --git a/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.h b/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.h index 320c96970..ab06a9f06 100644 --- a/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.h +++ b/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.h @@ -35,6 +35,9 @@ class QButtonGroup; class QPushButton; class QComboBox; class QColor; +// callbacks used for draw options (avoid direct QAction dependency) +#include +#include class ModificatorDisplayOptionsWidget : public CpacsEditorBase { @@ -72,6 +75,9 @@ private slots: QPushButton* buttonColorChoser{nullptr}; QComboBox* materialCombo{nullptr}; + // Callbacks mapped to indices of ui->drawOptionsCombo (used for wing draw options) + std::vector> drawCallbacks; + cpcr::CPACSTreeItem* currentItem{nullptr}; TIGLCreatorDocument* currentDoc{nullptr}; TIGLCreatorContext* currentContext{nullptr}; diff --git a/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.ui b/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.ui index 6feace4cb..f338e11c3 100644 --- a/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.ui +++ b/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.ui @@ -64,12 +64,15 @@ - + - + Color: + + false + @@ -104,22 +107,26 @@ - - - - Draw Options: - - - false - - - - - - false - - + + + + + Material: + + + false + + + + + + + false + + + + From b716d35d52b0ef6b2429495d264789446bbceda0 Mon Sep 17 00:00:00 2001 From: Ole Albers Date: Thu, 18 Dec 2025 10:03:13 +0100 Subject: [PATCH 02/26] add draw functions --- TIGLCreator/src/TIGLCreatorDocument.cpp | 43 ++++++-- TIGLCreator/src/TIGLCreatorDocument.h | 4 +- .../ModificatorDisplayOptionsWidget.cpp | 100 +++++++++--------- .../ModificatorDisplayOptionsWidget.ui | 2 +- 4 files changed, 87 insertions(+), 62 deletions(-) diff --git a/TIGLCreator/src/TIGLCreatorDocument.cpp b/TIGLCreator/src/TIGLCreatorDocument.cpp index ad9ea0aa0..251db3017 100644 --- a/TIGLCreator/src/TIGLCreatorDocument.cpp +++ b/TIGLCreator/src/TIGLCreatorDocument.cpp @@ -1101,17 +1101,28 @@ void TIGLCreatorDocument::drawFuselageGuideCurves() app->getScene()->getContext()->UpdateCurrentViewer(); } -void TIGLCreatorDocument::drawWing() +void TIGLCreatorDocument::drawWing(const QString& Uid) { - QString wingUid = dlgGetWingSelection(); - if (wingUid == "") { - return; + QString wingUid; + if (Uid == nullptr) { + wingUid = dlgGetWingSelection(); + if (wingUid == "") { + return; + } + else { + drawComponentByUID(wingUid); + } } else { - drawComponentByUID(wingUid); + wingUid = Uid; } tigl::CCPACSWing& wing = GetConfiguration().GetWing(wingUid.toStdString()); + auto obejcts = app->getScene()->GetShapeManager().GetIObjectsFromShapeName(wingUid.toStdString()); + for (auto& obj : obejcts) { + app->getScene()->GetShapeManager().removeObject(obj); + app->getScene()->getContext()->Remove(obj, Standard_False); + } if (wing.GetComponentSegments()) { for (auto& pcs : wing.GetComponentSegments()->GetComponentSegments()) { @@ -1132,11 +1143,17 @@ void TIGLCreatorDocument::drawWing() } } -void TIGLCreatorDocument::drawWingFlaps() +void TIGLCreatorDocument::drawWingFlaps(const QString& Uid) { - QString wingUid = dlgGetWingSelection(); - if (wingUid == "") { - return; + QString wingUid; + if (Uid == nullptr) { + wingUid = dlgGetWingSelection(); + if (wingUid == "") { + return; + } + } + else { + wingUid = Uid; } try { @@ -1177,8 +1194,14 @@ bool TIGLCreatorDocument::drawWingFlaps(tigl::CCPACSWing& wing) return false; } - app->getScene()->deleteAllObjects(); + auto obejcts = app->getScene()->GetShapeManager().GetIObjectsFromShapeName(wing.GetUID()); + for (auto& obj : obejcts) { + app->getScene()->GetShapeManager().removeObject(obj); + app->getScene()->getContext()->Remove(obj, Standard_False); + } app->getScene()->displayShape(wing.GetLoftWithCutouts(), true, getDefaultShapeColor()); + auto shape = app->getScene()->getCurrentShape(); + app->getScene()->GetShapeManager().addObject(wing.GetUID(), shape); for (auto& pcs : wing.GetComponentSegments()->GetComponentSegments()) { if (!pcs->GetControlSurfaces() || pcs->GetControlSurfaces()->ControlSurfaceCount() == 0) { diff --git a/TIGLCreator/src/TIGLCreatorDocument.h b/TIGLCreator/src/TIGLCreatorDocument.h index f9769293a..5fd595508 100644 --- a/TIGLCreator/src/TIGLCreatorDocument.h +++ b/TIGLCreator/src/TIGLCreatorDocument.h @@ -93,7 +93,7 @@ public slots: // Wing slots void drawWingProfiles(); - void drawWing(); + void drawWing(const QString& Uid=nullptr); void drawWingOverlayProfilePoints(); void drawWingGuideCurves(); void drawWingTriangulation(); @@ -102,7 +102,7 @@ public slots: void drawWingComponentSegment(); void drawWingComponentSegmentPoints(); void drawWingShells(); - void drawWingFlaps(); + void drawWingFlaps(const QString& wingUID=nullptr); void drawWingStructure(); // Fuselage slots diff --git a/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp b/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp index 72c40abba..c17a5c929 100644 --- a/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp +++ b/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp @@ -82,7 +82,7 @@ void ModificatorDisplayOptionsWidget::setFromItem(cpcr::CPACSTreeItem* item, TIG ui->renderingModeCombo->setVisible(false); ui->labelColor->setVisible(false); ui->buttonColorChoser->setVisible(false); - ui->label_color->setVisible(false); + ui->labelColor->setVisible(false); ui->labelMaterial->setVisible(false); ui->materialCombo->setVisible(false); ui->drawOptionsCombo->setVisible(false); @@ -92,10 +92,10 @@ void ModificatorDisplayOptionsWidget::setFromItem(cpcr::CPACSTreeItem* item, TIG } if (item) { - auto uid = item->getUid(); - if ((!uid.empty() && doc->GetConfiguration().GetUIDManager().HasGeometricComponent(uid))) { + const QString uid = QString::fromStdString(item->getUid()); + if ((!uid.isEmpty() && doc->GetConfiguration().GetUIDManager().HasGeometricComponent(uid.toStdString()))) { const auto& shapes = doc->GetConfiguration().GetUIDManager().GetShapeContainer(); - auto it = shapes.find(uid); + auto it = shapes.find(uid.toStdString()); if (it != shapes.end() && it->second != nullptr) { tigl::ITiglGeometricComponent* comp = it->second; if (comp->GetComponentType() != TIGL_COMPONENT_PLANE && comp->GetComponentType() != TIGL_COMPONENT_CROSS_BEAM_STRUT) { @@ -105,14 +105,13 @@ void ModificatorDisplayOptionsWidget::setFromItem(cpcr::CPACSTreeItem* item, TIG ui->transparencySlider->setVisible(true); ui->labelRenderingMode->setVisible(true); ui->renderingModeCombo->setVisible(true); - ui->label_color->setVisible(true); + ui->labelColor->setVisible(true); ui->buttonColorChoser->setVisible(true); ui->labelMaterial->setVisible(true); ui->materialCombo->setVisible(true); + ui->drawOptionsCombo->setVisible(true); } - - const QString type = QString::fromStdString(item->getType()); - const QString uid = QString::fromStdString(item->getUid()); + // get current values @@ -151,65 +150,68 @@ void ModificatorDisplayOptionsWidget::setFromItem(cpcr::CPACSTreeItem* item, TIG ui->labelRenderingMode->setVisible(false); ui->renderingModeCombo->setVisible(false); ui->buttonColorChoser->setVisible(false); - ui->label_color->setVisible(false); + ui->labelColor->setVisible(false); ui->labelMaterial->setVisible(false); ui->materialCombo->setVisible(false); + ui->drawOptionsCombo->setVisible(false); } } - } + - // Populate draw options combo when the selected item is a wing (type or uid == "wing"). - ui->drawOptionsCombo->clear(); - drawCallbacks.clear(); - auto type = doc->GetConfiguration().GetUIDManager().GetGeometricComponent(uid.toStdString()).GetComponentType(); + // Populate draw options combo when the selected item is a wing (type or uid == "wing"). + ui->drawOptionsCombo->clear(); + drawCallbacks.clear(); + if (doc->GetConfiguration().GetUIDManager().HasGeometricComponent(uid.toStdString())) { + auto type = doc->GetConfiguration().GetUIDManager().GetGeometricComponent(uid.toStdString()).GetComponentType(); - if (type == TIGL_COMPONENT_WING) { - // Add entries and store callbacks that call the document drawing functions - ui->drawOptionsCombo->addItem(tr("Profiles")); - drawCallbacks.push_back([doc]() { if (doc) doc->drawWingProfiles(); }); + if (type == TIGL_COMPONENT_WING) { + // Add entries and store callbacks that call the document drawing functions + ui->drawOptionsCombo->addItem(tr("Wing")); + drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawWing(uid); }); - ui->drawOptionsCombo->addItem(tr("Overlay profile points")); - drawCallbacks.push_back([doc]() { if (doc) doc->drawWingOverlayProfilePoints(); }); + ui->drawOptionsCombo->addItem(tr("Profiles")); + drawCallbacks.push_back([doc]() { if (doc) doc->drawWingProfiles(); }); - ui->drawOptionsCombo->addItem(tr("Guide curves")); - drawCallbacks.push_back([doc]() { if (doc) doc->drawWingGuideCurves(); }); + ui->drawOptionsCombo->addItem(tr("Overlay profile points")); + drawCallbacks.push_back([doc]() { if (doc) doc->drawWingOverlayProfilePoints(); }); - ui->drawOptionsCombo->addItem(tr("Wing")); - drawCallbacks.push_back([doc]() { if (doc) doc->drawWing(); }); + ui->drawOptionsCombo->addItem(tr("Guide curves")); + drawCallbacks.push_back([doc]() { if (doc) doc->drawWingGuideCurves(); }); - ui->drawOptionsCombo->addItem(tr("Triangulation")); - drawCallbacks.push_back([doc]() { if (doc) doc->drawWingTriangulation(); }); + ui->drawOptionsCombo->addItem(tr("Triangulation")); + drawCallbacks.push_back([doc]() { if (doc) doc->drawWingTriangulation(); }); - ui->drawOptionsCombo->addItem(tr("Sample points")); - drawCallbacks.push_back([doc]() { if (doc) doc->drawWingSamplePoints(); }); + ui->drawOptionsCombo->addItem(tr("Sample points")); + drawCallbacks.push_back([doc]() { if (doc) doc->drawWingSamplePoints(); }); - ui->drawOptionsCombo->addItem(tr("Fused wing")); - drawCallbacks.push_back([doc]() { if (doc) doc->drawFusedWing(); }); + ui->drawOptionsCombo->addItem(tr("Fused wing")); + drawCallbacks.push_back([doc]() { if (doc) doc->drawFusedWing(); }); - ui->drawOptionsCombo->addItem(tr("Component segment")); - drawCallbacks.push_back([doc]() { if (doc) doc->drawWingComponentSegment(); }); + ui->drawOptionsCombo->addItem(tr("Component segment")); + drawCallbacks.push_back([doc]() { if (doc) doc->drawWingComponentSegment(); }); - ui->drawOptionsCombo->addItem(tr("Component segment points")); - drawCallbacks.push_back([doc]() { if (doc) doc->drawWingComponentSegmentPoints(); }); + ui->drawOptionsCombo->addItem(tr("Component segment points")); + drawCallbacks.push_back([doc]() { if (doc) doc->drawWingComponentSegmentPoints(); }); - ui->drawOptionsCombo->addItem(tr("Shells")); - drawCallbacks.push_back([doc]() { if (doc) doc->drawWingShells(); }); + ui->drawOptionsCombo->addItem(tr("Shells")); + drawCallbacks.push_back([doc]() { if (doc) doc->drawWingShells(); }); - ui->drawOptionsCombo->addItem(tr("Structure")); - drawCallbacks.push_back([doc]() { if (doc) doc->drawWingStructure(); }); + ui->drawOptionsCombo->addItem(tr("Structure")); + drawCallbacks.push_back([doc]() { if (doc) doc->drawWingStructure(); }); - ui->drawOptionsCombo->addItem(tr("Flaps")); - drawCallbacks.push_back([doc]() { if (doc) doc->drawWingFlaps(); }); + ui->drawOptionsCombo->addItem(tr("Flaps")); + drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawWingFlaps(uid); }); - // Trigger the corresponding callback when an item is activated. Use UniqueConnection to avoid duplicate connections. - connect(ui->drawOptionsCombo, QOverload::of(&QComboBox::activated), this, - [this](int idx) { - if (idx >= 0 && idx < static_cast(drawCallbacks.size()) && drawCallbacks[idx]) { - drawCallbacks[idx](); - } - }, Qt::UniqueConnection); - } - + // Trigger the corresponding callback when an item is activated. Use UniqueConnection to avoid duplicate connections. + connect(ui->drawOptionsCombo, QOverload::of(&QComboBox::activated), this, + [this](int idx) { + if (idx >= 0 && idx < static_cast(drawCallbacks.size()) && drawCallbacks[idx]) { + drawCallbacks[idx](); + } + }, Qt::UniqueConnection); + } + } + } } diff --git a/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.ui b/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.ui index 477b66fe6..f27cf0c84 100644 --- a/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.ui +++ b/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.ui @@ -66,7 +66,7 @@ - + Color: From 9407856f6513714e29cf1e34ed08d525c2fa0899 Mon Sep 17 00:00:00 2001 From: Ole Albers Date: Thu, 18 Dec 2025 16:11:19 +0100 Subject: [PATCH 03/26] don't delete wing when displaying flaps --- TIGLCreator/src/TIGLCreatorDocument.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/TIGLCreator/src/TIGLCreatorDocument.cpp b/TIGLCreator/src/TIGLCreatorDocument.cpp index 16cc7dd8b..312c97ca8 100644 --- a/TIGLCreator/src/TIGLCreatorDocument.cpp +++ b/TIGLCreator/src/TIGLCreatorDocument.cpp @@ -1200,8 +1200,7 @@ bool TIGLCreatorDocument::drawWingFlaps(tigl::CCPACSWing& wing) app->getScene()->GetShapeManager().removeObject(obj); app->getScene()->getContext()->Remove(obj, Standard_False); } - app->getScene()->displayShape(wing.GetLoftWithCutouts(), true, getDefaultShapeColor()); - auto shape = app->getScene()->getCurrentShape(); + auto shape = app->getScene()->displayShape(wing.GetLoftWithCutouts(), true, getDefaultShapeColor()); app->getScene()->GetShapeManager().addObject(wing.GetUID(), shape); for (auto& pcs : wing.GetComponentSegments()->GetComponentSegments()) { From c51fbd1e7f0b60e371c4ab6cd2b584ee99e45e15 Mon Sep 17 00:00:00 2001 From: Ole Albers Date: Thu, 8 Jan 2026 12:22:33 +0100 Subject: [PATCH 04/26] fix mirrored flap transform --- TIGLCreator/src/TIGLCreatorDocument.cpp | 111 +++++++++++++++++++++--- 1 file changed, 97 insertions(+), 14 deletions(-) diff --git a/TIGLCreator/src/TIGLCreatorDocument.cpp b/TIGLCreator/src/TIGLCreatorDocument.cpp index 49a787003..dbcd2fd12 100644 --- a/TIGLCreator/src/TIGLCreatorDocument.cpp +++ b/TIGLCreator/src/TIGLCreatorDocument.cpp @@ -65,6 +65,7 @@ #include "CTiglPoint.h" #include "CTiglError.h" #include "TIGLCreatorSettings.h" +#include "CTiglTransformation.h" #include "CTiglIntersectionCalculation.h" #include "TIGLCreatorWindow.h" #include "TIGLCreatorEtaXsiDialog.h" @@ -81,6 +82,8 @@ #include "tiglcommonfunctions.h" #include "CTiglPoint.h" #include "CTiglExportCollada.h" +#include "CNamedShape.h" +#include "TiglSymmetryAxis.h" #include "CCPACSWingCSStructure.h" #include "CCPACSWingSparSegment.h" #include "CCPACSWingRibsDefinition.h" @@ -775,12 +778,12 @@ void TIGLCreatorDocument::drawComponentByUID(const QString& uid) if (loft) { double opacity = 0; bool shaded = true; - // By default, we display the wing without cutouts (for performance). + // By default, we display the wing without cutouts (for performance). // Therefore, it is visually better to display the flaps using a wireframe rendering by default if (component.GetComponentType() == TIGL_COMPONENT_CONTROL_SURFACE_DEVICE) { shaded = false; } - + auto shape = app->getScene()->displayShape(loft, true, getDefaultShapeColor(), opacity, shaded); app->getScene()->GetShapeManager().addObject(uid.toStdString(), shape); @@ -823,10 +826,10 @@ void TIGLCreatorDocument::drawComponentByUID(const QString& uid) void TIGLCreatorDocument::drawControlPointNet() { - auto pre_filter = [](auto* shape) { + auto pre_filter = [](auto* shape) { return shape != nullptr && shape->GetComponentType() != TIGL_COMPONENT_PLANE && - shape->GetComponentType() != TIGL_COMPONENT_CROSS_BEAM_STRUT; + shape->GetComponentType() != TIGL_COMPONENT_CROSS_BEAM_STRUT; }; TIGLGeometryChoserDialog dialog(GetConfiguration().GetUIDManager(), app, pre_filter); @@ -931,7 +934,7 @@ void TIGLCreatorDocument::drawControlPointNetByUID(const QString& uid) void TIGLCreatorDocument::drawConfiguration(bool withDuctCutouts) { tiglConfigurationSetWithDuctCutouts(m_cpacsHandle, (TiglBoolean)withDuctCutouts); - + std::vector shapesToDraw; shapesToDraw.push_back(TIGL_COMPONENT_FUSELAGE); shapesToDraw.push_back(TIGL_COMPONENT_WING); @@ -1208,14 +1211,43 @@ bool TIGLCreatorDocument::drawWingFlaps(tigl::CCPACSWing& wing) return false; } - auto obejcts = app->getScene()->GetShapeManager().GetIObjectsFromShapeName(wing.GetUID()); - for (auto& obj : obejcts) { - app->getScene()->GetShapeManager().removeObject(obj); + auto objects = app->getScene()->GetShapeManager().GetIObjectsFromShapeName(wing.GetUID()); + for (auto& obj : objects) { app->getScene()->getContext()->Remove(obj, Standard_False); + app->getScene()->GetShapeManager().removeObject(obj); } auto shape = app->getScene()->displayShape(wing.GetLoftWithCutouts(), true, getDefaultShapeColor()); app->getScene()->GetShapeManager().addObject(wing.GetUID(), shape); + // manually mirror wing with cutouts + tigl::ITiglGeometricComponent& component = GetConfiguration().GetUIDManager().GetGeometricComponent(wing.GetUID()); + auto* geometricComp = dynamic_cast(&component); + + if (geometricComp) { + TiglSymmetryAxis sym = geometricComp->GetSymmetryAxis(); + if (sym != TIGL_NO_SYMMETRY) { + tigl::CTiglTransformation trafo; + if (sym == TIGL_X_Z_PLANE) { + trafo.AddMirroringAtXZPlane(); + } + else if (sym == TIGL_X_Y_PLANE) { + trafo.AddMirroringAtXYPlane(); + } + else if (sym == TIGL_Y_Z_PLANE) { + trafo.AddMirroringAtYZPlane(); + } + + TopoDS_Shape loftCutouts = wing.GetLoftWithCutouts(); + PNamedShape loftNamed(new CNamedShape(loftCutouts, wing.GetUID().c_str())); + + PNamedShape mirrored = trafo.Transform(loftNamed); + if (mirrored) { + auto mshape = app->getScene()->displayShape(mirrored, false, getDefaultShapeSymmetryColor()); + app->getScene()->GetShapeManager().addObject(wing.GetUID(), mshape); + } + } + } + for (auto& pcs : wing.GetComponentSegments()->GetComponentSegments()) { if (!pcs->GetControlSurfaces() || pcs->GetControlSurfaces()->ControlSurfaceCount() == 0) { continue; @@ -1223,18 +1255,33 @@ bool TIGLCreatorDocument::drawWingFlaps(tigl::CCPACSWing& wing) if (auto& teds = pcs->GetControlSurfaces()->GetTrailingEdgeDevices()) { for (auto& ted : teds->GetTrailingEdgeDevices()) { + auto objs = app->getScene()->GetShapeManager().GetIObjectsFromShapeName(ted->GetUID()); + // remove old wireframe flap shapes + for (auto& obj : objs) { + app->getScene()->getContext()->Remove(obj, Standard_True); + app->getScene()->GetShapeManager().removeObject(obj); + } drawWingFlap(ted->GetUID().c_str()); + + } } if (auto& leds = pcs->GetControlSurfaces()->GetLeadingEdgeDevices()) { for (auto& led : leds->GetLeadingEdgeDevices()) { + auto objs = app->getScene()->GetShapeManager().GetIObjectsFromShapeName(led->GetUID()); + // remove old wireframe flap shapes + for (auto& obj : objs) { + app->getScene()->getContext()->Remove(obj, Standard_True); + app->getScene()->GetShapeManager().removeObject(obj); + } drawWingFlap(led->GetUID().c_str()); } } } app->getScene()->updateViewer(); } + catch (tigl::CTiglError& ex) { displayError(ex.what(), "Error"); return false; @@ -1251,13 +1298,21 @@ void TIGLCreatorDocument::drawWingFlap(const QString& uid) if (*obj.type == typeid(tigl::CCPACSTrailingEdgeDevice)) { auto* ted = static_cast(obj.ptr); app->getScene()->displayShape(ted->GetLoft(), false, Quantity_NOC_GREEN); + + // if flap has mirrored loft, display it too (not mirrored), to later update its transform and then mirror it + PNamedShape mirrored_loft = ted->GetMirroredLoft(); + if (mirrored_loft) { + PNamedShape mirror_named(new CNamedShape(ted->GetLoft()->Shape(), (ted->GetUID() + "M").c_str())); + auto mirror_shape = app->getScene()->displayShape(mirror_named, false, Quantity_NOC_GREEN); + } updateFlapTransform(ted->GetUID()); + } else if (*obj.type == typeid(tigl::CCPACSLeadingEdgeDevice)) { - auto* ted = static_cast(obj.ptr); - app->getScene()->displayShape(ted->GetLoft(), false, Quantity_NOC_GREEN); - updateFlapTransform(ted->GetUID()); + auto* led = static_cast(obj.ptr); + app->getScene()->displayShape(led->GetLoft(), false, Quantity_NOC_GREEN); + updateFlapTransform(led->GetUID()); } } catch (const tigl::CTiglError& ex) { @@ -1271,6 +1326,7 @@ void TIGLCreatorDocument::updateFlapTransform(const std::string& controlUID) gp_Trsf trsf; IObjectList flaps; + IObjectList mflaps; if (*obj.type == typeid(tigl::CCPACSTrailingEdgeDevice)) { auto* controlSurfaceDevice = static_cast(obj.ptr); @@ -1279,7 +1335,9 @@ void TIGLCreatorDocument::updateFlapTransform(const std::string& controlUID) flaps = app->getScene()->GetShapeManager().GetIObjectsFromShapeName(controlSurfaceDevice->GetUID()); - } + mflaps = + app->getScene()->GetShapeManager().GetIObjectsFromShapeName(controlSurfaceDevice->GetUID()+"M"); + } catch (const tigl::CTiglError&) { displayError(QString("Error computing control surface device '%1'").arg(controlUID.c_str()), QString("Error")); @@ -1299,11 +1357,36 @@ void TIGLCreatorDocument::updateFlapTransform(const std::string& controlUID) QString("Error")); } } - + for (const auto& flap : flaps) { app->getScene()->getContext()->SetLocation(flap, trsf); } - + + for (const auto& mflap : mflaps) { + // apply mirroring on transformed flap + tigl::ITiglGeometricComponent& component = GetConfiguration().GetUIDManager().GetGeometricComponent(controlUID); + auto* geometricComp = dynamic_cast(&component); + if (geometricComp) { + TiglSymmetryAxis sym = geometricComp->GetSymmetryAxis(); + if (sym != TIGL_NO_SYMMETRY) { + gp_Trsf mirror_trsf; + tigl::CTiglTransformation trafo(trsf); + if (sym == TIGL_X_Z_PLANE) { + mirror_trsf.SetMirror(gp_Ax2(gp_Pnt(0, 0, 0), gp_Dir(0, 1, 0))); + } + else if (sym == TIGL_X_Y_PLANE) { + mirror_trsf.SetMirror(gp_Ax2(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1))); + } + else if (sym == TIGL_Y_Z_PLANE) { + mirror_trsf.SetMirror(gp_Ax2(gp_Pnt(0, 0, 0), gp_Dir(1, 0, 0))); + } + + app->getScene()->getContext()->SetLocation(mflap, mirror_trsf * trsf); + + } + } + } + app->getViewer()->update(); } From eb2c509ee5af3439a391bf1a5e8d120308ad151c Mon Sep 17 00:00:00 2001 From: Ole Albers Date: Thu, 8 Jan 2026 12:32:29 +0100 Subject: [PATCH 05/26] apply flap transform for leds --- TIGLCreator/src/TIGLCreatorDocument.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/TIGLCreator/src/TIGLCreatorDocument.cpp b/TIGLCreator/src/TIGLCreatorDocument.cpp index dbcd2fd12..4bf81118a 100644 --- a/TIGLCreator/src/TIGLCreatorDocument.cpp +++ b/TIGLCreator/src/TIGLCreatorDocument.cpp @@ -1312,6 +1312,13 @@ void TIGLCreatorDocument::drawWingFlap(const QString& uid) else if (*obj.type == typeid(tigl::CCPACSLeadingEdgeDevice)) { auto* led = static_cast(obj.ptr); app->getScene()->displayShape(led->GetLoft(), false, Quantity_NOC_GREEN); + + // if flap has mirrored loft, display it too (not mirrored), to later update its transform and then mirror it + PNamedShape mirrored_loft = led->GetMirroredLoft(); + if (mirrored_loft) { + PNamedShape mirror_named(new CNamedShape(led->GetLoft()->Shape(), (led->GetUID() + "M").c_str())); + auto mirror_shape = app->getScene()->displayShape(mirror_named, false, Quantity_NOC_GREEN); + } updateFlapTransform(led->GetUID()); } } @@ -1337,7 +1344,7 @@ void TIGLCreatorDocument::updateFlapTransform(const std::string& controlUID) app->getScene()->GetShapeManager().GetIObjectsFromShapeName(controlSurfaceDevice->GetUID()); mflaps = app->getScene()->GetShapeManager().GetIObjectsFromShapeName(controlSurfaceDevice->GetUID()+"M"); - } + } catch (const tigl::CTiglError&) { displayError(QString("Error computing control surface device '%1'").arg(controlUID.c_str()), QString("Error")); @@ -1351,6 +1358,8 @@ void TIGLCreatorDocument::updateFlapTransform(const std::string& controlUID) flaps = app->getScene()->GetShapeManager().GetIObjectsFromShapeName(controlSurfaceDevice->GetUID()); + mflaps = + app->getScene()->GetShapeManager().GetIObjectsFromShapeName(controlSurfaceDevice->GetUID()+"M"); } catch (const tigl::CTiglError&) { displayError(QString("Error computing control surface device '%1'").arg(controlUID.c_str()), From d9e7c9b470aa036d17a707dbb257f25fa9da1d73 Mon Sep 17 00:00:00 2001 From: Ole Albers Date: Thu, 8 Jan 2026 15:33:50 +0100 Subject: [PATCH 06/26] fix display wing option --- TIGLCreator/src/TIGLCreatorDocument.cpp | 41 ++++++++++++++----- .../ModificatorDisplayOptionsWidget.cpp | 1 + 2 files changed, 31 insertions(+), 11 deletions(-) diff --git a/TIGLCreator/src/TIGLCreatorDocument.cpp b/TIGLCreator/src/TIGLCreatorDocument.cpp index 4bf81118a..e88a96991 100644 --- a/TIGLCreator/src/TIGLCreatorDocument.cpp +++ b/TIGLCreator/src/TIGLCreatorDocument.cpp @@ -802,16 +802,16 @@ void TIGLCreatorDocument::drawComponentByUID(const QString& uid) if (objects[0]->Shape() != component.GetLoft()->Shape()) { objects[0]->SetShape(component.GetLoft()->Shape()); } - else { - auto* geometricComp = dynamic_cast(&component); - if (geometricComp) { - if (geometricComp->GetMirroredLoft()) { - if (objects[1]->Shape() != geometricComp->GetMirroredLoft()->Shape()) { - objects[1]->SetShape(geometricComp->GetMirroredLoft()->Shape()); - } + + auto* geometricComp = dynamic_cast(&component); + if (geometricComp) { + if (geometricComp->GetMirroredLoft()) { + if (objects[1]->Shape() != geometricComp->GetMirroredLoft()->Shape()) { + objects[1]->SetShape(geometricComp->GetMirroredLoft()->Shape()); } } } + for (auto& obj : objects) { app->getScene()->getContext()->Display(obj, Standard_False); } @@ -1135,11 +1135,13 @@ void TIGLCreatorDocument::drawWing(const QString& Uid) } tigl::CCPACSWing& wing = GetConfiguration().GetWing(wingUid.toStdString()); - auto obejcts = app->getScene()->GetShapeManager().GetIObjectsFromShapeName(wingUid.toStdString()); - for (auto& obj : obejcts) { + auto objects = app->getScene()->GetShapeManager().GetIObjectsFromShapeName(wingUid.toStdString()); + for (auto& obj : objects) { app->getScene()->GetShapeManager().removeObject(obj); app->getScene()->getContext()->Remove(obj, Standard_False); } + drawComponentByUID(wingUid); + if (wing.GetComponentSegments()) { for (auto& pcs : wing.GetComponentSegments()->GetComponentSegments()) { @@ -1148,12 +1150,26 @@ void TIGLCreatorDocument::drawWing(const QString& Uid) } if (auto& teds = pcs->GetControlSurfaces()->GetTrailingEdgeDevices()) { for (auto& ted : teds->GetTrailingEdgeDevices()) { - drawComponentByUID(ted->GetUID().c_str()); + auto objects = app->getScene()->GetShapeManager().GetIObjectsFromShapeName(ted->GetUID()); + for (auto& obj : objects) { + app->getScene()->getContext()->Remove(obj, Standard_False); + } + objects = app->getScene()->GetShapeManager().GetIObjectsFromShapeName(ted->GetUID()+"M"); + for (auto& obj : objects) { + app->getScene()->getContext()->Remove(obj, Standard_False); + } } } if (auto& leds = pcs->GetControlSurfaces()->GetLeadingEdgeDevices()) { for (auto& led : leds->GetLeadingEdgeDevices()) { - drawComponentByUID(led->GetUID().c_str()); + auto objects = app->getScene()->GetShapeManager().GetIObjectsFromShapeName(led->GetUID()); + for (auto& obj : objects) { + app->getScene()->getContext()->Remove(obj, Standard_False); + } + objects = app->getScene()->GetShapeManager().GetIObjectsFromShapeName(led->GetUID()+"M"); + for (auto& obj : objects) { + app->getScene()->getContext()->Remove(obj, Standard_False); + } } } } @@ -1304,6 +1320,7 @@ void TIGLCreatorDocument::drawWingFlap(const QString& uid) if (mirrored_loft) { PNamedShape mirror_named(new CNamedShape(ted->GetLoft()->Shape(), (ted->GetUID() + "M").c_str())); auto mirror_shape = app->getScene()->displayShape(mirror_named, false, Quantity_NOC_GREEN); + app->getScene()->GetShapeManager().addObject(ted->GetUID(), mirror_shape); } updateFlapTransform(ted->GetUID()); @@ -1318,6 +1335,8 @@ void TIGLCreatorDocument::drawWingFlap(const QString& uid) if (mirrored_loft) { PNamedShape mirror_named(new CNamedShape(led->GetLoft()->Shape(), (led->GetUID() + "M").c_str())); auto mirror_shape = app->getScene()->displayShape(mirror_named, false, Quantity_NOC_GREEN); + app->getScene()->GetShapeManager().addObject(led->GetUID(), mirror_shape); + } updateFlapTransform(led->GetUID()); } diff --git a/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp b/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp index efc2476bf..215aa1d93 100644 --- a/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp +++ b/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp @@ -476,6 +476,7 @@ void ModificatorDisplayOptionsWidget::onResetOptions() // redraw component to reset options (necessary to reset different colors on mirrored components) context->Remove(obj, Standard_False); sm.removeObject(obj); + sm.removeObject(currentItem->getUid()); currentDoc->drawComponentByUID(uid); } } From 4481e660b3f81e26fa340af8321d8a8f5bdce688 Mon Sep 17 00:00:00 2001 From: Ole Albers Date: Thu, 8 Jan 2026 16:48:40 +0100 Subject: [PATCH 07/26] fix crash invalid uid --- .../src/modificators/ModificatorDisplayOptionsWidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp b/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp index 215aa1d93..32f1372b2 100644 --- a/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp +++ b/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp @@ -166,7 +166,7 @@ void ModificatorDisplayOptionsWidget::setFromItem(cpcr::CPACSTreeItem* item, TIG // Populate draw options combo when the selected item is a wing (type or uid == "wing"). ui->drawOptionsCombo->clear(); drawCallbacks.clear(); - if (doc->GetConfiguration().GetUIDManager().HasGeometricComponent(uid.toStdString())) { + if (!uid.isEmpty() && doc->GetConfiguration().GetUIDManager().HasGeometricComponent(uid.toStdString())) { auto type = doc->GetConfiguration().GetUIDManager().GetGeometricComponent(uid.toStdString()).GetComponentType(); if (type == TIGL_COMPONENT_WING) { From 0d4fdcceea8cea5ac3df9c6205064490e30f3ab8 Mon Sep 17 00:00:00 2001 From: Ole Albers Date: Fri, 9 Jan 2026 12:04:02 +0100 Subject: [PATCH 08/26] fix reset button for wings --- .../ModificatorDisplayOptionsWidget.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp b/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp index 32f1372b2..db6424bf9 100644 --- a/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp +++ b/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp @@ -476,10 +476,22 @@ void ModificatorDisplayOptionsWidget::onResetOptions() // redraw component to reset options (necessary to reset different colors on mirrored components) context->Remove(obj, Standard_False); sm.removeObject(obj); - sm.removeObject(currentItem->getUid()); - currentDoc->drawComponentByUID(uid); + } } + + auto type = currentDoc->GetConfiguration().GetUIDManager().GetGeometricComponent(uid.toStdString()).GetComponentType(); + if (type == TIGL_COMPONENT_WING) { + tigl::CCPACSWing& wing = currentDoc->GetConfiguration().GetWing(uid.toStdString()); + wing.SetBuildFlaps(false); + currentDoc->drawWing(uid); + + } + + else { + currentDoc->drawComponentByUID(uid); + } + if (!currentContext->getContext().IsNull()) { currentContext->updateViewer(); } From 3d899925f1230ae80774d9131d4f45abb124737a Mon Sep 17 00:00:00 2001 From: Ole Albers Date: Fri, 23 Jan 2026 12:28:01 +0100 Subject: [PATCH 09/26] current state --- TIGLCreator/src/TIGLCreatorDocument.cpp | 112 ++++++++++++------ TIGLCreator/src/TIGLCreatorDocument.h | 5 +- .../ModificatorDisplayOptionsWidget.cpp | 4 +- src/wing/CCPACSWing.cpp | 34 ++++++ src/wing/CCPACSWing.h | 6 + 5 files changed, 120 insertions(+), 41 deletions(-) diff --git a/TIGLCreator/src/TIGLCreatorDocument.cpp b/TIGLCreator/src/TIGLCreatorDocument.cpp index e88a96991..a916b1986 100644 --- a/TIGLCreator/src/TIGLCreatorDocument.cpp +++ b/TIGLCreator/src/TIGLCreatorDocument.cpp @@ -439,24 +439,40 @@ QString TIGLCreatorDocument::dlgGetWingSelection() } // Wing Component Segment selection Dialog -QString TIGLCreatorDocument::dlgGetWingComponentSegmentSelection() +QString TIGLCreatorDocument::dlgGetWingComponentSegmentSelection(const QString& wingUID) { QStringList compSegs; bool ok; - // Initialize wing list tigl::CCPACSConfiguration& config = GetConfiguration(); - int wingCount = config.GetWingCount(); - for (int i = 1; i <= wingCount; i++) { - tigl::CCPACSWing& wing = config.GetWing(i); - if (wing.IsRotorBlade()) { - continue; + if (wingUID.isEmpty()) { + + int wingCount = config.GetWingCount(); + for (int i = 1; i <= wingCount; i++) { + tigl::CCPACSWing& wing = config.GetWing(i); + if (wing.IsRotorBlade()) { + continue; + } + // Get all component segments + for (int j = 1; j <= wing.GetComponentSegmentCount(); ++j) { + tigl::CCPACSWingComponentSegment& segment = wing.GetComponentSegment(j); + compSegs << segment.GetUID().c_str(); + } } - + } + else { + tigl::CCPACSWing& wing = config.GetWing(wingUID.toStdString()); + if (wing.IsRotorBlade()) { + throw tigl::CTiglError("Selected wing is a rotor blade!", TIGL_ERROR); + } + // Only get component segments of the selected wing for (int j = 1; j <= wing.GetComponentSegmentCount(); ++j) { tigl::CCPACSWingComponentSegment& segment = wing.GetComponentSegment(j); compSegs << segment.GetUID().c_str(); } + if (wing.GetComponentSegmentCount() == 1 && !compSegs.empty()) { + return compSegs[0]; + } } QString choice = QInputDialog::getItem(app, tr("Select Component Segment"), tr("Available Component Segments:"), @@ -1239,29 +1255,11 @@ bool TIGLCreatorDocument::drawWingFlaps(tigl::CCPACSWing& wing) tigl::ITiglGeometricComponent& component = GetConfiguration().GetUIDManager().GetGeometricComponent(wing.GetUID()); auto* geometricComp = dynamic_cast(&component); - if (geometricComp) { - TiglSymmetryAxis sym = geometricComp->GetSymmetryAxis(); - if (sym != TIGL_NO_SYMMETRY) { - tigl::CTiglTransformation trafo; - if (sym == TIGL_X_Z_PLANE) { - trafo.AddMirroringAtXZPlane(); - } - else if (sym == TIGL_X_Y_PLANE) { - trafo.AddMirroringAtXYPlane(); - } - else if (sym == TIGL_Y_Z_PLANE) { - trafo.AddMirroringAtYZPlane(); - } - - TopoDS_Shape loftCutouts = wing.GetLoftWithCutouts(); - PNamedShape loftNamed(new CNamedShape(loftCutouts, wing.GetUID().c_str())); - - PNamedShape mirrored = trafo.Transform(loftNamed); - if (mirrored) { - auto mshape = app->getScene()->displayShape(mirrored, false, getDefaultShapeSymmetryColor()); - app->getScene()->GetShapeManager().addObject(wing.GetUID(), mshape); - } - } + PNamedShape loftNamed(new CNamedShape(wing.GetLoftWithCutouts(), wing.GetUID().c_str())); + PNamedShape mirroredLoft = wing.GetMirroredLoft(loftNamed); + if (mirroredLoft) { + auto shape = app->getScene()->displayShape(mirroredLoft, true, getDefaultShapeSymmetryColor()); + app->getScene()->GetShapeManager().addObject(wing.GetUID(), shape); } for (auto& pcs : wing.GetComponentSegments()->GetComponentSegments()) { @@ -1418,6 +1416,37 @@ void TIGLCreatorDocument::updateFlapTransform(const std::string& controlUID) app->getViewer()->update(); } +void TIGLCreatorDocument::removeWingFlaps(const QString& Uid) +{ + tigl::CCPACSWing& wing = GetConfiguration().GetWing(Uid.toStdString()); + + for (int j = 1; j <= wing.GetComponentSegmentCount(); ++j) { + tigl::CCPACSWingComponentSegment& cs = wing.GetComponentSegment(j); + + if (auto& teds = cs.GetControlSurfaces()->GetTrailingEdgeDevices()) { + for (auto& ted : teds->GetTrailingEdgeDevices()) { + auto objs = app->getScene()->GetShapeManager().GetIObjectsFromShapeName(ted->GetUID()); + // remove flap shapes + for (auto& obj : objs) { + app->getScene()->getContext()->Remove(obj, Standard_True); + app->getScene()->GetShapeManager().removeObject(obj); + } + } + } + if (auto& leds = cs.GetControlSurfaces()->GetLeadingEdgeDevices()) { + for (auto& led : leds->GetLeadingEdgeDevices()) { + auto objs = app->getScene()->GetShapeManager().GetIObjectsFromShapeName(led->GetUID()); + // remove flap shapes + for (auto& obj : objs) { + app->getScene()->getContext()->Remove(obj, Standard_True); + app->getScene()->GetShapeManager().removeObject(obj); + } + } + } + } +} + + void TIGLCreatorDocument::drawFuselage() { QString fuselageUid = dlgGetFuselageSelection(); @@ -2372,9 +2401,9 @@ void TIGLCreatorDocument::drawWingShells() } } -void TIGLCreatorDocument::drawWingStructure() +void TIGLCreatorDocument::drawWingStructure(const QString& Uid) { - QString csUid = dlgGetWingComponentSegmentSelection(); + QString csUid = dlgGetWingComponentSegmentSelection(Uid); if (csUid == "") { return; } @@ -2409,10 +2438,17 @@ void TIGLCreatorDocument::drawWingStructure() return; } - app->getScene()->deleteAllObjects(); + auto objects = app->getScene()->GetShapeManager().GetIObjectsFromShapeName(Uid.toStdString()); + for (auto& obj : objects) { + app->getScene()->getContext()->Remove(obj, Standard_False); + app->getScene()->GetShapeManager().removeObject(obj); + } + + removeWingFlaps(Uid); // display component segment shape with transparency - app->getScene()->displayShape(cs.GetLoft(), true, Quantity_NOC_ShapeCol, 0.5); + auto cs_shape = app->getScene()->displayShape(cs.GetLoft(), true, Quantity_NOC_ShapeCol, 0.5); + app->getScene()->GetShapeManager().addObject(Uid.toStdString(), cs_shape); const tigl::CCPACSWingCSStructure& structure = *cs.GetStructure(); @@ -2420,14 +2456,16 @@ void TIGLCreatorDocument::drawWingStructure() for (int ispar = 1; ispar <= structure.GetSparSegmentCount(); ++ispar) { const tigl::CCPACSWingSparSegment& spar = structure.GetSparSegment(ispar); TopoDS_Shape sparGeom = spar.GetSparGeometry(); - app->getScene()->displayShape(sparGeom, true, Quantity_NOC_RED); + auto spar_shape = app->getScene()->displayShape(sparGeom, true, Quantity_NOC_RED); + app->getScene()->GetShapeManager().addObject(Uid.toStdString(), spar_shape); } // draw ribs for (int irib = 1; irib <= structure.GetRibsDefinitionCount(); ++irib) { const tigl::CCPACSWingRibsDefinition& rib = structure.GetRibsDefinition(irib); TopoDS_Shape ribGeom = rib.GetRibsGeometry(); - app->getScene()->displayShape(ribGeom, true, Quantity_NOC_RED); + auto rib_shape = app->getScene()->displayShape(ribGeom, true, Quantity_NOC_RED); + app->getScene()->GetShapeManager().addObject(Uid.toStdString(), rib_shape); } } catch (tigl::CTiglError& err) { diff --git a/TIGLCreator/src/TIGLCreatorDocument.h b/TIGLCreator/src/TIGLCreatorDocument.h index 5fd595508..f7b451e71 100644 --- a/TIGLCreator/src/TIGLCreatorDocument.h +++ b/TIGLCreator/src/TIGLCreatorDocument.h @@ -103,7 +103,7 @@ public slots: void drawWingComponentSegmentPoints(); void drawWingShells(); void drawWingFlaps(const QString& wingUID=nullptr); - void drawWingStructure(); + void drawWingStructure(const QString& wingUID=nullptr); // Fuselage slots void drawFuselageProfiles(); @@ -164,7 +164,7 @@ private slots: // Wing selection dialogs QString dlgGetWingOrRotorBladeSelection(); QString dlgGetWingSelection(); - QString dlgGetWingComponentSegmentSelection(); + QString dlgGetWingComponentSegmentSelection(const QString& wingUID=nullptr); QString dlgGetWingSegmentSelection(); QString dlgGetWingProfileSelection(); @@ -216,6 +216,7 @@ private slots: void drawWingShells(tigl::CCPACSWing& wing); bool drawWingFlaps(tigl::CCPACSWing& wing); void drawWingFlap(const QString& flapUID); + void removeWingFlaps(const QString& Uid); void createShapeTriangulation(const class TopoDS_Shape& shape, class TopoDS_Compound& compound); diff --git a/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp b/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp index db6424bf9..1df095470 100644 --- a/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp +++ b/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp @@ -202,7 +202,7 @@ void ModificatorDisplayOptionsWidget::setFromItem(cpcr::CPACSTreeItem* item, TIG drawCallbacks.push_back([doc]() { if (doc) doc->drawWingShells(); }); ui->drawOptionsCombo->addItem(tr("Structure")); - drawCallbacks.push_back([doc]() { if (doc) doc->drawWingStructure(); }); + drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawWingStructure(uid); }); ui->drawOptionsCombo->addItem(tr("Flaps")); drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawWingFlaps(uid); }); @@ -491,7 +491,7 @@ void ModificatorDisplayOptionsWidget::onResetOptions() else { currentDoc->drawComponentByUID(uid); } - + if (!currentContext->getContext().IsNull()) { currentContext->updateViewer(); } diff --git a/src/wing/CCPACSWing.cpp b/src/wing/CCPACSWing.cpp index 09347ebea..6eebe56ae 100644 --- a/src/wing/CCPACSWing.cpp +++ b/src/wing/CCPACSWing.cpp @@ -64,6 +64,7 @@ #include #include #include +#include "CNamedShape.h" #include "CTiglLogging.h" #include #include @@ -305,6 +306,39 @@ CCPACSWingComponentSegment& CCPACSWing::GetComponentSegment(const std::string& u return m_componentSegments->GetComponentSegment(uid); } +PNamedShape CCPACSWing::GetMirroredLoft(PNamedShape input_shape) const +{ + if (!input_shape) { + input_shape = GetLoft(); + } + const TiglSymmetryAxis& symmetryAxis = GetSymmetryAxis(); + if (symmetryAxis == TIGL_NO_SYMMETRY) { + return PNamedShape(); + } + + CTiglTransformation trafo; + if (symmetryAxis == TIGL_X_Z_PLANE) { + trafo.AddMirroringAtXZPlane(); + } + else if (symmetryAxis == TIGL_X_Y_PLANE) { + trafo.AddMirroringAtXYPlane(); + } + else if (symmetryAxis == TIGL_Y_Z_PLANE) { + trafo.AddMirroringAtYZPlane(); + } + + PNamedShape mirroredShape = trafo.Transform(input_shape); + + std::string mirrorName = mirroredShape->Name(); + mirrorName += "M"; + std::string mirrorShortName = mirroredShape->ShortName(); + mirrorShortName += "M"; + mirroredShape->SetName(mirrorName.c_str()); + mirroredShape->SetShortName(mirrorShortName.c_str()); + return mirroredShape; +} + + // Gets the loft of the whole wing with modeled leading edge. TopoDS_Shape& CCPACSWing::GetLoftWithLeadingEdge() { diff --git a/src/wing/CCPACSWing.h b/src/wing/CCPACSWing.h index 94788ccb0..8ca9ccbb3 100644 --- a/src/wing/CCPACSWing.h +++ b/src/wing/CCPACSWing.h @@ -174,6 +174,12 @@ friend class CTiglWingBuilder; */ TIGL_EXPORT CCPACSWingComponentSegment& GetComponentSegment(const std::string& uid); + /** + * @brief Returns the mirrored loft at the wings symmetry plane + * @param input_shape Shape to be mirrored with the wings symmetry + * @return PNamedShape + */ + TIGL_EXPORT PNamedShape GetMirroredLoft(PNamedShape input_shape = nullptr) const; /** * @brief Returns the positioning transformation for a given section uid * @param sectionUID From 009cbe75e0e15873fcd2b4e6de4d92f95dd430e3 Mon Sep 17 00:00:00 2001 From: Ole Albers Date: Fri, 23 Jan 2026 14:42:58 +0100 Subject: [PATCH 10/26] mirror ribs and spars --- TIGLCreator/src/TIGLCreatorDocument.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/TIGLCreator/src/TIGLCreatorDocument.cpp b/TIGLCreator/src/TIGLCreatorDocument.cpp index a916b1986..cd53ef021 100644 --- a/TIGLCreator/src/TIGLCreatorDocument.cpp +++ b/TIGLCreator/src/TIGLCreatorDocument.cpp @@ -2458,6 +2458,16 @@ void TIGLCreatorDocument::drawWingStructure(const QString& Uid) TopoDS_Shape sparGeom = spar.GetSparGeometry(); auto spar_shape = app->getScene()->displayShape(sparGeom, true, Quantity_NOC_RED); app->getScene()->GetShapeManager().addObject(Uid.toStdString(), spar_shape); + + PNamedShape loftNamed(new CNamedShape(sparGeom, Uid.toStdString())); + tigl::CCPACSWing& wing = GetConfiguration().GetWing(Uid.toStdString()); + PNamedShape mirroredLoft = wing.GetMirroredLoft(loftNamed); + if (mirroredLoft) + { + auto shape = app->getScene()->displayShape(mirroredLoft, true, getDefaultShapeSymmetryColor()); + app->getScene()->GetShapeManager().addObject(Uid.toStdString(), shape); + + } } // draw ribs @@ -2466,6 +2476,16 @@ void TIGLCreatorDocument::drawWingStructure(const QString& Uid) TopoDS_Shape ribGeom = rib.GetRibsGeometry(); auto rib_shape = app->getScene()->displayShape(ribGeom, true, Quantity_NOC_RED); app->getScene()->GetShapeManager().addObject(Uid.toStdString(), rib_shape); + + PNamedShape loftNamed(new CNamedShape(ribGeom, Uid.toStdString())); + tigl::CCPACSWing& wing = GetConfiguration().GetWing(Uid.toStdString()); + PNamedShape mirroredLoft = wing.GetMirroredLoft(loftNamed); + if (mirroredLoft) + { + auto shape = app->getScene()->displayShape(mirroredLoft, true, getDefaultShapeSymmetryColor()); + app->getScene()->GetShapeManager().addObject(Uid.toStdString(), shape); + + } } } catch (tigl::CTiglError& err) { From 4fb65919e89b6482f2305f283e20715247eb01d0 Mon Sep 17 00:00:00 2001 From: Ole Albers Date: Tue, 3 Feb 2026 10:41:43 +0100 Subject: [PATCH 11/26] add wing structure to display options --- TIGLCreator/src/TIGLCreatorDocument.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/TIGLCreator/src/TIGLCreatorDocument.cpp b/TIGLCreator/src/TIGLCreatorDocument.cpp index cd53ef021..b59d958e4 100644 --- a/TIGLCreator/src/TIGLCreatorDocument.cpp +++ b/TIGLCreator/src/TIGLCreatorDocument.cpp @@ -1190,6 +1190,7 @@ void TIGLCreatorDocument::drawWing(const QString& Uid) } } } + app->getScene()->updateViewer(); } void TIGLCreatorDocument::drawWingFlaps(const QString& Uid) @@ -2445,10 +2446,18 @@ void TIGLCreatorDocument::drawWingStructure(const QString& Uid) } removeWingFlaps(Uid); + tigl::CCPACSWing& wing = GetConfiguration().GetWing(Uid.toStdString()); // display component segment shape with transparency auto cs_shape = app->getScene()->displayShape(cs.GetLoft(), true, Quantity_NOC_ShapeCol, 0.5); app->getScene()->GetShapeManager().addObject(Uid.toStdString(), cs_shape); + PNamedShape mirroredLoft = wing.GetMirroredLoft(cs.GetLoft()); + if (mirroredLoft) + { + auto shape = app->getScene()->displayShape(mirroredLoft, true, Quantity_NOC_ShapeCol, 0.5); + app->getScene()->GetShapeManager().addObject(Uid.toStdString(), shape); + + } const tigl::CCPACSWingCSStructure& structure = *cs.GetStructure(); @@ -2460,11 +2469,10 @@ void TIGLCreatorDocument::drawWingStructure(const QString& Uid) app->getScene()->GetShapeManager().addObject(Uid.toStdString(), spar_shape); PNamedShape loftNamed(new CNamedShape(sparGeom, Uid.toStdString())); - tigl::CCPACSWing& wing = GetConfiguration().GetWing(Uid.toStdString()); PNamedShape mirroredLoft = wing.GetMirroredLoft(loftNamed); if (mirroredLoft) { - auto shape = app->getScene()->displayShape(mirroredLoft, true, getDefaultShapeSymmetryColor()); + auto shape = app->getScene()->displayShape(mirroredLoft, true, Quantity_NOC_RED); app->getScene()->GetShapeManager().addObject(Uid.toStdString(), shape); } @@ -2482,7 +2490,7 @@ void TIGLCreatorDocument::drawWingStructure(const QString& Uid) PNamedShape mirroredLoft = wing.GetMirroredLoft(loftNamed); if (mirroredLoft) { - auto shape = app->getScene()->displayShape(mirroredLoft, true, getDefaultShapeSymmetryColor()); + auto shape = app->getScene()->displayShape(mirroredLoft, true, Quantity_NOC_RED); app->getScene()->GetShapeManager().addObject(Uid.toStdString(), shape); } From b173bb596dcadc8ec7854837ef14b4f30560b12d Mon Sep 17 00:00:00 2001 From: Ole Albers Date: Tue, 3 Feb 2026 13:00:01 +0100 Subject: [PATCH 12/26] add shells to display options --- TIGLCreator/src/TIGLCreatorDocument.cpp | 44 +++++++++++++++---- TIGLCreator/src/TIGLCreatorDocument.h | 2 +- .../ModificatorDisplayOptionsWidget.cpp | 2 +- 3 files changed, 37 insertions(+), 11 deletions(-) diff --git a/TIGLCreator/src/TIGLCreatorDocument.cpp b/TIGLCreator/src/TIGLCreatorDocument.cpp index b59d958e4..46b0052d6 100644 --- a/TIGLCreator/src/TIGLCreatorDocument.cpp +++ b/TIGLCreator/src/TIGLCreatorDocument.cpp @@ -1252,10 +1252,6 @@ bool TIGLCreatorDocument::drawWingFlaps(tigl::CCPACSWing& wing) auto shape = app->getScene()->displayShape(wing.GetLoftWithCutouts(), true, getDefaultShapeColor()); app->getScene()->GetShapeManager().addObject(wing.GetUID(), shape); - // manually mirror wing with cutouts - tigl::ITiglGeometricComponent& component = GetConfiguration().GetUIDManager().GetGeometricComponent(wing.GetUID()); - auto* geometricComp = dynamic_cast(&component); - PNamedShape loftNamed(new CNamedShape(wing.GetLoftWithCutouts(), wing.GetUID().c_str())); PNamedShape mirroredLoft = wing.GetMirroredLoft(loftNamed); if (mirroredLoft) { @@ -2390,9 +2386,19 @@ void TIGLCreatorDocument::drawWingComponentSegmentPoints() } } -void TIGLCreatorDocument::drawWingShells() +void TIGLCreatorDocument::drawWingShells(const QString& Uid) { - QString wingUid = dlgGetWingSelection(); + QString wingUid; + if (Uid == nullptr) { + wingUid = dlgGetWingSelection(); + if (wingUid == "") { + return; + } + } + else { + wingUid = Uid; + } + try { tigl::CCPACSWing& wing = GetConfiguration().GetWing(wingUid.toStdString()); drawWingShells(wing); @@ -3123,10 +3129,30 @@ void TIGLCreatorDocument::drawWingComponentSegmentPoint(const std::string& csUID void TIGLCreatorDocument::drawWingShells(tigl::CCPACSWing& wing) { START_COMMAND() - app->getScene()->deleteAllObjects(); - app->getScene()->displayShape(wing.GetUpperShape(), true, Quantity_NOC_GREEN); - app->getScene()->displayShape(wing.GetLowerShape(), true, Quantity_NOC_RED); + auto objects = app->getScene()->GetShapeManager().GetIObjectsFromShapeName(wing.GetUID()); + for (auto& obj : objects) { + app->getScene()->getContext()->Remove(obj, Standard_False); + app->getScene()->GetShapeManager().removeObject(obj); + } + + removeWingFlaps(QString::fromStdString(wing.GetUID())); + + TopoDS_Shape shapes[2] = {wing.GetUpperShape(), wing.GetLowerShape()}; + Quantity_NameOfColor colors[2] = {Quantity_NOC_GREEN, Quantity_NOC_RED}; + for (int i = 0; i < 2; ++i) { + + auto shape = app->getScene()->displayShape(shapes[i], true, colors[i]); + app->getScene()->GetShapeManager().addObject(wing.GetUID(), shape); + + PNamedShape loftNamed(new CNamedShape(shapes[i], wing.GetUID().c_str())); + PNamedShape mirroredLoft = wing.GetMirroredLoft(loftNamed); + if (mirroredLoft) { + auto shape = app->getScene()->displayShape(mirroredLoft, true, colors[i]); + app->getScene()->GetShapeManager().addObject(wing.GetUID(), shape); + } + } + app->getScene()->getViewer()->Update(); } /* diff --git a/TIGLCreator/src/TIGLCreatorDocument.h b/TIGLCreator/src/TIGLCreatorDocument.h index f7b451e71..b62861abd 100644 --- a/TIGLCreator/src/TIGLCreatorDocument.h +++ b/TIGLCreator/src/TIGLCreatorDocument.h @@ -101,7 +101,7 @@ public slots: void drawFusedWing(); void drawWingComponentSegment(); void drawWingComponentSegmentPoints(); - void drawWingShells(); + void drawWingShells(const QString& wingUID=nullptr); void drawWingFlaps(const QString& wingUID=nullptr); void drawWingStructure(const QString& wingUID=nullptr); diff --git a/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp b/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp index 1df095470..f578926d2 100644 --- a/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp +++ b/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp @@ -199,7 +199,7 @@ void ModificatorDisplayOptionsWidget::setFromItem(cpcr::CPACSTreeItem* item, TIG drawCallbacks.push_back([doc]() { if (doc) doc->drawWingComponentSegmentPoints(); }); ui->drawOptionsCombo->addItem(tr("Shells")); - drawCallbacks.push_back([doc]() { if (doc) doc->drawWingShells(); }); + drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawWingShells(uid); }); ui->drawOptionsCombo->addItem(tr("Structure")); drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawWingStructure(uid); }); From 0032980487501bd1f6d49c3b57c51f9edd20afe3 Mon Sep 17 00:00:00 2001 From: Ole Albers Date: Tue, 3 Feb 2026 14:16:00 +0100 Subject: [PATCH 13/26] add component segments to display options --- TIGLCreator/src/TIGLCreatorDocument.cpp | 32 ++++++++++++++++--- TIGLCreator/src/TIGLCreatorDocument.h | 4 +-- .../ModificatorDisplayOptionsWidget.cpp | 4 +-- 3 files changed, 31 insertions(+), 9 deletions(-) diff --git a/TIGLCreator/src/TIGLCreatorDocument.cpp b/TIGLCreator/src/TIGLCreatorDocument.cpp index 46b0052d6..88d7713de 100644 --- a/TIGLCreator/src/TIGLCreatorDocument.cpp +++ b/TIGLCreator/src/TIGLCreatorDocument.cpp @@ -2361,19 +2361,41 @@ void TIGLCreatorDocument::drawIntersectionLine() delete Intersector; } -void TIGLCreatorDocument::drawWingComponentSegment() +void TIGLCreatorDocument::drawWingComponentSegment(const QString& Uid) { - QString csUid = dlgGetWingComponentSegmentSelection(); + QString csUid = dlgGetWingComponentSegmentSelection(Uid); if (csUid == "") { return; } - drawComponentByUID(csUid); + auto& cs = GetConfiguration().GetUIDManager().ResolveObject(csUid.toStdString()); + + auto objects = app->getScene()->GetShapeManager().GetIObjectsFromShapeName(Uid.toStdString()); + for (auto& obj : objects) { + app->getScene()->getContext()->Remove(obj, Standard_False); + app->getScene()->GetShapeManager().removeObject(obj); + } + + removeWingFlaps(Uid); + tigl::CCPACSWing& wing = GetConfiguration().GetWing(Uid.toStdString()); + + // display component segment shape with transparency + auto cs_shape = app->getScene()->displayShape(cs.GetLoft(), true, getDefaultShapeColor()); + app->getScene()->GetShapeManager().addObject(Uid.toStdString(), cs_shape); + PNamedShape mirroredLoft = wing.GetMirroredLoft(cs.GetLoft()); + if (mirroredLoft) + { + auto shape = app->getScene()->displayShape(mirroredLoft, true, getDefaultShapeSymmetryColor()); + app->getScene()->GetShapeManager().addObject(Uid.toStdString(), shape); + + } + + app->getScene()->updateViewer(); } -void TIGLCreatorDocument::drawWingComponentSegmentPoints() +void TIGLCreatorDocument::drawWingComponentSegmentPoints(const QString& Uid) { - QString csUid = dlgGetWingComponentSegmentSelection(); + QString csUid = dlgGetWingComponentSegmentSelection(Uid); if (csUid == "") { return; } diff --git a/TIGLCreator/src/TIGLCreatorDocument.h b/TIGLCreator/src/TIGLCreatorDocument.h index b62861abd..42fbe6a25 100644 --- a/TIGLCreator/src/TIGLCreatorDocument.h +++ b/TIGLCreator/src/TIGLCreatorDocument.h @@ -99,8 +99,8 @@ public slots: void drawWingTriangulation(); void drawWingSamplePoints(); void drawFusedWing(); - void drawWingComponentSegment(); - void drawWingComponentSegmentPoints(); + void drawWingComponentSegment(const QString& wingUID=nullptr); + void drawWingComponentSegmentPoints(const QString& wingUID=nullptr); void drawWingShells(const QString& wingUID=nullptr); void drawWingFlaps(const QString& wingUID=nullptr); void drawWingStructure(const QString& wingUID=nullptr); diff --git a/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp b/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp index f578926d2..a68fd4b79 100644 --- a/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp +++ b/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp @@ -193,10 +193,10 @@ void ModificatorDisplayOptionsWidget::setFromItem(cpcr::CPACSTreeItem* item, TIG drawCallbacks.push_back([doc]() { if (doc) doc->drawFusedWing(); }); ui->drawOptionsCombo->addItem(tr("Component segment")); - drawCallbacks.push_back([doc]() { if (doc) doc->drawWingComponentSegment(); }); + drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawWingComponentSegment(uid); }); ui->drawOptionsCombo->addItem(tr("Component segment points")); - drawCallbacks.push_back([doc]() { if (doc) doc->drawWingComponentSegmentPoints(); }); + drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawWingComponentSegmentPoints(uid); }); ui->drawOptionsCombo->addItem(tr("Shells")); drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawWingShells(uid); }); From 6619f614734c0afc585b00ebd30cd00882e77094 Mon Sep 17 00:00:00 2001 From: Ole Albers Date: Tue, 3 Feb 2026 14:31:39 +0100 Subject: [PATCH 14/26] add fused wing --- TIGLCreator/src/TIGLCreatorDocument.cpp | 2 +- TIGLCreator/src/TIGLCreatorDocument.h | 2 +- .../src/modificators/ModificatorDisplayOptionsWidget.cpp | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/TIGLCreator/src/TIGLCreatorDocument.cpp b/TIGLCreator/src/TIGLCreatorDocument.cpp index 88d7713de..5d2580467 100644 --- a/TIGLCreator/src/TIGLCreatorDocument.cpp +++ b/TIGLCreator/src/TIGLCreatorDocument.cpp @@ -2178,7 +2178,7 @@ void TIGLCreatorDocument::drawFusedFuselage() app->getScene()->displayShape(fuselage.GetLoft(), true, getDefaultShapeColor()); } -void TIGLCreatorDocument::drawFusedWing() +void TIGLCreatorDocument::drawFusedWing(const QString& Uid) { QString wingUid = dlgGetWingSelection(); try { diff --git a/TIGLCreator/src/TIGLCreatorDocument.h b/TIGLCreator/src/TIGLCreatorDocument.h index 42fbe6a25..af0250e54 100644 --- a/TIGLCreator/src/TIGLCreatorDocument.h +++ b/TIGLCreator/src/TIGLCreatorDocument.h @@ -98,7 +98,7 @@ public slots: void drawWingGuideCurves(); void drawWingTriangulation(); void drawWingSamplePoints(); - void drawFusedWing(); + void drawFusedWing(const QString& wingUID=nullptr); void drawWingComponentSegment(const QString& wingUID=nullptr); void drawWingComponentSegmentPoints(const QString& wingUID=nullptr); void drawWingShells(const QString& wingUID=nullptr); diff --git a/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp b/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp index a68fd4b79..4b07c88f8 100644 --- a/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp +++ b/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp @@ -189,8 +189,8 @@ void ModificatorDisplayOptionsWidget::setFromItem(cpcr::CPACSTreeItem* item, TIG ui->drawOptionsCombo->addItem(tr("Sample points")); drawCallbacks.push_back([doc]() { if (doc) doc->drawWingSamplePoints(); }); - ui->drawOptionsCombo->addItem(tr("Fused wing")); - drawCallbacks.push_back([doc]() { if (doc) doc->drawFusedWing(); }); + ui->drawOptionsCombo->addItem(tr("Show Fused wing")); + drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawFusedWing(uid); }); ui->drawOptionsCombo->addItem(tr("Component segment")); drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawWingComponentSegment(uid); }); From 84f390e8edbdd3e39afb83c4b6fbae48e67db558 Mon Sep 17 00:00:00 2001 From: Ole Albers Date: Tue, 3 Feb 2026 14:32:03 +0100 Subject: [PATCH 15/26] rename show options --- .../ModificatorDisplayOptionsWidget.cpp | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp b/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp index 4b07c88f8..0e18d8897 100644 --- a/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp +++ b/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp @@ -171,40 +171,40 @@ void ModificatorDisplayOptionsWidget::setFromItem(cpcr::CPACSTreeItem* item, TIG if (type == TIGL_COMPONENT_WING) { // Add entries and store callbacks that call the document drawing functions - ui->drawOptionsCombo->addItem(tr("Wing")); + ui->drawOptionsCombo->addItem(tr("Show Wing")); drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawWing(uid); }); - ui->drawOptionsCombo->addItem(tr("Profiles")); + ui->drawOptionsCombo->addItem(tr("Show Wing Profiles")); drawCallbacks.push_back([doc]() { if (doc) doc->drawWingProfiles(); }); - ui->drawOptionsCombo->addItem(tr("Overlay profile points")); + ui->drawOptionsCombo->addItem(tr("Show overlay profile points")); drawCallbacks.push_back([doc]() { if (doc) doc->drawWingOverlayProfilePoints(); }); - ui->drawOptionsCombo->addItem(tr("Guide curves")); + ui->drawOptionsCombo->addItem(tr("Show Wing Guide curves")); drawCallbacks.push_back([doc]() { if (doc) doc->drawWingGuideCurves(); }); - ui->drawOptionsCombo->addItem(tr("Triangulation")); + ui->drawOptionsCombo->addItem(tr("Show Wing Triangulation")); drawCallbacks.push_back([doc]() { if (doc) doc->drawWingTriangulation(); }); - ui->drawOptionsCombo->addItem(tr("Sample points")); + ui->drawOptionsCombo->addItem(tr("Show Wing sample points")); drawCallbacks.push_back([doc]() { if (doc) doc->drawWingSamplePoints(); }); ui->drawOptionsCombo->addItem(tr("Show Fused wing")); drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawFusedWing(uid); }); - ui->drawOptionsCombo->addItem(tr("Component segment")); + ui->drawOptionsCombo->addItem(tr("Show Wing Component segment")); drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawWingComponentSegment(uid); }); - ui->drawOptionsCombo->addItem(tr("Component segment points")); + ui->drawOptionsCombo->addItem(tr("Show Wing Component segment points")); drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawWingComponentSegmentPoints(uid); }); - ui->drawOptionsCombo->addItem(tr("Shells")); + ui->drawOptionsCombo->addItem(tr("Show Wing Shells")); drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawWingShells(uid); }); - ui->drawOptionsCombo->addItem(tr("Structure")); + ui->drawOptionsCombo->addItem(tr("Show Wing Structure")); drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawWingStructure(uid); }); - ui->drawOptionsCombo->addItem(tr("Flaps")); + ui->drawOptionsCombo->addItem(tr("Show Wing Flaps")); drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawWingFlaps(uid); }); // Trigger the corresponding callback when an item is activated. Use UniqueConnection to avoid duplicate connections. From c7b5cd87de26fa334964a7f1a80446d4d3b6d357 Mon Sep 17 00:00:00 2001 From: Ole Albers Date: Tue, 3 Feb 2026 14:32:45 +0100 Subject: [PATCH 16/26] use removeWingFlaps helper --- TIGLCreator/src/TIGLCreatorDocument.cpp | 33 +------------------------ 1 file changed, 1 insertion(+), 32 deletions(-) diff --git a/TIGLCreator/src/TIGLCreatorDocument.cpp b/TIGLCreator/src/TIGLCreatorDocument.cpp index 5d2580467..f382926ab 100644 --- a/TIGLCreator/src/TIGLCreatorDocument.cpp +++ b/TIGLCreator/src/TIGLCreatorDocument.cpp @@ -1156,40 +1156,9 @@ void TIGLCreatorDocument::drawWing(const QString& Uid) app->getScene()->GetShapeManager().removeObject(obj); app->getScene()->getContext()->Remove(obj, Standard_False); } + removeWingFlaps(wingUid); drawComponentByUID(wingUid); - if (wing.GetComponentSegments()) - { - for (auto& pcs : wing.GetComponentSegments()->GetComponentSegments()) { - if (!pcs->GetControlSurfaces() || pcs->GetControlSurfaces()->ControlSurfaceCount() == 0) { - continue; - } - if (auto& teds = pcs->GetControlSurfaces()->GetTrailingEdgeDevices()) { - for (auto& ted : teds->GetTrailingEdgeDevices()) { - auto objects = app->getScene()->GetShapeManager().GetIObjectsFromShapeName(ted->GetUID()); - for (auto& obj : objects) { - app->getScene()->getContext()->Remove(obj, Standard_False); - } - objects = app->getScene()->GetShapeManager().GetIObjectsFromShapeName(ted->GetUID()+"M"); - for (auto& obj : objects) { - app->getScene()->getContext()->Remove(obj, Standard_False); - } - } - } - if (auto& leds = pcs->GetControlSurfaces()->GetLeadingEdgeDevices()) { - for (auto& led : leds->GetLeadingEdgeDevices()) { - auto objects = app->getScene()->GetShapeManager().GetIObjectsFromShapeName(led->GetUID()); - for (auto& obj : objects) { - app->getScene()->getContext()->Remove(obj, Standard_False); - } - objects = app->getScene()->GetShapeManager().GetIObjectsFromShapeName(led->GetUID()+"M"); - for (auto& obj : objects) { - app->getScene()->getContext()->Remove(obj, Standard_False); - } - } - } - } - } app->getScene()->updateViewer(); } From 942bb66c4392124f8f042b59e0281867dc4e92dd Mon Sep 17 00:00:00 2001 From: Ole Albers Date: Tue, 3 Feb 2026 14:36:50 +0100 Subject: [PATCH 17/26] use draw wing in drawfusedwing --- TIGLCreator/src/TIGLCreatorDocument.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/TIGLCreator/src/TIGLCreatorDocument.cpp b/TIGLCreator/src/TIGLCreatorDocument.cpp index f382926ab..e59f89bfa 100644 --- a/TIGLCreator/src/TIGLCreatorDocument.cpp +++ b/TIGLCreator/src/TIGLCreatorDocument.cpp @@ -2149,14 +2149,8 @@ void TIGLCreatorDocument::drawFusedFuselage() void TIGLCreatorDocument::drawFusedWing(const QString& Uid) { - QString wingUid = dlgGetWingSelection(); - try { - tigl::CCPACSWing& wing = GetConfiguration().GetWing(wingUid.toStdString()); - drawFusedWing(wing); - } - catch (tigl::CTiglError& ex) { - displayError(ex.what()); - } + // check if function can be removed entirely + drawWing(Uid); } void TIGLCreatorDocument::drawFusedAircraft() From 6169d9809674a2f72839375915ba2ec9955ae2a6 Mon Sep 17 00:00:00 2001 From: Ole Albers Date: Tue, 3 Feb 2026 16:43:54 +0100 Subject: [PATCH 18/26] add sample points to display options --- TIGLCreator/src/TIGLCreatorContext.cpp | 9 +- TIGLCreator/src/TIGLCreatorContext.h | 2 +- TIGLCreator/src/TIGLCreatorDocument.cpp | 90 +++++++++---------- TIGLCreator/src/TIGLCreatorDocument.h | 4 +- .../ModificatorDisplayOptionsWidget.cpp | 2 +- 5 files changed, 51 insertions(+), 56 deletions(-) diff --git a/TIGLCreator/src/TIGLCreatorContext.cpp b/TIGLCreator/src/TIGLCreatorContext.cpp index 963464a06..299deb89d 100644 --- a/TIGLCreator/src/TIGLCreatorContext.cpp +++ b/TIGLCreator/src/TIGLCreatorContext.cpp @@ -410,7 +410,7 @@ Handle(AIS_Shape) TIGLCreatorContext::displayShape(const PNamedShape& pshape, bo } // Displays a point on the screen -void TIGLCreatorContext::displayPoint(const gp_Pnt& aPoint, +Handle(AIS_Shape) TIGLCreatorContext::displayPoint(const gp_Pnt& aPoint, const char* aText, Standard_Boolean UpdateViewer, Standard_Real anXoffset, @@ -419,16 +419,17 @@ void TIGLCreatorContext::displayPoint(const gp_Pnt& aPoint, Standard_Real TextScale) { if (std::string(aText).empty()) { - displayShape(BRepBuilderAPI_MakeVertex(gp_Pnt(aPoint.X() + anXoffset, aPoint.Y() + anYoffset, aPoint.Z() + aZoffset)), UpdateViewer, Quantity_NOC_YELLOW); + return displayShape(BRepBuilderAPI_MakeVertex(gp_Pnt(aPoint.X() + anXoffset, aPoint.Y() + anYoffset, aPoint.Z() + aZoffset)), UpdateViewer, Quantity_NOC_YELLOW); } else { Handle(ISession_Point) aGraphicPoint = new ISession_Point(aPoint.X(), aPoint.Y(), aPoint.Z()); myContext->Display(aGraphicPoint,UpdateViewer); Handle(ISession_Text) aGraphicText = new ISession_Text(aText, aPoint.X() + anXoffset, - aPoint.Y() + anYoffset, - aPoint.Z() + aZoffset); + aPoint.Y() + anYoffset, + aPoint.Z() + aZoffset); aGraphicText->SetScale(TextScale); myContext->Display(aGraphicText,UpdateViewer); + return Handle(AIS_Shape)::DownCast(aGraphicPoint); } } diff --git a/TIGLCreator/src/TIGLCreatorContext.h b/TIGLCreator/src/TIGLCreatorContext.h index 95e2072d6..a9ffea5e7 100644 --- a/TIGLCreator/src/TIGLCreatorContext.h +++ b/TIGLCreator/src/TIGLCreatorContext.h @@ -61,7 +61,7 @@ class TIGLCreatorContext : public QObject void setGridOffset (Standard_Real offset); - void displayPoint(const gp_Pnt& aPoint, + Handle(AIS_Shape) displayPoint(const gp_Pnt& aPoint, const char* aText, Standard_Boolean UpdateViewer, Standard_Real anXoffset, diff --git a/TIGLCreator/src/TIGLCreatorDocument.cpp b/TIGLCreator/src/TIGLCreatorDocument.cpp index e59f89bfa..0d7408048 100644 --- a/TIGLCreator/src/TIGLCreatorDocument.cpp +++ b/TIGLCreator/src/TIGLCreatorDocument.cpp @@ -410,24 +410,30 @@ QString TIGLCreatorDocument::dlgGetWingOrRotorBladeSelection() } // Wing selection Dialog -QString TIGLCreatorDocument::dlgGetWingSelection() +QString TIGLCreatorDocument::dlgGetWingSelection(const QString& wingUid) { QStringList wings; bool ok; // Initialize wing list tigl::CCPACSConfiguration& config = GetConfiguration(); - int wingCount = config.GetWingCount(); - for (int i = 1; i <= wingCount; i++) { - tigl::CCPACSWing& wing = config.GetWing(i); - if (!wing.IsRotorBlade()) { - std::string name = wing.GetUID(); - if (name.empty()) { - name = "Unknown wing"; + + if (wingUid.isEmpty()) { + int wingCount = config.GetWingCount(); + for (int i = 1; i <= wingCount; i++) { + tigl::CCPACSWing& wing = config.GetWing(i); + if (!wing.IsRotorBlade()) { + std::string name = wing.GetUID(); + if (name.empty()) { + name = "Unknown wing"; + } + wings << name.c_str(); } - wings << name.c_str(); } } + else { + return wingUid; + } QString choice = QInputDialog::getItem(app, tr("Select Wing"), tr("Available Wings:"), wings, 0, false, &ok); if (ok) { @@ -1136,19 +1142,7 @@ void TIGLCreatorDocument::drawFuselageGuideCurves() void TIGLCreatorDocument::drawWing(const QString& Uid) { - QString wingUid; - if (Uid == nullptr) { - wingUid = dlgGetWingSelection(); - if (wingUid == "") { - return; - } - else { - drawComponentByUID(wingUid); - } - } - else { - wingUid = Uid; - } + QString wingUid = dlgGetWingSelection(Uid); tigl::CCPACSWing& wing = GetConfiguration().GetWing(wingUid.toStdString()); auto objects = app->getScene()->GetShapeManager().GetIObjectsFromShapeName(wingUid.toStdString()); @@ -1164,16 +1158,7 @@ void TIGLCreatorDocument::drawWing(const QString& Uid) void TIGLCreatorDocument::drawWingFlaps(const QString& Uid) { - QString wingUid; - if (Uid == nullptr) { - wingUid = dlgGetWingSelection(); - if (wingUid == "") { - return; - } - } - else { - wingUid = Uid; - } + QString wingUid = dlgGetWingSelection(Uid); try { tigl::CCPACSWing& wing = GetConfiguration().GetWing(wingUid.toStdString()); @@ -1464,9 +1449,9 @@ void TIGLCreatorDocument::drawFuselageTriangulation() app->getScene()->displayShape(triangulation, true, getDefaultShapeColor()); } -void TIGLCreatorDocument::drawWingSamplePoints() +void TIGLCreatorDocument::drawWingSamplePoints(const QString& Uid) { - QString wingUid = dlgGetWingSelection(); + QString wingUid = dlgGetWingSelection(Uid); try { tigl::CCPACSWing& wing = GetConfiguration().GetWing(wingUid.toStdString()); drawWingSamplePoints(wing); @@ -2373,16 +2358,7 @@ void TIGLCreatorDocument::drawWingComponentSegmentPoints(const QString& Uid) void TIGLCreatorDocument::drawWingShells(const QString& Uid) { - QString wingUid; - if (Uid == nullptr) { - wingUid = dlgGetWingSelection(); - if (wingUid == "") { - return; - } - } - else { - wingUid = Uid; - } + QString wingUid = dlgGetWingSelection(Uid); try { tigl::CCPACSWing& wing = GetConfiguration().GetWing(wingUid.toStdString()); @@ -3022,28 +2998,46 @@ void TIGLCreatorDocument::drawWingSamplePoints(tigl::CCPACSWing& wing) return; } - app->getScene()->deleteAllObjects(); + auto objects = app->getScene()->GetShapeManager().GetIObjectsFromShapeName(wing.GetUID()); + for (auto& obj : objects) { + app->getScene()->getContext()->Remove(obj, Standard_False); + app->getScene()->GetShapeManager().removeObject(obj); + } + + removeWingFlaps(QString::fromStdString(wing.GetUID())); for (int segmentIndex = 1; segmentIndex <= wing.GetSegmentCount(); segmentIndex++) { // Draw segment loft auto& segment = (tigl::CCPACSWingSegment&)wing.GetSegment(segmentIndex); - app->getScene()->displayShape(segment.GetLoft(), true, getDefaultShapeColor()); + auto shape = app->getScene()->displayShape(segment.GetLoft(), true, getDefaultShapeColor()); + app->getScene()->GetShapeManager().addObject(wing.GetUID(), shape); + PNamedShape mirroredLoft = wing.GetMirroredLoft(segment.GetLoft()); + if (mirroredLoft) + { + auto shape = app->getScene()->displayShape(mirroredLoft, true, getDefaultShapeSymmetryColor()); + app->getScene()->GetShapeManager().addObject(wing.GetUID(), shape); + + } + // Draw some points on the wing segment for (double eta = 0.0; eta <= 1.0; eta += 0.1) { for (double xsi = 0.0; xsi <= 1.0; xsi += 0.1) { double x, y, z; tiglWingGetUpperPoint(m_cpacsHandle, wingIndex, segmentIndex, eta, xsi, &x, &y, &z); - app->getScene()->displayPoint(gp_Pnt(x, y, z), "", Standard_False, 0., 0., 0., 1.); + auto point = app->getScene()->displayPoint(gp_Pnt(x, y, z), "", Standard_False, 0., 0., 0., 1.); + app->getScene()->GetShapeManager().addObject(wing.GetUID(), point); tiglWingGetLowerPoint(m_cpacsHandle, wingIndex, segmentIndex, eta, xsi, &x, &y, &z); - app->getScene()->displayPoint(gp_Pnt(x, y, z), "", Standard_False, 0., 0., 0., 1.); + point = app->getScene()->displayPoint(gp_Pnt(x, y, z), "", Standard_False, 0., 0., 0., 1.); + app->getScene()->GetShapeManager().addObject(wing.GetUID(), point); } } } + app->getScene()->updateViewer(); } /* diff --git a/TIGLCreator/src/TIGLCreatorDocument.h b/TIGLCreator/src/TIGLCreatorDocument.h index af0250e54..81a7b534e 100644 --- a/TIGLCreator/src/TIGLCreatorDocument.h +++ b/TIGLCreator/src/TIGLCreatorDocument.h @@ -97,7 +97,7 @@ public slots: void drawWingOverlayProfilePoints(); void drawWingGuideCurves(); void drawWingTriangulation(); - void drawWingSamplePoints(); + void drawWingSamplePoints(const QString& wingUID=nullptr); void drawFusedWing(const QString& wingUID=nullptr); void drawWingComponentSegment(const QString& wingUID=nullptr); void drawWingComponentSegmentPoints(const QString& wingUID=nullptr); @@ -163,7 +163,7 @@ private slots: // Wing selection dialogs QString dlgGetWingOrRotorBladeSelection(); - QString dlgGetWingSelection(); + QString dlgGetWingSelection(const QString& wingUID=nullptr); QString dlgGetWingComponentSegmentSelection(const QString& wingUID=nullptr); QString dlgGetWingSegmentSelection(); QString dlgGetWingProfileSelection(); diff --git a/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp b/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp index 0e18d8897..3fb90861f 100644 --- a/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp +++ b/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp @@ -187,7 +187,7 @@ void ModificatorDisplayOptionsWidget::setFromItem(cpcr::CPACSTreeItem* item, TIG drawCallbacks.push_back([doc]() { if (doc) doc->drawWingTriangulation(); }); ui->drawOptionsCombo->addItem(tr("Show Wing sample points")); - drawCallbacks.push_back([doc]() { if (doc) doc->drawWingSamplePoints(); }); + drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawWingSamplePoints(uid); }); ui->drawOptionsCombo->addItem(tr("Show Fused wing")); drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawFusedWing(uid); }); From 04086740db570a18208b52168639db32e7260a81 Mon Sep 17 00:00:00 2001 From: Ole Albers Date: Tue, 3 Feb 2026 16:53:24 +0100 Subject: [PATCH 19/26] add triangulation to display options --- TIGLCreator/src/TIGLCreatorDocument.cpp | 24 +++++++++++++++---- TIGLCreator/src/TIGLCreatorDocument.h | 2 +- .../ModificatorDisplayOptionsWidget.cpp | 2 +- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/TIGLCreator/src/TIGLCreatorDocument.cpp b/TIGLCreator/src/TIGLCreatorDocument.cpp index 0d7408048..0ca040d58 100644 --- a/TIGLCreator/src/TIGLCreatorDocument.cpp +++ b/TIGLCreator/src/TIGLCreatorDocument.cpp @@ -1417,9 +1417,9 @@ void TIGLCreatorDocument::drawFuselage() } } -void TIGLCreatorDocument::drawWingTriangulation() +void TIGLCreatorDocument::drawWingTriangulation(const QString& Uid) { - QString wingUid = dlgGetWingSelection(); + QString wingUid = dlgGetWingSelection(Uid); try { tigl::CCPACSWing& wing = GetConfiguration().GetWing(wingUid.toStdString()); drawWingTriangulation(wing); @@ -2968,14 +2968,30 @@ void TIGLCreatorDocument::drawWingTriangulation(tigl::CCPACSWing& wing) START_COMMAND() //clear screen - app->getScene()->deleteAllObjects(); + auto objects = app->getScene()->GetShapeManager().GetIObjectsFromShapeName(wing.GetUID()); + for (auto& obj : objects) { + app->getScene()->getContext()->Remove(obj, Standard_False); + app->getScene()->GetShapeManager().removeObject(obj); + } + + removeWingFlaps(QString::fromStdString(wing.GetUID())); //we do not fuse segments anymore but build it from scratch with the profiles const TopoDS_Shape& fusedWing = wing.GetLoft()->Shape(); TopoDS_Compound compound; createShapeTriangulation(fusedWing, compound); - app->getScene()->displayShape(compound, true, getDefaultShapeColor()); + auto shape = app->getScene()->displayShape(compound, true, getDefaultShapeColor()); + app->getScene()->GetShapeManager().addObject(wing.GetUID(), shape); + + PNamedShape loftNamed(new CNamedShape(compound, wing.GetUID().c_str())); + PNamedShape mirroredLoft = wing.GetMirroredLoft(loftNamed); + if (mirroredLoft) + { + auto shape = app->getScene()->displayShape(mirroredLoft, true, getDefaultShapeSymmetryColor()); + app->getScene()->GetShapeManager().addObject(wing.GetUID(), shape); + } + app->getScene()->updateViewer(); } /* diff --git a/TIGLCreator/src/TIGLCreatorDocument.h b/TIGLCreator/src/TIGLCreatorDocument.h index 81a7b534e..a783f9b36 100644 --- a/TIGLCreator/src/TIGLCreatorDocument.h +++ b/TIGLCreator/src/TIGLCreatorDocument.h @@ -96,7 +96,7 @@ public slots: void drawWing(const QString& Uid=nullptr); void drawWingOverlayProfilePoints(); void drawWingGuideCurves(); - void drawWingTriangulation(); + void drawWingTriangulation(const QString& wingUID=nullptr); void drawWingSamplePoints(const QString& wingUID=nullptr); void drawFusedWing(const QString& wingUID=nullptr); void drawWingComponentSegment(const QString& wingUID=nullptr); diff --git a/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp b/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp index 3fb90861f..6e7297fb5 100644 --- a/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp +++ b/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp @@ -184,7 +184,7 @@ void ModificatorDisplayOptionsWidget::setFromItem(cpcr::CPACSTreeItem* item, TIG drawCallbacks.push_back([doc]() { if (doc) doc->drawWingGuideCurves(); }); ui->drawOptionsCombo->addItem(tr("Show Wing Triangulation")); - drawCallbacks.push_back([doc]() { if (doc) doc->drawWingTriangulation(); }); + drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawWingTriangulation(uid); }); ui->drawOptionsCombo->addItem(tr("Show Wing sample points")); drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawWingSamplePoints(uid); }); From 7f4b1cb241aa53030e7c143061a814a7c9eeaf12 Mon Sep 17 00:00:00 2001 From: Ole Albers Date: Tue, 3 Feb 2026 17:06:10 +0100 Subject: [PATCH 20/26] add overlay porfile points to display options --- TIGLCreator/src/TIGLCreatorDocument.cpp | 13 +++++++++---- TIGLCreator/src/TIGLCreatorDocument.h | 2 +- .../ModificatorDisplayOptionsWidget.cpp | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/TIGLCreator/src/TIGLCreatorDocument.cpp b/TIGLCreator/src/TIGLCreatorDocument.cpp index 0ca040d58..82d6365ce 100644 --- a/TIGLCreator/src/TIGLCreatorDocument.cpp +++ b/TIGLCreator/src/TIGLCreatorDocument.cpp @@ -1008,9 +1008,9 @@ void TIGLCreatorDocument::drawWingProfiles() } } -void TIGLCreatorDocument::drawWingOverlayProfilePoints() +void TIGLCreatorDocument::drawWingOverlayProfilePoints(const QString& Uid) { - QString wingUid = dlgGetWingSelection(); + QString wingUid = dlgGetWingSelection(Uid); try { tigl::CCPACSWing& wing = GetConfiguration().GetWing(wingUid.toStdString()); drawWingOverlayProfilePoints(wing); @@ -2904,6 +2904,8 @@ void TIGLCreatorDocument::drawAirfoil(tigl::CCPACSWingProfile& profile) void TIGLCreatorDocument::drawWingOverlayProfilePoints(tigl::CCPACSWing& wing) { START_COMMAND() + + drawWing(QString::fromStdString(wing.GetUID())); for (int i = 1; i <= wing.GetSegmentCount(); i++) { // Get segment @@ -2922,7 +2924,8 @@ void TIGLCreatorDocument::drawWingOverlayProfilePoints(tigl::CCPACSWing& wing) gp_Pnt pnt = j.Get_gp_Pnt(); pnt = innerT.Transform(pnt); - app->getScene()->displayPoint(pnt, "", Standard_False, 0.0, 0.0, 0.0, 2.0); + auto point = app->getScene()->displayPoint(pnt, "", Standard_False, 0.0, 0.0, 0.0, 2.0); + app->getScene()->GetShapeManager().addObject(wing.GetUID(), point); } // Get outer profile point list @@ -2940,9 +2943,11 @@ void TIGLCreatorDocument::drawWingOverlayProfilePoints(tigl::CCPACSWing& wing) gp_Pnt pnt = j.Get_gp_Pnt(); pnt = outerT.Transform(pnt); - app->getScene()->displayPoint(pnt, "", Standard_False, 0.0, 0.0, 0.0, 2.0); + auto point = app->getScene()->displayPoint(pnt, "", Standard_False, 0.0, 0.0, 0.0, 2.0); + app->getScene()->GetShapeManager().addObject(wing.GetUID(), point); } } + app->getScene()->updateViewer(); } /* diff --git a/TIGLCreator/src/TIGLCreatorDocument.h b/TIGLCreator/src/TIGLCreatorDocument.h index a783f9b36..31d271766 100644 --- a/TIGLCreator/src/TIGLCreatorDocument.h +++ b/TIGLCreator/src/TIGLCreatorDocument.h @@ -94,7 +94,7 @@ public slots: // Wing slots void drawWingProfiles(); void drawWing(const QString& Uid=nullptr); - void drawWingOverlayProfilePoints(); + void drawWingOverlayProfilePoints(const QString& wingUID=nullptr); void drawWingGuideCurves(); void drawWingTriangulation(const QString& wingUID=nullptr); void drawWingSamplePoints(const QString& wingUID=nullptr); diff --git a/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp b/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp index 6e7297fb5..5765be8d5 100644 --- a/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp +++ b/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp @@ -178,7 +178,7 @@ void ModificatorDisplayOptionsWidget::setFromItem(cpcr::CPACSTreeItem* item, TIG drawCallbacks.push_back([doc]() { if (doc) doc->drawWingProfiles(); }); ui->drawOptionsCombo->addItem(tr("Show overlay profile points")); - drawCallbacks.push_back([doc]() { if (doc) doc->drawWingOverlayProfilePoints(); }); + drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawWingOverlayProfilePoints(uid); }); ui->drawOptionsCombo->addItem(tr("Show Wing Guide curves")); drawCallbacks.push_back([doc]() { if (doc) doc->drawWingGuideCurves(); }); From 0fb81efa1995ae22cdd0165a430d335586636d24 Mon Sep 17 00:00:00 2001 From: Ole Albers Date: Wed, 4 Feb 2026 09:20:00 +0100 Subject: [PATCH 21/26] add wing guide curves to display options --- TIGLCreator/src/TIGLCreatorDocument.cpp | 4 ++-- TIGLCreator/src/TIGLCreatorDocument.h | 2 +- .../src/modificators/ModificatorDisplayOptionsWidget.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/TIGLCreator/src/TIGLCreatorDocument.cpp b/TIGLCreator/src/TIGLCreatorDocument.cpp index 82d6365ce..9dbbbc681 100644 --- a/TIGLCreator/src/TIGLCreatorDocument.cpp +++ b/TIGLCreator/src/TIGLCreatorDocument.cpp @@ -1020,9 +1020,9 @@ void TIGLCreatorDocument::drawWingOverlayProfilePoints(const QString& Uid) } } -void TIGLCreatorDocument::drawWingGuideCurves() +void TIGLCreatorDocument::drawWingGuideCurves(const QString& uid) { - QString wingUid = dlgGetWingSelection(); + QString wingUid = dlgGetWingSelection(uid); if (wingUid == "") { return; } diff --git a/TIGLCreator/src/TIGLCreatorDocument.h b/TIGLCreator/src/TIGLCreatorDocument.h index 31d271766..d412164f3 100644 --- a/TIGLCreator/src/TIGLCreatorDocument.h +++ b/TIGLCreator/src/TIGLCreatorDocument.h @@ -95,7 +95,7 @@ public slots: void drawWingProfiles(); void drawWing(const QString& Uid=nullptr); void drawWingOverlayProfilePoints(const QString& wingUID=nullptr); - void drawWingGuideCurves(); + void drawWingGuideCurves(const QString& wingUID=nullptr); void drawWingTriangulation(const QString& wingUID=nullptr); void drawWingSamplePoints(const QString& wingUID=nullptr); void drawFusedWing(const QString& wingUID=nullptr); diff --git a/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp b/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp index 5765be8d5..4c1157878 100644 --- a/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp +++ b/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp @@ -181,7 +181,7 @@ void ModificatorDisplayOptionsWidget::setFromItem(cpcr::CPACSTreeItem* item, TIG drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawWingOverlayProfilePoints(uid); }); ui->drawOptionsCombo->addItem(tr("Show Wing Guide curves")); - drawCallbacks.push_back([doc]() { if (doc) doc->drawWingGuideCurves(); }); + drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawWingGuideCurves(uid); }); ui->drawOptionsCombo->addItem(tr("Show Wing Triangulation")); drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawWingTriangulation(uid); }); From 6013a5b11c8ce209ab0eea232164954072def3a8 Mon Sep 17 00:00:00 2001 From: Ole Albers Date: Wed, 4 Feb 2026 11:07:38 +0100 Subject: [PATCH 22/26] add fuselage options to display options --- TIGLCreator/src/TIGLCreatorDocument.cpp | 109 ++++++++++-------- TIGLCreator/src/TIGLCreatorDocument.h | 16 +-- .../ModificatorDisplayOptionsWidget.cpp | 70 ++++++++--- 3 files changed, 124 insertions(+), 71 deletions(-) diff --git a/TIGLCreator/src/TIGLCreatorDocument.cpp b/TIGLCreator/src/TIGLCreatorDocument.cpp index 9dbbbc681..b7a8d908a 100644 --- a/TIGLCreator/src/TIGLCreatorDocument.cpp +++ b/TIGLCreator/src/TIGLCreatorDocument.cpp @@ -691,12 +691,15 @@ QString TIGLCreatorDocument::dlgGetRotorProfileSelection() } // Fuselage selection Dialog -QString TIGLCreatorDocument::dlgGetFuselageSelection() +QString TIGLCreatorDocument::dlgGetFuselageSelection(const QString& Uid) { QStringList fuselages; bool ok; - // Initialize wing list + if (!Uid.isEmpty()) { + return Uid; + } + // Initialize fuselage list tigl::CCPACSConfiguration& config = GetConfiguration(); int fuselageCount = config.GetFuselageCount(); for (int i = 1; i <= fuselageCount; i++) { @@ -1108,9 +1111,9 @@ void TIGLCreatorDocument::drawFuselageProfiles() } } -void TIGLCreatorDocument::drawFuselageGuideCurves() +void TIGLCreatorDocument::drawFuselageGuideCurves(const QString& Uid) { - QString fuselageUid = dlgGetFuselageSelection(); + QString fuselageUid = dlgGetFuselageSelection(Uid); if (fuselageUid == "") { return; } @@ -1198,11 +1201,8 @@ bool TIGLCreatorDocument::drawWingFlaps(tigl::CCPACSWing& wing) return false; } - auto objects = app->getScene()->GetShapeManager().GetIObjectsFromShapeName(wing.GetUID()); - for (auto& obj : objects) { - app->getScene()->getContext()->Remove(obj, Standard_False); - app->getScene()->GetShapeManager().removeObject(obj); - } + removeWing(QString::fromStdString(wing.GetUID())); + auto shape = app->getScene()->displayShape(wing.GetLoftWithCutouts(), true, getDefaultShapeColor()); app->getScene()->GetShapeManager().addObject(wing.GetUID(), shape); @@ -1367,6 +1367,17 @@ void TIGLCreatorDocument::updateFlapTransform(const std::string& controlUID) app->getViewer()->update(); } +void TIGLCreatorDocument::removeWing(const QString& Uid) +{ + tigl::CCPACSWing& wing = GetConfiguration().GetWing(Uid.toStdString()); + + auto objects = app->getScene()->GetShapeManager().GetIObjectsFromShapeName(wing.GetUID()); + for (auto& obj : objects) { + app->getScene()->getContext()->Remove(obj, Standard_False); + app->getScene()->GetShapeManager().removeObject(obj); + } +} + void TIGLCreatorDocument::removeWingFlaps(const QString& Uid) { tigl::CCPACSWing& wing = GetConfiguration().GetWing(Uid.toStdString()); @@ -1397,10 +1408,20 @@ void TIGLCreatorDocument::removeWingFlaps(const QString& Uid) } } +void TIGLCreatorDocument::removeFuselage(const QString& Uid) + { + tigl::CCPACSFuselage& fuselage = GetConfiguration().GetFuselage(Uid.toStdString()); + + auto objects = app->getScene()->GetShapeManager().GetIObjectsFromShapeName(fuselage.GetUID()); + for (auto& obj : objects) { + app->getScene()->getContext()->Remove(obj, Standard_False); + app->getScene()->GetShapeManager().removeObject(obj); + } + } -void TIGLCreatorDocument::drawFuselage() +void TIGLCreatorDocument::drawFuselage(const QString& Uid) { - QString fuselageUid = dlgGetFuselageSelection(); + QString fuselageUid = dlgGetFuselageSelection(Uid); if (fuselageUid == "") { return; } @@ -1408,7 +1429,7 @@ void TIGLCreatorDocument::drawFuselage() START_COMMAND() auto& fuselage = GetConfiguration().GetFuselage(fuselageUid.toStdString()); - app->getScene()->deleteAllObjects(); + removeFuselage(fuselageUid); for (int i = 1; i <= fuselage.GetSegmentCount(); i++) { // Draw segment loft @@ -1429,9 +1450,9 @@ void TIGLCreatorDocument::drawWingTriangulation(const QString& Uid) } } -void TIGLCreatorDocument::drawFuselageTriangulation() +void TIGLCreatorDocument::drawFuselageTriangulation(const QString& Uid) { - QString fuselageUid = dlgGetFuselageSelection(); + QString fuselageUid = dlgGetFuselageSelection(Uid); if (fuselageUid == "") { return; } @@ -1440,13 +1461,14 @@ void TIGLCreatorDocument::drawFuselageTriangulation() auto& fuselage = GetConfiguration().GetFuselage(fuselageUid.toStdString()); //clear screen - app->getScene()->deleteAllObjects(); - const TopoDS_Shape& fusedWing = fuselage.GetLoft()->Shape(); + removeFuselage(fuselageUid); + const TopoDS_Shape& fusedFuselage = fuselage.GetLoft()->Shape(); TopoDS_Compound triangulation; - createShapeTriangulation(fusedWing, triangulation); + createShapeTriangulation(fusedFuselage, triangulation); - app->getScene()->displayShape(triangulation, true, getDefaultShapeColor()); + auto shape = app->getScene()->displayShape(triangulation, true, getDefaultShapeColor()); + app->getScene()->GetShapeManager().addObject(fuselageUid.toStdString(), shape); } void TIGLCreatorDocument::drawWingSamplePoints(const QString& Uid) @@ -1461,9 +1483,9 @@ void TIGLCreatorDocument::drawWingSamplePoints(const QString& Uid) } } -void TIGLCreatorDocument::drawFuselageSamplePoints() +void TIGLCreatorDocument::drawFuselageSamplePoints(const QString& Uid) { - QString fuselageUid = dlgGetFuselageSelection(); + QString fuselageUid = dlgGetFuselageSelection(Uid); if (fuselageUid == "") { return; } @@ -1481,14 +1503,21 @@ void TIGLCreatorDocument::drawFuselageSamplePoints() 1, // TODO: we need to implement that function to use UID instead of index! segmentIndex, eta, zeta, &x, &y, &z); - app->getScene()->displayPoint(gp_Pnt(x, y, z), "", false, 0, 0, 0, 1.0); + auto points = app->getScene()->displayPoint(gp_Pnt(x, y, z), "", false, 0, 0, 0, 1.0); + app->getScene()->GetShapeManager().addObject(fuselageUid.toStdString(), points); } } } + app->getScene()->updateViewer(); } -void TIGLCreatorDocument::drawFuselageSamplePointsAngle() +void TIGLCreatorDocument::drawFuselageSamplePointsAngle(const QString& Uid) { + QString fuselageUid = dlgGetFuselageSelection(Uid); + if (fuselageUid == "") { + return; + } + // ask user defined angle bool ok = false; double angle = @@ -1498,10 +1527,10 @@ void TIGLCreatorDocument::drawFuselageSamplePointsAngle() } START_COMMAND() - int fuselageIndex = 1; + int fuselageIndex = GetConfiguration().GetFuselageIndex(fuselageUid.toStdString()); double x, y, z; - app->getScene()->deleteAllObjects(); + removeFuselage(fuselageUid); auto& fuselage = GetConfiguration().GetFuselage(fuselageIndex); // Draw the fuselage @@ -1513,8 +1542,10 @@ void TIGLCreatorDocument::drawFuselageSamplePointsAngle() // Display the intersection point tiglFuselageGetPointAngle(m_cpacsHandle, fuselageIndex, i, 0.5, angle, &x, &y, &z); - app->getScene()->displayPoint(gp_Pnt(x, y, z), "", Standard_False, 0., 0., 0., 1.); + auto points = app->getScene()->displayPoint(gp_Pnt(x, y, z), "", Standard_False, 0., 0., 0., 1.); + app->getScene()->GetShapeManager().addObject(fuselageUid.toStdString(), points); } + app->getScene()->updateViewer(); } void TIGLCreatorDocument::drawAllFuselagesAndWingsSurfacePoints() @@ -1569,6 +1600,7 @@ void TIGLCreatorDocument::drawAllFuselagesAndWingsSurfacePoints() app->getScene()->updateViewer(); } + // ----------------------- // Export Functions // ----------------------- @@ -2119,15 +2151,15 @@ void TIGLCreatorDocument::exportFuselageCurvesBRep() } } -void TIGLCreatorDocument::drawFusedFuselage() +void TIGLCreatorDocument::drawFusedFuselage(const QString& Uid) { - QString fuselageUid = dlgGetFuselageSelection(); + QString fuselageUid = dlgGetFuselageSelection(Uid); if (fuselageUid == "") { return; } START_COMMAND() - app->getScene()->deleteAllObjects(); + removeFuselage(fuselageUid); auto& fuselage = GetConfiguration().GetFuselage(fuselageUid.toStdString()); app->getScene()->displayShape(fuselage.GetLoft(), true, getDefaultShapeColor()); } @@ -2973,12 +3005,7 @@ void TIGLCreatorDocument::drawWingTriangulation(tigl::CCPACSWing& wing) START_COMMAND() //clear screen - auto objects = app->getScene()->GetShapeManager().GetIObjectsFromShapeName(wing.GetUID()); - for (auto& obj : objects) { - app->getScene()->getContext()->Remove(obj, Standard_False); - app->getScene()->GetShapeManager().removeObject(obj); - } - + removeWing(QString::fromStdString(wing.GetUID())); removeWingFlaps(QString::fromStdString(wing.GetUID())); //we do not fuse segments anymore but build it from scratch with the profiles @@ -3019,12 +3046,7 @@ void TIGLCreatorDocument::drawWingSamplePoints(tigl::CCPACSWing& wing) return; } - auto objects = app->getScene()->GetShapeManager().GetIObjectsFromShapeName(wing.GetUID()); - for (auto& obj : objects) { - app->getScene()->getContext()->Remove(obj, Standard_False); - app->getScene()->GetShapeManager().removeObject(obj); - } - + removeWing(QString::fromStdString(wing.GetUID())); removeWingFlaps(QString::fromStdString(wing.GetUID())); for (int segmentIndex = 1; segmentIndex <= wing.GetSegmentCount(); segmentIndex++) { @@ -3130,12 +3152,7 @@ void TIGLCreatorDocument::drawWingShells(tigl::CCPACSWing& wing) { START_COMMAND() - auto objects = app->getScene()->GetShapeManager().GetIObjectsFromShapeName(wing.GetUID()); - for (auto& obj : objects) { - app->getScene()->getContext()->Remove(obj, Standard_False); - app->getScene()->GetShapeManager().removeObject(obj); - } - + removeWing(QString::fromStdString(wing.GetUID())); removeWingFlaps(QString::fromStdString(wing.GetUID())); TopoDS_Shape shapes[2] = {wing.GetUpperShape(), wing.GetLowerShape()}; diff --git a/TIGLCreator/src/TIGLCreatorDocument.h b/TIGLCreator/src/TIGLCreatorDocument.h index d412164f3..097c7ebca 100644 --- a/TIGLCreator/src/TIGLCreatorDocument.h +++ b/TIGLCreator/src/TIGLCreatorDocument.h @@ -107,12 +107,12 @@ public slots: // Fuselage slots void drawFuselageProfiles(); - void drawFuselage(); - void drawFuselageTriangulation(); - void drawFuselageSamplePoints(); - void drawFuselageSamplePointsAngle(); - void drawFusedFuselage(); - void drawFuselageGuideCurves(); + void drawFuselage(const QString& Uid=nullptr); + void drawFuselageTriangulation(const QString& Uid=nullptr); + void drawFuselageSamplePoints(const QString& Uid=nullptr); + void drawFuselageSamplePointsAngle(const QString& Uid=nullptr); + void drawFusedFuselage(const QString& Uid=nullptr); + void drawFuselageGuideCurves(const QString& Uid=nullptr); // Rotor blade slots void drawRotorProfiles(); @@ -178,7 +178,7 @@ private slots: QString dlgGetRotorProfileSelection(); // Fuselage selection dialogs - QString dlgGetFuselageSelection(); + QString dlgGetFuselageSelection(const QString& Uid=nullptr); QString dlgGetFuselageSegmentSelection(); QString dlgGetFuselageProfileSelection(); @@ -216,7 +216,9 @@ private slots: void drawWingShells(tigl::CCPACSWing& wing); bool drawWingFlaps(tigl::CCPACSWing& wing); void drawWingFlap(const QString& flapUID); + void removeWing(const QString& Uid); void removeWingFlaps(const QString& Uid); + void removeFuselage(const QString& Uid); void createShapeTriangulation(const class TopoDS_Shape& shape, class TopoDS_Compound& compound); diff --git a/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp b/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp index 4c1157878..f7c13950f 100644 --- a/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp +++ b/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp @@ -170,42 +170,75 @@ void ModificatorDisplayOptionsWidget::setFromItem(cpcr::CPACSTreeItem* item, TIG auto type = doc->GetConfiguration().GetUIDManager().GetGeometricComponent(uid.toStdString()).GetComponentType(); if (type == TIGL_COMPONENT_WING) { - // Add entries and store callbacks that call the document drawing functions + ui->drawOptionsCombo->addItem(tr("Show Wing")); drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawWing(uid); }); + ui->drawOptionsCombo->addItem(tr("Show Fused wing")); + drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawFusedWing(uid); }); + + ui->drawOptionsCombo->addItem(tr("Show Wing Shells")); + drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawWingShells(uid); }); + + ui->drawOptionsCombo->addItem(tr("Show Wing Component segment")); + drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawWingComponentSegment(uid); }); + + ui->drawOptionsCombo->addItem(tr("Show Wing Structure")); + drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawWingStructure(uid); }); + + ui->drawOptionsCombo->addItem(tr("Show Wing triangulation")); + drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawWingTriangulation(uid); }); + ui->drawOptionsCombo->addItem(tr("Show Wing Profiles")); drawCallbacks.push_back([doc]() { if (doc) doc->drawWingProfiles(); }); - ui->drawOptionsCombo->addItem(tr("Show overlay profile points")); - drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawWingOverlayProfilePoints(uid); }); - ui->drawOptionsCombo->addItem(tr("Show Wing Guide curves")); drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawWingGuideCurves(uid); }); - ui->drawOptionsCombo->addItem(tr("Show Wing Triangulation")); - drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawWingTriangulation(uid); }); + ui->drawOptionsCombo->addItem(tr("Show Wing Flaps")); + drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawWingFlaps(uid); }); - ui->drawOptionsCombo->addItem(tr("Show Wing sample points")); + ui->drawOptionsCombo->addItem(tr("Show Wing Sample points")); drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawWingSamplePoints(uid); }); - ui->drawOptionsCombo->addItem(tr("Show Fused wing")); - drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawFusedWing(uid); }); - - ui->drawOptionsCombo->addItem(tr("Show Wing Component segment")); - drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawWingComponentSegment(uid); }); + ui->drawOptionsCombo->addItem(tr("Show Wing Overlay profile points")); + drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawWingOverlayProfilePoints(uid); }); ui->drawOptionsCombo->addItem(tr("Show Wing Component segment points")); drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawWingComponentSegmentPoints(uid); }); - ui->drawOptionsCombo->addItem(tr("Show Wing Shells")); - drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawWingShells(uid); }); + // Trigger the corresponding callback when an item is activated. Use UniqueConnection to avoid duplicate connections. + connect(ui->drawOptionsCombo, QOverload::of(&QComboBox::activated), this, + [this](int idx) { + if (idx >= 0 && idx < static_cast(drawCallbacks.size()) && drawCallbacks[idx]) { + drawCallbacks[idx](); + } + }, Qt::UniqueConnection); + } - ui->drawOptionsCombo->addItem(tr("Show Wing Structure")); - drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawWingStructure(uid); }); + if (type == TIGL_COMPONENT_FUSELAGE) { + + ui->drawOptionsCombo->addItem(tr("Show Fuselage")); + drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawFuselage(uid); }); + + ui->drawOptionsCombo->addItem(tr("Show Fuselage Profiles")); + drawCallbacks.push_back([doc]() { if (doc) doc->drawFuselageProfiles(); }); + + ui->drawOptionsCombo->addItem(tr("Show Fuselage Guide Curves")); + drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawFuselageGuideCurves(uid); }); + + ui->drawOptionsCombo->addItem(tr("Show Fuselage triangulation")); + drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawFuselageTriangulation(uid); }); + + ui->drawOptionsCombo->addItem(tr("Show Fuselage Sample points")); + drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawFuselageSamplePoints(uid); }); + + ui->drawOptionsCombo->addItem(tr("Show Fuselage Sample points at angle")); + drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawFuselageSamplePointsAngle(uid); }); + + ui->drawOptionsCombo->addItem(tr("Show Fused fuselage")); + drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawFusedFuselage(uid); }); - ui->drawOptionsCombo->addItem(tr("Show Wing Flaps")); - drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawWingFlaps(uid); }); // Trigger the corresponding callback when an item is activated. Use UniqueConnection to avoid duplicate connections. connect(ui->drawOptionsCombo, QOverload::of(&QComboBox::activated), this, @@ -215,6 +248,7 @@ void ModificatorDisplayOptionsWidget::setFromItem(cpcr::CPACSTreeItem* item, TIG } }, Qt::UniqueConnection); } + } } From b22f2b0e812eb72397e3f07d52c3f1b92921a543 Mon Sep 17 00:00:00 2001 From: Ole Albers Date: Wed, 4 Feb 2026 13:43:32 +0100 Subject: [PATCH 23/26] add aircraft options --- .../ModificatorDisplayOptionsWidget.cpp | 41 ++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp b/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp index f7c13950f..609005c02 100644 --- a/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp +++ b/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp @@ -101,7 +101,7 @@ void ModificatorDisplayOptionsWidget::setFromItem(cpcr::CPACSTreeItem* item, TIG auto it = shapes.find(uid.toStdString()); if (it != shapes.end() && it->second != nullptr) { tigl::ITiglGeometricComponent* comp = it->second; - if (comp->GetComponentType() != TIGL_COMPONENT_PLANE && comp->GetComponentType() != TIGL_COMPONENT_CROSS_BEAM_STRUT) { + if (comp->GetComponentType() != TIGL_COMPONENT_CROSS_BEAM_STRUT) { if (ui) { ui->infoLabel->setVisible(false); ui->labelTransparency->setVisible(true); @@ -249,6 +249,45 @@ void ModificatorDisplayOptionsWidget::setFromItem(cpcr::CPACSTreeItem* item, TIG }, Qt::UniqueConnection); } + if (type == TIGL_COMPONENT_PLANE) { + + ui->drawOptionsCombo->addItem(tr("Show the complete aircraft")); + drawCallbacks.push_back([doc]() { if (doc) doc->drawConfiguration(); }); + + ui->drawOptionsCombo->addItem(tr("Show the complete aircraft with duct cutouts")); + drawCallbacks.push_back([doc]() { if (doc) doc->drawConfigurationWithDuctCutouts(); }); + + ui->drawOptionsCombo->addItem(tr("Show he complete aircraft fused (slow)")); + drawCallbacks.push_back([doc]() { if (doc) doc->drawFusedAircraft(); }); + + ui->drawOptionsCombo->addItem(tr("Show fused aircraft triangulation (slow)")); + drawCallbacks.push_back([doc]() { if (doc) doc->drawFusedAircraftTriangulation(); }); + + ui->drawOptionsCombo->addItem(tr("Show intersection line"));; + drawCallbacks.push_back([doc]() { if (doc) doc->drawIntersectionLine(); }); + + ui->drawOptionsCombo->addItem(tr("Draw Far Field")); + drawCallbacks.push_back([doc]() { if (doc) doc->drawFarField(); }); + + ui->drawOptionsCombo->addItem(tr("Draw Systems")); + drawCallbacks.push_back([doc]() { if (doc) doc->drawSystems(); }); + + ui->drawOptionsCombo->addItem(tr("Draw any Component")); + drawCallbacks.push_back([doc]() { if (doc) doc->drawComponent(); }); + + ui->drawOptionsCombo->addItem(tr("Draw Control Point Net")); + drawCallbacks.push_back([doc]() { if (doc) doc->drawControlPointNet(); }); + + connect(ui->drawOptionsCombo, QOverload::of(&QComboBox::activated), this, + [this](int idx) { + if (idx >= 0 && idx < static_cast(drawCallbacks.size()) && drawCallbacks[idx]) { + drawCallbacks[idx](); + } + }, Qt::UniqueConnection); + + } + + } } From 2fdd20ba8ca3984bbe5e401219f70b542aba5aea Mon Sep 17 00:00:00 2001 From: Ole Albers Date: Thu, 5 Feb 2026 15:51:42 +0100 Subject: [PATCH 24/26] add rotor to display functions --- TIGLCreator/src/TIGLCreatorDocument.cpp | 57 +++++++------ TIGLCreator/src/TIGLCreatorDocument.h | 28 +++---- .../ModificatorDisplayOptionsWidget.cpp | 80 ++++++++++++++++++- 3 files changed, 125 insertions(+), 40 deletions(-) diff --git a/TIGLCreator/src/TIGLCreatorDocument.cpp b/TIGLCreator/src/TIGLCreatorDocument.cpp index b7a8d908a..6f798298b 100644 --- a/TIGLCreator/src/TIGLCreatorDocument.cpp +++ b/TIGLCreator/src/TIGLCreatorDocument.cpp @@ -549,11 +549,13 @@ QString TIGLCreatorDocument::dlgGetWingProfileSelection() } // Rotor selection Dialog -QString TIGLCreatorDocument::dlgGetRotorSelection() +QString TIGLCreatorDocument::dlgGetRotorSelection(const QString& rotorUid) { QStringList rotors; bool ok; - + if (!rotorUid.isEmpty()) { + return rotorUid; + } // Initialize rotorBlade list tigl::CCPACSConfiguration& config = GetConfiguration(); int rotorCount = config.GetRotorCount(); @@ -576,11 +578,13 @@ QString TIGLCreatorDocument::dlgGetRotorSelection() } // Rotor Blade selection Dialog -QString TIGLCreatorDocument::dlgGetRotorBladeSelection() +QString TIGLCreatorDocument::dlgGetRotorBladeSelection(const QString& rotorBladeUid) { QStringList wings; bool ok; - + if (!rotorBladeUid.isEmpty()) { + return rotorBladeUid; + } // Initialize wing list tigl::CCPACSConfiguration& config = GetConfiguration(); int wingCount = config.GetWingCount(); @@ -606,11 +610,14 @@ QString TIGLCreatorDocument::dlgGetRotorBladeSelection() } // Rotor Blade Component Segment Selection Dialog -QString TIGLCreatorDocument::dlgGetRotorBladeComponentSegmentSelection() +QString TIGLCreatorDocument::dlgGetRotorBladeComponentSegmentSelection(const QString& rotorBladeCompSegUid) { QStringList compSegs; bool ok; + if (!rotorBladeCompSegUid.isEmpty()) { + return rotorBladeCompSegUid; + } // Initialize wing list tigl::CCPACSConfiguration& config = GetConfiguration(); int wingCount = config.GetWingCount(); @@ -2560,9 +2567,9 @@ void TIGLCreatorDocument::drawRotorProfiles() } } -void TIGLCreatorDocument::drawRotorBladeOverlayProfilePoints() +void TIGLCreatorDocument::drawRotorBladeOverlayProfilePoints(const QString& Uid) { - QString wingUid = dlgGetRotorBladeSelection(); + QString wingUid = dlgGetRotorBladeSelection(Uid); try { tigl::CCPACSWing& wing = GetConfiguration().GetWing(wingUid.toStdString()); drawWingOverlayProfilePoints(wing); @@ -2585,9 +2592,9 @@ void TIGLCreatorDocument::drawRotorBladeGuideCurves() } } -void TIGLCreatorDocument::drawRotorBlade() +void TIGLCreatorDocument::drawRotorBlade(const QString& Uid) { - QString wingUid = dlgGetRotorBladeSelection(); + QString wingUid = dlgGetRotorBladeSelection(Uid); try { tigl::CCPACSWing& wing = GetConfiguration().GetWing(wingUid.toStdString()); drawWing(wing); @@ -2597,9 +2604,9 @@ void TIGLCreatorDocument::drawRotorBlade() } } -void TIGLCreatorDocument::drawRotorBladeTriangulation() +void TIGLCreatorDocument::drawRotorBladeTriangulation(const QString& Uid) { - QString wingUid = dlgGetRotorBladeSelection(); + QString wingUid = dlgGetRotorBladeSelection(Uid); try { tigl::CCPACSWing& wing = GetConfiguration().GetWing(wingUid.toStdString()); drawWingTriangulation(wing); @@ -2609,9 +2616,9 @@ void TIGLCreatorDocument::drawRotorBladeTriangulation() } } -void TIGLCreatorDocument::drawRotorBladeSamplePoints() +void TIGLCreatorDocument::drawRotorBladeSamplePoints(const QString& Uid) { - QString wingUid = dlgGetRotorBladeSelection(); + QString wingUid = dlgGetRotorBladeSelection(Uid); try { tigl::CCPACSWing& wing = GetConfiguration().GetWing(wingUid.toStdString()); drawWingSamplePoints(wing); @@ -2621,9 +2628,9 @@ void TIGLCreatorDocument::drawRotorBladeSamplePoints() } } -void TIGLCreatorDocument::drawFusedRotorBlade() +void TIGLCreatorDocument::drawFusedRotorBlade(const QString& Uid) { - QString wingUid = dlgGetRotorBladeSelection(); + QString wingUid = dlgGetRotorBladeSelection(Uid); try { tigl::CCPACSWing& wing = GetConfiguration().GetWing(wingUid.toStdString()); drawFusedWing(wing); @@ -2633,9 +2640,9 @@ void TIGLCreatorDocument::drawFusedRotorBlade() } } -void TIGLCreatorDocument::drawRotorBladeComponentSegment() +void TIGLCreatorDocument::drawRotorBladeComponentSegment(const QString& Uid) { - QString csUid = dlgGetRotorBladeComponentSegmentSelection(); + QString csUid = dlgGetRotorBladeComponentSegmentSelection(Uid); if (csUid == "") { return; } @@ -2652,9 +2659,9 @@ void TIGLCreatorDocument::drawRotorBladeComponentSegment() } } -void TIGLCreatorDocument::drawRotorBladeComponentSegmentPoints() +void TIGLCreatorDocument::drawRotorBladeComponentSegmentPoints(const QString& Uid) { - QString csUid = dlgGetRotorBladeComponentSegmentSelection(); + QString csUid = dlgGetRotorBladeComponentSegmentSelection(Uid); if (csUid == "") { return; } @@ -2666,9 +2673,9 @@ void TIGLCreatorDocument::drawRotorBladeComponentSegmentPoints() } } -void TIGLCreatorDocument::drawRotorBladeShells() +void TIGLCreatorDocument::drawRotorBladeShells(const QString& Uid) { - QString wingUid = dlgGetRotorBladeSelection(); + QString wingUid = dlgGetRotorBladeSelection(Uid); try { tigl::CCPACSWing& wing = GetConfiguration().GetWing(wingUid.toStdString()); drawWingShells(wing); @@ -2741,9 +2748,9 @@ void TIGLCreatorDocument::drawRotor() drawRotorByUID(rotorUid); } -void TIGLCreatorDocument::drawRotorDisk() +void TIGLCreatorDocument::drawRotorDisk(const QString& uid) { - QString rotorUid = dlgGetRotorSelection(); + QString rotorUid = dlgGetRotorSelection(uid); if (rotorUid == "") { return; } @@ -2760,9 +2767,9 @@ void TIGLCreatorDocument::drawRotorDisk() app->getScene()->displayShape(rotorDisk, true, Quantity_NOC_RotorCol, 0.9); } -void TIGLCreatorDocument::showRotorProperties() +void TIGLCreatorDocument::showRotorProperties(const QString& uid) { - QString rotorUid = dlgGetRotorSelection(); + QString rotorUid = dlgGetRotorSelection(uid); if (rotorUid == "") { return; } diff --git a/TIGLCreator/src/TIGLCreatorDocument.h b/TIGLCreator/src/TIGLCreatorDocument.h index 097c7ebca..cdbad2b58 100644 --- a/TIGLCreator/src/TIGLCreatorDocument.h +++ b/TIGLCreator/src/TIGLCreatorDocument.h @@ -116,21 +116,21 @@ public slots: // Rotor blade slots void drawRotorProfiles(); - void drawRotorBlade(); - void drawRotorBladeOverlayProfilePoints(); + void drawRotorBlade(const QString& uid=nullptr); + void drawRotorBladeOverlayProfilePoints(const QString& uid=nullptr); void drawRotorBladeGuideCurves(); - void drawRotorBladeTriangulation(); - void drawRotorBladeSamplePoints(); - void drawFusedRotorBlade(); - void drawRotorBladeComponentSegment(); - void drawRotorBladeComponentSegmentPoints(); - void drawRotorBladeShells(); + void drawRotorBladeTriangulation(const QString& uid=nullptr); + void drawRotorBladeSamplePoints(const QString& uid=nullptr); + void drawFusedRotorBlade(const QString& uid=nullptr); + void drawRotorBladeComponentSegment(const QString& uid=nullptr); + void drawRotorBladeComponentSegmentPoints(const QString& uid=nullptr); + void drawRotorBladeShells(const QString& uid=nullptr); // Rotorcraft slots - void drawRotorByUID(const QString& uid); + void drawRotorByUID(const QString& uid=nullptr); void drawRotor(); - void drawRotorDisk(); - void showRotorProperties(); + void drawRotorDisk(const QString& uid=nullptr); + void showRotorProperties(const QString& uid=nullptr); // TIGL slots void exportAsIges(); @@ -169,11 +169,11 @@ private slots: QString dlgGetWingProfileSelection(); // Rotor selection dialogs - QString dlgGetRotorSelection(); + QString dlgGetRotorSelection(const QString& rotorUid=nullptr); // Rotor Blade selection dialogs - QString dlgGetRotorBladeSelection(); - QString dlgGetRotorBladeComponentSegmentSelection(); + QString dlgGetRotorBladeSelection(const QString& rotorBladeUid=nullptr); + QString dlgGetRotorBladeComponentSegmentSelection(const QString& rotorBladeCompSegUid=nullptr); QString dlgGetRotorBladeSegmentSelection(); QString dlgGetRotorProfileSelection(); diff --git a/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp b/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp index 609005c02..94cb7730d 100644 --- a/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp +++ b/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp @@ -88,6 +88,7 @@ void ModificatorDisplayOptionsWidget::setFromItem(cpcr::CPACSTreeItem* item, TIG ui->labelMaterial->setVisible(false); ui->materialCombo->setVisible(false); ui->buttonResetOptions->setVisible(false); + ui->labelDrawOptions->setVisible(false); ui->drawOptionsCombo->setVisible(false); } currentItem = nullptr; @@ -101,7 +102,7 @@ void ModificatorDisplayOptionsWidget::setFromItem(cpcr::CPACSTreeItem* item, TIG auto it = shapes.find(uid.toStdString()); if (it != shapes.end() && it->second != nullptr) { tigl::ITiglGeometricComponent* comp = it->second; - if (comp->GetComponentType() != TIGL_COMPONENT_CROSS_BEAM_STRUT) { + if (comp->GetComponentType() != TIGL_COMPONENT_PLANE && comp->GetComponentType() != TIGL_COMPONENT_CROSS_BEAM_STRUT) { if (ui) { ui->infoLabel->setVisible(false); ui->labelTransparency->setVisible(true); @@ -113,6 +114,7 @@ void ModificatorDisplayOptionsWidget::setFromItem(cpcr::CPACSTreeItem* item, TIG ui->labelMaterial->setVisible(true); ui->materialCombo->setVisible(true); ui->buttonResetOptions->setVisible(true); + ui->labelDrawOptions->setVisible(true); ui->drawOptionsCombo->setVisible(true); } @@ -144,6 +146,22 @@ void ModificatorDisplayOptionsWidget::setFromItem(cpcr::CPACSTreeItem* item, TIG materialCombo->setCurrentIndex(0); } + else if (comp->GetComponentType() == TIGL_COMPONENT_PLANE) { + if (ui) { + ui->infoLabel->setVisible(true); + ui->labelTransparency->setVisible(false); + ui->transparencySlider->setVisible(false); + ui->labelRenderingMode->setVisible(false); + ui->renderingModeCombo->setVisible(false); + ui->buttonColorChoser->setVisible(false); + ui->labelColor->setVisible(false); + ui->labelMaterial->setVisible(false); + ui->materialCombo->setVisible(false); + ui->buttonResetOptions->setVisible(false); + ui->labelDrawOptions->setVisible(true); + ui->drawOptionsCombo->setVisible(true); + } + } } } else { @@ -158,6 +176,7 @@ void ModificatorDisplayOptionsWidget::setFromItem(cpcr::CPACSTreeItem* item, TIG ui->labelMaterial->setVisible(false); ui->materialCombo->setVisible(false); ui->buttonResetOptions->setVisible(false); + ui->labelDrawOptions->setVisible(false); ui->drawOptionsCombo->setVisible(false); } } @@ -287,6 +306,65 @@ void ModificatorDisplayOptionsWidget::setFromItem(cpcr::CPACSTreeItem* item, TIG } + if (type == TIGL_COMPONENT_ROTORBLADE) { + + ui->drawOptionsCombo->addItem(tr("Show Rotor Blade")); + drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawRotorBlade(uid); }); + + ui->drawOptionsCombo->addItem(tr("Show Rotor Blade Guide curves")); + drawCallbacks.push_back([doc]() { if (doc) doc->drawRotorBladeGuideCurves(); }); + + ui->drawOptionsCombo->addItem(tr("Show Rotor Blade overlay profile points")); + drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawRotorBladeOverlayProfilePoints(uid); }); + + ui->drawOptionsCombo->addItem(tr("Show Rotor Blade Triangulation")); + drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawRotorBladeTriangulation(uid); }); + + ui->drawOptionsCombo->addItem(tr("Show Sample Rotor Blade points")); + drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawRotorBladeSamplePoints(uid); }); + + ui->drawOptionsCombo->addItem(tr("Show Fused Rotor Blade")); + drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawFusedRotorBlade(uid); }); + + ui->drawOptionsCombo->addItem(tr("Show Rotor Blade Component segment")); + drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawRotorBladeComponentSegment(uid); }); + + ui->drawOptionsCombo->addItem(tr("Show Rotor Blade Component segment points")); + drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawRotorBladeComponentSegmentPoints(uid); }); + + ui->drawOptionsCombo->addItem(tr("Show Rotor Blade Shells")); + drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawRotorBladeShells(uid); }); + + ui->drawOptionsCombo->addItem(tr("Show all Rotors, Wings and Fuselages")); + drawCallbacks.push_back([doc]() { if (doc) doc->drawAllFuselagesAndWingsSurfacePoints(); }); + + connect(ui->drawOptionsCombo, QOverload::of(&QComboBox::activated), this, + [this](int idx) { + if (idx >= 0 && idx < static_cast(drawCallbacks.size()) && drawCallbacks[idx]) { + drawCallbacks[idx](); + } + }, Qt::UniqueConnection); + } + + if (type == TIGL_COMPONENT_ROTOR) { + + ui->drawOptionsCombo->addItem(tr("Show Rotor")); + drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawRotorByUID(uid); }); + + ui->drawOptionsCombo->addItem(tr("Show Rotor Disk")); + drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawRotorDisk(uid); }); + + ui->drawOptionsCombo->addItem(tr("Show Rotor Properties")); + drawCallbacks.push_back([doc, uid]() { if (doc) doc->showRotorProperties(uid); }); + + connect(ui->drawOptionsCombo, QOverload::of(&QComboBox::activated), this, + [this](int idx) { + if (idx >= 0 && idx < static_cast(drawCallbacks.size()) && drawCallbacks[idx]) { + drawCallbacks[idx](); + } + }, Qt::UniqueConnection); + + } } } From a4684f49428d3ea04256f27ae0100fd50a89d655 Mon Sep 17 00:00:00 2001 From: Ole Albers Date: Fri, 6 Feb 2026 16:14:29 +0100 Subject: [PATCH 25/26] create DrawOptionsActions to collect the actions in one file and use them in two places --- TIGLCreator/src/DrawOptionsActions.cpp | 82 ++++ TIGLCreator/src/DrawOptionsActions.h | 16 + TIGLCreator/src/TIGLCreatorWindow.cpp | 118 +++--- TIGLCreator/src/TIGLCreatorWindow.h | 4 + TIGLCreator/src/TIGLCreatorWindow.ui | 386 ------------------ .../ModificatorDisplayOptionsWidget.cpp | 185 +++------ .../ModificatorDisplayOptionsWidget.ui | 2 +- 7 files changed, 217 insertions(+), 576 deletions(-) create mode 100644 TIGLCreator/src/DrawOptionsActions.cpp create mode 100644 TIGLCreator/src/DrawOptionsActions.h diff --git a/TIGLCreator/src/DrawOptionsActions.cpp b/TIGLCreator/src/DrawOptionsActions.cpp new file mode 100644 index 000000000..1c5d44c37 --- /dev/null +++ b/TIGLCreator/src/DrawOptionsActions.cpp @@ -0,0 +1,82 @@ +#include "DrawOptionsActions.h" +#include + +// Forward declaration for example +void onColorChosen(); + + +// WING actions +const std::vector& getWingDrawOptionsActions() { + static std::vector actions = { + { "Show Wing", [](TIGLCreatorDocument* doc, const QString& uid){ doc->drawWing(uid);} }, + { "Show Fused wing", [](TIGLCreatorDocument* doc, const QString& uid){ doc->drawFusedWing(uid);} }, + { "Show Wing Shells", [](TIGLCreatorDocument* doc, const QString& uid){ doc->drawWingShells(uid); } }, + { "Show Wing Component segment", [](TIGLCreatorDocument* doc, const QString& uid){ doc->drawWingComponentSegment(uid); } }, + { "Show Wing Structure", [](TIGLCreatorDocument* doc, const QString& uid){ doc->drawWingStructure(uid);} }, + { "Show Wing triangulation", [](TIGLCreatorDocument* doc, const QString& uid){ doc->drawWingTriangulation(uid); } }, + { "Show Wing Profiles", [](TIGLCreatorDocument* doc, const QString& uid){ doc->drawWingProfiles(); } }, + { "Show Wing Guide curves", [](TIGLCreatorDocument* doc, const QString& uid){ doc->drawWingGuideCurves(uid);} }, + { "Show Wing Flaps", [](TIGLCreatorDocument* doc, const QString& uid){ doc->drawWingFlaps(uid);} }, + { "Show Wing Sample points", [](TIGLCreatorDocument* doc, const QString& uid){ doc->drawWingSamplePoints(uid);} }, + { "Show Wing Overlay profile points", [](TIGLCreatorDocument* doc, const QString& uid){ doc->drawWingOverlayProfilePoints(uid); } }, + { "Show Wing Component segment points", [](TIGLCreatorDocument* doc, const QString& uid){ doc->drawWingComponentSegmentPoints(uid);} } + }; + return actions; +} + +// FUSELAGE actions +const std::vector& getFuselageDrawOptionsActions() { + static std::vector actions = { + { "Show Fuselage", [](TIGLCreatorDocument* doc, const QString& uid){ doc->drawFuselage(uid);} }, + { "Show Fuselage Profiles", [](TIGLCreatorDocument* doc, const QString& uid){ doc->drawFuselageProfiles(); } }, + { "Show Fuselage Guide Curves", [](TIGLCreatorDocument* doc, const QString& uid){ doc->drawFuselageGuideCurves(uid); } }, + { "Show Fuselage triangulation", [](TIGLCreatorDocument* doc, const QString& uid){ doc->drawFuselageTriangulation(uid); } }, + { "Show Fuselage Sample points", [](TIGLCreatorDocument* doc, const QString& uid){ doc->drawFuselageSamplePoints(uid); } }, + { "Show Fuselage Sample points at angle", [](TIGLCreatorDocument* doc, const QString& uid){ doc->drawFuselageSamplePointsAngle(uid); } }, + { "Show Fused fuselage", [](TIGLCreatorDocument* doc, const QString& uid){ doc->drawFusedFuselage(uid); } } + }; + return actions; +} + +// PLANE actions +const std::vector& getPlaneDrawOptionsActions() { + static std::vector actions = { + { "Show the complete aircraft", [](TIGLCreatorDocument* doc, const QString& uid){ doc->drawConfiguration(); } }, + { "Show the complete aircraft with duct cutouts", [](TIGLCreatorDocument* doc, const QString& uid){ doc->drawConfigurationWithDuctCutouts(); } }, + { "Show he complete aircraft fused (slow)", [](TIGLCreatorDocument* doc, const QString& uid){ doc->drawFusedAircraft(); } }, + { "Show fused aircraft triangulation (slow)", [](TIGLCreatorDocument* doc, const QString& uid){ doc->drawFusedAircraftTriangulation(); } }, + { "Show intersection line", [](TIGLCreatorDocument* doc, const QString& uid){ doc->drawIntersectionLine(); } }, + { "Draw Far Field", [](TIGLCreatorDocument* doc, const QString& uid){ doc->drawFarField(); } }, + { "Draw Systems", [](TIGLCreatorDocument* doc, const QString& uid){ doc->drawSystems();} }, + { "Draw any Component", [](TIGLCreatorDocument* doc, const QString& uid){ doc->drawComponent(); } }, + { "Draw Control Point Net", [](TIGLCreatorDocument* doc, const QString& uid){ doc->drawControlPointNet(); } } + }; + return actions; +} + +// ROTORBLADE actions +const std::vector& getRotorBladeDrawOptionsActions() { + static std::vector actions = { + { "Show Rotor Blade", [](TIGLCreatorDocument* doc, const QString& uid){ doc->drawRotorBlade(uid); } }, + { "Show Rotor Blade Guide curves", [](TIGLCreatorDocument* doc, const QString& uid){ doc->drawRotorBladeGuideCurves(); } }, + { "Show Rotor Blade overlay profile points", [](TIGLCreatorDocument* doc, const QString& uid){ doc->drawRotorBladeOverlayProfilePoints(uid); } }, + { "Show Rotor Blade Triangulation", [](TIGLCreatorDocument* doc, const QString& uid){ doc->drawRotorBladeTriangulation(uid); } }, + { "Show Sample Rotor Blade points", [](TIGLCreatorDocument* doc, const QString& uid){ doc->drawRotorBladeSamplePoints(uid); } }, + { "Show Fused Rotor Blade", [](TIGLCreatorDocument* doc, const QString& uid){ doc->drawFusedRotorBlade(uid); } }, + { "Show Rotor Blade Component segment", [](TIGLCreatorDocument* doc, const QString& uid){ doc->drawRotorBladeComponentSegment(uid); } }, + { "Show Rotor Blade Component segment points", [](TIGLCreatorDocument* doc, const QString& uid){ doc->drawRotorBladeComponentSegmentPoints(uid); } }, + { "Show Rotor Blade Shells", [](TIGLCreatorDocument* doc, const QString& uid){ doc->drawRotorBladeShells(uid); } }, + { "Show all Rotors, Wings and Fuselages", [](TIGLCreatorDocument* doc, const QString& uid){ doc->drawAllFuselagesAndWingsSurfacePoints(); } } + }; + return actions; +} + +// ROTOR actions +const std::vector& getRotorDrawOptionsActions() { + static std::vector actions = { + { "Show Rotor", [](TIGLCreatorDocument* doc, const QString& uid){ doc->drawRotorByUID(uid);} }, + { "Show Rotor Disk", [](TIGLCreatorDocument* doc, const QString& uid){doc->drawRotorDisk(uid);} }, + { "Show Rotor Properties", [](TIGLCreatorDocument* doc, const QString& uid){ doc->showRotorProperties(uid);} } + }; + return actions; +} diff --git a/TIGLCreator/src/DrawOptionsActions.h b/TIGLCreator/src/DrawOptionsActions.h new file mode 100644 index 000000000..1eb06bed0 --- /dev/null +++ b/TIGLCreator/src/DrawOptionsActions.h @@ -0,0 +1,16 @@ +#pragma once +#include +#include "TIGLCreatorDocument.h" + +void handleDrawOption(const QString& actionName); + +struct DrawOptionAction { + QString label; // User-facing label + std::function handler; +}; + +const std::vector& getWingDrawOptionsActions(); +const std::vector& getFuselageDrawOptionsActions(); +const std::vector& getPlaneDrawOptionsActions(); +const std::vector& getRotorBladeDrawOptionsActions(); +const std::vector& getRotorDrawOptionsActions(); \ No newline at end of file diff --git a/TIGLCreator/src/TIGLCreatorWindow.cpp b/TIGLCreator/src/TIGLCreatorWindow.cpp index e25fb62ce..2f2235243 100644 --- a/TIGLCreator/src/TIGLCreatorWindow.cpp +++ b/TIGLCreator/src/TIGLCreatorWindow.cpp @@ -51,6 +51,7 @@ #include "TIGLCreatorLoggerHTMLDecorator.h" #include "TIGLCreatorScreenshotDialog.h" #include "TIGLCreatorScopedCommand.h" +#include "DrawOptionsActions.h" #include "tigl_config.h" #include "api/tigl_version.h" #include "TIGLCreatorMaterials.h" @@ -192,6 +193,7 @@ TIGLCreatorWindow::TIGLCreatorWindow() connectSignals(); createMenus(); + setupDrawMenus(); updateMenus(); loadSettings(); @@ -906,57 +908,6 @@ void TIGLCreatorWindow::connectConfiguration() return; } - // CPACS Wing Actions - connect(drawWingProfilesAction, SIGNAL(triggered()), cpacsConfiguration, SLOT(drawWingProfiles())); - connect(drawWingOverlayCPACSProfilePointsAction, SIGNAL(triggered()), cpacsConfiguration, SLOT(drawWingOverlayProfilePoints())); - connect(drawWingGuideCurvesAction, SIGNAL(triggered()), cpacsConfiguration, SLOT(drawWingGuideCurves())); - connect(drawWingsAction, SIGNAL(triggered()), cpacsConfiguration, SLOT(drawWing())); - connect(drawWingTriangulationAction, SIGNAL(triggered()), cpacsConfiguration, SLOT(drawWingTriangulation())); - connect(drawWingSamplePointsAction, SIGNAL(triggered()), cpacsConfiguration, SLOT(drawWingSamplePoints())); - connect(drawFusedWingAction, SIGNAL(triggered()), cpacsConfiguration, SLOT(drawFusedWing())); - connect(drawWingComponentSegmentAction, SIGNAL(triggered()), cpacsConfiguration, SLOT(drawWingComponentSegment())); - connect(drawWingCSPointAction, SIGNAL(triggered()), cpacsConfiguration, SLOT(drawWingComponentSegmentPoints())); - connect(drawWingShellAction, SIGNAL(triggered()), cpacsConfiguration, SLOT(drawWingShells())); - connect(drawWingStructureAction, SIGNAL(triggered(bool)), cpacsConfiguration, SLOT(drawWingStructure())); - connect(drawWingFlapsAction, SIGNAL(triggered()), cpacsConfiguration, SLOT(drawWingFlaps())); - - // CPACS Aircraft Actions - connect(showAllWingsAndFuselagesAction, SIGNAL(triggered()), cpacsConfiguration, SLOT(drawConfiguration())); - connect(showAllWingsAndFuselageDuctCutoutsAction, SIGNAL(triggered()), cpacsConfiguration, SLOT(drawConfigurationWithDuctCutouts())); - connect(showAllWingsAndFuselagesSurfacePointsAction, SIGNAL(triggered()), cpacsConfiguration, SLOT(drawAllFuselagesAndWingsSurfacePoints())); - connect(drawFusedAircraftAction, SIGNAL(triggered()), cpacsConfiguration, SLOT(drawFusedAircraft())); - connect(drawIntersectionAction, SIGNAL(triggered()), cpacsConfiguration, SLOT(drawIntersectionLine())); - connect(showFusedAirplaneTriangulation, SIGNAL(triggered()), cpacsConfiguration, SLOT(drawFusedAircraftTriangulation())); - connect(drawFarFieldAction, SIGNAL(triggered()), cpacsConfiguration, SLOT(drawFarField())); - connect(drawSystemsAction, SIGNAL(triggered()), cpacsConfiguration, SLOT(drawSystems())); - connect(drawComponentAction, SIGNAL(triggered()), cpacsConfiguration, SLOT(drawComponent())); - connect(drawControlPointNetAction, SIGNAL(triggered()), cpacsConfiguration, SLOT(drawControlPointNet())); - - // CPACS Fuselage Actions - connect(drawFuselageProfilesAction, SIGNAL(triggered()), cpacsConfiguration, SLOT(drawFuselageProfiles())); - connect(drawFuselageAction, SIGNAL(triggered()), cpacsConfiguration, SLOT(drawFuselage())); - connect(drawFuselageTriangulationAction, SIGNAL(triggered()), cpacsConfiguration, SLOT(drawFuselageTriangulation())); - connect(drawFuselageSamplePointsAction, SIGNAL(triggered()), cpacsConfiguration, SLOT(drawFuselageSamplePoints())); - connect(drawFuselageSamplePointsAngleAction, SIGNAL(triggered()), cpacsConfiguration, SLOT(drawFuselageSamplePointsAngle())); - connect(drawFusedFuselageAction, SIGNAL(triggered()), cpacsConfiguration, SLOT(drawFusedFuselage())); - connect(drawFuselageGuideCurvesAction, SIGNAL(triggered()), cpacsConfiguration, SLOT(drawFuselageGuideCurves())); - - // CPACS RotorBlade Actions - connect(drawRotorProfilesAction, SIGNAL(triggered()), cpacsConfiguration, SLOT(drawRotorProfiles())); - connect(drawRotorBladeOverlayCPACSProfilePointsAction, SIGNAL(triggered()), cpacsConfiguration, SLOT(drawRotorBladeOverlayProfilePoints())); - connect(drawRotorBladeGuideCurvesAction, SIGNAL(triggered()), cpacsConfiguration, SLOT(drawRotorBladeGuideCurves())); - connect(drawRotorBladesAction, SIGNAL(triggered()), cpacsConfiguration, SLOT(drawRotorBlade())); - connect(drawRotorBladeTriangulationAction, SIGNAL(triggered()), cpacsConfiguration, SLOT(drawRotorBladeTriangulation())); - connect(drawRotorBladeSamplePointsAction, SIGNAL(triggered()), cpacsConfiguration, SLOT(drawRotorBladeSamplePoints())); - connect(drawFusedRotorBladeAction, SIGNAL(triggered()), cpacsConfiguration, SLOT(drawFusedRotorBlade())); - connect(drawRotorBladeComponentSegmentAction, SIGNAL(triggered()), cpacsConfiguration, SLOT(drawRotorBladeComponentSegment())); - connect(drawRotorBladeCSPointAction, SIGNAL(triggered()), cpacsConfiguration, SLOT(drawRotorBladeComponentSegmentPoints())); - connect(drawRotorBladeShellAction, SIGNAL(triggered()), cpacsConfiguration, SLOT(drawRotorBladeShells())); - - // CPACS Rotorcraft Actions - connect(drawRotorsAction, SIGNAL(triggered()), cpacsConfiguration, SLOT(drawRotor())); - connect(showRotorPropertiesAction, SIGNAL(triggered()), cpacsConfiguration, SLOT(showRotorProperties())); - // Export functions connect(tiglExportFusedIgesAction, SIGNAL(triggered()), cpacsConfiguration, SLOT(exportFusedAsIges())); connect(tiglExportIgesAction, SIGNAL(triggered()), cpacsConfiguration, SLOT(exportAsIges())); @@ -1207,10 +1158,6 @@ void TIGLCreatorWindow::updateMenus() } } catch(tigl::CTiglError& ){} - drawFarFieldAction->setEnabled(hasFarField); - showAllWingsAndFuselageDuctCutoutsAction->setEnabled(hasDucts); - drawSystemsAction->setEnabled(hasACSystems); - drawRotorsAction->setEnabled(nRotors > 0); menuRotorcraft->setEnabled((nRotors > 0) || (nRotorBlades > 0)); menuRotorBlades->setEnabled(nRotorBlades > 0); menuWings->setEnabled(nWings - nRotorBlades > 0); @@ -1470,3 +1417,64 @@ void TIGLCreatorWindow::onSetMaterialRequested(const QString &m) myScene->setObjectsMaterial(it->second); } } + + +void TIGLCreatorWindow::populateDrawMenu( + QMenu* menu, + const std::vector& actions, + bool needsUid) +{ + for (const auto& action : actions) { + QAction* qa = new QAction(action.label, this); + + connect(qa, &QAction::triggered, this, + [this, action, needsUid]() { + QString uid; + if (needsUid && treeWidget) { + uid = treeWidget->getSelectedUID(); + } + action.handler(cpacsConfiguration, uid); + }); + + menu->addAction(qa); + } +} + +void TIGLCreatorWindow::setupDrawMenus() +{ + // Aircraft (plane-level, no UID needed) + populateDrawMenu( + menuAircraft, + getPlaneDrawOptionsActions(), + false + ); + + // Wings + populateDrawMenu( + menuWings, + getWingDrawOptionsActions(), + true + ); + + // Fuselages + populateDrawMenu( + menuFuselages, + getFuselageDrawOptionsActions(), + true + ); + + // Rotor blades + populateDrawMenu( + menuRotorBlades, + getRotorBladeDrawOptionsActions(), + true + ); + + // Rotors + populateDrawMenu( + menuRotorcraft, + getRotorDrawOptionsActions(), + true + ); +} + diff --git a/TIGLCreator/src/TIGLCreatorWindow.h b/TIGLCreator/src/TIGLCreatorWindow.h index 9d9b54abe..53532fd91 100644 --- a/TIGLCreator/src/TIGLCreatorWindow.h +++ b/TIGLCreator/src/TIGLCreatorWindow.h @@ -30,6 +30,7 @@ #include "CSharedPtr.h" #include "ui_TIGLCreatorWindow.h" +#include "DrawOptionsActions.h" #include "ModificatorModel.h" @@ -141,6 +142,9 @@ private slots: void closeEvent(QCloseEvent* event) override; bool deleteEnvVar(const char* varname); + void populateDrawMenu(QMenu* menu, const std::vector& actions, bool needsUid); + void setupDrawMenus(); + QAction *recentFileActions[MaxRecentFiles]; // The OpenCASCADE context; diff --git a/TIGLCreator/src/TIGLCreatorWindow.ui b/TIGLCreator/src/TIGLCreatorWindow.ui index 5344bcde5..efa9733fd 100644 --- a/TIGLCreator/src/TIGLCreatorWindow.ui +++ b/TIGLCreator/src/TIGLCreatorWindow.ui @@ -162,46 +162,16 @@ Aircraft - - - - - - - - - - Wings - - - - - - - - - - - - - Fuselages - - - - - - - @@ -214,17 +184,6 @@ Rotor blades - - - - - - - - - - - @@ -519,272 +478,6 @@ Ctrl+V - - - Show the complete Aircraft - - - Show all Fuselages and Wings - - - Show all Fuselages and Wings - - - - - Show sample Surface points on Fuselage and Wings - - - Show sample Surface points on Fuselages and Wings - - - Show sample Surface points on Fuselages and Wings - - - - - Show the complete Aircraft fused (slow) - - - Show the complete Aircraft fused - - - - - Show Wing - - - Show a wing only - - - - - Show Wing Profiles - - - Show the profiles of a wing - - - Show the profiles of a wing - - - - - Show Wing overlay profile points - - - Show the points of a wing profile - - - - - Show Wing triangulation - - - Shows the triangulation of a wing - - - - - Show Sample Wing points - - - Show sample points on a wing - - - - - - - - Show Fused Wing - - - Shows a fused wing - - - Shows a fused wing - - - - - Show Wing Component Segment - - - Shows a wing component segment - - - Shows a wing component segment - - - - - Show Rotor Blade - - - Show a rotor blade only - - - - - Show Rotor Profiles - - - Show the profiles of a rotor - - - Show the profiles of a rotor - - - - - Show Rotor Blade overlay profile points - - - Show the points of a rotor blade profile - - - - - Show Rotor Blade triangulation - - - Shows the triangulation of a rotor blade - - - - - Show Sample Rotor Blade points - - - Show sample points on a rotor blade - - - - - - - - Show Fused Rotor Blade - - - Shows a fused rotor blade - - - Shows a fused rotor blade - - - - - Show Rotor Blade Component Segment - - - Shows a rotor blade component segment - - - Shows a rotor blade component segment - - - - - Show Rotor Blade Component Segment Point - - - - - Show Rotor Blade Shells - - - - - Show all Rotors, Wings and Fuselages - - - Show all Rotors, Wings and Fuselages - - - - - Show a Rotor - - - Show only one rotor - - - - - Show Rotor Properties... - - - Show properties of a rotor - - - - - Show Fuselage - - - Shows a fuselage - - - Shows a fuselage. - - - - - Show Fuselage Profiles - - - Show the profiles of a fuselage - - - Show the profiles of a fuselage - - - - - Show Fuselage triangulation - - - Shows the triangulation of a fuselage - - - Shows the triangulation of a fuselage. - - - - - Show Sample Fuselage points - - - Show sample points on a fuselage - - - Show sample points on a fuselage. - - - - - Show Sample Fuselage point at Angle - - - Show sample point on a fuselage at user defined angle and eta = 0.5 - - - Show sample point on a fuselage at user defined angle and eta = 0.5 - - - - - Show Fused Fuselage - - - Show a fused fuselage - - - Show a fused fuselage. - - Export Configuration @@ -1202,16 +895,6 @@ Ctrl+W - - - Show Intersection Line - - - - - Show fused Airplane Triangulation (slow) - - @@ -1243,11 +926,6 @@ Settings - - - Show Wing Shells - - Export Model as structed IGES @@ -1269,11 +947,6 @@ Export Fuselage - - - Show Wing Component Segment Point - - Export fused Configuration (slow) @@ -1284,14 +957,6 @@ Export Configuration (not fused) - - - false - - - Draw Far Field - - Export fused/trimmed Configuration @@ -1312,21 +977,6 @@ Export Fused Configuration (slow) - - - Show Wing Guide Curves - - - - - Show Rotor Blade Guide Curves - - - - - Show Fuselage Guide Curves - - Export Wing Curves @@ -1366,16 +1016,6 @@ Draw Vector - - - Draw Systems - - - - - Show Wing Structure - - Export Configuration @@ -1402,16 +1042,6 @@ false - - - Draw any Component - - - - - Draw Control Point Net - - Select all @@ -1420,22 +1050,6 @@ Ctrl+A - - - Show Wing Flaps - - - - - Show the complete Aircraft with Duct Cutouts - - - Show all Fuselages and Wings with Duct Cutouts - - - Show all Fuselages and Wings with Duct Cutouts - - diff --git a/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp b/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp index 94cb7730d..1216dee75 100644 --- a/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp +++ b/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp @@ -32,6 +32,7 @@ #include "ui_ModificatorDisplayOptionsWidget.h" #include #include "TIGLCreatorWindow.h" +#include "../DrawOptionsActions.h" #define BTN_STYLE "#%2 {background-color: %1; color: black; border: 1px solid black; border-radius: 5px;} #%2:hover {border: 1px solid white;}" @@ -63,6 +64,15 @@ ModificatorDisplayOptionsWidget::ModificatorDisplayOptionsWidget(QWidget* parent connect(materialCombo, SIGNAL(currentTextChanged(const QString &)), this, SLOT(onMaterialChanged(const QString &))); connect(buttonColorChoser, SIGNAL(clicked()), this, SLOT(onColorChosen())); connect(buttonResetOptions, SIGNAL(clicked()), this, SLOT(onResetOptions())); + + // for (const auto& action : getDrawOptionsActions()) { + // QAction* act = findChild(action.name); + // if (act) { + // connect(act, &QAction::triggered, this, [this, action]() { + // action.handler(currentUid); // Pass the UID + // }); + // } + // } } ModificatorDisplayOptionsWidget::~ModificatorDisplayOptionsWidget() = default; @@ -119,7 +129,6 @@ void ModificatorDisplayOptionsWidget::setFromItem(cpcr::CPACSTreeItem* item, TIG } - // get current values auto &sm = context->GetShapeManager(); if (sm.HasShapeEntry(uid.toStdString())) { @@ -188,45 +197,16 @@ void ModificatorDisplayOptionsWidget::setFromItem(cpcr::CPACSTreeItem* item, TIG if (!uid.isEmpty() && doc->GetConfiguration().GetUIDManager().HasGeometricComponent(uid.toStdString())) { auto type = doc->GetConfiguration().GetUIDManager().GetGeometricComponent(uid.toStdString()).GetComponentType(); - if (type == TIGL_COMPONENT_WING) { - - ui->drawOptionsCombo->addItem(tr("Show Wing")); - drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawWing(uid); }); - - ui->drawOptionsCombo->addItem(tr("Show Fused wing")); - drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawFusedWing(uid); }); - - ui->drawOptionsCombo->addItem(tr("Show Wing Shells")); - drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawWingShells(uid); }); - - ui->drawOptionsCombo->addItem(tr("Show Wing Component segment")); - drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawWingComponentSegment(uid); }); - - ui->drawOptionsCombo->addItem(tr("Show Wing Structure")); - drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawWingStructure(uid); }); - - ui->drawOptionsCombo->addItem(tr("Show Wing triangulation")); - drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawWingTriangulation(uid); }); - - ui->drawOptionsCombo->addItem(tr("Show Wing Profiles")); - drawCallbacks.push_back([doc]() { if (doc) doc->drawWingProfiles(); }); - - ui->drawOptionsCombo->addItem(tr("Show Wing Guide curves")); - drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawWingGuideCurves(uid); }); - - ui->drawOptionsCombo->addItem(tr("Show Wing Flaps")); - drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawWingFlaps(uid); }); - - ui->drawOptionsCombo->addItem(tr("Show Wing Sample points")); - drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawWingSamplePoints(uid); }); - - ui->drawOptionsCombo->addItem(tr("Show Wing Overlay profile points")); - drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawWingOverlayProfilePoints(uid); }); - - ui->drawOptionsCombo->addItem(tr("Show Wing Component segment points")); - drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawWingComponentSegmentPoints(uid); }); - // Trigger the corresponding callback when an item is activated. Use UniqueConnection to avoid duplicate connections. + if (type == TIGL_COMPONENT_WING) { + drawCallbacks.clear(); + ui->drawOptionsCombo->clear(); + for (const auto& action : getWingDrawOptionsActions()) { + ui->drawOptionsCombo->addItem(tr(action.label.toUtf8())); + drawCallbacks.push_back([this, action, uid, doc]() { + action.handler(doc, uid); + }); + } connect(ui->drawOptionsCombo, QOverload::of(&QComboBox::activated), this, [this](int idx) { if (idx >= 0 && idx < static_cast(drawCallbacks.size()) && drawCallbacks[idx]) { @@ -236,30 +216,14 @@ void ModificatorDisplayOptionsWidget::setFromItem(cpcr::CPACSTreeItem* item, TIG } if (type == TIGL_COMPONENT_FUSELAGE) { - - ui->drawOptionsCombo->addItem(tr("Show Fuselage")); - drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawFuselage(uid); }); - - ui->drawOptionsCombo->addItem(tr("Show Fuselage Profiles")); - drawCallbacks.push_back([doc]() { if (doc) doc->drawFuselageProfiles(); }); - - ui->drawOptionsCombo->addItem(tr("Show Fuselage Guide Curves")); - drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawFuselageGuideCurves(uid); }); - - ui->drawOptionsCombo->addItem(tr("Show Fuselage triangulation")); - drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawFuselageTriangulation(uid); }); - - ui->drawOptionsCombo->addItem(tr("Show Fuselage Sample points")); - drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawFuselageSamplePoints(uid); }); - - ui->drawOptionsCombo->addItem(tr("Show Fuselage Sample points at angle")); - drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawFuselageSamplePointsAngle(uid); }); - - ui->drawOptionsCombo->addItem(tr("Show Fused fuselage")); - drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawFusedFuselage(uid); }); - - - // Trigger the corresponding callback when an item is activated. Use UniqueConnection to avoid duplicate connections. + drawCallbacks.clear(); + ui->drawOptionsCombo->clear(); + for (const auto& action : getFuselageDrawOptionsActions()) { + ui->drawOptionsCombo->addItem(tr(action.label.toUtf8())); + drawCallbacks.push_back([this, action, uid, doc]() { + action.handler(doc, uid); + }); + } connect(ui->drawOptionsCombo, QOverload::of(&QComboBox::activated), this, [this](int idx) { if (idx >= 0 && idx < static_cast(drawCallbacks.size()) && drawCallbacks[idx]) { @@ -269,75 +233,31 @@ void ModificatorDisplayOptionsWidget::setFromItem(cpcr::CPACSTreeItem* item, TIG } if (type == TIGL_COMPONENT_PLANE) { - - ui->drawOptionsCombo->addItem(tr("Show the complete aircraft")); - drawCallbacks.push_back([doc]() { if (doc) doc->drawConfiguration(); }); - - ui->drawOptionsCombo->addItem(tr("Show the complete aircraft with duct cutouts")); - drawCallbacks.push_back([doc]() { if (doc) doc->drawConfigurationWithDuctCutouts(); }); - - ui->drawOptionsCombo->addItem(tr("Show he complete aircraft fused (slow)")); - drawCallbacks.push_back([doc]() { if (doc) doc->drawFusedAircraft(); }); - - ui->drawOptionsCombo->addItem(tr("Show fused aircraft triangulation (slow)")); - drawCallbacks.push_back([doc]() { if (doc) doc->drawFusedAircraftTriangulation(); }); - - ui->drawOptionsCombo->addItem(tr("Show intersection line"));; - drawCallbacks.push_back([doc]() { if (doc) doc->drawIntersectionLine(); }); - - ui->drawOptionsCombo->addItem(tr("Draw Far Field")); - drawCallbacks.push_back([doc]() { if (doc) doc->drawFarField(); }); - - ui->drawOptionsCombo->addItem(tr("Draw Systems")); - drawCallbacks.push_back([doc]() { if (doc) doc->drawSystems(); }); - - ui->drawOptionsCombo->addItem(tr("Draw any Component")); - drawCallbacks.push_back([doc]() { if (doc) doc->drawComponent(); }); - - ui->drawOptionsCombo->addItem(tr("Draw Control Point Net")); - drawCallbacks.push_back([doc]() { if (doc) doc->drawControlPointNet(); }); - + drawCallbacks.clear(); + ui->drawOptionsCombo->clear(); + for (const auto& action : getPlaneDrawOptionsActions()) { + ui->drawOptionsCombo->addItem(tr(action.label.toUtf8())); + drawCallbacks.push_back([this, action, uid, doc]() { + action.handler(doc, uid); + }); + } connect(ui->drawOptionsCombo, QOverload::of(&QComboBox::activated), this, [this](int idx) { if (idx >= 0 && idx < static_cast(drawCallbacks.size()) && drawCallbacks[idx]) { drawCallbacks[idx](); } }, Qt::UniqueConnection); - } if (type == TIGL_COMPONENT_ROTORBLADE) { - - ui->drawOptionsCombo->addItem(tr("Show Rotor Blade")); - drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawRotorBlade(uid); }); - - ui->drawOptionsCombo->addItem(tr("Show Rotor Blade Guide curves")); - drawCallbacks.push_back([doc]() { if (doc) doc->drawRotorBladeGuideCurves(); }); - - ui->drawOptionsCombo->addItem(tr("Show Rotor Blade overlay profile points")); - drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawRotorBladeOverlayProfilePoints(uid); }); - - ui->drawOptionsCombo->addItem(tr("Show Rotor Blade Triangulation")); - drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawRotorBladeTriangulation(uid); }); - - ui->drawOptionsCombo->addItem(tr("Show Sample Rotor Blade points")); - drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawRotorBladeSamplePoints(uid); }); - - ui->drawOptionsCombo->addItem(tr("Show Fused Rotor Blade")); - drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawFusedRotorBlade(uid); }); - - ui->drawOptionsCombo->addItem(tr("Show Rotor Blade Component segment")); - drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawRotorBladeComponentSegment(uid); }); - - ui->drawOptionsCombo->addItem(tr("Show Rotor Blade Component segment points")); - drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawRotorBladeComponentSegmentPoints(uid); }); - - ui->drawOptionsCombo->addItem(tr("Show Rotor Blade Shells")); - drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawRotorBladeShells(uid); }); - - ui->drawOptionsCombo->addItem(tr("Show all Rotors, Wings and Fuselages")); - drawCallbacks.push_back([doc]() { if (doc) doc->drawAllFuselagesAndWingsSurfacePoints(); }); - + drawCallbacks.clear(); + ui->drawOptionsCombo->clear(); + for (const auto& action : getRotorBladeDrawOptionsActions()) { + ui->drawOptionsCombo->addItem(tr(action.label.toUtf8())); + drawCallbacks.push_back([this, action, uid, doc]() { + action.handler(doc, uid); + }); + } connect(ui->drawOptionsCombo, QOverload::of(&QComboBox::activated), this, [this](int idx) { if (idx >= 0 && idx < static_cast(drawCallbacks.size()) && drawCallbacks[idx]) { @@ -347,23 +267,20 @@ void ModificatorDisplayOptionsWidget::setFromItem(cpcr::CPACSTreeItem* item, TIG } if (type == TIGL_COMPONENT_ROTOR) { - - ui->drawOptionsCombo->addItem(tr("Show Rotor")); - drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawRotorByUID(uid); }); - - ui->drawOptionsCombo->addItem(tr("Show Rotor Disk")); - drawCallbacks.push_back([doc, uid]() { if (doc) doc->drawRotorDisk(uid); }); - - ui->drawOptionsCombo->addItem(tr("Show Rotor Properties")); - drawCallbacks.push_back([doc, uid]() { if (doc) doc->showRotorProperties(uid); }); - + drawCallbacks.clear(); + ui->drawOptionsCombo->clear(); + for (const auto& action : getRotorDrawOptionsActions()) { + ui->drawOptionsCombo->addItem(tr(action.label.toUtf8())); + drawCallbacks.push_back([this, action, uid, doc]() { + action.handler(doc, uid); + }); + } connect(ui->drawOptionsCombo, QOverload::of(&QComboBox::activated), this, [this](int idx) { if (idx >= 0 && idx < static_cast(drawCallbacks.size()) && drawCallbacks[idx]) { drawCallbacks[idx](); } }, Qt::UniqueConnection); - } } diff --git a/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.ui b/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.ui index acf06ad05..c15408140 100644 --- a/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.ui +++ b/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.ui @@ -112,7 +112,7 @@ - Material: + Draw Options: false From f0c061e6688fd24783ad396999976bb93395d8e4 Mon Sep 17 00:00:00 2001 From: Ole Albers Date: Tue, 2 Jun 2026 10:45:17 +0200 Subject: [PATCH 26/26] fix merge errors --- .../src/modificators/ModificatorDisplayOptionsWidget.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp b/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp index 3035874ba..e62ccfeae 100644 --- a/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp +++ b/TIGLCreator/src/modificators/ModificatorDisplayOptionsWidget.cpp @@ -128,14 +128,12 @@ void ModificatorDisplayOptionsWidget::setFromItem(cpcr::CPACSTreeItem* item, TIG ui->drawOptionsCombo->setVisible(true); } - - // get current values auto &sm = context->GetShapeManager(); - if (sm.HasShapeEntry(uid)) { - auto objs = sm.GetIObjectsFromShapeName(uid); + if (sm.HasShapeEntry(uid.toStdString())) { + auto objs = sm.GetIObjectsFromShapeName(uid.toStdString()); if (objs.empty()) { - LOG(WARNING) << "No objects found for shape with uid " << uid; + LOG(WARNING) << "No objects found for shape with uid " << uid.toStdString(); return; } auto obj = objs[0];