Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 18882 → Rev 18883

/trunk/Scribus/scribus/pageitem.cpp
8544,117 → 8544,6
*x2 = m_xPos + qMax(1.0, qMax(m_width, m_lineWidth));
*y2 = m_yPos + qMax(1.0, qMax(m_height, m_lineWidth));
}
QRectF totalRect = QRectF(QPointF(*x1, *y1), QPointF(*x2, *y2));
if (m_startArrowIndex != 0)
{
QTransform arrowTrans;
FPointArray arrow = m_Doc->arrowStyles().at(m_startArrowIndex-1).points.copy();
arrowTrans.translate(m_xPos, m_yPos);
arrowTrans.rotate(m_rotation);
if (itemType() == Line)
{
arrowTrans.translate(0, 0);
arrowTrans.scale(m_startArrowScale / 100.0, m_startArrowScale / 100.0);
if (NamedLStyle.isEmpty())
{
if (m_lineWidth != 0.0)
arrowTrans.scale(m_lineWidth, m_lineWidth);
}
else
{
multiLine ml = m_Doc->MLineStyles[NamedLStyle];
if (ml[ml.size()-1].Width != 0.0)
arrowTrans.scale(ml[ml.size()-1].Width, ml[ml.size()-1].Width);
}
arrowTrans.scale(-1,1);
arrow.map(arrowTrans);
}
else
{
FPoint Start = PoLine.point(0);
for (int xx = 1; xx < PoLine.size(); xx += 2)
{
FPoint Vector = PoLine.point(xx);
if ((Start.x() != Vector.x()) || (Start.y() != Vector.y()))
{
arrowTrans.translate(Start.x(), Start.y());
arrowTrans.rotate(atan2(Start.y()-Vector.y(),Start.x()-Vector.x())*(180.0/M_PI));
arrowTrans.scale(m_startArrowScale / 100.0, m_startArrowScale / 100.0);
if (NamedLStyle.isEmpty())
{
if (m_lineWidth != 0.0)
arrowTrans.scale(m_lineWidth, m_lineWidth);
}
else
{
multiLine ml = m_Doc->MLineStyles[NamedLStyle];
if (ml[ml.size()-1].Width != 0.0)
arrowTrans.scale(ml[ml.size()-1].Width, ml[ml.size()-1].Width);
}
arrow.map(arrowTrans);
break;
}
}
}
FPoint minAr = getMinClipF(&arrow);
FPoint maxAr = getMaxClipF(&arrow);
totalRect = totalRect.united(QRectF(QPointF(minAr.x(), minAr.y()), QPointF(maxAr.x(), maxAr.y())));
}
if (m_endArrowIndex != 0)
{
QTransform arrowTrans;
FPointArray arrow = m_Doc->arrowStyles().at(m_endArrowIndex-1).points.copy();
arrowTrans.translate(m_xPos, m_yPos);
arrowTrans.rotate(m_rotation);
if (itemType() == Line)
{
arrowTrans.translate(m_width, 0);
arrowTrans.scale(m_endArrowScale / 100.0, m_endArrowScale / 100.0);
if (NamedLStyle.isEmpty())
{
if (m_lineWidth != 0.0)
arrowTrans.scale(m_lineWidth, m_lineWidth);
}
else
{
multiLine ml = m_Doc->MLineStyles[NamedLStyle];
if (ml[ml.size()-1].Width != 0.0)
arrowTrans.scale(ml[ml.size()-1].Width, ml[ml.size()-1].Width);
}
arrow.map(arrowTrans);
}
else
{
FPoint End = PoLine.point(PoLine.size()-2);
for (uint xx = PoLine.size()-1; xx > 0; xx -= 2)
{
FPoint Vector = PoLine.point(xx);
if ((End.x() != Vector.x()) || (End.y() != Vector.y()))
{
arrowTrans.translate(End.x(), End.y());
arrowTrans.rotate(atan2(End.y()-Vector.y(),End.x()-Vector.x())*(180.0/M_PI));
arrowTrans.scale(m_endArrowScale / 100.0, m_endArrowScale / 100.0);
if (NamedLStyle.isEmpty())
{
if (m_lineWidth != 0.0)
arrowTrans.scale(m_lineWidth, m_lineWidth);
}
else
{
multiLine ml = m_Doc->MLineStyles[NamedLStyle];
if (ml[ml.size()-1].Width != 0.0)
arrowTrans.scale(ml[ml.size()-1].Width, ml[ml.size()-1].Width);
}
arrow.map(arrowTrans);
break;
}
}
}
FPoint minAr = getMinClipF(&arrow);
FPoint maxAr = getMaxClipF(&arrow);
totalRect = totalRect.united(QRectF(QPointF(minAr.x(), minAr.y()), QPointF(maxAr.x(), maxAr.y())));
}
totalRect.getCoords(x1, y1, x2, y2);
}
 
