/** * @brief FullUpdateFromFile update tool data form file. */ void VToolAlongLine::FullUpdateFromFile() { QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { typeLine = domElement.attribute(AttrTypeLine, ""); formula = domElement.attribute(AttrLength, ""); basePointId = domElement.attribute(AttrFirstPoint, "").toUInt(); secondPointId = domElement.attribute(AttrSecondPoint, "").toUInt(); } RefreshGeometry(); }
/** * @brief VToolDetail constructor. * @param doc dom document container * @param data container with variables * @param id object id in container * @param typeCreation way we create this tool. * @param scene pointer to scene. * @param parent parent object */ VToolDetail::VToolDetail(VPattern *doc, VContainer *data, const quint32 &id, const Source &typeCreation, VMainGraphicsScene *scene, QGraphicsItem *parent) :VAbstractTool(doc, data, id), QGraphicsPathItem(parent), dialog(nullptr), sceneDetails(scene) { VDetail detail = data->GetDetail(id); for (ptrdiff_t i = 0; i< detail.CountNode(); ++i) { switch (detail.at(i).getTypeTool()) { case (Tool::NodePoint): InitTool<VNodePoint>(scene, detail.at(i)); break; case (Tool::NodeArc): InitTool<VNodeArc>(scene, detail.at(i)); break; case (Tool::NodeSpline): InitTool<VNodeSpline>(scene, detail.at(i)); break; case (Tool::NodeSplinePath): InitTool<VNodeSplinePath>(scene, detail.at(i)); break; default: qDebug()<<"Get wrong tool type. Ignore."; break; } doc->IncrementReferens(detail.at(i).getId()); } this->setFlag(QGraphicsItem::ItemIsMovable, true); this->setFlag(QGraphicsItem::ItemIsSelectable, true); RefreshGeometry(); this->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true); this->setFlag(QGraphicsItem::ItemIsFocusable, true); if (typeCreation == Source::FromGui || typeCreation == Source::FromTool) { AddToFile(); if (typeCreation != Source::FromTool) { qApp->getUndoStack()->endMacro(); } } }
/** * @brief FullUpdateFromFile update tool data form file. */ void VToolShoulderPoint::FullUpdateFromFile() { QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { typeLine = domElement.attribute(AttrTypeLine, ""); formulaLength = domElement.attribute(AttrLength, ""); basePointId = domElement.attribute(AttrP1Line, "").toUInt(); p2Line = domElement.attribute(AttrP2Line, "").toUInt(); pShoulder = domElement.attribute(AttrPShoulder, "").toUInt(); } RefreshGeometry(); if (vis != nullptr) { VisToolShoulderPoint *visual = qobject_cast<VisToolShoulderPoint *>(vis); visual->setPoint1Id(pShoulder); visual->setLineP1Id(basePointId); visual->setLineP2Id(p2Line); visual->setLength(qApp->FormulaToUser(formulaLength)); visual->setLineStyle(VAbstractTool::LineStyle(typeLine)); visual->RefreshGeometry(); } }
/** * @brief FullUpdateFromFile update tool data form file. */ void VToolDetail::FullUpdateFromFile() { RefreshGeometry(); }
/** * @brief SetFactor set current scale factor of scene. * @param factor scene scale factor. */ void VToolAlongLine::SetFactor(qreal factor) { VDrawTool::SetFactor(factor); RefreshGeometry(); }
/** * @brief SetFactor set current scale factor of scene. * @param factor scene scale factor. */ void VToolBisector::SetFactor(qreal factor) { VDrawTool::SetFactor(factor); RefreshGeometry(); }
/** * @brief SetFactor set current scale factor of scene. * @param factor scene scale factor. */ void VToolShoulderPoint::SetFactor(qreal factor) { VDrawTool::SetFactor(factor); RefreshGeometry(); }