QElectroTech 0.100.0-dev
Loading...
Searching...
No Matches
bordertitleblock.h
Go to the documentation of this file.
1/*
2 Copyright 2006-2024 The QElectroTech Team
3 This file is part of QElectroTech.
4
5 QElectroTech is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 2 of the License, or
8 (at your option) any later version.
9
10 QElectroTech is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
17*/
18#ifndef BORDERTITLEBLOCK_H
19#define BORDERTITLEBLOCK_H
21#include "borderproperties.h"
22#include "diagramcontext.h"
24
25#include <QDate>
26#include <QObject>
27#include <QRectF>
28class QPainter;
29class DiagramPosition;
37class BorderTitleBlock : public QObject
38{
39 Q_OBJECT
40
41 public:
42 BorderTitleBlock(QObject * = nullptr);
43 ~BorderTitleBlock() override;
44
45 private:
47
48 //METHODS
49 public:
50 void draw(QPainter *painter);
51 void drawDxf(QString &, int);
52
53 //METHODS TO GET DIMENSION
54 //COLUMNS
56 int columnsCount() const { return(columns_count_); }
58 qreal columnsWidth() const { return(columns_width_); }
60 qreal columnsTotalWidth() const {
63 qreal columnsHeaderHeight() const {
64 return(columns_header_height_); }
65
66 //ROWS
68 int rowsCount() const { return(rows_count_); }
70 qreal rowsHeight() const { return(rows_height_); }
72 qreal rowsTotalHeight() const {
73 return(rows_count_ * rows_height_); }
75 qreal rowsHeaderWidth() const { return(rows_header_width_); }
76
77 // border - title block = diagram
83 qreal diagramWidth() const
84{
85 return(columnsTotalWidth() + rowsHeaderWidth()); }
91 qreal diagramHeight() const
92{
94
95 QRectF titleBlockRect () const;
96
98 private:
99 QRectF titleBlockRectForQPainter () const;
100
101 public:
102 QRectF borderAndTitleBlockRect () const;
103 QRectF columnsRect () const;
104 QRectF rowsRect () const;
105 QRectF outsideBorderRect() const;
106 QRectF insideBorderRect() const;
107
108 // methods to get title block basic data
110 QString author() const { return(btb_author_); }
112 QDate date() const { return(btb_date_); }
114 QString title() const { return(btb_title_); }
116 QString folio() const { return(btb_folio_); }
118 QString finalfolio() const { return(btb_final_folio_); }
120 QString plant() const { return(btb_plant_); }
122 QString locmach() const { return(btb_locmach_); }
124 QString indexrev() const { return(btb_indexrev_); }
126 QString fileName() const { return(btb_filename_); }
128 QString version() const { return(btb_version_); }
133 QString autoPageNum() const { return(btb_auto_page_num_); }
135 int folioTotal() const { return(folio_total_);}
136
137 // methods to get display options
140 return(display_titleblock_); }
143 bool columnsAreDisplayed() const { return(display_columns_); }
146 bool rowsAreDisplayed() const { return(display_rows_); }
148 bool borderIsDisplayed() const { return(display_border_); }
149
150 // methods to set dimensions
151 void setColumnsCount(int);
152 void setRowsCount(int);
153 void setColumnsWidth(const qreal &);
154 void setRowsHeight(const qreal &);
155 void setColumnsHeaderHeight(const qreal &);
156 void setRowsHeaderWidth(const qreal &);
157 void setDiagramHeight(const qreal &);
158
159 DiagramPosition convertPosition(const QPointF &);
160
161 // methods to set title block basic data
162 void setFolio(const QString &folio);
163 void setFolioData(int, int, const QString& = nullptr,
164 const DiagramContext & = DiagramContext());
165 void setPreviousFolioNum(const QString &previous);
166 void setNextFolioNum(const QString &next);
167
168 void titleBlockToXml(QDomElement &);
169 void titleBlockFromXml(const QDomElement &);
170 void borderToXml(QDomElement &);
171 void borderFromXml(const QDomElement &);
172
176 void importBorder(const BorderProperties &);
177
180 QString titleBlockTemplateName() const;
181
182 public slots:
183 void titleBlockTemplateChanged(const QString &);
185 const QString &,
186 const TitleBlockTemplate * = nullptr);
187
188 // methods to set display options
189 void displayTitleBlock(bool);
190 void displayColumns(bool);
191 void displayRows(bool);
192 void displayBorder(bool);
193
194 private:
195 void updateRectangles();
197 const DiagramContext & = DiagramContext());
198 QString incrementLetters(const QString &);
199
200 signals:
207 void borderChanged(QRectF old_border, QRectF new_border);
217 void titleBlockFolioChanged(const QString &);
232 void needTitleBlockTemplate(const QString &);
233
239
240 // attributes
241 private:
242 // titleblock basic data
243 QString btb_author_;
244 QDate btb_date_;
245 QString btb_title_;
246 QString btb_folio_;
247 QString btb_plant_;
248 QString btb_locmach_;
255 QString btb_version_;
258 Qt::Edge m_edge;
261
262 // border dimensions (rows and columns)
263 // columns: number and dimensions
267
268 // rows: number and dimensions
272
273 // title block dimensions
275
276 // rectangles used for drawing operations
278
279 // display options
285};
286#endif
The BorderProperties class This class is a container for dimensions and display properties of a diagr...
Definition borderproperties.h:29
The BorderTitleBlock class This class represents the border and the titleblock which frame a particul...
Definition bordertitleblock.h:38
bool titleBlockIsDisplayed() const
Definition bordertitleblock.h:139
void draw(QPainter *painter)
BorderTitleBlock::draw Draw the border and the titleblock.
Definition bordertitleblock.cpp:512
void borderToXml(QDomElement &)
BorderTitleBlock::borderToXml Exports the border current settings to XML.
Definition bordertitleblock.cpp:232
bool borderIsDisplayed() const
Definition bordertitleblock.h:148
QString fileName() const
Definition bordertitleblock.h:126
QString m_previous_folio_num
titleblock previous folio num
Definition bordertitleblock.h:260
DiagramContext titleblockInformation() const
BorderTitleBlock::titleblockInformation.
Definition bordertitleblock.cpp:106
qreal rowsHeaderWidth() const
Definition bordertitleblock.h:75
void titleBlockTemplateChanged(const QString &)
BorderTitleBlock::titleBlockTemplateChanged This slot may be used to inform this class that the given...
Definition bordertitleblock.cpp:416
const TitleBlockTemplate * titleBlockTemplate()
BorderTitleBlock::titleBlockTemplate.
Definition bordertitleblock.cpp:382
void setRowsHeight(const qreal &)
BorderTitleBlock::setRowsHeight Change the height of the lines. If the indicated height is lower than...
Definition bordertitleblock.cpp:821
QRectF titleBlockRectForQPainter() const
BorderTitleBlock::titleBlockRectForQPainter.
Definition bordertitleblock.cpp:123
void setFolioData(int, int, const QString &=nullptr, const DiagramContext &=DiagramContext())
BorderTitleBlock::setFolioData.
Definition bordertitleblock.cpp:978
void informationChanged()
infoChanged Signal emitted when the informations changed.
void setColumnsWidth(const qreal &)
BorderTitleBlock::setColumnsWidth Change the width of the columns. If the width indicated is less tha...
Definition bordertitleblock.cpp:768
void importBorder(const BorderProperties &)
BorderTitleBlock::importBorder.
Definition bordertitleblock.cpp:366
QRectF outsideBorderRect() const
BorderTitleBlock::outsideBorderRect.
Definition bordertitleblock.cpp:180
QString btb_folio_
titleblock folio
Definition bordertitleblock.h:246
QString plant() const
Definition bordertitleblock.h:120
DiagramContext additionalFields() const
Definition bordertitleblock.h:130
int folio_index_
titleblock index
Definition bordertitleblock.h:252
QString btb_title_
titleblock title
Definition bordertitleblock.h:245
QString locmach() const
Definition bordertitleblock.h:122
void displayColumns(bool)
BorderTitleBlock::displayColumns.
Definition bordertitleblock.cpp:459
void needFolioData()
needFolioData Signal emitted when the title block requires its data to be updated in order to generat...
void titleBlockFolioChanged(const QString &)
titleBlockFolioChanged Signal emitted after Folio has changed
~BorderTitleBlock() override
BorderTitleBlock::~BorderTitleBlock.
Definition bordertitleblock.cpp:80
void displayTitleBlock(bool)
BorderTitleBlock::displayTitleBlock.
Definition bordertitleblock.cpp:448
bool display_titleblock_
Definition bordertitleblock.h:280
Qt::Edge m_edge
titleblock edge
Definition bordertitleblock.h:258
qreal columns_header_height_
columns header height
Definition bordertitleblock.h:266
void setTitleBlockTemplate(const TitleBlockTemplate *)
BorderTitleBlock::setTitleBlockTemplate.
Definition bordertitleblock.cpp:393
DiagramContext additional_fields_
titleblock additional fields
Definition bordertitleblock.h:257
void titleBlockFromXml(const QDomElement &)
BorderTitleBlock::titleBlockFromXml Reads the title block values from XML.
Definition bordertitleblock.cpp:221
void setColumnsHeaderHeight(const qreal &)
BorderTitleBlock::setColumnsHeaderHeight Change the height of the headers containing the column numbe...
Definition bordertitleblock.cpp:784
qreal diagramWidth() const
diagramWidth
Definition bordertitleblock.h:83
void setPreviousFolioNum(const QString &previous)
BorderTitleBlock::setPreviousFolioNum.
Definition bordertitleblock.cpp:1008
bool columnsAreDisplayed() const
Definition bordertitleblock.h:143
void importTitleBlock(const TitleBlockProperties &)
BorderTitleBlock::importTitleBlock.
Definition bordertitleblock.cpp:314
qreal rows_header_width_
rows header width
Definition bordertitleblock.h:271
qreal columnsTotalWidth() const
Definition bordertitleblock.h:60
qreal rowsTotalHeight() const
Definition bordertitleblock.h:72
void setRowsCount(int)
BorderTitleBlock::setRowsCount Allows you to change the number of lines. If this number of lines is l...
Definition bordertitleblock.cpp:802
int rows_count_
rows count
Definition bordertitleblock.h:269
QString version() const
Definition bordertitleblock.h:128
QString btb_filename_
titleblock filename
Definition bordertitleblock.h:254
void updateDiagramContextForTitleBlock(const DiagramContext &=DiagramContext())
BorderTitleBlock::updateDiagramContextForTitleBlock Update the informations given to the titleblock t...
Definition bordertitleblock.cpp:897
QString btb_version_
Definition bordertitleblock.h:255
QString btb_locmach_
titleblock locmach
Definition bordertitleblock.h:248
QString m_next_folio_num
titleblock next folio num
Definition bordertitleblock.h:259
QString btb_indexrev_
titleblock index rev
Definition bordertitleblock.h:249
qreal diagramHeight() const
diagramHeight
Definition bordertitleblock.h:91
void setFolio(const QString &folio)
BorderTitleBlock::setFolio.
Definition bordertitleblock.cpp:884
void setNextFolioNum(const QString &next)
BorderTitleBlock::setNextFolioNum.
Definition bordertitleblock.cpp:1020
bool display_rows_
Definition bordertitleblock.h:282
QDate btb_date_
titleblock date
Definition bordertitleblock.h:244
void displayBorder(bool)
BorderTitleBlock::displayBorder.
Definition bordertitleblock.cpp:485
QRectF borderAndTitleBlockRect() const
BorderTitleBlock::borderAndTitleBlockRect.
Definition bordertitleblock.cpp:142
qreal rowsHeight() const
Definition bordertitleblock.h:70
QString indexrev() const
Definition bordertitleblock.h:124
QString finalfolio() const
Definition bordertitleblock.h:118
void borderFromXml(const QDomElement &)
BorderTitleBlock::borderFromXml Reads the border settings from XML.
Definition bordertitleblock.cpp:250
void setColumnsCount(int)
BorderTitleBlock::setColumnsCount Allows you to change the number of columns. If this number of colum...
Definition bordertitleblock.cpp:749
QString btb_plant_
titleblock plant
Definition bordertitleblock.h:247
void updateRectangles()
BorderTitleBlock::updateRectangles This method update the diagram rect according to the value of rows...
Definition bordertitleblock.cpp:496
QString btb_auto_page_num_
titleblock auto page num
Definition bordertitleblock.h:251
void setDiagramHeight(const qreal &)
BorderTitleBlock::setDiagramHeight This method tries to get as close as possible to the given height ...
Definition bordertitleblock.cpp:851
qreal titleblock_height_
Definition bordertitleblock.h:274
bool display_border_
Definition bordertitleblock.h:283
QString btb_final_folio_
titleblock final folio
Definition bordertitleblock.h:250
int folio_total_
titleblock total
Definition bordertitleblock.h:253
qreal columnsHeaderHeight() const
Definition bordertitleblock.h:63
void titleBlockToXml(QDomElement &)
BorderTitleBlock::titleBlockToXml Exports the title block current values to XML.
Definition bordertitleblock.cpp:212
bool display_columns_
Definition bordertitleblock.h:281
void needTitleBlockTemplate(const QString &)
needTitleBlockTemplate Signal emitted when this object needs to set a specific title block template....
void borderChanged(QRectF old_border, QRectF new_border)
borderChanged Signal emitted after the border has changed
void setRowsHeaderWidth(const qreal &)
BorderTitleBlock::setRowsHeaderWidth Change the width of the headers containing the line numbers....
Definition bordertitleblock.cpp:837
QRectF insideBorderRect() const
BorderTitleBlock::insideBorderRect.
Definition bordertitleblock.cpp:194
QString author() const
Definition bordertitleblock.h:110
QString autoPageNum() const
Definition bordertitleblock.h:133
void titleBlockTemplateRemoved(const QString &, const TitleBlockTemplate *=nullptr)
BorderTitleBlock::titleBlockTemplateRemoved This slot has to be used to inform this class that the gi...
Definition bordertitleblock.cpp:431
void drawDxf(QString &, int)
BorderTitleBlock::drawDxf.
Definition bordertitleblock.cpp:619
QRectF rowsRect() const
BorderTitleBlock::rowsRect.
Definition bordertitleblock.cpp:166
void displayChanged()
displayChanged Signal emitted after display options have changed
int rowsCount() const
Definition bordertitleblock.h:68
TitleBlockTemplateRenderer * m_titleblock_template_renderer
Definition bordertitleblock.h:284
bool rowsAreDisplayed() const
Definition bordertitleblock.h:146
QString incrementLetters(const QString &)
BorderTitleBlock::incrementLetters increments string with Letters A to Z.
Definition bordertitleblock.cpp:938
void displayRows(bool)
BorderTitleBlock::displayRows.
Definition bordertitleblock.cpp:470
BorderProperties exportBorder()
BorderTitleBlock::exportBorder.
Definition bordertitleblock.cpp:347
QRectF titleBlockRect() const
BorderTitleBlock::titleBlockRect.
Definition bordertitleblock.cpp:88
qreal columns_width_
columns width
Definition bordertitleblock.h:265
QRectF columnsRect() const
BorderTitleBlock::columnsRect.
Definition bordertitleblock.cpp:152
qreal rows_height_
rows height
Definition bordertitleblock.h:270
QString title() const
Definition bordertitleblock.h:114
BorderTitleBlock(const BorderTitleBlock &)
int columnsCount() const
Definition bordertitleblock.h:56
int columns_count_
columns count
Definition bordertitleblock.h:264
qreal columnsWidth() const
Definition bordertitleblock.h:58
QString folio() const
Definition bordertitleblock.h:116
QDate date() const
Definition bordertitleblock.h:112
QRectF diagram_rect_
Definition bordertitleblock.h:277
TitleBlockProperties exportTitleBlock()
BorderTitleBlock::exportTitleBlock.
Definition bordertitleblock.cpp:288
DiagramPosition convertPosition(const QPointF &)
BorderTitleBlock::convertPosition Convert a Point in cartesian coordinate (x : 12....
Definition bordertitleblock.cpp:864
QString titleBlockTemplateName() const
BorderTitleBlock::titleBlockTemplateName.
Definition bordertitleblock.cpp:403
int folioTotal() const
Definition bordertitleblock.h:135
QString btb_author_
titleblock author
Definition bordertitleblock.h:243
Definition diagramcontext.h:57
Definition diagramposition.h:28
Definition titleblockproperties.h:29
The TitleBlockTemplate class This class represents an title block template for an electric diagram....
Definition titleblocktemplate.h:37
The TitleBlockTemplateRenderer class.
Definition titleblocktemplaterenderer.h:28