Fix dxf export for border

This commit is contained in:
David Varley
2020-08-16 15:39:20 +10:00
committed by Laurent Trinques
parent d4ee161c07
commit ea9a230844
3 changed files with 16 additions and 14 deletions

View File

@@ -652,11 +652,11 @@ void BorderTitleBlock::drawDxf(
if (display_border_ && if (display_border_ &&
display_columns_) { display_columns_) {
for (int i = 1 ; i <= columns_count_ ; ++ i) { for (int i = 1 ; i <= columns_count_ ; ++ i) {
double xCoord = diagram_rect_.topLeft().x() + double xCoord = diagram_rect_.topLeft().x() * Createdxf::xScale +
(rows_header_width_ + ((i - 1) * (rows_header_width_ + ((i - 1) *
columns_width_)); columns_width_));
double yCoord = Createdxf::sheetHeight double yCoord = Createdxf::sheetHeight
- diagram_rect_.topLeft().y() - diagram_rect_.topLeft().y()*Createdxf::yScale
- columns_header_height_; - columns_header_height_;
double recWidth = columns_width_; double recWidth = columns_width_;
double recHeight = columns_header_height_; double recHeight = columns_header_height_;
@@ -665,27 +665,27 @@ void BorderTitleBlock::drawDxf(
if (settings.value("border-columns_0", true).toBool()){ if (settings.value("border-columns_0", true).toBool()){
Createdxf::drawTextAligned(file_path, Createdxf::drawTextAligned(file_path,
QString::number(i - 1), QString::number(i - 1),
xCoord, xCoord+recWidth/4,
yCoord + recHeight*0.5, yCoord + recHeight*0.2,
recHeight*0.7, recHeight*0.7,
0, 0,
0, 0,
1, 1,
2, 2,
xCoord+recWidth/2, xCoord+recWidth/2,
color, color,
0); 0);
}else{ }else{
Createdxf::drawTextAligned(file_path, Createdxf::drawTextAligned(file_path,
QString::number(i), QString::number(i),
xCoord, xCoord+recWidth/4,
yCoord + recHeight*0.5, yCoord + recHeight*0.2,
recHeight*0.7, recHeight*0.7,
0, 0,
0, 0,
1, 1,
2, 2,
xCoord+recWidth/2, xCoord+recWidth/2,
color, color,
0); 0);
} }
@@ -699,8 +699,8 @@ void BorderTitleBlock::drawDxf(
for (int i = 1 ; i <= rows_count_ ; ++ i) { for (int i = 1 ; i <= rows_count_ ; ++ i) {
double xCoord = diagram_rect_.topLeft().x() double xCoord = diagram_rect_.topLeft().x()
* Createdxf::xScale; * Createdxf::xScale;
double yCoord = Createdxf::sheetHeight double yCoord = Createdxf::sheetHeight
- diagram_rect_.topLeft().y() - diagram_rect_.topLeft().y()
*Createdxf::yScale *Createdxf::yScale
- ( - (
columns_header_height_ columns_header_height_
@@ -713,8 +713,8 @@ void BorderTitleBlock::drawDxf(
recWidth, recHeight, color); recWidth, recHeight, color);
Createdxf::drawTextAligned(file_path, Createdxf::drawTextAligned(file_path,
row_string, row_string,
xCoord, xCoord+recWidth*0.1,
yCoord + recHeight*0.5, yCoord + recHeight*0.4,
recWidth*0.7, recWidth*0.7,
0, 0,
0, 0,

View File

@@ -412,7 +412,9 @@ void ExportDialog::generateDxf(Diagram *diagram, int width, int height, bool kee
//Add project elements (lines, rectangles, circles, texts) to dxf file //Add project elements (lines, rectangles, circles, texts) to dxf file
if (epw -> exportProperties().draw_border) { if (epw -> exportProperties().draw_border) {
Createdxf::drawRectangle(file_path, 0, 0, double(width)*Createdxf::xScale, double(height)*Createdxf::yScale, 0); double bx0 = Diagram::margin * Createdxf::xScale;
double by0 = Diagram::margin * Createdxf::yScale;
Createdxf::drawRectangle(file_path, bx0, -by0, double(width)*Createdxf::xScale, double(height)*Createdxf::yScale, 0);
} }
diagram -> border_and_titleblock.drawDxf(width, height, keep_aspect_ratio, file_path, 0); diagram -> border_and_titleblock.drawDxf(width, height, keep_aspect_ratio, file_path, 0);

View File

@@ -1528,7 +1528,7 @@ void TitleBlockTemplate::renderDxf(QRectF &title_block_rect,
QList<int> widths = columnsWidth(titleblock_width); QList<int> widths = columnsWidth(titleblock_width);
// draw the titleblock border // draw the titleblock border
double xCoord = title_block_rect.topLeft().x(); double xCoord = title_block_rect.topLeft().x()*Createdxf::xScale;
double yCoord = double yCoord =
Createdxf::sheetHeight Createdxf::sheetHeight
- title_block_rect.bottomLeft().y() - title_block_rect.bottomLeft().y()