本文整理汇总了C++中QSharedPointer::GetP1方法的典型用法代码示例。如果您正苦于以下问题:C++ QSharedPointer::GetP1方法的具体用法?C++ QSharedPointer::GetP1怎么用?C++ QSharedPointer::GetP1使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSharedPointer
的用法示例。
在下文中一共展示了QSharedPointer::GetP1方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RefreshCurve
/**
* @brief RefreshCurve refresh curve on scene.
* @param curve curve.
* @param curveId curve id.
*/
void VToolCutSpline::RefreshCurve(VSimpleCurve *curve, quint32 curveId, SimpleCurvePoint curvePosition,
PathDirection direction)
{
const QSharedPointer<VSpline> spl = VAbstractTool::data.GeometricObject<VSpline>(curveId);
QPainterPath path;
path.addPath(spl->GetPath(direction));
path.setFillRule( Qt::WindingFill );
if (curvePosition == SimpleCurvePoint::FirstPoint)
{
path.translate(-spl->GetP1().toQPointF().x(), -spl->GetP1().toQPointF().y());
}
else
{
path.translate(-spl->GetP4().toQPointF().x(), -spl->GetP4().toQPointF().y());
}
curve->setPath(path);
}
示例2: Record
/**
* @brief Record return description for record
* @param tool record data
* @return description
*/
QString DialogHistory::Record(const VToolRecord &tool)
{
const QDomElement domElem = doc->elementById(QString().setNum(tool.getId()));
if (domElem.isElement() == false)
{
qDebug()<<"Can't find element by id"<<Q_FUNC_INFO;
return QString(tr("Can't create record."));
}
try
{
switch ( tool.getTypeTool() )
{
case Tool::Arrow:
Q_UNREACHABLE();
break;
case Tool::SinglePoint:
{
return QString(tr("%1 - Base point")).arg(PointName(tool.getId()));
}
case Tool::EndLine:
{
return QString(tr("%1_%2 - Line from point %1 to point %2"))
.arg(PointName(AttrUInt(domElem, VAbstractTool::AttrBasePoint)))
.arg(PointName(tool.getId()));
}
case Tool::Line:
{
return QString(tr("%1_%2 - Line from point %1 to point %2"))
.arg(PointName(AttrUInt(domElem, VAbstractTool::AttrFirstPoint)))
.arg(PointName(AttrUInt(domElem, VAbstractTool::AttrSecondPoint)));
}
case Tool::AlongLine:
{
return QString(tr("%3 - Point along line %1_%2"))
.arg(PointName(AttrUInt(domElem, VAbstractTool::AttrFirstPoint)))
.arg(PointName(AttrUInt(domElem, VAbstractTool::AttrSecondPoint)))
.arg(PointName(tool.getId()));
}
case Tool::ShoulderPoint:
{
return QString(tr("%1 - Point of shoulder")).arg(PointName(tool.getId()));
}
case Tool::Normal:
{
return QString(tr("%3 - normal to line %1_%2"))
.arg(PointName(AttrUInt(domElem, VAbstractTool::AttrFirstPoint)))
.arg(PointName(AttrUInt(domElem, VAbstractTool::AttrSecondPoint)))
.arg(PointName(tool.getId()));
}
case Tool::Bisector:
{
return QString(tr("%4 - bisector of angle %1_%2_%3"))
.arg(PointName(AttrUInt(domElem, VAbstractTool::AttrFirstPoint)))
.arg(PointName(AttrUInt(domElem, VAbstractTool::AttrSecondPoint)))
.arg(PointName(AttrUInt(domElem, VAbstractTool::AttrThirdPoint)))
.arg(PointName(tool.getId()));
}
case Tool::LineIntersect:
{
return QString(tr("%5 - intersection of lines %1_%2 and %3_%4"))
.arg(PointName(AttrUInt(domElem, VAbstractTool::AttrP1Line1)))
.arg(PointName(AttrUInt(domElem, VAbstractTool::AttrP2Line1)))
.arg(PointName(AttrUInt(domElem, VAbstractTool::AttrP1Line2)))
.arg(PointName(AttrUInt(domElem, VAbstractTool::AttrP2Line2)))
.arg(PointName(tool.getId()));
}
case Tool::Spline:
{
const QSharedPointer<VSpline> spl = data->GeometricObject<VSpline>(tool.getId());
SCASSERT(spl != nullptr);
return QString(tr("Curve %1_%2")).arg(PointName(spl->GetP1().id())).arg(PointName(spl->GetP4().id()));
}
case Tool::Arc:
{
const QSharedPointer<VArc> arc = data->GeometricObject<VArc>(tool.getId());
SCASSERT(arc != nullptr);
return QString(tr("Arc with center in point %1")).arg(PointName(arc->GetCenter().id()));
}
case Tool::SplinePath:
{
const QSharedPointer<VSplinePath> splPath = data->GeometricObject<VSplinePath>(tool.getId());
SCASSERT(splPath != nullptr);
const QVector<VSplinePoint> points = splPath->GetSplinePath();
QString record;
if (points.size() != 0 )
{
// We use only first and last point name in curve
record = QString(tr("Curve point %1")).arg(PointName(points.at(0).P().id()));
if (points.size() > 1)
{
record.append(QString("_%1").arg(PointName(points.last().P().id())));
}
}
else
{
//.........这里部分代码省略.........
示例3: AddToNewDetail
/**
* @brief AddToNewDetail create united detail adding one node per time.
* @param tool tool that make union.
* @param doc dom document container.
* @param data container with variables.
* @param newDetail united detail.
* @param det detail what we union.
* @param i index node in detail.
* @param idTool id tool union details.
* @param dx bias node x axis.
* @param dy bias node y axis.
* @param pRotate point rotation.
* @param angle angle rotation.
*/
void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer *data, VDetail &newDetail,
const VDetail &det, const int &i, const quint32 &idTool, const qreal &dx,
const qreal &dy, const quint32 &pRotate, const qreal &angle)
{
quint32 id = 0, idObject = 0;
switch (det.at(i).getTypeTool())
{
case (Tool::NodePoint):
{
if ( qFuzzyCompare(dx+1, 1) && qFuzzyCompare(dy+1, 1) && (pRotate == 0))
{
id = det.at(i).getId();
}
else
{
VPointF *point = new VPointF(*data->GeometricObject<VPointF>(det.at(i).getId()));
point->setMode(Draw::Modeling);
BiasRotatePoint(point, dx, dy, data->GeometricObject<VPointF>(pRotate)->toQPointF(),
angle);
idObject = data->AddGObject(point);
VPointF *point1 = new VPointF(*point);
point1->setMode(Draw::Modeling);
id = data->AddGObject(point1);
VNodePoint::Create(doc, data, id, idObject, Document::FullParse, Source::FromGui, idTool, tool);
}
}
break;
case (Tool::NodeArc):
{
if (qFuzzyCompare(dx+1, 1) && qFuzzyCompare(dy+1, 1) && pRotate == 0)
{
id = det.at(i).getId();
}
else
{
const QSharedPointer<VArc> arc = data->GeometricObject<VArc>(det.at(i).getId());
VPointF p1 = VPointF(arc->GetP1(), "A", 0, 0);
BiasRotatePoint(&p1, dx, dy, data->GeometricObject<VPointF>(pRotate)->toQPointF(), angle);
VPointF p2 = VPointF(arc->GetP2(), "A", 0, 0);
BiasRotatePoint(&p2, dx, dy, data->GeometricObject<VPointF>(pRotate)->toQPointF(), angle);
VPointF *center = new VPointF(arc->GetCenter());
BiasRotatePoint(center, dx, dy, data->GeometricObject<VPointF>(pRotate)->toQPointF(),
angle);
QLineF l1(center->toQPointF(), p1.toQPointF());
QLineF l2(center->toQPointF(), p2.toQPointF());
center->setMode(Draw::Modeling);
quint32 idCenter = data->AddGObject(center);
Q_UNUSED(idCenter);
VArc *arc1 = new VArc(*center, arc->GetRadius(), arc->GetFormulaRadius(),
l1.angle(), QString().setNum(l1.angle()), l2.angle(),
QString().setNum(l2.angle()));
arc1->setMode(Draw::Modeling);
idObject = data->AddGObject(arc1);
VArc *arc2 = new VArc(*arc1);
arc2->setMode(Draw::Modeling);
id = data->AddGObject(arc2);
VNodeArc::Create(doc, data, id, idObject, Document::FullParse, Source::FromGui, idTool, tool);
}
}
break;
case (Tool::NodeSpline):
{
if (qFuzzyCompare(dx+1, 1) && qFuzzyCompare(dy+1, 1) && pRotate == 0)
{
id = det.at(i).getId();
}
else
{
const QSharedPointer<VSpline> spline = data->GeometricObject<VSpline>(det.at(i).getId());
VPointF *p1 = new VPointF(spline->GetP1());
BiasRotatePoint(p1, dx, dy, data->GeometricObject<VPointF>(pRotate)->toQPointF(), angle);
//quint32 idP1 = data->AddGObject(p1);
VPointF p2 = VPointF(spline->GetP2());
BiasRotatePoint(&p2, dx, dy, data->GeometricObject<VPointF>(pRotate)->toQPointF(), angle);
VPointF p3 = VPointF(spline->GetP3());
BiasRotatePoint(&p3, dx, dy, data->GeometricObject<VPointF>(pRotate)->toQPointF(), angle);
VPointF *p4 = new VPointF(spline->GetP4());
BiasRotatePoint(p4, dx, dy, data->GeometricObject<VPointF>(pRotate)->toQPointF(), angle);
//quint32 idP4 = data->AddGObject(p4);
//.........这里部分代码省略.........
示例4: UpdatePoints
/**
* @brief UpdatePoints update data for united details.
* @param idDetail id united detail.
* @param data container with variables.
* @param det detail what we union.
* @param i index node in detail.
* @param idCount count updated or created objects.
* @param dx bias node x axis.
* @param dy bias node y axis.
* @param pRotate point rotation.
* @param angle angle rotation.
*/
void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data, const VDetail &det, const int &i,
quint32 &idCount, const qreal &dx, const qreal &dy, const quint32 &pRotate,
const qreal &angle)
{
switch (det.at(i).getTypeTool())
{
case (Tool::NodePoint):
{
if (qFuzzyCompare(dx+1, 1) == false || qFuzzyCompare(dy+1, 1) == false || pRotate != 0)
{
VPointF *point = new VPointF(*data->GeometricObject<VPointF>(det.at(i).getId()));
point->setMode(Draw::Modeling);
BiasRotatePoint(point, dx, dy, data->GeometricObject<VPointF>(pRotate)->toQPointF(), angle);
++idCount;
data->UpdateGObject(idDetail+idCount, point);
++idCount;
}
}
break;
case (Tool::NodeArc):
{
if (qFuzzyCompare(dx+1, 1) == false || qFuzzyCompare(dy+1, 1) == false || pRotate != 0)
{
const QSharedPointer<VArc> arc = data->GeometricObject<VArc>(det.at(i).getId());
VPointF p1 = VPointF(arc->GetP1());
BiasRotatePoint(&p1, dx, dy, data->GeometricObject<VPointF>(pRotate)->toQPointF(), angle);
VPointF p2 = VPointF(arc->GetP2());
BiasRotatePoint(&p2, dx, dy, data->GeometricObject<VPointF>(pRotate)->toQPointF(), angle);
VPointF *center = new VPointF(arc->GetCenter());
BiasRotatePoint(center, dx, dy, data->GeometricObject<VPointF>(pRotate)->toQPointF(),
angle);
QLineF l1(center->toQPointF(), p1.toQPointF());
QLineF l2(center->toQPointF(), p2.toQPointF());
++idCount;
center->setMode(Draw::Modeling);
data->UpdateGObject(idDetail+idCount, center);
VArc *arc1 = new VArc(*center, arc->GetRadius(), arc->GetFormulaRadius(), l1.angle(),
QString().setNum(l1.angle()), l2.angle(), QString().setNum(l2.angle()));
arc1->setMode(Draw::Modeling);
++idCount;
data->UpdateGObject(idDetail+idCount, arc1);
++idCount;
}
}
break;
case (Tool::NodeSpline):
{
if (qFuzzyCompare(dx+1, 1) == false || qFuzzyCompare(dy+1, 1) == false || pRotate != 0)
{
const QSharedPointer<VSpline> spline = data->GeometricObject<VSpline>(det.at(i).getId());
VPointF *p1 = new VPointF(spline->GetP1());
BiasRotatePoint(p1, dx, dy, data->GeometricObject<VPointF>(pRotate)->toQPointF(), angle);
++idCount;
data->UpdateGObject(idDetail+idCount, p1);
VPointF p2 = VPointF(spline->GetP2());
BiasRotatePoint(&p2, dx, dy, data->GeometricObject<VPointF>(pRotate)->toQPointF(), angle);
VPointF p3 = VPointF(spline->GetP3());
BiasRotatePoint(&p3, dx, dy, data->GeometricObject<VPointF>(pRotate)->toQPointF(), angle);
VPointF *p4 = new VPointF(spline->GetP4());
BiasRotatePoint(p4, dx, dy, data->GeometricObject<VPointF>(pRotate)->toQPointF(), angle);
++idCount;
data->UpdateGObject(idDetail+idCount, p4);
VSpline *spl = new VSpline(*p1, p2.toQPointF(), p3.toQPointF(), *p4, spline->GetKcurve(), 0,
Draw::Modeling);
++idCount;
data->UpdateGObject(idDetail+idCount, spl);
++idCount;
}
}
break;
case (Tool::NodeSplinePath):
{
if (qFuzzyCompare(dx+1, 1) == false || qFuzzyCompare(dy+1, 1) == false || pRotate != 0)
{
VSplinePath *path = new VSplinePath();
path->setMode(Draw::Modeling);
const QSharedPointer<VSplinePath> splinePath = data->GeometricObject<VSplinePath>(det.at(i).getId());
SCASSERT(splinePath != nullptr);
//.........这里部分代码省略.........
示例5: Create
/**
* @brief Create help create tool.
* @param _id tool id, 0 if tool doesn't exist yet.
* @param pointName point name.
* @param formula string with formula length first spline.
* @param splineId id spline in data container.
* @param mx label bias x axis.
* @param my label bias y axis.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
* @param parse parser file mode.
* @param typeCreation way we create this tool.
*/
VToolCutSpline* VToolCutSpline::Create(const quint32 _id, const QString &pointName, QString &formula,
const quint32 &splineId, const qreal &mx, const qreal &my,
VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation)
{
const QSharedPointer<VSpline> spl = data->GeometricObject<VSpline>(splineId);
const qreal result = CheckFormula(_id, formula, data);
QPointF spl1p2, spl1p3, spl2p2, spl2p3;
QPointF point = spl->CutSpline(qApp->toPixel(result), spl1p2, spl1p3, spl2p2, spl2p3);
quint32 id = _id;
quint32 spl1id = 0;
quint32 spl2id = 0;
if (typeCreation == Source::FromGui)
{
VPointF *p = new VPointF(point, pointName, mx, my);
id = data->AddGObject(p);
VSpline *spline1 = new VSpline(spl->GetP1(), spl1p2, spl1p3, *p, spl->GetKcurve());
spl1id = data->AddGObject(spline1);
data->AddCurveLength<VSplineLength>(spl1id, id);
VSpline *spline2 = new VSpline(*p, spl2p2, spl2p3, spl->GetP4(), spl->GetKcurve());
spl2id = data->AddGObject(spline2);
data->AddCurveLength<VSplineLength>(spl2id, id);
}
else
{
VPointF *p = new VPointF(point, pointName, mx, my);
data->UpdateGObject(id, p);
spl1id = id + 1;
spl2id = id + 2;
VSpline *spline1 = new VSpline(spl->GetP1(), spl1p2, spl1p3, *p, spl->GetKcurve());
data->UpdateGObject(spl1id, spline1);
data->AddCurveLength<VSplineLength>(spl1id, id);
VSpline *spline2 = new VSpline(*p, spl2p2, spl2p3, spl->GetP4(), spl->GetKcurve());
data->UpdateGObject(spl2id, spline2);
data->AddCurveLength<VSplineLength>(spl2id, id);
if (parse != Document::FullParse)
{
doc->UpdateToolData(id, data);
}
}
VDrawTool::AddRecord(id, Tool::CutSpline, doc);
if (parse == Document::FullParse)
{
VToolCutSpline *point = new VToolCutSpline(doc, data, id, formula, splineId, spl1id, spl2id, typeCreation);
scene->addItem(point);
connect(point, &VToolPoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolCutSpline::SetFactor);
connect(scene, &VMainGraphicsScene::DisableItem, point, &VToolPoint::Disable);
doc->AddTool(id, point);
doc->AddTool(spl1id, point);
doc->AddTool(spl2id, point);
doc->IncrementReferens(splineId);
return point;
}
return nullptr;
}