void PageItem::getVisualBoundingRect(double * x1, double * y1, double * x2, double * y2) const
8718,124 → 8607,6
*x2 = *x1 + qMax(visualWidth(), extraSpace);
*y2 = *y1 + qMax(visualHeight(), extraSpace);
}
QRectF totalRect(QPointF(*x1, *y1), QPointF(*x2, *y2));
if (m_startArrowIndex != 0)
{
QTransform arrowTrans;
FPointArray arrow = m_Doc->arrowStyles().at(m_startArrowIndex-1).points.copy();
arrowTrans.translate(m_xPos, m_yPos);
arrowTrans.rotate(m_rotation);
if (itemType() == Line)
{
arrowTrans.translate(0, 0);
arrowTrans.scale(m_startArrowScale / 100.0, m_startArrowScale / 100.0);
if (NamedLStyle.isEmpty())
{
if (m_lineWidth != 0.0)
arrowTrans.scale(m_lineWidth, m_lineWidth);
}
else
{
multiLine ml = m_Doc->MLineStyles[NamedLStyle];
if (ml[ml.size()-1].Width != 0.0)
arrowTrans.scale(ml[ml.size()-1].Width, ml[ml.size()-1].Width);
}
arrowTrans.scale(-1,1);
arrow.map(arrowTrans);
}
else
{
FPoint Start = PoLine.point(0);
for (int xx = 1; xx < PoLine.size(); xx += 2)
{
FPoint Vector = PoLine.point(xx);
if ((Start.x() != Vector.x()) || (Start.y() != Vector.y()))
{
arrowTrans.translate(Start.x(), Start.y());
arrowTrans.rotate(atan2(Start.y()-Vector.y(),Start.x()-Vector.x())*(180.0/M_PI));
arrowTrans.scale(m_startArrowScale / 100.0, m_startArrowScale / 100.0);
if (NamedLStyle.isEmpty())
{
if (m_lineWidth != 0.0)
arrowTrans.scale(m_lineWidth, m_lineWidth);
}
else
{
multiLine ml = m_Doc->MLineStyles[NamedLStyle];
if (ml[ml.size()-1].Width != 0.0)
arrowTrans.scale(ml[ml.size()-1].Width, ml[ml.size()-1].Width);
}
arrow.map(arrowTrans);
break;
}
}
}
FPoint minAr = getMinClipF(&arrow);
FPoint maxAr = getMaxClipF(&arrow);
totalRect = totalRect.united(QRectF(QPointF(minAr.x(), minAr.y()), QPointF(maxAr.x(), maxAr.y())));
}
if (m_endArrowIndex != 0)
{
QTransform arrowTrans;
FPointArray arrow = m_Doc->arrowStyles().at(m_endArrowIndex-1).points.copy();
arrowTrans.translate(m_xPos, m_yPos);
arrowTrans.rotate(m_rotation);
if (itemType() == Line)
{
arrowTrans.translate(m_width, 0);
arrowTrans.scale(m_endArrowScale / 100.0, m_endArrowScale / 100.0);
if (NamedLStyle.isEmpty())
{
if (m_lineWidth != 0.0)
arrowTrans.scale(m_lineWidth, m_lineWidth);
}
else
{
multiLine ml = m_Doc->MLineStyles[NamedLStyle];
if (ml[ml.size()-1].Width != 0.0)
arrowTrans.scale(ml[ml.size()-1].Width, ml[ml.size()-1].Width);
}
arrow.map(arrowTrans);
}
else
{
FPoint End = PoLine.point(PoLine.size()-2);
for (uint xx = PoLine.size()-1; xx > 0; xx -= 2)
{
FPoint Vector = PoLine.point(xx);
if ((End.x() != Vector.x()) || (End.y() != Vector.y()))
{
arrowTrans.translate(End.x(), End.y());
arrowTrans.rotate(atan2(End.y()-Vector.y(),End.x()-Vector.x())*(180.0/M_PI));
arrowTrans.scale(m_endArrowScale / 100.0, m_endArrowScale / 100.0);
if (NamedLStyle.isEmpty())
{
if (m_lineWidth != 0.0)
arrowTrans.scale(m_lineWidth, m_lineWidth);
}
else
{
multiLine ml = m_Doc->MLineStyles[NamedLStyle];
if (ml[ml.size()-1].Width != 0.0)
arrowTrans.scale(ml[ml.size()-1].Width, ml[ml.size()-1].Width);
}
arrow.map(arrowTrans);
break;
}
}
}
FPoint minAr = getMinClipF(&arrow);
FPoint maxAr = getMaxClipF(&arrow);
totalRect = totalRect.united(QRectF(QPointF(minAr.x(), minAr.y()), QPointF(maxAr.x(), maxAr.y())));
}
if (isPathText())
{
QTransform clipTrans;
clipTrans.translate(m_xPos, m_yPos);
clipTrans.rotate(m_rotation);
totalRect = totalRect.united(QRectF(clipTrans.mapRect(Clip.boundingRect())));
}
totalRect.getCoords(x1, y1, x2, y2);
}
 
