void RExporter::exportSplineSegment(const RSpline& spline) { RPainterPath pp; pp.setPen(currentPen); pp.setInheritPen(true); pp.addSpline(spline); exportPainterPaths(QList<RPainterPath>() << pp); }
void RExporter::exportSpline(const RSpline& spline, double offset) { RLinetypePattern p = getLinetypePattern(); bool continuous = false; if (getEntity() == NULL || !p.isValid() || p.getNumDashes() == 1 || draftMode || screenBasedLinetypes) { continuous = true; } if (!continuous) { p.scale(getPatternFactor()); if (RMath::isNaN(offset)) { double length = spline.getLength(); offset = getPatternOffset(length, p); } exportExplodable(spline, offset); } else { // version <= 3.0.0 was (line interpolation): //exportExplodable(spline, offset); // performance improvement (using real splines): RPainterPath pp; pp.setPen(QPen(Qt::SolidLine)); pp.addSpline(spline); exportPainterPaths(QList<RPainterPath>() << pp); } /* RLinetypePattern p = getLinetypePattern(); p.scale(getPatternFactor()); if (RMath::isNaN(offset)) { double length = spline.getLength(); offset = getPatternOffset(length, p); } double currentOffset = offset; QList<QSharedPointer<RShape> > sub = spline.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(), currentOffset); currentOffset -= line->getLength(); } QSharedPointer<RArc> arc = (*it).dynamicCast<RArc>(); if (!arc.isNull()) { exportArc(*arc.data(), currentOffset); currentOffset -= arc->getLength(); } } */ }
/** * Updates the internal bounding box. */ void RSpline::updateBoundingBox() const { //getExploded(); RPainterPath pp; pp.addSpline(*this); boundingBox = pp.getBoundingBox(); }
void RExporter::exportSpline(const RSpline& spline, double offset) { RLinetypePattern p = getLinetypePattern(); bool continuous = false; if (getEntity() == NULL || !p.isValid() || p.getNumDashes() <= 1 || draftMode || screenBasedLinetypes || twoColorSelectedMode) { continuous = true; } p.scale(getLineTypePatternScale(p)); double patternLength = p.getPatternLength(); if (patternLength<RS::PointTolerance || spline.getLength() / patternLength > RSettings::getDashThreshold()) { continuous = true; } if (!continuous) { if (getEntity()!=NULL && (getEntity()->getType()!=RS::EntitySpline || RSpline::hasProxy())) { // we have a spline proxy: RShapesExporter(*this, QList<QSharedPointer<RShape> >() << QSharedPointer<RShape>(spline.clone()), offset); } else { // fallback if we don't have a spline proxy: p.scale(getLineTypePatternScale(p)); if (RMath::isNaN(offset)) { double length = spline.getLength(); offset = p.getPatternOffset(length); } exportExplodable(spline, offset); } } else { // version <= 3.0.0 was (line interpolation): //exportExplodable(spline, offset); // performance improvement (using real splines): RPainterPath pp; pp.setPen(currentPen); pp.setInheritPen(true); pp.addSpline(spline); exportPainterPaths(QList<RPainterPath>() << pp); } /* RLinetypePattern p = getLinetypePattern(); p.scale(getLineTypePatternScale(p)); if (RMath::isNaN(offset)) { double length = spline.getLength(); offset = p.getPatternOffset(length); } double currentOffset = offset; QList<QSharedPointer<RShape> > sub = spline.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(), currentOffset); currentOffset -= line->getLength(); } QSharedPointer<RArc> arc = (*it).dynamicCast<RArc>(); if (!arc.isNull()) { exportArc(*arc.data(), currentOffset); currentOffset -= arc->getLength(); } } */ }