/** * Exports the given shapes as part of the geometry of the current entity. */ void RExporter::exportShape(QSharedPointer<RShape> shape) { if (shape.isNull()) { return; } QSharedPointer<RLine> line = shape.dynamicCast<RLine>(); if (!line.isNull()) { exportLine(*line.data()); } QSharedPointer<RArc> arc = shape.dynamicCast<RArc>(); if (!arc.isNull()) { exportArc(*arc.data()); } QSharedPointer<RCircle> circle = shape.dynamicCast<RCircle>(); if (!circle.isNull()) { exportCircle(*circle.data()); } QSharedPointer<RTriangle> triangle = shape.dynamicCast<RTriangle>(); if (!triangle.isNull()) { exportTriangle(*triangle.data()); } }
void RExporter::exportExplodable(const RExplodable& explodable, double offset) { QList<QSharedPointer<RShape> > sub = explodable.getExploded(); RLinetypePattern p = getLinetypePattern(); if (!p.isValid() || p.getNumDashes() <= 1 || draftMode || screenBasedLinetypes || twoColorSelectedMode) { for (int i=0; i<sub.length(); i++) { QSharedPointer<RLine> lineP = sub[i].dynamicCast<RLine>(); if (!lineP.isNull()) { exportLine(*lineP.data()); continue; } QSharedPointer<RArc> arc = sub[i].dynamicCast<RArc>(); if (!arc.isNull()) { exportArc(*arc.data()); continue; } } return; } if (getEntity()!=NULL && (getEntity()->getType()!=RS::EntitySpline || RSpline::hasProxy())) { // all explodable entities including splines if we have a spline proxy: RShapesExporter(*this, sub, offset); return; } // use alternative algorithm for splines if we don't have a spline proxy: double dist; for (int i=0; i<sub.length(); i++) { QSharedPointer<RLine> lineP = sub[i].dynamicCast<RLine>(); if (!lineP.isNull()) { RLine line = *lineP.data(); dist = exportLine(line, offset); offset -= lineP->getLength(); continue; } QSharedPointer<RArc> arc = sub[i].dynamicCast<RArc>(); if (!arc.isNull()) { exportArc(*arc.data(), offset); offset -= arc->getLength(); continue; } } }
void RExporter::exportExplodable(const RExplodable& explodable, double offset) { QList<QSharedPointer<RShape> > sub = explodable.getExploded(); QList<QSharedPointer<RShape> >::iterator it; for (it=sub.begin(); it!=sub.end(); ++it) { QSharedPointer<RLine> line = (*it).dynamicCast<RLine>(); if (!line.isNull()) { exportLine(*line.data(), offset); offset -= line->getLength(); continue; } QSharedPointer<RArc> arc = (*it).dynamicCast<RArc>(); if (!arc.isNull()) { exportArc(*arc.data(), offset); offset -= arc->getLength(); continue; } } }
void RGraphicsSceneQt::exportThickArc(const RArc& arc, double w1, double w2) { if (RPolyline::hasProxy()) { bool hasCurrentPath = false; if (currentPainterPath.isValid()) { hasCurrentPath = true; endPath(); } beginPath(); RPolyline::getPolylineProxy()->exportThickArc(currentPainterPath, arc, w1, w2); currentPainterPath.setBrush(currentPen.color()); currentPainterPath.setPen(QPen(Qt::NoPen)); endPath(); if (hasCurrentPath) { beginPath(); } } else { exportArc(arc); } }
/** * Exports a circle with the current attributes. * The default implementation calls exportArc with a full circle arc. */ void RExporter::exportCircle(const RCircle& circle) { RArc arc(circle.center, circle.radius, 0.0, 2*M_PI, false); exportArc(arc); }