double PageItem::visualXPos() const
/trunk/Scribus/scribus/pageitem.h
275,13 → 275,15
//added switch for not updating welded items - used by notes frames with automatic size adjusted
void updateClip(bool updateWelded = true);
void convertClip();
void getBoundingRect(double *x1, double *y1, double *x2, double *y2) const;
void getVisualBoundingRect(double *x1, double *y1, double *x2, double *y2) const;
QRectF getBoundingRect() const;
QRectF getCurrentBoundingRect(double moreSpace = 0.0) const;
QRectF getVisualBoundingRect() const;
 
virtual void getBoundingRect(double *x1, double *y1, double *x2, double *y2) const;
virtual void getVisualBoundingRect(double *x1, double *y1, double *x2, double *y2) const;
 
 
//>> ********* Functions related to drawing the item *********
 
 
/trunk/Scribus/scribus/pageitem_line.cpp
42,6 → 42,7
#include "undomanager.h"
#include "undostate.h"
#include "util.h"
#include "util_math.h"
 
using namespace std;
 
170,3 → 171,115
double y = m_yPos + m_width * sin(rot * M_PI / 180.0);
return QPointF(x, y);
}
 
void PageItem_Line::getBoundingRect(double *x1, double *y1, double *x2, double *y2) const
{
PageItem::getBoundingRect(x1, y1, x2, y2);
QRectF totalRect = QRectF(QPointF(*x1, *y1), QPointF(*x2, *y2));
if (m_startArrowIndex != 0)
{
QTransform arrowTrans;
FPointArray arrow = m_Doc->arrowStyles().at(m_startArrowIndex-1).points.copy();
arrowTrans.translate(m_xPos, m_yPos);
arrowTrans.rotate(m_rotation);
arrowTrans.translate(0, 0);
arrowTrans.scale(m_startArrowScale / 100.0, m_startArrowScale / 100.0);
if (NamedLStyle.isEmpty())
{
if (m_lineWidth != 0.0)
arrowTrans.scale(m_lineWidth, m_lineWidth);
}
else
{
multiLine ml = m_Doc->MLineStyles[NamedLStyle];
if (ml[ml.size()-1].Width != 0.0)
arrowTrans.scale(ml[ml.size()-1].Width, ml[ml.size()-1].Width);
}
arrowTrans.scale(-1,1);
arrow.map(arrowTrans);
FPoint minAr = getMinClipF(&arrow);
FPoint maxAr = getMaxClipF(&arrow);
totalRect = totalRect.united(QRectF(QPointF(minAr.x(), minAr.y()), QPointF(maxAr.x(), maxAr.y())));
}
if (m_endArrowIndex != 0)
{
QTransform arrowTrans;
FPointArray arrow = m_Doc->arrowStyles().at(m_endArrowIndex-1).points.copy();
arrowTrans.translate(m_xPos, m_yPos);
arrowTrans.rotate(m_rotation);
arrowTrans.translate(m_width, 0);
arrowTrans.scale(m_endArrowScale / 100.0, m_endArrowScale / 100.0);
if (NamedLStyle.isEmpty())
{
if (m_lineWidth != 0.0)
arrowTrans.scale(m_lineWidth, m_lineWidth);
}
else
{
multiLine ml = m_Doc->MLineStyles[NamedLStyle];
if (ml[ml.size()-1].Width != 0.0)
arrowTrans.scale(ml[ml.size()-1].Width, ml[ml.size()-1].Width);
}
arrow.map(arrowTrans);
FPoint minAr = getMinClipF(&arrow);
FPoint maxAr = getMaxClipF(&arrow);
totalRect = totalRect.united(QRectF(QPointF(minAr.x(), minAr.y()), QPointF(maxAr.x(), maxAr.y())));
}
totalRect.getCoords(x1, y1, x2, y2);
}
 
