diff --git a/elementperso.cpp b/elementperso.cpp index 8bacedec3..73478786c 100644 --- a/elementperso.cpp +++ b/elementperso.cpp @@ -147,6 +147,7 @@ bool ElementPerso::parseElement(QDomElement &e, QPainter &qp, Schema *s) { else if (e.tagName() == "ligne") return(parseLigne(e, qp)); else if (e.tagName() == "ellipse") return(parseEllipse(e, qp)); else if (e.tagName() == "cercle") return(parseCercle(e, qp)); + else if (e.tagName() == "arc") return(parseArc(e, qp)); else if (e.tagName() == "polygone") return(parsePolygone(e, qp)); else return(true); // on n'est pas chiant, on ignore l'element inconnu } @@ -192,6 +193,23 @@ bool ElementPerso::parseEllipse(QDomElement &e, QPainter &qp) { return(true); } +bool ElementPerso::parseArc(QDomElement &e, QPainter &qp) { + // verifie la presence des attributs obligatoires + double arc_x, arc_y, arc_l, arc_h, arc_s, arc_a; + if (!attributeIsAReal(e, QString("x"), &arc_x)) return(false); + if (!attributeIsAReal(e, QString("y"), &arc_y)) return(false); + if (!attributeIsAReal(e, QString("largeur"), &arc_l)) return(false); + if (!attributeIsAReal(e, QString("hauteur"), &arc_h)) return(false); + if (!attributeIsAReal(e, QString("start"), &arc_s)) return(false); + if (!attributeIsAReal(e, QString("angle"), &arc_a)) return(false); + + qp.save(); + setPainterStyle(e, qp); + qp.drawArc(QRectF(arc_x, arc_y, arc_l, arc_h), (int)(arc_s * 16), (int)(arc_a * 16)); + qp.restore(); + return(true); +} + bool ElementPerso::parsePolygone(QDomElement &e, QPainter &qp) { int i = 1; while(true) { diff --git a/elementperso.h b/elementperso.h index 4e2fea502..80860712c 100644 --- a/elementperso.h +++ b/elementperso.h @@ -22,6 +22,7 @@ bool parseLigne(QDomElement &, QPainter &); bool parseEllipse(QDomElement &, QPainter &); bool parseCercle(QDomElement &, QPainter &); + bool parseArc(QDomElement &, QPainter &); bool parsePolygone(QDomElement &, QPainter &); bool parseBorne(QDomElement &, Schema *); void setQPainterAntiAliasing(QPainter &, bool);