Skip to content

Commit

Permalink
Added FreeCAD Style Titleblock
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasfalk committed Sep 14, 2024
1 parent 305e2cd commit 7670892
Show file tree
Hide file tree
Showing 10 changed files with 471 additions and 14 deletions.
7 changes: 7 additions & 0 deletions Src/PageLayout/TitleBlock/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,18 @@ set(ISO7200BTitleBlock_SOURCES
ISO7200B/iso7200bdialog.ui
)

set(FreeCADATitleBlock_SOURCES
FreeCADA/freecada.h
FreeCADA/freecada.cpp
)

add_library(TitleBlock STATIC
${TitleBlock_SOURCES}
${PlainTitleBlock_SOURCES}
${ISO7200ATitleBlock_SOURCES}
${ISO7200BTitleBlock_SOURCES}
${FreeCADATitleBlock_SOURCES}

)

target_link_libraries(TitleBlock PRIVATE
Expand Down
324 changes: 324 additions & 0 deletions Src/PageLayout/TitleBlock/FreeCADA/freecada.cpp

Large diffs are not rendered by default.

30 changes: 30 additions & 0 deletions Src/PageLayout/TitleBlock/FreeCADA/freecada.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#ifndef FREECADA_H
#define FREECADA_H

#include "PageLayout/TitleBlock/titleblock.h"
#include "PageLayout/TitleBlock/ISO7200A/iso7200a.h"

class FreeCADA : public ISO7200A
{
public:
FreeCADA();

///
/// \brief draw draws the title-block into the given drawer and into the given rectangle
/// \param into the universal drawer that is drawn in to
/// \param where the rectangle where the title-block is drawn in to(typically the drawing area
/// of the frame)
/// \param onWhat is the page layout the frame is to be draw on, this is to get
/// the name for example
///
virtual void draw(std::shared_ptr<UniversalDraw> into, QRectF where,
QPageLayout onWhat) override;

protected:
///
/// \brief initLanguages initialises the Languages map(m_languageTexts)
///
void initLanguages() override;
};

#endif // FREECADA_H
1 change: 1 addition & 0 deletions Src/PageLayout/TitleBlock/ISO7200A/iso7200a.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ void ISO7200A::updateCurrentLanguage()

void ISO7200A::initLanguages()
{
m_languageTexts->clear();
QMap<QString, ISO7200ATextStruct> en_gb = {
{ "ResponsibleDepartment", ISO7200ATextStruct{ "Resp. dept.", "AB 131" } },
{ "TechnicalReference", ISO7200ATextStruct{ "Technical reference.", "Susan Müller" } },
Expand Down
2 changes: 1 addition & 1 deletion Src/PageLayout/TitleBlock/ISO7200A/iso7200a.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class ISO7200A : public TitleBlock
virtual void initLanguages();

///
/// \brief m_picturePath is the Path to a Picture, if it is a walyed path to a picture(.svg or
/// \brief m_picturePath is the Path to a Picture, if it is a waled path to a picture(.svg or
/// .png) than it is drawn.
///
QString m_picturePath = "";
Expand Down
17 changes: 9 additions & 8 deletions Src/PageLayout/TitleBlock/ISO7200B/iso7200b.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ void ISO7200B::draw(std::shared_ptr<UniversalDraw> into, QRectF where, QPageLayo

void ISO7200B::initLanguages()
{
m_languageTexts->clear();
QMap<QString, ISO7200ATextStruct> en_gb = {
{ "ResponsibleDepartment", ISO7200ATextStruct{ "Resp. dept.", "AB 131" } },
{ "TechnicalReference", ISO7200ATextStruct{ "Technical reference.", "Susan Müller" } },
Expand Down Expand Up @@ -248,12 +249,12 @@ void ISO7200B::initLanguages()
m_languageTexts->insert("de_de", de_de);
}

QString ISO7200B::picturePath() const
{
return m_picturePath;
}
// QString ISO7200B::picturePath() const
// {
// return m_picturePath;
// }

void ISO7200B::setPicturePath(const QString &newPicturePath)
{
m_picturePath = newPicturePath;
}
// void ISO7200B::setPicturePath(const QString &newPicturePath)
// {
// m_picturePath = newPicturePath;
// }
6 changes: 3 additions & 3 deletions Src/PageLayout/TitleBlock/ISO7200B/iso7200b.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ class ISO7200B : public ISO7200A
virtual void draw(std::shared_ptr<UniversalDraw> into, QRectF where,
QPageLayout onWhat) override;

QString picturePath() const;
void setPicturePath(const QString &newPicturePath);
// QString picturePath() const;
// void setPicturePath(const QString &newPicturePath);

protected:
///
Expand All @@ -39,7 +39,7 @@ class ISO7200B : public ISO7200A
/// \brief m_picturePath is the Path to a Picture, if it is a walyed path to a picture(.svg or
/// .png) than it is drawn.
///
QString m_picturePath = "";
// QString m_picturePath = "";
};

#endif // ISO7200B_H
60 changes: 60 additions & 0 deletions Src/Test/Zeichnung.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions Src/Window/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "PageLayout/TitleBlock/ISO7200A/iso7200adialog.h"
#include "PageLayout/TitleBlock/ISO7200B/iso7200b.h"
#include "PageLayout/TitleBlock/ISO7200B/iso7200bdialog.h"
#include "PageLayout/TitleBlock/FreeCADA/freecada.h"
#include "PageLayout/Frame/ISO5457/iso5457frame.h"
#include "PageLayout/Frame/ISO5457/iso5457framedialog.h"
#include "PageLayout/FoldingLines/foldinglines.h"
Expand Down Expand Up @@ -223,6 +224,9 @@ QList<QString> UTGMainWindow::sortedPageNames(QMap<QString, QPageSize> pageMap)
ret.append("Tabloid");
ret.append("Ledger");

QStringList titleBlocks = names.filter(QRegularExpression{ "^TitleBlock .*" });
ret.append(titleBlocks);

if (ret.size() != nmsSize) {
foreach (QString nm, names) {
if (!ret.contains(nm)) {
Expand Down Expand Up @@ -468,6 +472,8 @@ void UTGMainWindow::on_TitleBlockComboBox_currentTextChanged(const QString &arg1
}
} else if (arg1 == "ISO7200 Style B") {
m_titleblock = std::make_shared<ISO7200B>();
} else if (arg1 == "FreeCAD Style A") {
m_titleblock = std::make_shared<FreeCADA>();
}
updateFrame();
initTitleBlockLanguages();
Expand Down Expand Up @@ -508,6 +514,20 @@ void UTGMainWindow::on_TitleBlockPushButton_clicked()
dialog.setModal(true);
dialog.exec();

m_titleblock = tmp; // dialog.titleBlock();
m_ui->TitleBlLanguageComboBox->setCurrentText(m_titleblock->language());
} else if (m_titleblock->type() == "FreeCAD Style A") {
// TODO
ISO7200ADialog dialog;

auto shared_base = std::shared_ptr<TitleBlock>{ std::move(m_titleblock) };
std::shared_ptr<FreeCADA> tmp = std::static_pointer_cast<FreeCADA>(shared_base);

dialog.setTitleBlock(tmp);

dialog.setModal(true);
dialog.exec();

m_titleblock = tmp; // dialog.titleBlock();
m_ui->TitleBlLanguageComboBox->setCurrentText(m_titleblock->language());
}
Expand Down
18 changes: 16 additions & 2 deletions Src/Window/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,20 @@ private slots:
QPageSize::ExactMatch } },
{ "Ledger",
QPageSize{ QSizeF{ 279, 432 }, QPageSize::Millimeter, "Ledger", QPageSize::ExactMatch } },

// Titleblock Sizes
{ "TitleBlock Plain",
QPageSize{ QSizeF{ 50, 180 }, QPageSize::Millimeter, "TitleBlock Plain",
QPageSize::ExactMatch } },
{ "TitleBlock ISO7200 Style A",
QPageSize{ QSizeF{ 36, 180 }, QPageSize::Millimeter, "TitleBlock ISO7200 Style A",
QPageSize::ExactMatch } },
{ "TitleBlock ISO7200 Style B",
QPageSize{ QSizeF{ 27, 180 }, QPageSize::Millimeter, "TitleBlock ISO7200 Style B",
QPageSize::ExactMatch } },
{ "TitleBlock FreeCAD Style A",
QPageSize{ QSizeF{ 47, 140.35 }, QPageSize::Millimeter, "TitleBlock FreeCAD Style A",
QPageSize::ExactMatch } },
};
QList<QString> sortedPageNames(QMap<QString, QPageSize> pageMap);

Expand All @@ -490,8 +504,8 @@ private slots:
///
/// \brief m_titleBlocks a list for selecting the title-block
///
QList<QString> m_titleBlocks =
QList<QString>{ "None", "Plain TitleBlock", "ISO7200 Style A", "ISO7200 Style B" };
QList<QString> m_titleBlocks = QList<QString>{ "None", "Plain TitleBlock", "ISO7200 Style A",
"ISO7200 Style B", "FreeCAD Style A" };

///
/// \brief m_foldingLineAlgs is a list of all Folding Line Algorithms available
Expand Down

0 comments on commit 7670892

Please sign in to comment.