mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-07 20:34:14 +02:00
83f72c95c6
Circles and arcs: drawArcEllipse() split each curve into quarters and fitted a circular ARC through a point half way between the curve and its chord, so every circle came out as a flattened diamond. A circle or an arc of one is now one exact CIRCLE or ARC. R10 has no ELLIPSE entity, so a true ellipse is a polyline through the curve, one point every 5 degrees. The export also used a different scale on each axis, which made round things oval; it now uses one, the largest that fits the sheet. Title block at the right: the DXF laid the horizontal template out in the narrow vertical strip, squashing it into the top corner. It is now laid out horizontally and turned a quarter, as draw() turns the painter. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
109 lines
2.8 KiB
C++
109 lines
2.8 KiB
C++
#include "titleblocktemplaterenderer.h"
|
|
#include "titleblocktemplate.h"
|
|
|
|
/**
|
|
@brief TitleBlockTemplateRenderer::TitleBlockTemplateRenderer
|
|
Constructor
|
|
@param parent : Parent QObject of this renderer
|
|
*/
|
|
TitleBlockTemplateRenderer::TitleBlockTemplateRenderer(QObject *parent) :
|
|
QObject(parent),
|
|
m_titleblock_template(nullptr)
|
|
{
|
|
}
|
|
|
|
/**
|
|
@brief TitleBlockTemplateRenderer::~TitleBlockTemplateRenderer
|
|
Destructor
|
|
*/
|
|
TitleBlockTemplateRenderer::~TitleBlockTemplateRenderer()
|
|
{
|
|
}
|
|
|
|
/**
|
|
@brief TitleBlockTemplateRenderer::titleBlockTemplate
|
|
@return the titleblock template used for the rendering
|
|
*/
|
|
const TitleBlockTemplate *TitleBlockTemplateRenderer::titleBlockTemplate() const
|
|
{
|
|
return(m_titleblock_template);
|
|
}
|
|
|
|
/**
|
|
@brief TitleBlockTemplateRenderer::setTitleBlockTemplate
|
|
@param titleblock_template : TitleBlock template to render.
|
|
*/
|
|
void TitleBlockTemplateRenderer::setTitleBlockTemplate(
|
|
const TitleBlockTemplate *titleblock_template) {
|
|
if (titleblock_template != m_titleblock_template) {
|
|
m_titleblock_template = titleblock_template;
|
|
}
|
|
}
|
|
|
|
/**
|
|
@brief TitleBlockTemplateRenderer::setContext
|
|
@param context : Context to use when rendering the titleblock
|
|
*/
|
|
void TitleBlockTemplateRenderer::setContext(const DiagramContext &context) {
|
|
m_context = context;
|
|
}
|
|
|
|
/**
|
|
@brief TitleBlockTemplateRenderer::context
|
|
@return the current diagram context use when render the titleblock
|
|
*/
|
|
DiagramContext TitleBlockTemplateRenderer::context() const
|
|
{
|
|
return m_context;
|
|
}
|
|
|
|
/**
|
|
@brief TitleBlockTemplateRenderer::height
|
|
@return the height of the rendered template,
|
|
or -1 if no template has been
|
|
set for this renderer.
|
|
@see TitleBlockTemplate::height()
|
|
*/
|
|
int TitleBlockTemplateRenderer::height() const
|
|
{
|
|
if (!m_titleblock_template) return(-1);
|
|
return(m_titleblock_template -> height());
|
|
}
|
|
|
|
/**
|
|
@brief TitleBlockTemplateRenderer::render
|
|
Render the titleblock.
|
|
@param provided_painter : QPainter to use to render the titleblock.
|
|
@param titleblock_width : The total width of the titleblock to render
|
|
*/
|
|
void TitleBlockTemplateRenderer::render(QPainter *provided_painter,
|
|
int titleblock_width) {
|
|
if (!m_titleblock_template) return;
|
|
|
|
m_titleblock_template -> render(*provided_painter,
|
|
m_context,
|
|
titleblock_width);
|
|
}
|
|
|
|
/**
|
|
@brief TitleBlockTemplateRenderer::renderDxf
|
|
@param title_block_rect
|
|
@param titleblock_width
|
|
@param file_path
|
|
@param color
|
|
@param dxf_transform : see TitleBlockTemplate::renderDxf()
|
|
*/
|
|
void TitleBlockTemplateRenderer::renderDxf(QRectF &title_block_rect,
|
|
int titleblock_width,
|
|
QString &file_path,
|
|
int color,
|
|
const QTransform &dxf_transform) {
|
|
if (!m_titleblock_template) return;
|
|
m_titleblock_template -> renderDxf(title_block_rect,
|
|
m_context,
|
|
titleblock_width,
|
|
file_path, color,
|
|
dxf_transform);
|
|
}
|
|
|