void PageItem_Line::getVisualBoundingRect(double * x1, double * y1, double * x2, double * y2) const
{
PageItem::getVisualBoundingRect(x1, y1, x2, y2);
QRectF totalRect(QPointF(*x1, *y1), QPointF(*x2, *y2));
if (m_startArrowIndex != 0)
{
QTransform arrowTrans;
FPointArray arrow = m_Doc->arrowStyles().at(m_startArrowIndex-1).points.copy();
arrowTrans.translate(m_xPos, m_yPos);
arrowTrans.rotate(m_rotation);
arrowTrans.translate(0, 0);
arrowTrans.scale(m_startArrowScale / 100.0, m_startArrowScale / 100.0);
if (NamedLStyle.isEmpty())
{
if (m_lineWidth != 0.0)
arrowTrans.scale(m_lineWidth, m_lineWidth);
}
else
{
multiLine ml = m_Doc->MLineStyles[NamedLStyle];
if (ml[ml.size()-1].Width != 0.0)
arrowTrans.scale(ml[ml.size()-1].Width, ml[ml.size()-1].Width);
}
arrowTrans.scale(-1,1);
arrow.map(arrowTrans);
FPoint minAr = getMinClipF(&arrow);
FPoint maxAr = getMaxClipF(&arrow);
totalRect = totalRect.united(QRectF(QPointF(minAr.x(), minAr.y()), QPointF(maxAr.x(), maxAr.y())));
}
if (m_endArrowIndex != 0)
{
QTransform arrowTrans;
FPointArray arrow = m_Doc->arrowStyles().at(m_endArrowIndex-1).points.copy();
arrowTrans.translate(m_xPos, m_yPos);
arrowTrans.rotate(m_rotation);
arrowTrans.translate(m_width, 0);
arrowTrans.scale(m_endArrowScale / 100.0, m_endArrowScale / 100.0);
if (NamedLStyle.isEmpty())
{
if (m_lineWidth != 0.0)
arrowTrans.scale(m_lineWidth, m_lineWidth);
}
else
{
multiLine ml = m_Doc->MLineStyles[NamedLStyle];
if (ml[ml.size()-1].Width != 0.0)
arrowTrans.scale(ml[ml.size()-1].Width, ml[ml.size()-1].Width);
}
arrow.map(arrowTrans);
FPoint minAr = getMinClipF(&arrow);
FPoint maxAr = getMaxClipF(&arrow);
totalRect = totalRect.united(QRectF(QPointF(minAr.x(), minAr.y()), QPointF(maxAr.x(), maxAr.y())));
}
totalRect.getCoords(x1, y1, x2, y2);
}
/trunk/Scribus/scribus/pageitem_line.h
48,6 → 48,9
 
QPointF startPoint();
QPointF endPoint();
 
