void RGraphicsSceneQt::exportTriangle(const RTriangle& triangle) { if (getEntity() == NULL && !exportToPreview) { qWarning("RGraphicsSceneQt::exportTriangle: entity is NULL"); return; } // add new painter path with current entity ID: RPainterPath p; p.setZLevel(0); if (draftMode || screenBasedLinetypes) { QPen draftPen = currentPen; draftPen.setWidth(0); p.setPen(draftPen); } else { p.setPen(currentPen); } p.setBrush(currentBrush); p.moveTo(triangle.corner[0]); p.lineTo(triangle.corner[1]); p.lineTo(triangle.corner[2]); p.lineTo(triangle.corner[0]); if (!exportToPreview) { addPath(getBlockRefOrEntity()->getId(), p, draftMode); } else { addToPreview(p); } }
RPainterPath RPatternLine::getPainterPath() const { RPainterPath p; RVector cursor(0,0); p.moveTo(cursor); // continuous: if (dashes.length()==0) { cursor += RVector::createPolar(10.0, angle); p.lineTo(cursor); } else { for (int i=0; i<dashes.length(); i++) { double dash = dashes[i]; cursor += RVector::createPolar(qAbs(dash), angle); if (dash<0) { p.moveTo(cursor); } else { p.lineTo(cursor); } } } return p; }
void RGraphicsSceneQt::exportImage(const RImageData& image, bool forceSelected) { if (exportToPreview) { RPainterPath path; path.setPen(currentPen); path.setBrush(Qt::NoBrush); if (forceSelected) { path.setSelected(true); } QList<RLine> edges = image.getEdges(); for (int i=0; i<=edges.count(); i++) { if (i==0) { path.moveTo(edges.at(i).getStartPoint()); } else { path.lineTo(edges.at(i % edges.count()).getStartPoint()); } } addToPreview(path); } else { if (images.contains(getBlockRefOrEntity()->getId())) { images[getBlockRefOrEntity()->getId()].append(image); } else { images.insert(getBlockRefOrEntity()->getId(), QList<RImageData>() << image); } } }