Removed some FIXMEs. Added translations
9 QString qpointToString (const QPoint &p)
11 return "(" + QString("%1").arg(p.x()) +","+ QString ("%1").arg (p.y()) +")";
14 QString qpointfToString (const QPointF &p)
16 return "(" + QString("%1").arg(p.x()) +","+ QString ("%1").arg (p.y()) +")";
19 ostream &operator<< (ostream &stream, QPoint const &p)
21 stream << "("<<p.x()<<","<<p.y()<<")";
25 ostream &operator<< (ostream &stream, QPointF const &p)
27 stream << "("<<p.x()<<","<<p.y()<<")";
31 qreal getAngle(const QPointF &p)
33 // Calculate angle of vector to y-axis
43 return (qreal)(M_PI - atan ( (qreal)(p.x()) / (qreal)(p.y()) ) );
46 return (qreal)( 2*M_PI - atan ( (qreal)(p.x()) / (qreal)(p.y()) ) );
48 return (qreal)( - atan ( (qreal)(p.x()) / (qreal)(p.y()) ) );
52 QPointF normalise(const QPointF &p)
54 // Calculate normalised position (fixed length)
82 return QPoint ((int) (x),(int) (y));
86 // returns masked "<" ">" "&"
87 QString quotemeta(const QString &s)
90 QRegExp rx("&(?!amp;)");
91 r.replace ( rx,"&");
93 r.replace ( rx,">");
95 r.replace ( rx,"<");
97 r.replace ( rx,""");
102 qreal max(qreal a, qreal b)
109 int xmlObj::actindent=0; // make instance of actindent
118 QString xmlObj::singleElement(QString s, QString at)
120 return indent() + "<" + s +" " + at +" " + "/>\n";
124 QString xmlObj::beginElement(QString s)
126 return indent() + "<" + s + ">\n";
130 QString xmlObj::beginElement(QString s, QString at)
132 return indent() + "<" + s + " " + at + ">\n";
136 QString xmlObj::endElement(QString s)
138 return indent() + "</" + s + ">\n";
142 QString xmlObj::attribut(QString at, QString val)
144 return " " + at + "=\"" + quotemeta (val) + "\"";
147 // returns <s> val </s>
148 QString xmlObj::valueElement(QString el, QString val)
150 return indent() + "<" + el + ">" + quotemeta(val) + "</" +el + ">\n";
153 // returns <s at> val </s>
154 QString xmlObj::valueElement(QString el, QString val, QString at)
156 return indent() + "<" + el + " " + at + ">" + quotemeta(val) + "</" +el + ">\n";
159 void xmlObj::incIndent()
164 void xmlObj::decIndent()
167 if (actindent<0) actindent=0;
170 QString xmlObj::indent()
174 for (i=0; i<actindent*indentwidth; i++)