virtual void getBoundingRect(double *x1, double *y1, double *x2, double *y2) const;
virtual void getVisualBoundingRect(double *x1, double *y1, double *x2, double *y2) const;
protected:
virtual void DrawObj_Item(ScPainter *p, QRectF e);
/trunk/Scribus/scribus/pageitem_pathtext.cpp
437,3 → 437,14
{
return QString();
}
 
void PageItem_PathText::getVisualBoundingRect(double * x1, double * y1, double * x2, double * y2) const
{
PageItem::getVisualBoundingRect(x1, y1, x2, y2);
QRectF totalRect(QPointF(*x1, *y1), QPointF(*x2, *y2));
QTransform clipTrans;
clipTrans.translate(m_xPos, m_yPos);
clipTrans.rotate(m_rotation);
totalRect = totalRect.united(QRectF(clipTrans.mapRect(Clip.boundingRect())));
totalRect.getCoords(x1, y1, x2, y2);
}
/trunk/Scribus/scribus/pageitem_pathtext.h
48,6 → 48,8
virtual QString infoDescription();
StoryText itemRenderText;
 
virtual void getVisualBoundingRect(double *x1, double *y1, double *x2, double *y2) const;
 
protected:
virtual void DrawObj_Item(ScPainter *p, QRectF e);
 
/trunk/Scribus/scribus/pageitem_polyline.cpp
42,6 → 42,7
#include "undomanager.h"
#include "undostate.h"
#include "util.h"
#include "util_math.h"
 
using namespace std;
 
214,3 → 215,152
return QString();
}
 
void PageItem_PolyLine::getBoundingRect(double *x1, double *y1, double *x2, double *y2) const
{
PageItem::getBoundingRect(x1, y1, x2, y2);
QRectF totalRect = QRectF(QPointF(*x1, *y1), QPointF(*x2, *y2));
if (m_startArrowIndex != 0 && PoLine.size() > 0)
{
QTransform arrowTrans;
FPointArray arrow = m_Doc->arrowStyles().at(m_startArrowIndex-1).points.copy();
arrowTrans.translate(m_xPos, m_yPos);
arrowTrans.rotate(m_rotation);
FPoint Start = PoLine.point(0);
for (int xx = 1; xx < PoLine.size(); xx += 2)
{
FPoint Vector = PoLine.point(xx);
if ((Start.x() != Vector.x()) || (Start.y() != Vector.y()))
{
arrowTrans.translate(Start.x(), Start.y());
arrowTrans.rotate(atan2(Start.y()-Vector.y(),Start.x()-Vector.x())*(180.0/M_PI));
arrowTrans.scale(m_startArrowScale / 100.0, m_startArrowScale / 100.0);
if (NamedLStyle.isEmpty())
{
if (m_lineWidth != 0.0)
arrowTrans.scale(m_lineWidth, m_lineWidth);
}
else
{
multiLine ml = m_Doc->MLineStyles[NamedLStyle];
if (ml[ml.size()-1].Width != 0.0)
arrowTrans.scale(ml[ml.size()-1].Width, ml[ml.size()-1].Width);
}
arrow.map(arrowTrans);
break;
}
}
FPoint minAr = getMinClipF(&arrow);
FPoint maxAr = getMaxClipF(&arrow);
totalRect = totalRect.united(QRectF(QPointF(minAr.x(), minAr.y()), QPointF(maxAr.x(), maxAr.y())));
}
if (m_endArrowIndex != 0 && PoLine.size() >= 2)
{
QTransform arrowTrans;
FPointArray arrow = m_Doc->arrowStyles().at(m_endArrowIndex-1).points.copy();
arrowTrans.translate(m_xPos, m_yPos);
arrowTrans.rotate(m_rotation);
FPoint End = PoLine.point(PoLine.size()-2);
for (uint xx = PoLine.size()-1; xx > 0; xx -= 2)
{
FPoint Vector = PoLine.point(xx);
if ((End.x() != Vector.x()) || (End.y() != Vector.y()))
{
arrowTrans.translate(End.x(), End.y());
arrowTrans.rotate(atan2(End.y()-Vector.y(),End.x()-Vector.x())*(180.0/M_PI));
arrowTrans.scale(m_endArrowScale / 100.0, m_endArrowScale / 100.0);
if (NamedLStyle.isEmpty())
{
if (m_lineWidth != 0.0)
arrowTrans.scale(m_lineWidth, m_lineWidth);
}
else
{
multiLine ml = m_Doc->MLineStyles[NamedLStyle];
if (ml[ml.size()-1].Width != 0.0)
arrowTrans.scale(ml[ml.size()-1].Width, ml[ml.size()-1].Width);
}
arrow.map(arrowTrans);
break;
}
}
FPoint minAr = getMinClipF(&arrow);
FPoint maxAr = getMaxClipF(&arrow);
totalRect = totalRect.united(QRectF(QPointF(minAr.x(), minAr.y()), QPointF(maxAr.x(), maxAr.y())));
}
totalRect.getCoords(x1, y1, x2, y2);
}
 
