@ -43,11 +43,11 @@ static bool isLeftOfVector(const NormalizedPoint &a, const NormalizedPoint &b, c
*
* Does piecewise comparison and selects the distance to the closest segment
*/
static double distanceSqr ( double x , double y , double xScale , double yScale , const QLinkedLi st < NormalizedPoint > & path )
static double distanceSqr ( double x , double y , double xScale , double yScale , const QList < NormalizedPoint > & path )
{
double distance = DBL_MAX ;
double thisDistance ;
QLinkedLi st < NormalizedPoint > : : const_iterator i = path . constBegin ( ) ;
QList < NormalizedPoint > : : const_iterator i = path . constBegin ( ) ;
NormalizedPoint lastPoint = * i ;
for ( + + i ; i ! = path . constEnd ( ) ; + + i ) {
@ -1414,8 +1414,8 @@ public:
void setAnnotationProperties ( const QDomNode & node ) override ;
AnnotationPrivate * getNewAnnotationPrivate ( ) override ;
QLinkedLi st < NormalizedPoint > m_linePoints ;
QLinkedLi st < NormalizedPoint > m_transformedLinePoints ;
QList < NormalizedPoint > m_linePoints ;
QList < NormalizedPoint > m_transformedLinePoints ;
LineAnnotation : : TermStyle m_lineStartStyle ;
LineAnnotation : : TermStyle m_lineEndStyle ;
bool m_lineClosed : 1 ;
@ -1440,19 +1440,19 @@ LineAnnotation::~LineAnnotation()
{
}
void LineAnnotation : : setLinePoints ( const QLinkedLi st < NormalizedPoint > & points )
void LineAnnotation : : setLinePoints ( const QList < NormalizedPoint > & points )
{
Q_D ( LineAnnotation ) ;
d - > m_linePoints = points ;
}
QLinkedLi st < NormalizedPoint > LineAnnotation : : linePoints ( ) const
QList < NormalizedPoint > LineAnnotation : : linePoints ( ) const
{
Q_D ( const LineAnnotation ) ;
return d - > m_linePoints ;
}
QLinkedLi st < NormalizedPoint > LineAnnotation : : transformedLinePoints ( ) const
QList < NormalizedPoint > LineAnnotation : : transformedLinePoints ( ) const
{
Q_D ( const LineAnnotation ) ;
return d - > m_transformedLinePoints ;
@ -1598,7 +1598,7 @@ void LineAnnotation::store(QDomNode &node, QDomDocument &document) const
// append the list of points
int points = d - > m_linePoints . count ( ) ;
if ( points > 1 ) {
QLinkedLi st < NormalizedPoint > : : const_iterator it = d - > m_linePoints . begin ( ) , end = d - > m_linePoints . end ( ) ;
QList < NormalizedPoint > : : const_iterator it = d - > m_linePoints . begin ( ) , end = d - > m_linePoints . end ( ) ;
while ( it ! = end ) {
const NormalizedPoint & p = * it ;
QDomElement pElement = document . createElement ( QStringLiteral ( " point " ) ) ;
@ -1614,7 +1614,7 @@ void LineAnnotationPrivate::transform(const QTransform &matrix)
{
AnnotationPrivate : : transform ( matrix ) ;
QMutableLinkedLi stIterator < NormalizedPoint > it ( m_transformedLinePoints ) ;
QMutableListIterator < NormalizedPoint > it ( m_transformedLinePoints ) ;
while ( it . hasNext ( ) ) {
it . next ( ) . transform ( matrix ) ;
}
@ -1624,7 +1624,7 @@ void LineAnnotationPrivate::baseTransform(const QTransform &matrix)
{
AnnotationPrivate : : baseTransform ( matrix ) ;
QMutableLinkedLi stIterator < NormalizedPoint > it ( m_linePoints ) ;
QMutableListIterator < NormalizedPoint > it ( m_linePoints ) ;
while ( it . hasNext ( ) ) {
it . next ( ) . transform ( matrix ) ;
}
@ -1641,7 +1641,7 @@ void LineAnnotationPrivate::translate(const NormalizedPoint &coord)
{
AnnotationPrivate : : translate ( coord ) ;
QMutableLinkedLi stIterator < NormalizedPoint > it ( m_linePoints ) ;
QMutableListIterator < NormalizedPoint > it ( m_linePoints ) ;
while ( it . hasNext ( ) ) {
NormalizedPoint & p = it . next ( ) ;
p . x = p . x + coord . x ;
@ -1718,7 +1718,7 @@ AnnotationPrivate *LineAnnotationPrivate::getNewAnnotationPrivate()
double LineAnnotationPrivate : : distanceSqr ( double x , double y , double xScale , double yScale ) const
{
QLinkedLi st < NormalizedPoint > transformedLinePoints = m_transformedLinePoints ;
QList < NormalizedPoint > transformedLinePoints = m_transformedLinePoints ;
if ( m_lineClosed ) { // Close the path
transformedLinePoints . append ( transformedLinePoints . first ( ) ) ;
@ -1907,12 +1907,11 @@ double GeomAnnotationPrivate::distanceSqr(double x, double y, double xScale, dou
return AnnotationPrivate : : distanceSqr ( x , y , xScale , yScale ) ;
}
QLinkedList < NormalizedPoint > edges ;
edges < < NormalizedPoint ( m_transformedBoundary . left , m_transformedBoundary . top ) ;
edges < < NormalizedPoint ( m_transformedBoundary . right , m_transformedBoundary . top ) ;
edges < < NormalizedPoint ( m_transformedBoundary . right , m_transformedBoundary . bottom ) ;
edges < < NormalizedPoint ( m_transformedBoundary . left , m_transformedBoundary . bottom ) ;
edges < < NormalizedPoint ( m_transformedBoundary . left , m_transformedBoundary . top ) ;
const QList < NormalizedPoint > edges = { NormalizedPoint ( m_transformedBoundary . left , m_transformedBoundary . top ) ,
NormalizedPoint ( m_transformedBoundary . right , m_transformedBoundary . top ) ,
NormalizedPoint ( m_transformedBoundary . right , m_transformedBoundary . bottom ) ,
NormalizedPoint ( m_transformedBoundary . left , m_transformedBoundary . bottom ) ,
NormalizedPoint ( m_transformedBoundary . left , m_transformedBoundary . top ) } ;
distance = : : distanceSqr ( x , y , xScale , yScale , edges ) ;
if ( m_transformedBoundary . contains ( x , y ) ) {
@ -2213,7 +2212,7 @@ double HighlightAnnotationPrivate::distanceSqr(double x, double y, double xScale
NormalizedPoint point ( x , y ) ;
double outsideDistance = DBL_MAX ;
for ( const HighlightAnnotation : : Quad & quad : m_highlightQuads ) {
QLinkedLi st < NormalizedPoint > pathPoints ;
QList < NormalizedPoint > pathPoints ;
// first, we check if the point is within the area described by the 4 quads
// this is the case, if the point is always on one side of each segments delimiting the polygon:
@ -2354,8 +2353,8 @@ public:
void setAnnotationProperties ( const QDomNode & node ) override ;
AnnotationPrivate * getNewAnnotationPrivate ( ) override ;
QList < QLinkedLi st < NormalizedPoint > > m_inkPaths ;
QList < QLinkedLi st < NormalizedPoint > > m_transformedInkPaths ;
QList < QList < NormalizedPoint > > m_inkPaths ;
QList < QList < NormalizedPoint > > m_transformedInkPaths ;
} ;
InkAnnotation : : InkAnnotation ( )
@ -2372,19 +2371,19 @@ InkAnnotation::~InkAnnotation()
{
}
void InkAnnotation : : setInkPaths ( const QList < QLinkedLi st < NormalizedPoint > > & paths )
void InkAnnotation : : setInkPaths ( const QList < QList < NormalizedPoint > > & paths )
{
Q_D ( InkAnnotation ) ;
d - > m_inkPaths = paths ;
}
QList < QLinkedLi st < NormalizedPoint > > InkAnnotation : : inkPaths ( ) const
QList < QList < NormalizedPoint > > InkAnnotation : : inkPaths ( ) const
{
Q_D ( const InkAnnotation ) ;
return d - > m_inkPaths ;
}
QList < QLinkedLi st < NormalizedPoint > > InkAnnotation : : transformedInkPaths ( ) const
QList < QList < NormalizedPoint > > InkAnnotation : : transformedInkPaths ( ) const
{
Q_D ( const InkAnnotation ) ;
return d - > m_transformedInkPaths ;
@ -2410,14 +2409,12 @@ void InkAnnotation::store(QDomNode &node, QDomDocument &document) const
return ;
}
QList < QLinkedLi st < NormalizedPoint > > : : const_iterator pIt = d - > m_inkPaths . begin ( ) , pEnd = d - > m_inkPaths . end ( ) ;
QList < QList < NormalizedPoint > > : : const_iterator pIt = d - > m_inkPaths . begin ( ) , pEnd = d - > m_inkPaths . end ( ) ;
for ( ; pIt ! = pEnd ; + + pIt ) {
QDomElement pathElement = document . createElement ( QStringLiteral ( " path " ) ) ;
inkElement . appendChild ( pathElement ) ;
const QLinkedList < NormalizedPoint > & path = * pIt ;
QLinkedList < NormalizedPoint > : : const_iterator iIt = path . begin ( ) , iEnd = path . end ( ) ;
for ( ; iIt ! = iEnd ; + + iIt ) {
const NormalizedPoint & point = * iIt ;
const QList < NormalizedPoint > & path = * pIt ;
for ( const NormalizedPoint & point : path ) {
QDomElement pointElement = document . createElement ( QStringLiteral ( " point " ) ) ;
pathElement . appendChild ( pointElement ) ;
pointElement . setAttribute ( QStringLiteral ( " x " ) , QString : : number ( point . x ) ) ;
@ -2429,7 +2426,7 @@ void InkAnnotation::store(QDomNode &node, QDomDocument &document) const
double InkAnnotationPrivate : : distanceSqr ( double x , double y , double xScale , double yScale ) const
{
double distance = DBL_MAX ;
for ( const QLinkedLi st < NormalizedPoint > & path : m_transformedInkPaths ) {
for ( const QList < NormalizedPoint > & path : m_transformedInkPaths ) {
const double thisDistance = : : distanceSqr ( x , y , xScale , yScale , path ) ;
if ( thisDistance < distance ) {
distance = thisDistance ;
@ -2443,7 +2440,7 @@ void InkAnnotationPrivate::transform(const QTransform &matrix)
AnnotationPrivate : : transform ( matrix ) ;
for ( int i = 0 ; i < m_transformedInkPaths . count ( ) ; + + i ) {
QMutableLinkedLi stIterator < NormalizedPoint > it ( m_transformedInkPaths [ i ] ) ;
QMutableListIterator < NormalizedPoint > it ( m_transformedInkPaths [ i ] ) ;
while ( it . hasNext ( ) ) {
it . next ( ) . transform ( matrix ) ;
}
@ -2455,7 +2452,7 @@ void InkAnnotationPrivate::baseTransform(const QTransform &matrix)
AnnotationPrivate : : baseTransform ( matrix ) ;
for ( int i = 0 ; i < m_inkPaths . count ( ) ; + + i ) {
QMutableLinkedLi stIterator < NormalizedPoint > it ( m_inkPaths [ i ] ) ;
QMutableListIterator < NormalizedPoint > it ( m_inkPaths [ i ] ) ;
while ( it . hasNext ( ) ) {
it . next ( ) . transform ( matrix ) ;
}
@ -2474,7 +2471,7 @@ void InkAnnotationPrivate::translate(const NormalizedPoint &coord)
AnnotationPrivate : : translate ( coord ) ;
for ( int i = 0 ; i < m_inkPaths . count ( ) ; + + i ) {
QMutableLinkedLi stIterator < NormalizedPoint > it ( m_inkPaths [ i ] ) ;
QMutableListIterator < NormalizedPoint > it ( m_inkPaths [ i ] ) ;
while ( it . hasNext ( ) ) {
NormalizedPoint & p = it . next ( ) ;
p . x = p . x + coord . x ;
@ -2508,7 +2505,7 @@ void InkAnnotationPrivate::setAnnotationProperties(const QDomNode &node)
}
// build each path parsing 'point' subnodes
QLinkedLi st < NormalizedPoint > path ;
QList < NormalizedPoint > path ;
QDomNode pointNode = pathElement . firstChild ( ) ;
while ( pointNode . isElement ( ) ) {
QDomElement pointElement = pointNode . toElement ( ) ;