mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-22 01:10:53 +01:00
Export to DXF Format partially added. Following entities are exported:
1. Border and title block 2. Diagram independent text items 3. Element text items 4. Conductors Following entities are not exported right now: 1. Element components 2. Terminals 3. Maybe other things also. Lot of debugging shall be required. Thank you git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2718 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
#include "diagramposition.h"
|
||||
#include "qetapp.h"
|
||||
#include "math.h"
|
||||
#include "createdxf.h"
|
||||
|
||||
/**
|
||||
Constructeur simple : construit une bordure en recuperant les dimensions
|
||||
@@ -409,6 +410,80 @@ void BorderTitleBlock::draw(QPainter *qp, qreal x, qreal y) {
|
||||
titleblock_rect_ .translate(-x, -y);
|
||||
}
|
||||
|
||||
void BorderTitleBlock::drawDxf(int width, int height, bool keep_aspect_ratio, QString &file_path, int color) {
|
||||
|
||||
// Transform to DXF scale.
|
||||
columns_header_height_ *= Createdxf::yScale;
|
||||
rows_height_ *= Createdxf::yScale;
|
||||
rows_header_width_ *= Createdxf::xScale;
|
||||
columns_width_ *= Createdxf::xScale;
|
||||
|
||||
// dessine la case vide qui apparait des qu'il y a un entete
|
||||
if (display_border_ &&
|
||||
(display_columns_ ||
|
||||
display_rows_)
|
||||
) {
|
||||
Createdxf::drawRectangle(
|
||||
file_path,
|
||||
double(diagram_rect_.topLeft().x()) * Createdxf::xScale,
|
||||
Createdxf::sheetHeight - double(diagram_rect_.topLeft().y()) * Createdxf::yScale - columns_header_height_,
|
||||
rows_header_width_,
|
||||
columns_header_height_,
|
||||
color
|
||||
);
|
||||
}
|
||||
|
||||
// dessine la numerotation des colonnes
|
||||
if (display_border_ &&
|
||||
display_columns_) {
|
||||
for (int i = 1 ; i <= columns_count_ ; ++ i) {
|
||||
double xCoord = diagram_rect_.topLeft().x() +
|
||||
(rows_header_width_ + ((i - 1) *
|
||||
columns_width_));
|
||||
double yCoord = Createdxf::sheetHeight - diagram_rect_.topLeft().y() - columns_header_height_;
|
||||
double recWidth = columns_width_;
|
||||
double recHeight = columns_header_height_;
|
||||
Createdxf::drawRectangle(file_path, xCoord, yCoord, recWidth, recHeight, color);
|
||||
Createdxf::drawTextAligned(file_path, QString::number(i), xCoord,
|
||||
yCoord + recHeight*0.5, recHeight*0.7, 0, 0, 1, 2, xCoord+recWidth/2, color, 0);
|
||||
}
|
||||
}
|
||||
|
||||
// dessine la numerotation des lignes
|
||||
|
||||
if (display_border_ && display_rows_) {
|
||||
QString row_string("A");
|
||||
for (int i = 1 ; i <= rows_count_ ; ++ i) {
|
||||
double xCoord = diagram_rect_.topLeft().x() * Createdxf::xScale;
|
||||
double yCoord = Createdxf::sheetHeight - diagram_rect_.topLeft().y()*Createdxf::yScale
|
||||
- (columns_header_height_ + ((i - 1) * rows_height_))
|
||||
- rows_height_;
|
||||
double recWidth = rows_header_width_;
|
||||
double recHeight = rows_height_;
|
||||
Createdxf::drawRectangle(file_path, xCoord, yCoord, recWidth, recHeight, color);
|
||||
Createdxf::drawTextAligned(file_path, row_string, xCoord,
|
||||
yCoord + recHeight*0.5, recWidth*0.7, 0, 0, 1, 2, xCoord+recWidth/2, color, 0);
|
||||
row_string = incrementLetters(row_string);
|
||||
}
|
||||
}
|
||||
|
||||
// render the titleblock, using the TitleBlockTemplate object
|
||||
if (display_titleblock_) {
|
||||
//qp -> translate(titleblock_rect_.topLeft());
|
||||
titleblock_template_renderer_ -> renderDxf(titleblock_rect_, titleblock_rect_.width(), file_path, color);
|
||||
//qp -> translate(-titleblock_rect_.topLeft());
|
||||
}
|
||||
|
||||
// Transform back to QET scale
|
||||
columns_header_height_ /= Createdxf::yScale;
|
||||
rows_height_ /= Createdxf::yScale;
|
||||
rows_header_width_ /= Createdxf::xScale;
|
||||
columns_width_ /= Createdxf::xScale;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Ajoute une colonne.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user