void PageItem_PolyLine::getVisualBoundingRect(double * x1, double * y1, double * x2, double * y2) const
{
PageItem::getVisualBoundingRect(x1, y1, x2, y2);
QRectF totalRect(QPointF(*x1, *y1), QPointF(*x2, *y2));
if (m_startArrowIndex != 0 && PoLine.size() > 0)
{
QTransform arrowTrans;
FPointArray arrow = m_Doc->arrowStyles().at(m_startArrowIndex-1).points.copy();
arrowTrans.translate(m_xPos, m_yPos);
arrowTrans.rotate(m_rotation);
FPoint Start = PoLine.point(0);
for (int xx = 1; xx < PoLine.size(); xx += 2)
{
FPoint Vector = PoLine.point(xx);
if ((Start.x() != Vector.x()) || (Start.y() != Vector.y()))
{
arrowTrans.translate(Start.x(), Start.y());
arrowTrans.rotate(atan2(Start.y()-Vector.y(),Start.x()-Vector.x())*(180.0/M_PI));
arrowTrans.scale(m_startArrowScale / 100.0, m_startArrowScale / 100.0);
if (NamedLStyle.isEmpty())
{
if (m_lineWidth != 0.0)
arrowTrans.scale(m_lineWidth, m_lineWidth);
}
else
{
multiLine ml = m_Doc->MLineStyles[NamedLStyle];
if (ml[ml.size()-1].Width != 0.0)
arrowTrans.scale(ml[ml.size()-1].Width, ml[ml.size()-1].Width);
}
arrow.map(arrowTrans);
break;
}
}
FPoint minAr = getMinClipF(&arrow);
FPoint maxAr = getMaxClipF(&arrow);
totalRect = totalRect.united(QRectF(QPointF(minAr.x(), minAr.y()), QPointF(maxAr.x(), maxAr.y())));
}
if (m_endArrowIndex != 0 && PoLine.size() >= 2)
{
QTransform arrowTrans;
FPointArray arrow = m_Doc->arrowStyles().at(m_endArrowIndex-1).points.copy();
arrowTrans.translate(m_xPos, m_yPos);
arrowTrans.rotate(m_rotation);
FPoint End = PoLine.point(PoLine.size()-2);
for (uint xx = PoLine.size()-1; xx > 0; xx -= 2)
{
FPoint Vector = PoLine.point(xx);
if ((End.x() != Vector.x()) || (End.y() != Vector.y()))
{
arrowTrans.translate(End.x(), End.y());
arrowTrans.rotate(atan2(End.y()-Vector.y(),End.x()-Vector.x())*(180.0/M_PI));
arrowTrans.scale(m_endArrowScale / 100.0, m_endArrowScale / 100.0);
if (NamedLStyle.isEmpty())
{
if (m_lineWidth != 0.0)
arrowTrans.scale(m_lineWidth, m_lineWidth);
}
else
{
multiLine ml = m_Doc->MLineStyles[NamedLStyle];
if (ml[ml.size()-1].Width != 0.0)
arrowTrans.scale(ml[ml.size()-1].Width, ml[ml.size()-1].Width);
}
arrow.map(arrowTrans);
break;
}
}
FPoint minAr = getMinClipF(&arrow);
FPoint maxAr = getMaxClipF(&arrow);
totalRect = totalRect.united(QRectF(QPointF(minAr.x(), minAr.y()), QPointF(maxAr.x(), maxAr.y())));
}
totalRect.getCoords(x1, y1, x2, y2);
}
/trunk/Scribus/scribus/pageitem_polyline.h
45,6 → 45,9
virtual void applicableActions(QStringList& actionList);
virtual QString infoDescription();
 
