コード例 #1
0
ファイル: RGraphicsSceneQt.cpp プロジェクト: gonboy/qcad
void RGraphicsSceneQt::exportRay(const RRay& ray) {
    bool created = beginPath();

    Q_ASSERT(currentPainterPath.isValid());

    // find largest view box over all attached views:
    RBox box;
    QList<RGraphicsView*>::iterator it;
    for (it=views.begin(); it!=views.end(); it++) {
        RBox b = (*it)->getBox();
        box.growToIncludeBox(b);
    }

    // trim line to view box:
    RLine clippedLine = ray.getClippedLine(box);

    double offs = clippedLine.getStartPoint().getDistanceTo(ray.getBasePoint());
    if (RMath::isSameDirection(ray.getBasePoint().getAngleTo(clippedLine.getStartPoint()), ray.getDirection1())) {
        offs *= -1;
    }

    exportLine(clippedLine, offs);

    currentPainterPath.setAlwaysRegen(true);

    if (created) {
        endPath();
    }
}
コード例 #2
0
ファイル: RRayEntity.cpp プロジェクト: ppiecuch/qcad
void RRayEntity::setShape(const RRay& r) {
    data.setBasePoint(r.getBasePoint());
    data.setSecondPoint(r.getSecondPoint());
}