virtual void getBoundingRect(double *x1, double *y1, double *x2, double *y2) const;
virtual void getVisualBoundingRect(double *x1, double *y1, double *x2, double *y2) const;
 
protected:
virtual void DrawObj_Item(ScPainter *p, QRectF e);
 
/trunk/Scribus/scribus/pageitem_spiral.cpp
349,3 → 349,153
{
return QString();
}
 
void PageItem_Spiral::getBoundingRect(double *x1, double *y1, double *x2, double *y2) const
{
PageItem::getBoundingRect(x1, y1, x2, y2);
QRectF totalRect = QRectF(QPointF(*x1, *y1), QPointF(*x2, *y2));
if (m_startArrowIndex != 0 && PoLine.size() > 0)
{
QTransform arrowTrans;
FPointArray arrow = m_Doc->arrowStyles().at(m_startArrowIndex-1).points.copy();
arrowTrans.translate(m_xPos, m_yPos);
arrowTrans.rotate(m_rotation);
FPoint Start = PoLine.point(0);
for (int xx = 1; xx < PoLine.size(); xx += 2)
{
FPoint Vector = PoLine.point(xx);
if ((Start.x() != Vector.x()) || (Start.y() != Vector.y()))
{
arrowTrans.translate(Start.x(), Start.y());
arrowTrans.rotate(atan2(Start.y()-Vector.y(),Start.x()-Vector.x())*(180.0/M_PI));
arrowTrans.scale(m_startArrowScale / 100.0, m_startArrowScale / 100.0);
if (NamedLStyle.isEmpty())
{
if (m_lineWidth != 0.0)
arrowTrans.scale(m_lineWidth, m_lineWidth);
}
else
{
multiLine ml = m_Doc->MLineStyles[NamedLStyle];
if (ml[ml.size()-1].Width != 0.0)
arrowTrans.scale(ml[ml.size()-1].Width, ml[ml.size()-1].Width);
}
arrow.map(arrowTrans);
break;
}
}
FPoint minAr = getMinClipF(&arrow);
FPoint maxAr = getMaxClipF(&arrow);
totalRect = totalRect.united(QRectF(QPointF(minAr.x(), minAr.y()), QPointF(maxAr.x(), maxAr.y())));
}
if (m_endArrowIndex != 0 && PoLine.size() >= 2)
{
QTransform arrowTrans;
FPointArray arrow = m_Doc->arrowStyles().at(m_endArrowIndex-1).points.copy();
arrowTrans.translate(m_xPos, m_yPos);
arrowTrans.rotate(m_rotation);
FPoint End = PoLine.point(PoLine.size()-2);
for (uint xx = PoLine.size()-1; xx > 0; xx -= 2)
{
FPoint Vector = PoLine.point(xx);
if ((End.x() != Vector.x()) || (End.y() != Vector.y()))
{
arrowTrans.translate(End.x(), End.y());
arrowTrans.rotate(atan2(End.y()-Vector.y(),End.x()-Vector.x())*(180.0/M_PI));
arrowTrans.scale(m_endArrowScale / 100.0, m_endArrowScale / 100.0);
if (NamedLStyle.isEmpty())
{
if (m_lineWidth != 0.0)
arrowTrans.scale(m_lineWidth, m_lineWidth);
}
else
{
multiLine ml = m_Doc->MLineStyles[NamedLStyle];
if (ml[ml.size()-1].Width != 0.0)
arrowTrans.scale(ml[ml.size()-1].Width, ml[ml.size()-1].Width);
}
arrow.map(arrowTrans);
break;
}
}
FPoint minAr = getMinClipF(&arrow);
FPoint maxAr = getMaxClipF(&arrow);
totalRect = totalRect.united(QRectF(QPointF(minAr.x(), minAr.y()), QPointF(maxAr.x(), maxAr.y())));
}
totalRect.getCoords(x1, y1, x2, y2);
}
 
void PageItem_Spiral::getVisualBoundingRect(double * x1, double * y1, double * x2, double * y2) const
{
PageItem::getVisualBoundingRect(x1, y1, x2, y2);
QRectF totalRect(QPointF(*x1, *y1), QPointF(*x2, *y2));
if (m_startArrowIndex != 0 && PoLine.size() > 0)
{
QTransform arrowTrans;
FPointArray arrow = m_Doc->arrowStyles().at(m_startArrowIndex-1).points.copy();
arrowTrans.translate(m_xPos, m_yPos);
arrowTrans.rotate(m_rotation);
FPoint Start = PoLine.point(0);
for (int xx = 1; xx < PoLine.size(); xx += 2)
{
FPoint Vector = PoLine.point(xx);
if ((Start.x() != Vector.x()) || (Start.y() != Vector.y()))
{
arrowTrans.translate(Start.x(), Start.y());
arrowTrans.rotate(atan2(Start.y()-Vector.y(),Start.x()-Vector.x())*(180.0/M_PI));
arrowTrans.scale(m_startArrowScale / 100.0, m_startArrowScale / 100.0);
if (NamedLStyle.isEmpty())
{
if (m_lineWidth != 0.0)
arrowTrans.scale(m_lineWidth, m_lineWidth);
}
else
{
multiLine ml = m_Doc->MLineStyles[NamedLStyle];
if (ml[ml.size()-1].Width != 0.0)
arrowTrans.scale(ml[ml.size()-1].Width, ml[ml.size()-1].Width);
}
arrow.map(arrowTrans);
break;
}
}
FPoint minAr = getMinClipF(&arrow);
FPoint maxAr = getMaxClipF(&arrow);
totalRect = totalRect.united(QRectF(QPointF(minAr.x(), minAr.y()), QPointF(maxAr.x(), maxAr.y())));
}
if (m_endArrowIndex != 0 && PoLine.size() >= 2)
{
QTransform arrowTrans;
FPointArray arrow = m_Doc->arrowStyles().at(m_endArrowIndex-1).points.copy();
arrowTrans.translate(m_xPos, m_yPos);
arrowTrans.rotate(m_rotation);
FPoint End = PoLine.point(PoLine.size()-2);
for (uint xx = PoLine.size()-1; xx > 0; xx -= 2)
{
FPoint Vector = PoLine.point(xx);
if ((End.x() != Vector.x()) || (End.y() != Vector.y()))
{
arrowTrans.translate(End.x(), End.y());
arrowTrans.rotate(atan2(End.y()-Vector.y(),End.x()-Vector.x())*(180.0/M_PI));
arrowTrans.scale(m_endArrowScale / 100.0, m_endArrowScale / 100.0);
if (NamedLStyle.isEmpty())
{
if (m_lineWidth != 0.0)
arrowTrans.scale(m_lineWidth, m_lineWidth);
}
else
{
multiLine ml = m_Doc->MLineStyles[NamedLStyle];
if (ml[ml.size()-1].Width != 0.0)
arrowTrans.scale(ml[ml.size()-1].Width, ml[ml.size()-1].Width);
}
arrow.map(arrowTrans);
break;
}
}
FPoint minAr = getMinClipF(&arrow);
FPoint maxAr = getMaxClipF(&arrow);
totalRect = totalRect.united(QRectF(QPointF(minAr.x(), minAr.y()), QPointF(maxAr.x(), maxAr.y())));
}
totalRect.getCoords(x1, y1, x2, y2);
}
/trunk/Scribus/scribus/pageitem_spiral.h
49,6 → 49,9
double spiralStartAngle; //! angle where the spiral starts
double spiralEndAngle; //! angle the spiral spans
double spiralFactor; //! factor the spiral gets smaller
 
virtual void getBoundingRect(double *x1, double *y1, double *x2, double *y2) const;
virtual void getVisualBoundingRect(double *x1, double *y1, double *x2, double *y2) const;
protected:
virtual void DrawObj_Item(ScPainter *p, QRectF e);