Resolved issue #244. New feature: Adjust line and point thickness and label
size. --HG-- branch : develop
This commit is contained in:
parent
debcabf1a3
commit
b0f867499c
|
@ -2,6 +2,7 @@
|
||||||
- [#682] New feature. Export increments to Excel .csv.
|
- [#682] New feature. Export increments to Excel .csv.
|
||||||
- [#681] Enhance feature: Dashed line options for curves, arcs, etc.
|
- [#681] Enhance feature: Dashed line options for curves, arcs, etc.
|
||||||
- [#684] Proposal: Add option to only show outer edges on detail.
|
- [#684] Proposal: Add option to only show outer edges on detail.
|
||||||
|
- [#244] New feature: Adjust line and point thickness and label size.
|
||||||
|
|
||||||
# Version 0.5.1
|
# Version 0.5.1
|
||||||
- [#683] Tool Seam allowance's dialog is off screen on small resolutions.
|
- [#683] Tool Seam allowance's dialog is off screen on small resolutions.
|
||||||
|
|
|
@ -281,7 +281,6 @@ void MainWindow::AddPP(const QString &PPName)
|
||||||
// Show best for new PP
|
// Show best for new PP
|
||||||
VMainGraphicsView::NewSceneRect(ui->view->scene(), ui->view);
|
VMainGraphicsView::NewSceneRect(ui->view->scene(), ui->view);
|
||||||
ui->view->fitInView(doc->ActiveDrawBoundingRect(), Qt::KeepAspectRatio);
|
ui->view->fitInView(doc->ActiveDrawBoundingRect(), Qt::KeepAspectRatio);
|
||||||
ui->view->NewFactor(ui->view->transform().m11());
|
|
||||||
|
|
||||||
ui->actionNewDraw->setEnabled(true);
|
ui->actionNewDraw->setEnabled(true);
|
||||||
helpLabel->setText("");
|
helpLabel->setText("");
|
||||||
|
@ -356,7 +355,6 @@ void MainWindow::InitScenes()
|
||||||
sceneDraw->setTransform(ui->view->transform());
|
sceneDraw->setTransform(ui->view->transform());
|
||||||
sceneDetails->setTransform(ui->view->transform());
|
sceneDetails->setTransform(ui->view->transform());
|
||||||
|
|
||||||
connect(ui->view, &VMainGraphicsView::NewFactor, sceneDraw, &VMainGraphicsScene::SetFactor);
|
|
||||||
connect(ui->view, &VMainGraphicsView::MouseRelease, this, [this](){EndVisualization(true);});
|
connect(ui->view, &VMainGraphicsView::MouseRelease, this, [this](){EndVisualization(true);});
|
||||||
QSizePolicy policy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
QSizePolicy policy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||||
policy.setHorizontalStretch(12);
|
policy.setHorizontalStretch(12);
|
||||||
|
@ -2261,8 +2259,6 @@ void MainWindow::ActionDraw(bool checked)
|
||||||
|
|
||||||
currentScene = sceneDraw;
|
currentScene = sceneDraw;
|
||||||
ui->view->setScene(currentScene);
|
ui->view->setScene(currentScene);
|
||||||
connect(ui->view, &VMainGraphicsView::NewFactor, sceneDraw, &VMainGraphicsScene::SetFactor,
|
|
||||||
Qt::UniqueConnection);
|
|
||||||
RestoreCurrentScene();
|
RestoreCurrentScene();
|
||||||
|
|
||||||
mode = Draw::Calculation;
|
mode = Draw::Calculation;
|
||||||
|
@ -2336,7 +2332,6 @@ void MainWindow::ActionDetails(bool checked)
|
||||||
currentScene = sceneDetails;
|
currentScene = sceneDetails;
|
||||||
ui->view->itemClicked(nullptr);
|
ui->view->itemClicked(nullptr);
|
||||||
ui->view->setScene(currentScene);
|
ui->view->setScene(currentScene);
|
||||||
disconnect(ui->view, &VMainGraphicsView::NewFactor, sceneDraw, &VMainGraphicsScene::SetFactor);
|
|
||||||
RestoreCurrentScene();
|
RestoreCurrentScene();
|
||||||
|
|
||||||
if (mode == Draw::Calculation)
|
if (mode == Draw::Calculation)
|
||||||
|
@ -2451,7 +2446,6 @@ void MainWindow::ActionLayout(bool checked)
|
||||||
currentScene = tempSceneLayout;
|
currentScene = tempSceneLayout;
|
||||||
ui->view->itemClicked(nullptr);
|
ui->view->itemClicked(nullptr);
|
||||||
ui->view->setScene(currentScene);
|
ui->view->setScene(currentScene);
|
||||||
disconnect(ui->view, &VMainGraphicsView::NewFactor, sceneDraw, &VMainGraphicsScene::SetFactor);
|
|
||||||
|
|
||||||
if (mode == Draw::Calculation)
|
if (mode == Draw::Calculation)
|
||||||
{
|
{
|
||||||
|
@ -4587,7 +4581,6 @@ void MainWindow::ChangePP(int index, bool zoomBestFit)
|
||||||
if (zoomBestFit)
|
if (zoomBestFit)
|
||||||
{
|
{
|
||||||
ui->view->fitInView(doc->ActiveDrawBoundingRect(), Qt::KeepAspectRatio);
|
ui->view->fitInView(doc->ActiveDrawBoundingRect(), Qt::KeepAspectRatio);
|
||||||
ui->view->NewFactor(ui->view->transform().m11());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
toolOptions->itemClicked(nullptr);//hide options for tool in previous pattern piece
|
toolOptions->itemClicked(nullptr);//hide options for tool in previous pattern piece
|
||||||
|
|
|
@ -302,8 +302,7 @@ void MainWindowsNoGUI::PrintPages(QPrinter *printer)
|
||||||
|
|
||||||
painter.setFont( QFont( "Arial", 8, QFont::Normal ) );
|
painter.setFont( QFont( "Arial", 8, QFont::Normal ) );
|
||||||
painter.setRenderHint(QPainter::Antialiasing, true);
|
painter.setRenderHint(QPainter::Antialiasing, true);
|
||||||
painter.setPen(QPen(Qt::black, qApp->toPixel(WidthMainLine(*pattern->GetPatternUnit())), Qt::SolidLine,
|
painter.setPen(QPen(Qt::black, widthMainLine, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
||||||
Qt::RoundCap, Qt::RoundJoin));
|
|
||||||
painter.setBrush ( QBrush ( Qt::NoBrush ) );
|
painter.setBrush ( QBrush ( Qt::NoBrush ) );
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
@ -518,8 +517,7 @@ QIcon MainWindowsNoGUI::ScenePreview(int i) const
|
||||||
QPainter painter(&image);
|
QPainter painter(&image);
|
||||||
painter.setFont( QFont( "Arial", 8, QFont::Normal ) );
|
painter.setFont( QFont( "Arial", 8, QFont::Normal ) );
|
||||||
painter.setRenderHint(QPainter::Antialiasing, true);
|
painter.setRenderHint(QPainter::Antialiasing, true);
|
||||||
painter.setPen(QPen(Qt::black, qApp->toPixel(WidthMainLine(*pattern->GetPatternUnit())), Qt::SolidLine,
|
painter.setPen(QPen(Qt::black, widthMainLine, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
||||||
Qt::RoundCap, Qt::RoundJoin));
|
|
||||||
painter.setBrush ( QBrush ( Qt::NoBrush ) );
|
painter.setBrush ( QBrush ( Qt::NoBrush ) );
|
||||||
scenes.at(i)->render(&painter, r, r, Qt::IgnoreAspectRatio);
|
scenes.at(i)->render(&painter, r, r, Qt::IgnoreAspectRatio);
|
||||||
painter.end();
|
painter.end();
|
||||||
|
@ -599,8 +597,7 @@ void MainWindowsNoGUI::SvgFile(const QString &name, int i) const
|
||||||
painter.begin(&generator);
|
painter.begin(&generator);
|
||||||
painter.setFont( QFont( "Arial", 8, QFont::Normal ) );
|
painter.setFont( QFont( "Arial", 8, QFont::Normal ) );
|
||||||
painter.setRenderHint(QPainter::Antialiasing, true);
|
painter.setRenderHint(QPainter::Antialiasing, true);
|
||||||
painter.setPen(QPen(Qt::black, qApp->toPixel(WidthHairLine(*pattern->GetPatternUnit())), Qt::SolidLine,
|
painter.setPen(QPen(Qt::black, widthHairLine, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
||||||
Qt::RoundCap, Qt::RoundJoin));
|
|
||||||
painter.setBrush ( QBrush ( Qt::NoBrush ) );
|
painter.setBrush ( QBrush ( Qt::NoBrush ) );
|
||||||
scenes.at(i)->render(&painter, paper->rect(), paper->rect(), Qt::IgnoreAspectRatio);
|
scenes.at(i)->render(&painter, paper->rect(), paper->rect(), Qt::IgnoreAspectRatio);
|
||||||
painter.end();
|
painter.end();
|
||||||
|
@ -624,8 +621,7 @@ void MainWindowsNoGUI::PngFile(const QString &name, int i) const
|
||||||
QPainter painter(&image);
|
QPainter painter(&image);
|
||||||
painter.setFont( QFont( "Arial", 8, QFont::Normal ) );
|
painter.setFont( QFont( "Arial", 8, QFont::Normal ) );
|
||||||
painter.setRenderHint(QPainter::Antialiasing, true);
|
painter.setRenderHint(QPainter::Antialiasing, true);
|
||||||
painter.setPen(QPen(Qt::black, qApp->toPixel(WidthMainLine(*pattern->GetPatternUnit())), Qt::SolidLine,
|
painter.setPen(QPen(Qt::black, widthMainLine, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
||||||
Qt::RoundCap, Qt::RoundJoin));
|
|
||||||
painter.setBrush ( QBrush ( Qt::NoBrush ) );
|
painter.setBrush ( QBrush ( Qt::NoBrush ) );
|
||||||
scenes.at(i)->render(&painter, r, r, Qt::IgnoreAspectRatio);
|
scenes.at(i)->render(&painter, r, r, Qt::IgnoreAspectRatio);
|
||||||
image.save(name);
|
image.save(name);
|
||||||
|
@ -671,8 +667,7 @@ void MainWindowsNoGUI::PdfFile(const QString &name, int i) const
|
||||||
}
|
}
|
||||||
painter.setFont( QFont( "Arial", 8, QFont::Normal ) );
|
painter.setFont( QFont( "Arial", 8, QFont::Normal ) );
|
||||||
painter.setRenderHint(QPainter::Antialiasing, true);
|
painter.setRenderHint(QPainter::Antialiasing, true);
|
||||||
painter.setPen(QPen(Qt::black, qApp->toPixel(WidthMainLine(*pattern->GetPatternUnit())), Qt::SolidLine,
|
painter.setPen(QPen(Qt::black, widthMainLine, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
||||||
Qt::RoundCap, Qt::RoundJoin));
|
|
||||||
painter.setBrush ( QBrush ( Qt::NoBrush ) );
|
painter.setBrush ( QBrush ( Qt::NoBrush ) );
|
||||||
scenes.at(i)->render(&painter, r, r, Qt::IgnoreAspectRatio);
|
scenes.at(i)->render(&painter, r, r, Qt::IgnoreAspectRatio);
|
||||||
painter.end();
|
painter.end();
|
||||||
|
@ -827,7 +822,7 @@ void MainWindowsNoGUI::RestorePaper(int index) const
|
||||||
if (paper)
|
if (paper)
|
||||||
{
|
{
|
||||||
// Restore
|
// Restore
|
||||||
paper->setPen(QPen(Qt::black, qApp->toPixel(WidthMainLine(*pattern->GetPatternUnit()))));
|
paper->setPen(QPen(Qt::black, widthMainLine));
|
||||||
QBrush brush(Qt::gray);
|
QBrush brush(Qt::gray);
|
||||||
scenes.at(index)->setBackgroundBrush(brush);
|
scenes.at(index)->setBackgroundBrush(brush);
|
||||||
shadows.at(index)->setVisible(true);
|
shadows.at(index)->setVisible(true);
|
||||||
|
@ -1063,8 +1058,7 @@ bool MainWindowsNoGUI::IsLayoutGrayscale() const
|
||||||
QImage image(target.size(), QImage::Format_RGB32);
|
QImage image(target.size(), QImage::Format_RGB32);
|
||||||
image.fill(Qt::white);
|
image.fill(Qt::white);
|
||||||
QPainter painter(&image);
|
QPainter painter(&image);
|
||||||
painter.setPen(QPen(Qt::black, qApp->toPixel(WidthMainLine(*pattern->GetPatternUnit())), Qt::SolidLine,
|
painter.setPen(QPen(Qt::black, widthMainLine, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
||||||
Qt::RoundCap, Qt::RoundJoin));
|
|
||||||
painter.setBrush ( QBrush ( Qt::NoBrush ) );
|
painter.setBrush ( QBrush ( Qt::NoBrush ) );
|
||||||
scenes.at(i)->render(&painter, target, paper->rect(), Qt::KeepAspectRatio);
|
scenes.at(i)->render(&painter, target, paper->rect(), Qt::KeepAspectRatio);
|
||||||
painter.end();
|
painter.end();
|
||||||
|
|
|
@ -43,33 +43,7 @@
|
||||||
const QString CustomMSign = QStringLiteral("@");
|
const QString CustomMSign = QStringLiteral("@");
|
||||||
const QString CustomIncrSign = QStringLiteral("#");
|
const QString CustomIncrSign = QStringLiteral("#");
|
||||||
|
|
||||||
#define DefWidth 1.2//mm
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
qreal WidthMainLine(Unit patternUnit)
|
|
||||||
{
|
|
||||||
qreal _widthMainLine = DefWidth;
|
|
||||||
switch (patternUnit)
|
|
||||||
{
|
|
||||||
case Unit::Cm:
|
|
||||||
_widthMainLine = DefWidth/10.0;
|
|
||||||
break;
|
|
||||||
case Unit::Inch:
|
|
||||||
_widthMainLine = DefWidth/25.4;
|
|
||||||
break;
|
|
||||||
case Unit::Mm:
|
|
||||||
default:
|
|
||||||
_widthMainLine = DefWidth;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return _widthMainLine;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
qreal WidthHairLine(Unit patternUnit)
|
|
||||||
{
|
|
||||||
return WidthMainLine(patternUnit)/3.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
const QString AttrType = QStringLiteral("type");
|
const QString AttrType = QStringLiteral("type");
|
||||||
const QString AttrMx = QStringLiteral("mx");
|
const QString AttrMx = QStringLiteral("mx");
|
||||||
|
|
|
@ -63,9 +63,6 @@ static const quint32 null_id = 0;
|
||||||
# define V_NOEXCEPT_EXPR(x)
|
# define V_NOEXCEPT_EXPR(x)
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
qreal WidthMainLine(Unit patternUnit);
|
|
||||||
qreal WidthHairLine(Unit patternUnit);
|
|
||||||
|
|
||||||
extern const QString AttrType;
|
extern const QString AttrType;
|
||||||
extern const QString AttrMx;
|
extern const QString AttrMx;
|
||||||
extern const QString AttrMy;
|
extern const QString AttrMy;
|
||||||
|
|
|
@ -322,15 +322,6 @@ qreal UnitConvertor(qreal value, const Unit &from, const Unit &to)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void CheckFactor(qreal &oldFactor, const qreal &Newfactor)
|
|
||||||
{
|
|
||||||
if (Newfactor <= 2 && Newfactor >= 0.5)
|
|
||||||
{
|
|
||||||
oldFactor = Newfactor;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QStringList SupportedLocales()
|
QStringList SupportedLocales()
|
||||||
{
|
{
|
||||||
|
|
|
@ -53,7 +53,6 @@ class QMarginsF;
|
||||||
class VTranslateMeasurements;
|
class VTranslateMeasurements;
|
||||||
|
|
||||||
#define SceneSize 50000
|
#define SceneSize 50000
|
||||||
#define DefPointRadius 1.5//mm
|
|
||||||
|
|
||||||
enum class NodeDetail : char { Contour, Modeling };
|
enum class NodeDetail : char { Contour, Modeling };
|
||||||
enum class SceneObject : char { Point, Line, Spline, Arc, ElArc, SplinePath, Detail, Unknown };
|
enum class SceneObject : char { Point, Line, Spline, Arc, ElArc, SplinePath, Detail, Unknown };
|
||||||
|
@ -374,8 +373,6 @@ double FromPixel(double pix, const Unit &unit) Q_REQUIRED_RESULT;
|
||||||
|
|
||||||
qreal UnitConvertor(qreal value, const Unit &from, const Unit &to) Q_REQUIRED_RESULT;
|
qreal UnitConvertor(qreal value, const Unit &from, const Unit &to) Q_REQUIRED_RESULT;
|
||||||
|
|
||||||
void CheckFactor(qreal &oldFactor, const qreal &Newfactor);
|
|
||||||
|
|
||||||
void InitLanguages(QComboBox *combobox);
|
void InitLanguages(QComboBox *combobox);
|
||||||
QStringList SupportedLocales() Q_REQUIRED_RESULT;
|
QStringList SupportedLocales() Q_REQUIRED_RESULT;
|
||||||
|
|
||||||
|
|
|
@ -206,8 +206,7 @@ void DialogCurveIntersectAxis::ShowDialog(bool click)
|
||||||
QLineF line = QLineF(static_cast<QPointF>(*point), scene->getScenePos());
|
QLineF line = QLineF(static_cast<QPointF>(*point), scene->getScenePos());
|
||||||
|
|
||||||
//Radius of point circle, but little bigger. Need handle with hover sizes.
|
//Radius of point circle, but little bigger. Need handle with hover sizes.
|
||||||
qreal radius = ToPixel(DefPointRadius/*mm*/, Unit::Mm)*1.5;
|
if (line.length() <= defPointRadiusPixel*1.5)
|
||||||
if (line.length() <= radius)
|
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -316,8 +316,7 @@ void DialogEndLine::ShowDialog(bool click)
|
||||||
QLineF line = QLineF(static_cast<QPointF>(*point), scene->getScenePos());
|
QLineF line = QLineF(static_cast<QPointF>(*point), scene->getScenePos());
|
||||||
|
|
||||||
//Radius of point circle, but little bigger. Need handle with hover sizes.
|
//Radius of point circle, but little bigger. Need handle with hover sizes.
|
||||||
const qreal radius = ToPixel(DefPointRadius/*mm*/, Unit::Mm)*1.5;
|
if (line.length() <= defPointRadiusPixel*1.5)
|
||||||
if (line.length() <= radius)
|
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -236,8 +236,7 @@ void DialogLineIntersectAxis::ShowDialog(bool click)
|
||||||
QLineF line = QLineF(static_cast<QPointF>(*point), scene->getScenePos());
|
QLineF line = QLineF(static_cast<QPointF>(*point), scene->getScenePos());
|
||||||
|
|
||||||
//Radius of point circle, but little bigger. Need handle with hover sizes.
|
//Radius of point circle, but little bigger. Need handle with hover sizes.
|
||||||
qreal radius = ToPixel(DefPointRadius/*mm*/, Unit::Mm)*1.5;
|
if (line.length() <= defPointRadiusPixel*1.5)
|
||||||
if (line.length() <= radius)
|
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -216,8 +216,7 @@ void DialogRotation::ShowDialog(bool click)
|
||||||
const QLineF line = QLineF(static_cast<QPointF>(*point), scene->getScenePos());
|
const QLineF line = QLineF(static_cast<QPointF>(*point), scene->getScenePos());
|
||||||
|
|
||||||
//Radius of point circle, but little bigger. Need handle with hover sizes.
|
//Radius of point circle, but little bigger. Need handle with hover sizes.
|
||||||
const qreal radius = ToPixel(DefPointRadius/*mm*/, Unit::Mm)*1.5;
|
if (line.length() <= defPointRadiusPixel*1.5)
|
||||||
if (line.length() <= radius)
|
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -394,7 +394,6 @@ inline void DialogTool::AddVisualization()
|
||||||
|
|
||||||
if (not scene->items().contains(toolVis))
|
if (not scene->items().contains(toolVis))
|
||||||
{
|
{
|
||||||
connect(scene, &VMainGraphicsScene::NewFactor, toolVis, &Visualization::SetFactor);
|
|
||||||
scene->addItem(toolVis);
|
scene->addItem(toolVis);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,12 +40,6 @@ QString VAbstractOperation::getTagName() const
|
||||||
return VAbstractPattern::TagOperation;
|
return VAbstractPattern::TagOperation;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void VAbstractOperation::SetEnabled(bool enabled)
|
|
||||||
{
|
|
||||||
this->setEnabled(enabled);
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VAbstractOperation::Suffix() const
|
QString VAbstractOperation::Suffix() const
|
||||||
{
|
{
|
||||||
|
@ -144,7 +138,7 @@ void VAbstractOperation::FullUpdateFromFile()
|
||||||
{
|
{
|
||||||
VSimplePoint *item = qobject_cast<VSimplePoint *>(i.value());
|
VSimplePoint *item = qobject_cast<VSimplePoint *>(i.value());
|
||||||
SCASSERT(item != nullptr)
|
SCASSERT(item != nullptr)
|
||||||
item->RefreshGeometry(*VAbstractTool::data.GeometricObject<VPointF>(i.key()));
|
item->RefreshPointGeometry(*VAbstractTool::data.GeometricObject<VPointF>(i.key()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -156,29 +150,6 @@ void VAbstractOperation::FullUpdateFromFile()
|
||||||
SetVisualization();
|
SetVisualization();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void VAbstractOperation::SetFactor(qreal factor)
|
|
||||||
{
|
|
||||||
VDrawTool::SetFactor(factor);
|
|
||||||
QMapIterator<quint32, VAbstractSimple *> i(operatedObjects);
|
|
||||||
while (i.hasNext())
|
|
||||||
{
|
|
||||||
i.next();
|
|
||||||
if (i.value()->GetType() == GOType::Point)
|
|
||||||
{
|
|
||||||
VSimplePoint *item = qobject_cast<VSimplePoint *>(i.value());
|
|
||||||
SCASSERT(item != nullptr)
|
|
||||||
item->RefreshGeometry(*VAbstractTool::data.GeometricObject<VPointF>(i.key()));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
VSimpleCurve *item = qobject_cast<VSimpleCurve *>(i.value());
|
|
||||||
SCASSERT(item != nullptr)
|
|
||||||
item->RefreshGeometry(VAbstractTool::data.GeometricObject<VAbstractCurve>(i.key()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VAbstractOperation::AllowHover(bool enabled)
|
void VAbstractOperation::AllowHover(bool enabled)
|
||||||
{
|
{
|
||||||
|
@ -371,14 +342,25 @@ void VAbstractOperation::ToolSelectionType(const SelectionType &type)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VAbstractOperation::Disable(bool disable, const QString &namePP)
|
void VAbstractOperation::Disable(bool disable, const QString &namePP)
|
||||||
{
|
{
|
||||||
enabled = !CorrectDisable(disable, namePP);
|
const bool enabled = !CorrectDisable(disable, namePP);
|
||||||
SetEnabled(enabled);
|
setEnabled(enabled);
|
||||||
|
|
||||||
QMapIterator<quint32, VAbstractSimple *> i(operatedObjects);
|
QMapIterator<quint32, VAbstractSimple *> i(operatedObjects);
|
||||||
while (i.hasNext())
|
while (i.hasNext())
|
||||||
{
|
{
|
||||||
i.next();
|
i.next();
|
||||||
i.value()->SetEnabled(enabled);
|
if (i.value()->GetType() == GOType::Point)
|
||||||
|
{
|
||||||
|
VSimplePoint *item = qobject_cast<VSimplePoint *>(i.value());
|
||||||
|
SCASSERT(item != nullptr)
|
||||||
|
item->SetEnabled(enabled);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
VSimpleCurve *item = qobject_cast<VSimpleCurve *>(i.value());
|
||||||
|
SCASSERT(item != nullptr)
|
||||||
|
item->setEnabled(enabled);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -499,7 +481,7 @@ void VAbstractOperation::SaveSourceDestination(QDomElement &tag)
|
||||||
VSimpleCurve *VAbstractOperation::InitCurve(quint32 id, VContainer *data, GOType curveType)
|
VSimpleCurve *VAbstractOperation::InitCurve(quint32 id, VContainer *data, GOType curveType)
|
||||||
{
|
{
|
||||||
const QSharedPointer<VAbstractCurve> initCurve = data->GeometricObject<VAbstractCurve>(id);
|
const QSharedPointer<VAbstractCurve> initCurve = data->GeometricObject<VAbstractCurve>(id);
|
||||||
VSimpleCurve *curve = new VSimpleCurve(id, initCurve, *data->GetPatternUnit(), &factor);
|
VSimpleCurve *curve = new VSimpleCurve(id, initCurve);
|
||||||
curve->setParentItem(this);
|
curve->setParentItem(this);
|
||||||
curve->SetType(curveType);
|
curve->SetType(curveType);
|
||||||
connect(curve, &VSimpleCurve::Selected, this, &VAbstractOperation::ObjectSelected);
|
connect(curve, &VSimpleCurve::Selected, this, &VAbstractOperation::ObjectSelected);
|
||||||
|
@ -526,7 +508,7 @@ void VAbstractOperation::DoChangePosition(quint32 id, qreal mx, qreal my)
|
||||||
VSimplePoint *item = qobject_cast<VSimplePoint *>(operatedObjects.value(id));
|
VSimplePoint *item = qobject_cast<VSimplePoint *>(operatedObjects.value(id));
|
||||||
SCASSERT(item != nullptr)
|
SCASSERT(item != nullptr)
|
||||||
|
|
||||||
item->RefreshGeometry(*point);
|
item->RefreshPointGeometry(*point);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -593,8 +575,7 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
||||||
{
|
{
|
||||||
case GOType::Point:
|
case GOType::Point:
|
||||||
{
|
{
|
||||||
VSimplePoint *point = new VSimplePoint(object.id, QColor(baseColor),
|
VSimplePoint *point = new VSimplePoint(object.id, QColor(Qt::black));
|
||||||
*VAbstractTool::data.GetPatternUnit(), &factor);
|
|
||||||
point->setParentItem(this);
|
point->setParentItem(this);
|
||||||
point->SetType(GOType::Point);
|
point->SetType(GOType::Point);
|
||||||
connect(point, &VSimplePoint::Choosed, this, [this](quint32 id)
|
connect(point, &VSimplePoint::Choosed, this, [this](quint32 id)
|
||||||
|
@ -609,7 +590,7 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
||||||
});
|
});
|
||||||
connect(point, &VSimplePoint::Delete, this, &VAbstractOperation::DeleteFromLabel);
|
connect(point, &VSimplePoint::Delete, this, &VAbstractOperation::DeleteFromLabel);
|
||||||
connect(point, &VSimplePoint::NameChangedPosition, this, &VAbstractOperation::LabelChangePosition);
|
connect(point, &VSimplePoint::NameChangedPosition, this, &VAbstractOperation::LabelChangePosition);
|
||||||
point->RefreshGeometry(*VAbstractTool::data.GeometricObject<VPointF>(object.id));
|
point->RefreshPointGeometry(*VAbstractTool::data.GeometricObject<VPointF>(object.id));
|
||||||
operatedObjects.insert(object.id, point);
|
operatedObjects.insert(object.id, point);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,8 +67,6 @@ public:
|
||||||
|
|
||||||
virtual QString getTagName() const Q_DECL_OVERRIDE;
|
virtual QString getTagName() const Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
void SetEnabled(bool enabled);
|
|
||||||
|
|
||||||
QString Suffix() const;
|
QString Suffix() const;
|
||||||
void SetSuffix(const QString &suffix);
|
void SetSuffix(const QString &suffix);
|
||||||
|
|
||||||
|
@ -79,7 +77,6 @@ public:
|
||||||
QVector<DestinationItem> &destination);
|
QVector<DestinationItem> &destination);
|
||||||
public slots:
|
public slots:
|
||||||
virtual void FullUpdateFromFile() Q_DECL_OVERRIDE;
|
virtual void FullUpdateFromFile() Q_DECL_OVERRIDE;
|
||||||
virtual void SetFactor(qreal factor) Q_DECL_OVERRIDE;
|
|
||||||
|
|
||||||
virtual void AllowHover(bool enabled) Q_DECL_OVERRIDE;
|
virtual void AllowHover(bool enabled) Q_DECL_OVERRIDE;
|
||||||
virtual void AllowSelecting(bool enabled) Q_DECL_OVERRIDE;
|
virtual void AllowSelecting(bool enabled) Q_DECL_OVERRIDE;
|
||||||
|
|
|
@ -44,7 +44,6 @@
|
||||||
#include "../ifc/exception/vexceptionbadid.h"
|
#include "../ifc/exception/vexceptionbadid.h"
|
||||||
#include "../ifc/xml/vabstractpattern.h"
|
#include "../ifc/xml/vabstractpattern.h"
|
||||||
#include "../qmuparser/qmutokenparser.h"
|
#include "../qmuparser/qmutokenparser.h"
|
||||||
#include "../vgeometry/../ifc/ifcdef.h"
|
|
||||||
#include "../vgeometry/vgobject.h"
|
#include "../vgeometry/vgobject.h"
|
||||||
#include "../vgeometry/vpointf.h"
|
#include "../vgeometry/vpointf.h"
|
||||||
#include "../vgeometry/vspline.h"
|
#include "../vgeometry/vspline.h"
|
||||||
|
@ -56,8 +55,12 @@
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VAbstractSpline::VAbstractSpline(VAbstractPattern *doc, VContainer *data, quint32 id, QGraphicsItem *parent)
|
VAbstractSpline::VAbstractSpline(VAbstractPattern *doc, VContainer *data, quint32 id, QGraphicsItem *parent)
|
||||||
:VDrawTool(doc, data, id), QGraphicsPathItem(parent), controlPoints(QVector<VControlPointSpline *>()),
|
:VDrawTool(doc, data, id),
|
||||||
sceneType(SceneObject::Unknown), isHovered(false), detailsMode(false)
|
QGraphicsPathItem(parent),
|
||||||
|
controlPoints(),
|
||||||
|
sceneType(SceneObject::Unknown),
|
||||||
|
m_isHovered(false),
|
||||||
|
detailsMode(false)
|
||||||
{
|
{
|
||||||
InitDefShape();
|
InitDefShape();
|
||||||
setAcceptHoverEvents(true);
|
setAcceptHoverEvents(true);
|
||||||
|
@ -76,7 +79,7 @@ QPainterPath VAbstractSpline::shape() const
|
||||||
path.lineTo(points.at(i+1));
|
path.lineTo(points.at(i+1));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isHovered || detailsMode)
|
if (m_isHovered || detailsMode)
|
||||||
{
|
{
|
||||||
path.addPath(curve->GetDirectionPath());
|
path.addPath(curve->GetDirectionPath());
|
||||||
}
|
}
|
||||||
|
@ -111,7 +114,14 @@ QPainterPath VAbstractSpline::shape() const
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VAbstractSpline::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
void VAbstractSpline::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||||
{
|
{
|
||||||
if (isHovered || detailsMode)
|
const qreal width = ScaleWidth(m_isHovered ? widthMainLine : widthHairLine, SceneScale(scene()));
|
||||||
|
|
||||||
|
const QSharedPointer<VAbstractCurve> curve = VAbstractTool::data.GeometricObject<VAbstractCurve>(id);
|
||||||
|
setPen(QPen(CorrectColor(this, curve->GetColor()), width, LineStyleToPenStyle(curve->GetPenStyle()), Qt::RoundCap));
|
||||||
|
|
||||||
|
RefreshCtrlPoints();
|
||||||
|
|
||||||
|
if (m_isHovered || detailsMode)
|
||||||
{
|
{
|
||||||
painter->save();
|
painter->save();
|
||||||
|
|
||||||
|
@ -121,7 +131,6 @@ void VAbstractSpline::paint(QPainter *painter, const QStyleOptionGraphicsItem *o
|
||||||
painter->setPen(arrowPen);
|
painter->setPen(arrowPen);
|
||||||
painter->setBrush(brush());
|
painter->setBrush(brush());
|
||||||
|
|
||||||
const QSharedPointer<VAbstractCurve> curve = VAbstractTool::data.GeometricObject<VAbstractCurve>(id);
|
|
||||||
painter->drawPath(curve->GetDirectionPath());
|
painter->drawPath(curve->GetDirectionPath());
|
||||||
|
|
||||||
painter->restore();
|
painter->restore();
|
||||||
|
@ -149,12 +158,8 @@ void VAbstractSpline::FullUpdateFromFile()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VAbstractSpline::Disable(bool disable, const QString &namePP)
|
void VAbstractSpline::Disable(bool disable, const QString &namePP)
|
||||||
{
|
{
|
||||||
enabled = !CorrectDisable(disable, namePP);
|
const bool enabled = !CorrectDisable(disable, namePP);
|
||||||
this->setEnabled(enabled);
|
this->setEnabled(enabled);
|
||||||
const QSharedPointer<VAbstractCurve> curve = VAbstractTool::data.GeometricObject<VAbstractCurve>(id);
|
|
||||||
this->setPen(QPen(CorrectColor(curve->GetColor()),
|
|
||||||
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor,
|
|
||||||
LineStyleToPenStyle(curve->GetPenStyle()), Qt::RoundCap));
|
|
||||||
emit setEnabledPoint(enabled);
|
emit setEnabledPoint(enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,21 +194,11 @@ void VAbstractSpline::ShowTool(quint32 id, bool enable)
|
||||||
ShowItem(this, id, enable);
|
ShowItem(this, id, enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief SetFactor set current scale factor of scene.
|
|
||||||
* @param factor scene scale factor.
|
|
||||||
*/
|
|
||||||
void VAbstractSpline::SetFactor(qreal factor)
|
|
||||||
{
|
|
||||||
VDrawTool::SetFactor(factor);
|
|
||||||
RefreshGeometry();
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VAbstractSpline::RefreshGeometry()
|
void VAbstractSpline::RefreshGeometry()
|
||||||
{
|
{
|
||||||
InitDefShape();
|
InitDefShape();
|
||||||
|
RefreshCtrlPoints();
|
||||||
SetVisualization();
|
SetVisualization();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -215,13 +210,7 @@ void VAbstractSpline::RefreshGeometry()
|
||||||
// cppcheck-suppress unusedFunction
|
// cppcheck-suppress unusedFunction
|
||||||
void VAbstractSpline::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
void VAbstractSpline::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
||||||
{
|
{
|
||||||
Q_UNUSED(event)
|
m_isHovered = true;
|
||||||
const QSharedPointer<VAbstractCurve> curve = VAbstractTool::data.GeometricObject<VAbstractCurve>(id);
|
|
||||||
this->setPen(QPen(CorrectColor(curve->GetColor()),
|
|
||||||
qApp->toPixel(WidthMainLine(*VAbstractTool::data.GetPatternUnit()))/factor,
|
|
||||||
LineStyleToPenStyle(curve->GetPenStyle()), Qt::RoundCap));
|
|
||||||
this->setPath(curve->GetPath());
|
|
||||||
isHovered = true;
|
|
||||||
QGraphicsPathItem::hoverEnterEvent(event);
|
QGraphicsPathItem::hoverEnterEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -233,13 +222,7 @@ void VAbstractSpline::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
||||||
// cppcheck-suppress unusedFunction
|
// cppcheck-suppress unusedFunction
|
||||||
void VAbstractSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
void VAbstractSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||||
{
|
{
|
||||||
Q_UNUSED(event)
|
m_isHovered = false;
|
||||||
const QSharedPointer<VAbstractCurve> curve = VAbstractTool::data.GeometricObject<VAbstractCurve>(id);
|
|
||||||
this->setPen(QPen(CorrectColor(curve->GetColor()),
|
|
||||||
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor,
|
|
||||||
LineStyleToPenStyle(curve->GetPenStyle()), Qt::RoundCap));
|
|
||||||
this->setPath(curve->GetPath());
|
|
||||||
isHovered = false;
|
|
||||||
QGraphicsPathItem::hoverLeaveEvent(event);
|
QGraphicsPathItem::hoverLeaveEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -331,6 +314,12 @@ void VAbstractSpline::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &ob
|
||||||
doc->SetAttribute(tag, AttrPenStyle, curve->GetPenStyle());
|
doc->SetAttribute(tag, AttrPenStyle, curve->GetPenStyle());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VAbstractSpline::RefreshCtrlPoints()
|
||||||
|
{
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VSpline VAbstractSpline::CorrectedSpline(const VSpline &spline, const SplinePointPosition &position,
|
VSpline VAbstractSpline::CorrectedSpline(const VSpline &spline, const SplinePointPosition &position,
|
||||||
const QPointF &pos) const
|
const QPointF &pos) const
|
||||||
|
@ -403,9 +392,6 @@ VSpline VAbstractSpline::CorrectedSpline(const VSpline &spline, const SplinePoin
|
||||||
void VAbstractSpline::InitDefShape()
|
void VAbstractSpline::InitDefShape()
|
||||||
{
|
{
|
||||||
const QSharedPointer<VAbstractCurve> curve = VAbstractTool::data.GeometricObject<VAbstractCurve>(id);
|
const QSharedPointer<VAbstractCurve> curve = VAbstractTool::data.GeometricObject<VAbstractCurve>(id);
|
||||||
this->setPen(QPen(CorrectColor(curve->GetColor()),
|
|
||||||
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor,
|
|
||||||
LineStyleToPenStyle(curve->GetPenStyle())));
|
|
||||||
this->setPath(curve->GetPath());
|
this->setPath(curve->GetPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -418,26 +404,6 @@ void VAbstractSpline::ShowHandles(bool show)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void VAbstractSpline::setEnabled(bool enabled)
|
|
||||||
{
|
|
||||||
QGraphicsPathItem::setEnabled(enabled);
|
|
||||||
const QSharedPointer<VAbstractCurve> curve = VAbstractTool::data.GeometricObject<VAbstractCurve>(id);
|
|
||||||
|
|
||||||
if (enabled)
|
|
||||||
{
|
|
||||||
setPen(QPen(QColor(curve->GetColor()),
|
|
||||||
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor,
|
|
||||||
LineStyleToPenStyle(curve->GetPenStyle())));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
setPen(QPen(Qt::gray,
|
|
||||||
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor,
|
|
||||||
LineStyleToPenStyle(curve->GetPenStyle())));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VAbstractSpline::GetLineColor() const
|
QString VAbstractSpline::GetLineColor() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -68,8 +68,6 @@ public:
|
||||||
virtual QString getTagName() const Q_DECL_OVERRIDE;
|
virtual QString getTagName() const Q_DECL_OVERRIDE;
|
||||||
void ShowHandles(bool show);
|
void ShowHandles(bool show);
|
||||||
|
|
||||||
void setEnabled(bool enabled);
|
|
||||||
|
|
||||||
QString GetLineColor() const;
|
QString GetLineColor() const;
|
||||||
void SetLineColor(const QString &value);
|
void SetLineColor(const QString &value);
|
||||||
|
|
||||||
|
@ -85,7 +83,6 @@ public slots:
|
||||||
virtual void DetailsMode(bool mode) Q_DECL_OVERRIDE;
|
virtual void DetailsMode(bool mode) Q_DECL_OVERRIDE;
|
||||||
virtual void AllowHover(bool enabled) Q_DECL_OVERRIDE;
|
virtual void AllowHover(bool enabled) Q_DECL_OVERRIDE;
|
||||||
virtual void AllowSelecting(bool enabled) Q_DECL_OVERRIDE;
|
virtual void AllowSelecting(bool enabled) Q_DECL_OVERRIDE;
|
||||||
virtual void SetFactor(qreal factor) Q_DECL_OVERRIDE;
|
|
||||||
signals:
|
signals:
|
||||||
/**
|
/**
|
||||||
* @brief setEnabledPoint disable control points.
|
* @brief setEnabledPoint disable control points.
|
||||||
|
@ -98,7 +95,7 @@ protected:
|
||||||
*/
|
*/
|
||||||
QVector<VControlPointSpline *> controlPoints;
|
QVector<VControlPointSpline *> controlPoints;
|
||||||
SceneObject sceneType;
|
SceneObject sceneType;
|
||||||
bool isHovered;
|
bool m_isHovered;
|
||||||
bool detailsMode;
|
bool detailsMode;
|
||||||
/**
|
/**
|
||||||
* @brief RefreshGeometry refresh item on scene.
|
* @brief RefreshGeometry refresh item on scene.
|
||||||
|
@ -113,11 +110,10 @@ protected:
|
||||||
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ) Q_DECL_OVERRIDE;
|
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ) Q_DECL_OVERRIDE;
|
||||||
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;
|
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;
|
||||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
|
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
|
||||||
|
virtual void RefreshCtrlPoints();
|
||||||
|
|
||||||
VSpline CorrectedSpline(const VSpline &spline, const SplinePointPosition &position, const QPointF &pos) const;
|
VSpline CorrectedSpline(const VSpline &spline, const SplinePointPosition &position, const QPointF &pos) const;
|
||||||
|
|
||||||
void InitDefShape();
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void ShowToolVisualization(bool show);
|
void ShowToolVisualization(bool show);
|
||||||
|
|
||||||
|
@ -135,6 +131,8 @@ protected:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VAbstractSpline)
|
Q_DISABLE_COPY(VAbstractSpline)
|
||||||
|
|
||||||
|
void InitDefShape();
|
||||||
};
|
};
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -259,9 +259,6 @@ void VToolCubicBezier::SetVisualization()
|
||||||
void VToolCubicBezier::RefreshGeometry()
|
void VToolCubicBezier::RefreshGeometry()
|
||||||
{
|
{
|
||||||
const QSharedPointer<VCubicBezier> spl = VAbstractTool::data.GeometricObject<VCubicBezier>(id);
|
const QSharedPointer<VCubicBezier> spl = VAbstractTool::data.GeometricObject<VCubicBezier>(id);
|
||||||
this->setPen(QPen(CorrectColor(spl->GetColor()),
|
|
||||||
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor,
|
|
||||||
LineStyleToPenStyle(spl->GetPenStyle())));
|
|
||||||
this->setPath(spl->GetPath());
|
this->setPath(spl->GetPath());
|
||||||
|
|
||||||
SetVisualization();
|
SetVisualization();
|
||||||
|
|
|
@ -241,10 +241,6 @@ void VToolCubicBezierPath::RefreshGeometry()
|
||||||
QSharedPointer<VCubicBezierPath> splPath = VAbstractTool::data.GeometricObject<VCubicBezierPath>(id);
|
QSharedPointer<VCubicBezierPath> splPath = VAbstractTool::data.GeometricObject<VCubicBezierPath>(id);
|
||||||
setPath(splPath->GetPath());
|
setPath(splPath->GetPath());
|
||||||
|
|
||||||
this->setPen(QPen(CorrectColor(splPath->GetColor()),
|
|
||||||
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor,
|
|
||||||
LineStyleToPenStyle(splPath->GetPenStyle())));
|
|
||||||
|
|
||||||
SetVisualization();
|
SetVisualization();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,7 @@ VToolSpline::VToolSpline(VAbstractPattern *doc, VContainer *data, quint32 id, co
|
||||||
|
|
||||||
auto *controlPoint1 = new VControlPointSpline(1, SplinePointPosition::FirstPoint,
|
auto *controlPoint1 = new VControlPointSpline(1, SplinePointPosition::FirstPoint,
|
||||||
static_cast<QPointF>(spl->GetP2()),
|
static_cast<QPointF>(spl->GetP2()),
|
||||||
static_cast<QPointF>(spl->GetP1()), *data->GetPatternUnit(),
|
static_cast<QPointF>(spl->GetP1()),
|
||||||
freeAngle1, freeLength1, this);
|
freeAngle1, freeLength1, this);
|
||||||
connect(controlPoint1, &VControlPointSpline::ControlPointChangePosition, this,
|
connect(controlPoint1, &VControlPointSpline::ControlPointChangePosition, this,
|
||||||
&VToolSpline::ControlPointChangePosition);
|
&VToolSpline::ControlPointChangePosition);
|
||||||
|
@ -109,7 +109,7 @@ VToolSpline::VToolSpline(VAbstractPattern *doc, VContainer *data, quint32 id, co
|
||||||
|
|
||||||
auto *controlPoint2 = new VControlPointSpline(1, SplinePointPosition::LastPoint,
|
auto *controlPoint2 = new VControlPointSpline(1, SplinePointPosition::LastPoint,
|
||||||
static_cast<QPointF>(spl->GetP3()),
|
static_cast<QPointF>(spl->GetP3()),
|
||||||
static_cast<QPointF>(spl->GetP4()), *data->GetPatternUnit(),
|
static_cast<QPointF>(spl->GetP4()),
|
||||||
freeAngle2, freeLength2, this);
|
freeAngle2, freeLength2, this);
|
||||||
connect(controlPoint2, &VControlPointSpline::ControlPointChangePosition, this,
|
connect(controlPoint2, &VControlPointSpline::ControlPointChangePosition, this,
|
||||||
&VToolSpline::ControlPointChangePosition);
|
&VToolSpline::ControlPointChangePosition);
|
||||||
|
@ -533,10 +533,7 @@ bool VToolSpline::IsMovable() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
void VToolSpline::RefreshCtrlPoints()
|
||||||
* @brief RefreshGeometry refresh item on scene.
|
|
||||||
*/
|
|
||||||
void VToolSpline::RefreshGeometry()
|
|
||||||
{
|
{
|
||||||
// Very important to disable control points. Without it the pogram can't move the curve.
|
// Very important to disable control points. Without it the pogram can't move the curve.
|
||||||
foreach (auto *point, controlPoints)
|
foreach (auto *point, controlPoints)
|
||||||
|
@ -546,11 +543,6 @@ void VToolSpline::RefreshGeometry()
|
||||||
|
|
||||||
const auto spl = VAbstractTool::data.GeometricObject<VSpline>(id);
|
const auto spl = VAbstractTool::data.GeometricObject<VSpline>(id);
|
||||||
|
|
||||||
this->setPen(QPen(CorrectColor(spl->GetColor()),
|
|
||||||
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor,
|
|
||||||
LineStyleToPenStyle(spl->GetPenStyle())));
|
|
||||||
this->setPath(spl->GetPath());
|
|
||||||
|
|
||||||
controlPoints[0]->blockSignals(true);
|
controlPoints[0]->blockSignals(true);
|
||||||
controlPoints[1]->blockSignals(true);
|
controlPoints[1]->blockSignals(true);
|
||||||
|
|
||||||
|
@ -577,8 +569,6 @@ void VToolSpline::RefreshGeometry()
|
||||||
controlPoints[0]->blockSignals(false);
|
controlPoints[0]->blockSignals(false);
|
||||||
controlPoints[1]->blockSignals(false);
|
controlPoints[1]->blockSignals(false);
|
||||||
|
|
||||||
SetVisualization();
|
|
||||||
|
|
||||||
foreach (auto *point, controlPoints)
|
foreach (auto *point, controlPoints)
|
||||||
{
|
{
|
||||||
point->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
|
point->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
|
||||||
|
|
|
@ -86,7 +86,7 @@ protected:
|
||||||
virtual void hoverEnterEvent ( QGraphicsSceneHoverEvent * event ) Q_DECL_OVERRIDE;
|
virtual void hoverEnterEvent ( QGraphicsSceneHoverEvent * event ) Q_DECL_OVERRIDE;
|
||||||
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ) Q_DECL_OVERRIDE;
|
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ) Q_DECL_OVERRIDE;
|
||||||
virtual void SetVisualization() Q_DECL_OVERRIDE;
|
virtual void SetVisualization() Q_DECL_OVERRIDE;
|
||||||
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
virtual void RefreshCtrlPoints() Q_DECL_OVERRIDE;
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VToolSpline)
|
Q_DISABLE_COPY(VToolSpline)
|
||||||
QPointF oldPosition;
|
QPointF oldPosition;
|
||||||
|
|
|
@ -106,7 +106,7 @@ VToolSplinePath::VToolSplinePath(VAbstractPattern *doc, VContainer *data, quint3
|
||||||
|
|
||||||
auto *controlPoint = new VControlPointSpline(i, SplinePointPosition::FirstPoint,
|
auto *controlPoint = new VControlPointSpline(i, SplinePointPosition::FirstPoint,
|
||||||
static_cast<QPointF>(spl.GetP2()),
|
static_cast<QPointF>(spl.GetP2()),
|
||||||
static_cast<QPointF>(spl.GetP1()), *data->GetPatternUnit(),
|
static_cast<QPointF>(spl.GetP1()),
|
||||||
freeAngle1, freeLength1, this);
|
freeAngle1, freeLength1, this);
|
||||||
connect(controlPoint, &VControlPointSpline::ControlPointChangePosition, this,
|
connect(controlPoint, &VControlPointSpline::ControlPointChangePosition, this,
|
||||||
&VToolSplinePath::ControlPointChangePosition);
|
&VToolSplinePath::ControlPointChangePosition);
|
||||||
|
@ -118,8 +118,7 @@ VToolSplinePath::VToolSplinePath(VAbstractPattern *doc, VContainer *data, quint3
|
||||||
const bool freeLength2 = qmu::QmuTokenParser::IsSingle(spl.GetC2LengthFormula());
|
const bool freeLength2 = qmu::QmuTokenParser::IsSingle(spl.GetC2LengthFormula());
|
||||||
|
|
||||||
controlPoint = new VControlPointSpline(i, SplinePointPosition::LastPoint, static_cast<QPointF>(spl.GetP3()),
|
controlPoint = new VControlPointSpline(i, SplinePointPosition::LastPoint, static_cast<QPointF>(spl.GetP3()),
|
||||||
static_cast<QPointF>(spl.GetP4()), *data->GetPatternUnit(), freeAngle2,
|
static_cast<QPointF>(spl.GetP4()), freeAngle2, freeLength2, this);
|
||||||
freeLength2, this);
|
|
||||||
connect(controlPoint, &VControlPointSpline::ControlPointChangePosition, this,
|
connect(controlPoint, &VControlPointSpline::ControlPointChangePosition, this,
|
||||||
&VToolSplinePath::ControlPointChangePosition);
|
&VToolSplinePath::ControlPointChangePosition);
|
||||||
connect(this, &VToolSplinePath::setEnabledPoint, controlPoint, &VControlPointSpline::setEnabledPoint);
|
connect(this, &VToolSplinePath::setEnabledPoint, controlPoint, &VControlPointSpline::setEnabledPoint);
|
||||||
|
@ -661,10 +660,7 @@ bool VToolSplinePath::IsMovable(int index) const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
void VToolSplinePath::RefreshCtrlPoints()
|
||||||
* @brief RefreshGeometry refresh item on scene.
|
|
||||||
*/
|
|
||||||
void VToolSplinePath::RefreshGeometry()
|
|
||||||
{
|
{
|
||||||
// Very important to disable control points. Without it the pogram can't move the curve.
|
// Very important to disable control points. Without it the pogram can't move the curve.
|
||||||
foreach (auto *point, controlPoints)
|
foreach (auto *point, controlPoints)
|
||||||
|
@ -673,11 +669,6 @@ void VToolSplinePath::RefreshGeometry()
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto splPath = VAbstractTool::data.GeometricObject<VSplinePath>(id);
|
const auto splPath = VAbstractTool::data.GeometricObject<VSplinePath>(id);
|
||||||
this->setPath(splPath->GetPath());
|
|
||||||
|
|
||||||
this->setPen(QPen(CorrectColor(splPath->GetColor()),
|
|
||||||
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor,
|
|
||||||
LineStyleToPenStyle(splPath->GetPenStyle())));
|
|
||||||
|
|
||||||
for (qint32 i = 1; i<=splPath->CountSubSpl(); ++i)
|
for (qint32 i = 1; i<=splPath->CountSubSpl(); ++i)
|
||||||
{
|
{
|
||||||
|
@ -710,8 +701,6 @@ void VToolSplinePath::RefreshGeometry()
|
||||||
controlPoints[j-1]->blockSignals(false);
|
controlPoints[j-1]->blockSignals(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
SetVisualization();
|
|
||||||
|
|
||||||
foreach (auto *point, controlPoints)
|
foreach (auto *point, controlPoints)
|
||||||
{
|
{
|
||||||
point->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
|
point->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
|
||||||
|
|
|
@ -91,16 +91,17 @@ public slots:
|
||||||
const QPointF &pos);
|
const QPointF &pos);
|
||||||
virtual void EnableToolMove(bool move) Q_DECL_OVERRIDE;
|
virtual void EnableToolMove(bool move) Q_DECL_OVERRIDE;
|
||||||
protected:
|
protected:
|
||||||
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE;
|
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE;
|
||||||
virtual void RemoveReferens() Q_DECL_OVERRIDE;
|
virtual void RemoveReferens() Q_DECL_OVERRIDE;
|
||||||
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
|
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
|
||||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
|
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
|
||||||
virtual void mousePressEvent(QGraphicsSceneMouseEvent * event) Q_DECL_OVERRIDE;
|
virtual void mousePressEvent(QGraphicsSceneMouseEvent * event) Q_DECL_OVERRIDE;
|
||||||
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ) Q_DECL_OVERRIDE;
|
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ) Q_DECL_OVERRIDE;
|
||||||
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent * event) Q_DECL_OVERRIDE;
|
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent * event) Q_DECL_OVERRIDE;
|
||||||
virtual void hoverEnterEvent ( QGraphicsSceneHoverEvent * event ) Q_DECL_OVERRIDE;
|
virtual void hoverEnterEvent ( QGraphicsSceneHoverEvent * event ) Q_DECL_OVERRIDE;
|
||||||
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ) Q_DECL_OVERRIDE;
|
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ) Q_DECL_OVERRIDE;
|
||||||
virtual void SetVisualization() Q_DECL_OVERRIDE;
|
virtual void SetVisualization() Q_DECL_OVERRIDE;
|
||||||
|
virtual void RefreshCtrlPoints() Q_DECL_OVERRIDE;
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VToolSplinePath)
|
Q_DISABLE_COPY(VToolSplinePath)
|
||||||
QPointF oldPosition;
|
QPointF oldPosition;
|
||||||
|
@ -110,7 +111,6 @@ private:
|
||||||
QGraphicsItem *parent = nullptr);
|
QGraphicsItem *parent = nullptr);
|
||||||
|
|
||||||
bool IsMovable(int index) const;
|
bool IsMovable(int index) const;
|
||||||
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
|
||||||
static void AddPathPoint(VAbstractPattern *doc, QDomElement &domElement, const VSplinePoint &splPoint);
|
static void AddPathPoint(VAbstractPattern *doc, QDomElement &domElement, const VSplinePoint &splPoint);
|
||||||
void UpdateControlPoints(const VSpline &spl, VSplinePath &splPath, const qint32 &indexSpline) const;
|
void UpdateControlPoints(const VSpline &spl, VSplinePath &splPath, const qint32 &indexSpline) const;
|
||||||
void SetSplinePathAttributes(QDomElement &domElement, const VSplinePath &path);
|
void SetSplinePathAttributes(QDomElement &domElement, const VSplinePath &path);
|
||||||
|
|
|
@ -56,26 +56,30 @@
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VToolDoublePoint::VToolDoublePoint(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 p1id, quint32 p2id,
|
VToolDoublePoint::VToolDoublePoint(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 p1id, quint32 p2id,
|
||||||
QGraphicsItem *parent)
|
QGraphicsItem *parent)
|
||||||
:VAbstractPoint(doc, data, id), QGraphicsPathItem(parent), firstPoint(nullptr), secondPoint(nullptr), p1id(p1id),
|
:VAbstractPoint(doc, data, id),
|
||||||
|
QGraphicsPathItem(parent),
|
||||||
|
firstPoint(nullptr),
|
||||||
|
secondPoint(nullptr),
|
||||||
|
p1id(p1id),
|
||||||
p2id(p2id)
|
p2id(p2id)
|
||||||
{
|
{
|
||||||
firstPoint = new VSimplePoint(p1id, QColor(baseColor), *data->GetPatternUnit(), &factor);
|
firstPoint = new VSimplePoint(p1id, QColor(Qt::black));
|
||||||
firstPoint->setParentItem(this);
|
firstPoint->setParentItem(this);
|
||||||
connect(firstPoint, &VSimplePoint::Choosed, this, &VToolDoublePoint::Point1Choosed);
|
connect(firstPoint, &VSimplePoint::Choosed, this, &VToolDoublePoint::Point1Choosed);
|
||||||
connect(firstPoint, &VSimplePoint::Selected, this, &VToolDoublePoint::Point1Selected);
|
connect(firstPoint, &VSimplePoint::Selected, this, &VToolDoublePoint::Point1Selected);
|
||||||
connect(firstPoint, &VSimplePoint::ShowContextMenu, this, &VToolDoublePoint::contextMenuEvent);
|
connect(firstPoint, &VSimplePoint::ShowContextMenu, this, &VToolDoublePoint::contextMenuEvent);
|
||||||
connect(firstPoint, &VSimplePoint::Delete, this, &VToolDoublePoint::DeleteFromLabel);
|
connect(firstPoint, &VSimplePoint::Delete, this, &VToolDoublePoint::DeleteFromLabel);
|
||||||
connect(firstPoint, &VSimplePoint::NameChangedPosition, this, &VToolDoublePoint::Label1ChangePosition);
|
connect(firstPoint, &VSimplePoint::NameChangedPosition, this, &VToolDoublePoint::Label1ChangePosition);
|
||||||
firstPoint->RefreshGeometry(*VAbstractTool::data.GeometricObject<VPointF>(p1id));
|
firstPoint->RefreshPointGeometry(*VAbstractTool::data.GeometricObject<VPointF>(p1id));
|
||||||
|
|
||||||
secondPoint = new VSimplePoint(p2id, QColor(baseColor), *data->GetPatternUnit(), &factor);
|
secondPoint = new VSimplePoint(p2id, QColor(Qt::black));
|
||||||
secondPoint->setParentItem(this);
|
secondPoint->setParentItem(this);
|
||||||
connect(secondPoint, &VSimplePoint::Choosed, this, &VToolDoublePoint::Point2Choosed);
|
connect(secondPoint, &VSimplePoint::Choosed, this, &VToolDoublePoint::Point2Choosed);
|
||||||
connect(secondPoint, &VSimplePoint::Selected, this, &VToolDoublePoint::Point2Selected);
|
connect(secondPoint, &VSimplePoint::Selected, this, &VToolDoublePoint::Point2Selected);
|
||||||
connect(secondPoint, &VSimplePoint::ShowContextMenu, this, &VToolDoublePoint::contextMenuEvent);
|
connect(secondPoint, &VSimplePoint::ShowContextMenu, this, &VToolDoublePoint::contextMenuEvent);
|
||||||
connect(secondPoint, &VSimplePoint::Delete, this, &VToolDoublePoint::DeleteFromLabel);
|
connect(secondPoint, &VSimplePoint::Delete, this, &VToolDoublePoint::DeleteFromLabel);
|
||||||
connect(secondPoint, &VSimplePoint::NameChangedPosition, this, &VToolDoublePoint::Label2ChangePosition);
|
connect(secondPoint, &VSimplePoint::NameChangedPosition, this, &VToolDoublePoint::Label2ChangePosition);
|
||||||
secondPoint->RefreshGeometry(*VAbstractTool::data.GeometricObject<VPointF>(p2id));
|
secondPoint->RefreshPointGeometry(*VAbstractTool::data.GeometricObject<VPointF>(p2id));
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -102,12 +106,6 @@ void VToolDoublePoint::setNameP2(const QString &name)
|
||||||
SetPointName(p2id, name);
|
SetPointName(p2id, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void VToolDoublePoint::SetEnabled(bool enabled)
|
|
||||||
{
|
|
||||||
SetToolEnabled(this, baseColor, enabled);
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolDoublePoint::GroupVisibility(quint32 object, bool visible)
|
void VToolDoublePoint::GroupVisibility(quint32 object, bool visible)
|
||||||
{
|
{
|
||||||
|
@ -133,19 +131,11 @@ void VToolDoublePoint::Label2ChangePosition(const QPointF &pos)
|
||||||
ChangePosition(secondPoint, p2id, pos);
|
ChangePosition(secondPoint, p2id, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void VToolDoublePoint::SetFactor(qreal factor)
|
|
||||||
{
|
|
||||||
VDrawTool::SetFactor(factor);
|
|
||||||
firstPoint->RefreshGeometry(*VAbstractTool::data.GeometricObject<VPointF>(p1id));
|
|
||||||
secondPoint->RefreshGeometry(*VAbstractTool::data.GeometricObject<VPointF>(p2id));
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolDoublePoint::Disable(bool disable, const QString &namePP)
|
void VToolDoublePoint::Disable(bool disable, const QString &namePP)
|
||||||
{
|
{
|
||||||
enabled = !CorrectDisable(disable, namePP);
|
const bool enabled = !CorrectDisable(disable, namePP);
|
||||||
this->SetEnabled(enabled);
|
this->setEnabled(enabled);
|
||||||
firstPoint->SetEnabled(enabled);
|
firstPoint->SetEnabled(enabled);
|
||||||
secondPoint->SetEnabled(enabled);
|
secondPoint->SetEnabled(enabled);
|
||||||
}
|
}
|
||||||
|
@ -185,8 +175,8 @@ void VToolDoublePoint::Point2Selected(bool selected)
|
||||||
void VToolDoublePoint::FullUpdateFromFile()
|
void VToolDoublePoint::FullUpdateFromFile()
|
||||||
{
|
{
|
||||||
ReadAttributes();
|
ReadAttributes();
|
||||||
firstPoint->RefreshGeometry(*VAbstractTool::data.GeometricObject<VPointF>(p1id));
|
firstPoint->RefreshPointGeometry(*VAbstractTool::data.GeometricObject<VPointF>(p1id));
|
||||||
secondPoint->RefreshGeometry(*VAbstractTool::data.GeometricObject<VPointF>(p2id));
|
secondPoint->RefreshPointGeometry(*VAbstractTool::data.GeometricObject<VPointF>(p2id));
|
||||||
SetVisualization();
|
SetVisualization();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,7 +189,7 @@ void VToolDoublePoint::DoChangePosition(quint32 id, qreal mx, qreal my)
|
||||||
point->setMx(mx);
|
point->setMx(mx);
|
||||||
point->setMy(my);
|
point->setMy(my);
|
||||||
VAbstractTool::data.UpdateGObject(p1id, point);
|
VAbstractTool::data.UpdateGObject(p1id, point);
|
||||||
firstPoint->RefreshGeometry(*point);
|
firstPoint->RefreshPointGeometry(*point);
|
||||||
}
|
}
|
||||||
else if (id == p2id)
|
else if (id == p2id)
|
||||||
{
|
{
|
||||||
|
@ -207,7 +197,7 @@ void VToolDoublePoint::DoChangePosition(quint32 id, qreal mx, qreal my)
|
||||||
point->setMx(mx);
|
point->setMx(mx);
|
||||||
point->setMy(my);
|
point->setMy(my);
|
||||||
VAbstractTool::data.UpdateGObject(p2id, point);
|
VAbstractTool::data.UpdateGObject(p2id, point);
|
||||||
secondPoint->RefreshGeometry(*point);
|
secondPoint->RefreshPointGeometry(*point);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -268,19 +258,6 @@ void VToolDoublePoint::UpdateNamePosition(quint32 id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void VToolDoublePoint::RefreshLine(quint32 id)
|
|
||||||
{
|
|
||||||
if (id == p1id)
|
|
||||||
{
|
|
||||||
firstPoint->RefreshLine();
|
|
||||||
}
|
|
||||||
else if (id == p2id)
|
|
||||||
{
|
|
||||||
secondPoint->RefreshLine();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief itemChange hadle item change.
|
* @brief itemChange hadle item change.
|
||||||
|
|
|
@ -62,13 +62,10 @@ public:
|
||||||
QString nameP2() const;
|
QString nameP2() const;
|
||||||
void setNameP2(const QString &name);
|
void setNameP2(const QString &name);
|
||||||
|
|
||||||
void SetEnabled(bool enabled);
|
|
||||||
|
|
||||||
virtual void GroupVisibility(quint32 object, bool visible) Q_DECL_OVERRIDE;
|
virtual void GroupVisibility(quint32 object, bool visible) Q_DECL_OVERRIDE;
|
||||||
public slots:
|
public slots:
|
||||||
void Label1ChangePosition(const QPointF &pos);
|
void Label1ChangePosition(const QPointF &pos);
|
||||||
void Label2ChangePosition(const QPointF &pos);
|
void Label2ChangePosition(const QPointF &pos);
|
||||||
virtual void SetFactor(qreal factor) Q_DECL_OVERRIDE;
|
|
||||||
virtual void Disable(bool disable, const QString &namePP) Q_DECL_OVERRIDE;
|
virtual void Disable(bool disable, const QString &namePP) Q_DECL_OVERRIDE;
|
||||||
virtual void EnableToolMove(bool move) Q_DECL_OVERRIDE;
|
virtual void EnableToolMove(bool move) Q_DECL_OVERRIDE;
|
||||||
void Point1Choosed();
|
void Point1Choosed();
|
||||||
|
@ -91,7 +88,6 @@ protected:
|
||||||
quint32 p2id;
|
quint32 p2id;
|
||||||
|
|
||||||
virtual void UpdateNamePosition(quint32 id) Q_DECL_OVERRIDE;
|
virtual void UpdateNamePosition(quint32 id) Q_DECL_OVERRIDE;
|
||||||
virtual void RefreshLine(quint32 id) Q_DECL_OVERRIDE;
|
|
||||||
virtual QVariant itemChange ( GraphicsItemChange change, const QVariant &value ) Q_DECL_OVERRIDE;
|
virtual QVariant itemChange ( GraphicsItemChange change, const QVariant &value ) Q_DECL_OVERRIDE;
|
||||||
virtual void keyReleaseEvent(QKeyEvent * event) Q_DECL_OVERRIDE;
|
virtual void keyReleaseEvent(QKeyEvent * event) Q_DECL_OVERRIDE;
|
||||||
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE;
|
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE;
|
||||||
|
|
|
@ -80,17 +80,6 @@ VToolAlongLine::VToolAlongLine(VAbstractPattern *doc, VContainer *data, quint32
|
||||||
ToolCreation(typeCreation);
|
ToolCreation(typeCreation);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief SetFactor set current scale factor of scene.
|
|
||||||
* @param factor scene scale factor.
|
|
||||||
*/
|
|
||||||
void VToolAlongLine::SetFactor(qreal factor)
|
|
||||||
{
|
|
||||||
VDrawTool::SetFactor(factor);
|
|
||||||
RefreshGeometry();
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief contextMenuEvent handle context menu events. handle context menu event.
|
* @brief contextMenuEvent handle context menu events. handle context menu event.
|
||||||
|
|
|
@ -68,8 +68,6 @@ public:
|
||||||
quint32 GetSecondPointId() const;
|
quint32 GetSecondPointId() const;
|
||||||
void SetSecondPointId(const quint32 &value);
|
void SetSecondPointId(const quint32 &value);
|
||||||
virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE;
|
virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE;
|
||||||
public slots:
|
|
||||||
virtual void SetFactor(qreal factor) Q_DECL_OVERRIDE;
|
|
||||||
protected:
|
protected:
|
||||||
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE;
|
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE;
|
||||||
virtual void RemoveReferens() Q_DECL_OVERRIDE;
|
virtual void RemoveReferens() Q_DECL_OVERRIDE;
|
||||||
|
|
|
@ -241,17 +241,6 @@ QString VToolBisector::ThirdPointName() const
|
||||||
return VAbstractTool::data.GetGObject(thirdPointId)->name();
|
return VAbstractTool::data.GetGObject(thirdPointId)->name();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief SetFactor set current scale factor of scene.
|
|
||||||
* @param factor scene scale factor.
|
|
||||||
*/
|
|
||||||
void VToolBisector::SetFactor(qreal factor)
|
|
||||||
{
|
|
||||||
VDrawTool::SetFactor(factor);
|
|
||||||
RefreshGeometry();
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief contextMenuEvent handle context menu events.
|
* @brief contextMenuEvent handle context menu events.
|
||||||
|
|
|
@ -77,8 +77,6 @@ public:
|
||||||
void SetThirdPointId(const quint32 &value);
|
void SetThirdPointId(const quint32 &value);
|
||||||
|
|
||||||
virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE;
|
virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE;
|
||||||
public slots:
|
|
||||||
virtual void SetFactor(qreal factor) Q_DECL_OVERRIDE;
|
|
||||||
protected:
|
protected:
|
||||||
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE;
|
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE;
|
||||||
virtual void RemoveReferens() Q_DECL_OVERRIDE;
|
virtual void RemoveReferens() Q_DECL_OVERRIDE;
|
||||||
|
|
|
@ -75,9 +75,6 @@ VToolLinePoint::VToolLinePoint(VAbstractPattern *doc, VContainer *data, const qu
|
||||||
QPointF point1 = static_cast<QPointF>(*data->GeometricObject<VPointF>(basePointId));
|
QPointF point1 = static_cast<QPointF>(*data->GeometricObject<VPointF>(basePointId));
|
||||||
QPointF point2 = static_cast<QPointF>(*data->GeometricObject<VPointF>(id));
|
QPointF point2 = static_cast<QPointF>(*data->GeometricObject<VPointF>(id));
|
||||||
mainLine = new QGraphicsLineItem(QLineF(point1 - point2, QPointF()), this);
|
mainLine = new QGraphicsLineItem(QLineF(point1 - point2, QPointF()), this);
|
||||||
mainLine->setPen(QPen(CorrectColor(lineColor),
|
|
||||||
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor,
|
|
||||||
LineStyleToPenStyle(typeLine)));
|
|
||||||
mainLine->setFlag(QGraphicsItem::ItemStacksBehindParent, true);
|
mainLine->setFlag(QGraphicsItem::ItemStacksBehindParent, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,15 +84,30 @@ VToolLinePoint::~VToolLinePoint()
|
||||||
delete mainLine;
|
delete mainLine;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VToolLinePoint::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||||
|
{
|
||||||
|
const qreal width = ScaleWidth(m_isHovered ? widthMainLine : widthHairLine, SceneScale(scene()));
|
||||||
|
|
||||||
|
mainLine->setPen(QPen(CorrectColor(this, lineColor), width, LineStyleToPenStyle(m_lineType)));
|
||||||
|
|
||||||
|
VToolSinglePoint::paint(painter, option, widget);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QRectF VToolLinePoint::boundingRect() const
|
||||||
|
{
|
||||||
|
QRectF rect = VToolSinglePoint::boundingRect();
|
||||||
|
rect = rect.united(mainLine->boundingRect());
|
||||||
|
return rect;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief RefreshGeometry refresh item on scene.
|
* @brief RefreshGeometry refresh item on scene.
|
||||||
*/
|
*/
|
||||||
void VToolLinePoint::RefreshGeometry()
|
void VToolLinePoint::RefreshGeometry()
|
||||||
{
|
{
|
||||||
mainLine->setPen(QPen(CorrectColor(lineColor),
|
|
||||||
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor,
|
|
||||||
LineStyleToPenStyle(m_lineType)));
|
|
||||||
VToolSinglePoint::RefreshPointGeometry(*VDrawTool::data.GeometricObject<VPointF>(id));
|
VToolSinglePoint::RefreshPointGeometry(*VDrawTool::data.GeometricObject<VPointF>(id));
|
||||||
QPointF point = static_cast<QPointF>(*VDrawTool::data.GeometricObject<VPointF>(id));
|
QPointF point = static_cast<QPointF>(*VDrawTool::data.GeometricObject<VPointF>(id));
|
||||||
QPointF basePoint = static_cast<QPointF>(*VDrawTool::data.GeometricObject<VPointF>(basePointId));
|
QPointF basePoint = static_cast<QPointF>(*VDrawTool::data.GeometricObject<VPointF>(basePointId));
|
||||||
|
@ -121,25 +133,11 @@ void VToolLinePoint::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj
|
||||||
doc->SetAttribute(tag, AttrLineColor, lineColor);
|
doc->SetAttribute(tag, AttrLineColor, lineColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief SetFactor set current scale factor of scene.
|
|
||||||
* @param factor scene scale factor.
|
|
||||||
*/
|
|
||||||
void VToolLinePoint::SetFactor(qreal factor)
|
|
||||||
{
|
|
||||||
VDrawTool::SetFactor(factor);
|
|
||||||
RefreshGeometry();
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolLinePoint::Disable(bool disable, const QString &namePP)
|
void VToolLinePoint::Disable(bool disable, const QString &namePP)
|
||||||
{
|
{
|
||||||
VToolSinglePoint::Disable(disable, namePP);
|
VToolSinglePoint::Disable(disable, namePP);
|
||||||
mainLine->setPen(QPen(CorrectColor(lineColor),
|
mainLine->setEnabled(isEnabled());
|
||||||
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor,
|
|
||||||
LineStyleToPenStyle(m_lineType)));
|
|
||||||
mainLine->setEnabled(enabled);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -56,6 +56,10 @@ public:
|
||||||
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
||||||
enum { Type = UserType + static_cast<int>(Tool::LinePoint)};
|
enum { Type = UserType + static_cast<int>(Tool::LinePoint)};
|
||||||
|
|
||||||
|
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||||
|
QWidget *widget = nullptr) Q_DECL_OVERRIDE;
|
||||||
|
virtual QRectF boundingRect() const Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
VFormula GetFormulaLength() const;
|
VFormula GetFormulaLength() const;
|
||||||
void SetFormulaLength(const VFormula &value);
|
void SetFormulaLength(const VFormula &value);
|
||||||
|
|
||||||
|
@ -71,7 +75,6 @@ public:
|
||||||
void SetLineColor(const QString &value);
|
void SetLineColor(const QString &value);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void SetFactor(qreal factor) Q_DECL_OVERRIDE;
|
|
||||||
virtual void Disable(bool disable, const QString &namePP) Q_DECL_OVERRIDE;
|
virtual void Disable(bool disable, const QString &namePP) Q_DECL_OVERRIDE;
|
||||||
virtual void FullUpdateFromFile() Q_DECL_OVERRIDE;
|
virtual void FullUpdateFromFile() Q_DECL_OVERRIDE;
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -217,17 +217,6 @@ QString VToolNormal::SecondPointName() const
|
||||||
return VAbstractTool::data.GetGObject(secondPointId)->name();
|
return VAbstractTool::data.GetGObject(secondPointId)->name();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief SetFactor set current scale factor of scene.
|
|
||||||
* @param factor scene scale factor.
|
|
||||||
*/
|
|
||||||
void VToolNormal::SetFactor(qreal factor)
|
|
||||||
{
|
|
||||||
VDrawTool::SetFactor(factor);
|
|
||||||
RefreshGeometry();
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief contextMenuEvent handle context menu events.
|
* @brief contextMenuEvent handle context menu events.
|
||||||
|
|
|
@ -72,8 +72,6 @@ public:
|
||||||
void SetSecondPointId(const quint32 &value);
|
void SetSecondPointId(const quint32 &value);
|
||||||
|
|
||||||
virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE;
|
virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE;
|
||||||
public slots:
|
|
||||||
virtual void SetFactor(qreal factor) Q_DECL_OVERRIDE;
|
|
||||||
protected:
|
protected:
|
||||||
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE;
|
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE;
|
||||||
virtual void RemoveReferens() Q_DECL_OVERRIDE;
|
virtual void RemoveReferens() Q_DECL_OVERRIDE;
|
||||||
|
|
|
@ -259,17 +259,6 @@ QString VToolShoulderPoint::ShoulderPointName() const
|
||||||
return VAbstractTool::data.GetGObject(pShoulder)->name();
|
return VAbstractTool::data.GetGObject(pShoulder)->name();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief SetFactor set current scale factor of scene.
|
|
||||||
* @param factor scene scale factor.
|
|
||||||
*/
|
|
||||||
void VToolShoulderPoint::SetFactor(qreal factor)
|
|
||||||
{
|
|
||||||
VDrawTool::SetFactor(factor);
|
|
||||||
RefreshGeometry();
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief contextMenuEvent handle context menu events.
|
* @brief contextMenuEvent handle context menu events.
|
||||||
|
|
|
@ -77,8 +77,6 @@ public:
|
||||||
void setPShoulder(const quint32 &value);
|
void setPShoulder(const quint32 &value);
|
||||||
|
|
||||||
virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE;
|
virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE;
|
||||||
public slots:
|
|
||||||
virtual void SetFactor(qreal factor) Q_DECL_OVERRIDE;
|
|
||||||
protected:
|
protected:
|
||||||
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE;
|
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE;
|
||||||
virtual void RemoveReferens() Q_DECL_OVERRIDE;
|
virtual void RemoveReferens() Q_DECL_OVERRIDE;
|
||||||
|
|
|
@ -83,11 +83,10 @@ VToolBasePoint::VToolBasePoint (VAbstractPattern *doc, VContainer *data, quint32
|
||||||
const QString &namePP, QGraphicsItem * parent )
|
const QString &namePP, QGraphicsItem * parent )
|
||||||
:VToolSinglePoint(doc, data, id, parent), namePP(namePP)
|
:VToolSinglePoint(doc, data, id, parent), namePP(namePP)
|
||||||
{
|
{
|
||||||
baseColor = Qt::red;
|
m_baseColor = Qt::red;
|
||||||
this->setPen(QPen(baseColor, qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
|
|
||||||
this->setFlag(QGraphicsItem::ItemIsMovable, true);
|
this->setFlag(QGraphicsItem::ItemIsMovable, true);
|
||||||
this->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
|
this->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
|
||||||
SetColorLabel(Qt::black);
|
m_namePoint->setBrush(Qt::black);
|
||||||
ToolCreation(typeCreation);
|
ToolCreation(typeCreation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -360,17 +359,6 @@ void VToolBasePoint::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||||
VToolSinglePoint::mouseReleaseEvent(event);
|
VToolSinglePoint::mouseReleaseEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief SetColorLabel change color for label and label line.
|
|
||||||
* @param color new color.
|
|
||||||
*/
|
|
||||||
void VToolBasePoint::SetColorLabel(const Qt::GlobalColor &color)
|
|
||||||
{
|
|
||||||
namePoint->setBrush(color);
|
|
||||||
lineName->setPen(QPen(color, qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolBasePoint::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
|
void VToolBasePoint::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
|
||||||
{
|
{
|
||||||
|
@ -435,17 +423,6 @@ void VToolBasePoint::FullUpdateFromFile()
|
||||||
RefreshPointGeometry(*VAbstractTool::data.GeometricObject<VPointF>(id));
|
RefreshPointGeometry(*VAbstractTool::data.GeometricObject<VPointF>(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief SetFactor set current scale factor of scene.
|
|
||||||
* @param factor scene scale factor.
|
|
||||||
*/
|
|
||||||
void VToolBasePoint::SetFactor(qreal factor)
|
|
||||||
{
|
|
||||||
VDrawTool::SetFactor(factor);
|
|
||||||
RefreshPointGeometry(*(VAbstractTool::data.GeometricObject<VPointF>(id)));
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolBasePoint::EnableToolMove(bool move)
|
void VToolBasePoint::EnableToolMove(bool move)
|
||||||
{
|
{
|
||||||
|
|
|
@ -68,7 +68,6 @@ public:
|
||||||
void SetBasePointPos(const QPointF &pos);
|
void SetBasePointPos(const QPointF &pos);
|
||||||
public slots:
|
public slots:
|
||||||
virtual void FullUpdateFromFile() Q_DECL_OVERRIDE;
|
virtual void FullUpdateFromFile() Q_DECL_OVERRIDE;
|
||||||
virtual void SetFactor(qreal factor) Q_DECL_OVERRIDE;
|
|
||||||
virtual void EnableToolMove(bool move) Q_DECL_OVERRIDE;
|
virtual void EnableToolMove(bool move) Q_DECL_OVERRIDE;
|
||||||
signals:
|
signals:
|
||||||
/**
|
/**
|
||||||
|
@ -95,8 +94,6 @@ private:
|
||||||
|
|
||||||
VToolBasePoint (VAbstractPattern *doc, VContainer *data, quint32 id, const Source &typeCreation,
|
VToolBasePoint (VAbstractPattern *doc, VContainer *data, quint32 id, const Source &typeCreation,
|
||||||
const QString &namePP, QGraphicsItem * parent = nullptr );
|
const QString &namePP, QGraphicsItem * parent = nullptr );
|
||||||
|
|
||||||
void SetColorLabel(const Qt::GlobalColor & color);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VTOOLBASEPOINT_H
|
#endif // VTOOLBASEPOINT_H
|
||||||
|
|
|
@ -223,17 +223,6 @@ QString VToolLineIntersect::Line2P2Name() const
|
||||||
return VAbstractTool::data.GetGObject(p2Line2)->name();
|
return VAbstractTool::data.GetGObject(p2Line2)->name();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief SetFactor set current scale factor of scene.
|
|
||||||
* @param factor scene scale factor.
|
|
||||||
*/
|
|
||||||
void VToolLineIntersect::SetFactor(qreal factor)
|
|
||||||
{
|
|
||||||
VDrawTool::SetFactor(factor);
|
|
||||||
RefreshPointGeometry(*VAbstractTool::data.GeometricObject<VPointF>(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief contextMenuEvent handle context menu events.
|
* @brief contextMenuEvent handle context menu events.
|
||||||
|
|
|
@ -80,8 +80,6 @@ public:
|
||||||
void SetP2Line2(const quint32 &value);
|
void SetP2Line2(const quint32 &value);
|
||||||
|
|
||||||
virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE;
|
virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE;
|
||||||
public slots:
|
|
||||||
virtual void SetFactor(qreal factor) Q_DECL_OVERRIDE;
|
|
||||||
protected:
|
protected:
|
||||||
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE;
|
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE;
|
||||||
virtual void RemoveReferens() Q_DECL_OVERRIDE;
|
virtual void RemoveReferens() Q_DECL_OVERRIDE;
|
||||||
|
|
|
@ -269,17 +269,6 @@ QString VToolPointOfContact::SecondPointName() const
|
||||||
return VAbstractTool::data.GetGObject(secondPointId)->name();
|
return VAbstractTool::data.GetGObject(secondPointId)->name();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief SetFactor set current scale factor of scene.
|
|
||||||
* @param factor scene scale factor.
|
|
||||||
*/
|
|
||||||
void VToolPointOfContact::SetFactor(qreal factor)
|
|
||||||
{
|
|
||||||
VDrawTool::SetFactor(factor);
|
|
||||||
RefreshPointGeometry(*VAbstractTool::data.GeometricObject<VPointF>(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief contextMenuEvent handle context menu events.
|
* @brief contextMenuEvent handle context menu events.
|
||||||
|
|
|
@ -84,8 +84,6 @@ public:
|
||||||
void SetSecondPointId(const quint32 &value);
|
void SetSecondPointId(const quint32 &value);
|
||||||
|
|
||||||
virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE;
|
virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE;
|
||||||
public slots:
|
|
||||||
virtual void SetFactor(qreal factor) Q_DECL_OVERRIDE;
|
|
||||||
protected:
|
protected:
|
||||||
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE;
|
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE;
|
||||||
virtual void RemoveReferens() Q_DECL_OVERRIDE;
|
virtual void RemoveReferens() Q_DECL_OVERRIDE;
|
||||||
|
|
|
@ -76,19 +76,14 @@ QT_WARNING_POP
|
||||||
* @param parent parent object.
|
* @param parent parent object.
|
||||||
*/
|
*/
|
||||||
VToolSinglePoint::VToolSinglePoint(VAbstractPattern *doc, VContainer *data, quint32 id, QGraphicsItem *parent)
|
VToolSinglePoint::VToolSinglePoint(VAbstractPattern *doc, VContainer *data, quint32 id, QGraphicsItem *parent)
|
||||||
:VAbstractPoint(doc, data, id), QGraphicsEllipseItem(parent), radius(ToPixel(DefPointRadius/*mm*/, Unit::Mm)),
|
: VAbstractPoint(doc, data, id),
|
||||||
namePoint(nullptr), lineName(nullptr)
|
VScenePoint(parent)
|
||||||
{
|
{
|
||||||
namePoint = new VGraphicsSimpleTextItem(this);
|
connect(m_namePoint, &VGraphicsSimpleTextItem::ShowContextMenu, this, &VToolSinglePoint::contextMenuEvent);
|
||||||
connect(namePoint, &VGraphicsSimpleTextItem::ShowContextMenu, this, &VToolSinglePoint::contextMenuEvent);
|
connect(m_namePoint, &VGraphicsSimpleTextItem::DeleteTool, this, &VToolSinglePoint::DeleteFromLabel);
|
||||||
connect(namePoint, &VGraphicsSimpleTextItem::DeleteTool, this, &VToolSinglePoint::DeleteFromLabel);
|
connect(m_namePoint, &VGraphicsSimpleTextItem::PointChoosed, this, &VToolSinglePoint::PointChoosed);
|
||||||
connect(namePoint, &VGraphicsSimpleTextItem::PointChoosed, this, &VToolSinglePoint::PointChoosed);
|
connect(m_namePoint, &VGraphicsSimpleTextItem::PointSelected, this, &VToolSinglePoint::PointSelected);
|
||||||
connect(namePoint, &VGraphicsSimpleTextItem::PointSelected, this, &VToolSinglePoint::PointSelected);
|
connect(m_namePoint, &VGraphicsSimpleTextItem::NameChangePosition, this, &VToolSinglePoint::NameChangePosition);
|
||||||
connect(namePoint, &VGraphicsSimpleTextItem::NameChangePosition, this, &VToolSinglePoint::NameChangePosition);
|
|
||||||
lineName = new QGraphicsLineItem(this);
|
|
||||||
this->setBrush(QBrush(Qt::NoBrush));
|
|
||||||
this->setAcceptHoverEvents(true);
|
|
||||||
this->setFlag(QGraphicsItem::ItemIsFocusable, true);// For keyboard input focus
|
|
||||||
RefreshPointGeometry(*VAbstractTool::data.GeometricObject<VPointF>(id));
|
RefreshPointGeometry(*VAbstractTool::data.GeometricObject<VPointF>(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,8 +102,8 @@ void VToolSinglePoint::setName(const QString &name)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolSinglePoint::SetEnabled(bool enabled)
|
void VToolSinglePoint::SetEnabled(bool enabled)
|
||||||
{
|
{
|
||||||
SetToolEnabled(this, baseColor, enabled);
|
setEnabled(enabled);
|
||||||
SetToolEnabled(lineName, Qt::black, enabled);
|
m_lineName->setEnabled(enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -144,7 +139,7 @@ void VToolSinglePoint::UpdateNamePosition(quint32 id)
|
||||||
void VToolSinglePoint::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
void VToolSinglePoint::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||||
{
|
{
|
||||||
// Special for not selectable item first need to call standard mousePressEvent then accept event
|
// Special for not selectable item first need to call standard mousePressEvent then accept event
|
||||||
QGraphicsEllipseItem::mousePressEvent(event);
|
VScenePoint::mousePressEvent(event);
|
||||||
|
|
||||||
// Somehow clicking on notselectable object do not clean previous selections.
|
// Somehow clicking on notselectable object do not clean previous selections.
|
||||||
if (not (flags() & ItemIsSelectable) && scene())
|
if (not (flags() & ItemIsSelectable) && scene())
|
||||||
|
@ -165,29 +160,18 @@ void VToolSinglePoint::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief SetFactor set current scale factor of scene.
|
|
||||||
* @param factor scene scale factor.
|
|
||||||
*/
|
|
||||||
void VToolSinglePoint::SetFactor(qreal factor)
|
|
||||||
{
|
|
||||||
VDrawTool::SetFactor(factor);
|
|
||||||
RefreshPointGeometry(*VAbstractTool::data.GeometricObject<VPointF>(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolSinglePoint::Disable(bool disable, const QString &namePP)
|
void VToolSinglePoint::Disable(bool disable, const QString &namePP)
|
||||||
{
|
{
|
||||||
enabled = !CorrectDisable(disable, namePP);
|
const bool enabled = !CorrectDisable(disable, namePP);
|
||||||
this->SetEnabled(enabled);
|
SetEnabled(enabled);
|
||||||
namePoint->setEnabled(enabled);
|
m_namePoint->setEnabled(enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolSinglePoint::EnableToolMove(bool move)
|
void VToolSinglePoint::EnableToolMove(bool move)
|
||||||
{
|
{
|
||||||
namePoint->setFlag(QGraphicsItem::ItemIsMovable, move);
|
m_namePoint->setFlag(QGraphicsItem::ItemIsMovable, move);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -227,71 +211,7 @@ void VToolSinglePoint::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||||
PointChoosed();
|
PointChoosed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QGraphicsEllipseItem::mouseReleaseEvent(event);
|
VScenePoint::mouseReleaseEvent(event);
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief hoverEnterEvent handle hover enter events.
|
|
||||||
* @param event hover enter event.
|
|
||||||
*/
|
|
||||||
void VToolSinglePoint::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
|
||||||
{
|
|
||||||
Q_UNUSED(event)
|
|
||||||
this->setPen(QPen(CorrectColor(baseColor),
|
|
||||||
qApp->toPixel(WidthMainLine(*VAbstractTool::data.GetPatternUnit()))/factor));
|
|
||||||
QGraphicsEllipseItem::hoverEnterEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief hoverLeaveEvent handle hover leave events.
|
|
||||||
* @param event hover leave event.
|
|
||||||
*/
|
|
||||||
void VToolSinglePoint::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
|
||||||
{
|
|
||||||
Q_UNUSED(event)
|
|
||||||
this->setPen(QPen(CorrectColor(baseColor),
|
|
||||||
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
|
|
||||||
QGraphicsEllipseItem::hoverLeaveEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief RefreshPointGeometry refresh point on scene.
|
|
||||||
* @param point point.
|
|
||||||
*/
|
|
||||||
void VToolSinglePoint::RefreshPointGeometry(const VPointF &point)
|
|
||||||
{
|
|
||||||
this->setFlag(QGraphicsItem::ItemSendsGeometryChanges, false);
|
|
||||||
this->setPen(QPen(CorrectColor(baseColor),
|
|
||||||
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
|
|
||||||
QRectF rec = QRectF(0, 0, radius*2, radius*2);
|
|
||||||
rec.translate(-rec.center().x(), -rec.center().y());
|
|
||||||
this->setRect(rec);
|
|
||||||
this->setPos(static_cast<QPointF>(point));
|
|
||||||
this->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
|
|
||||||
namePoint->blockSignals(true);
|
|
||||||
QFont font = namePoint->font();
|
|
||||||
font.setPointSize(static_cast<qint32>(namePoint->FontSize()/factor));
|
|
||||||
namePoint->setFont(font);
|
|
||||||
namePoint->setText(point.name());
|
|
||||||
namePoint->setPos(QPointF(point.mx(), point.my()));
|
|
||||||
namePoint->blockSignals(false);
|
|
||||||
RefreshLine(id);
|
|
||||||
this->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief RefreshLine refresh line to label on scene.
|
|
||||||
*/
|
|
||||||
void VToolSinglePoint::RefreshLine(quint32 id)
|
|
||||||
{
|
|
||||||
Q_UNUSED(id)
|
|
||||||
VAbstractTool::RefreshLine(this, namePoint, lineName, radius);
|
|
||||||
lineName->setPen(QPen(CorrectColor(Qt::black),
|
|
||||||
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -305,13 +225,13 @@ QVariant VToolSinglePoint::itemChange(QGraphicsItem::GraphicsItemChange change,
|
||||||
{
|
{
|
||||||
if (change == QGraphicsItem::ItemSelectedChange)
|
if (change == QGraphicsItem::ItemSelectedChange)
|
||||||
{
|
{
|
||||||
namePoint->blockSignals(true);
|
m_namePoint->blockSignals(true);
|
||||||
namePoint->setSelected(value.toBool());
|
m_namePoint->setSelected(value.toBool());
|
||||||
namePoint->blockSignals(false);
|
m_namePoint->blockSignals(false);
|
||||||
emit ChangedToolSelection(value.toBool(), id, id);
|
emit ChangedToolSelection(value.toBool(), id, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
return QGraphicsEllipseItem::itemChange(change, value);
|
return VScenePoint::itemChange(change, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -337,7 +257,7 @@ void VToolSinglePoint::keyReleaseEvent(QKeyEvent *event)
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
QGraphicsEllipseItem::keyReleaseEvent ( event );
|
VScenePoint::keyReleaseEvent ( event );
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -366,10 +286,10 @@ void VToolSinglePoint::DoChangePosition(quint32 id, qreal mx, qreal my)
|
||||||
point->setMx(mx);
|
point->setMx(mx);
|
||||||
point->setMy(my);
|
point->setMy(my);
|
||||||
VAbstractTool::data.UpdateGObject(id, point);
|
VAbstractTool::data.UpdateGObject(id, point);
|
||||||
namePoint->blockSignals(true);
|
m_namePoint->blockSignals(true);
|
||||||
namePoint->setPos(QPointF(mx, my));
|
m_namePoint->setPos(QPointF(mx, my));
|
||||||
namePoint->blockSignals(false);
|
m_namePoint->blockSignals(false);
|
||||||
RefreshLine(id);
|
RefreshLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -387,18 +307,18 @@ void VToolSinglePoint::AllowSelecting(bool enabled)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolSinglePoint::AllowLabelHover(bool enabled)
|
void VToolSinglePoint::AllowLabelHover(bool enabled)
|
||||||
{
|
{
|
||||||
namePoint->setAcceptHoverEvents(enabled);
|
m_namePoint->setAcceptHoverEvents(enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolSinglePoint::AllowLabelSelecting(bool enabled)
|
void VToolSinglePoint::AllowLabelSelecting(bool enabled)
|
||||||
{
|
{
|
||||||
namePoint->setFlag(QGraphicsItem::ItemIsSelectable, enabled);
|
m_namePoint->setFlag(QGraphicsItem::ItemIsSelectable, enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolSinglePoint::ToolSelectionType(const SelectionType &type)
|
void VToolSinglePoint::ToolSelectionType(const SelectionType &type)
|
||||||
{
|
{
|
||||||
VAbstractTool::ToolSelectionType(type);
|
VAbstractTool::ToolSelectionType(type);
|
||||||
namePoint->LabelSelectionType(type);
|
m_namePoint->LabelSelectionType(type);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,6 @@
|
||||||
#define VTOOLSINGLEPOINT_H
|
#define VTOOLSINGLEPOINT_H
|
||||||
|
|
||||||
#include <qcompilerdetection.h>
|
#include <qcompilerdetection.h>
|
||||||
#include <QGraphicsEllipseItem>
|
|
||||||
#include <QGraphicsItem>
|
#include <QGraphicsItem>
|
||||||
#include <QMetaObject>
|
#include <QMetaObject>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
@ -41,63 +40,50 @@
|
||||||
|
|
||||||
#include "../vabstractpoint.h"
|
#include "../vabstractpoint.h"
|
||||||
#include "../vmisc/def.h"
|
#include "../vmisc/def.h"
|
||||||
|
#include "../vwidgets/vscenepoint.h"
|
||||||
|
|
||||||
template <class T> class QSharedPointer;
|
template <class T> class QSharedPointer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The VToolSinglePoint class parent for all tools what create points.
|
* @brief The VToolSinglePoint class parent for all tools what create points.
|
||||||
*/
|
*/
|
||||||
class VToolSinglePoint: public VAbstractPoint, public QGraphicsEllipseItem
|
class VToolSinglePoint: public VAbstractPoint, public VScenePoint
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
VToolSinglePoint(VAbstractPattern *doc, VContainer *data, quint32 id, QGraphicsItem * parent = nullptr);
|
VToolSinglePoint(VAbstractPattern *doc, VContainer *data, quint32 id, QGraphicsItem * parent = nullptr);
|
||||||
virtual ~VToolSinglePoint() Q_DECL_EQ_DEFAULT;
|
virtual ~VToolSinglePoint() Q_DECL_EQ_DEFAULT;
|
||||||
|
|
||||||
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
||||||
enum { Type = UserType + static_cast<int>(Tool::SinglePoint)};
|
enum { Type = UserType + static_cast<int>(Tool::SinglePoint)};
|
||||||
|
|
||||||
QString name() const;
|
QString name() const;
|
||||||
void setName(const QString &name);
|
void setName(const QString &name);
|
||||||
|
|
||||||
void SetEnabled(bool enabled);
|
void SetEnabled(bool enabled);
|
||||||
|
|
||||||
virtual void GroupVisibility(quint32 object, bool visible) Q_DECL_OVERRIDE;
|
virtual void GroupVisibility(quint32 object, bool visible) Q_DECL_OVERRIDE;
|
||||||
public slots:
|
public slots:
|
||||||
void NameChangePosition(const QPointF &pos);
|
void NameChangePosition(const QPointF &pos);
|
||||||
virtual void SetFactor(qreal factor) Q_DECL_OVERRIDE;
|
virtual void Disable(bool disable, const QString &namePP) Q_DECL_OVERRIDE;
|
||||||
virtual void Disable(bool disable, const QString &namePP) Q_DECL_OVERRIDE;
|
virtual void EnableToolMove(bool move) Q_DECL_OVERRIDE;
|
||||||
virtual void EnableToolMove(bool move) Q_DECL_OVERRIDE;
|
void PointChoosed();
|
||||||
void PointChoosed();
|
void PointSelected(bool selected);
|
||||||
void PointSelected(bool selected);
|
virtual void FullUpdateFromFile() Q_DECL_OVERRIDE;
|
||||||
virtual void FullUpdateFromFile() Q_DECL_OVERRIDE;
|
virtual void DoChangePosition(quint32 id, qreal mx, qreal my) Q_DECL_OVERRIDE;
|
||||||
virtual void DoChangePosition(quint32 id, qreal mx, qreal my) Q_DECL_OVERRIDE;
|
virtual void AllowHover(bool enabled) Q_DECL_OVERRIDE;
|
||||||
virtual void AllowHover(bool enabled) Q_DECL_OVERRIDE;
|
virtual void AllowSelecting(bool enabled) Q_DECL_OVERRIDE;
|
||||||
virtual void AllowSelecting(bool enabled) Q_DECL_OVERRIDE;
|
void AllowLabelHover(bool enabled);
|
||||||
void AllowLabelHover(bool enabled);
|
void AllowLabelSelecting(bool enabled);
|
||||||
void AllowLabelSelecting(bool enabled);
|
virtual void ToolSelectionType(const SelectionType &type) Q_DECL_OVERRIDE;
|
||||||
virtual void ToolSelectionType(const SelectionType &type) Q_DECL_OVERRIDE;
|
|
||||||
protected:
|
protected:
|
||||||
/** @brief radius radius circle. */
|
virtual void UpdateNamePosition(quint32 id) Q_DECL_OVERRIDE;
|
||||||
qreal radius;
|
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
|
||||||
|
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ) Q_DECL_OVERRIDE;
|
||||||
/** @brief namePoint point label. */
|
virtual QVariant itemChange ( GraphicsItemChange change, const QVariant &value ) Q_DECL_OVERRIDE;
|
||||||
VGraphicsSimpleTextItem *namePoint;
|
virtual void keyReleaseEvent(QKeyEvent * event) Q_DECL_OVERRIDE;
|
||||||
|
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE;
|
||||||
/** @brief lineName line what we see if label moved too away from point. */
|
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
|
||||||
QGraphicsLineItem *lineName;
|
|
||||||
|
|
||||||
virtual void UpdateNamePosition(quint32 id) Q_DECL_OVERRIDE;
|
|
||||||
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
|
|
||||||
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ) Q_DECL_OVERRIDE;
|
|
||||||
virtual void hoverEnterEvent ( QGraphicsSceneHoverEvent * event ) Q_DECL_OVERRIDE;
|
|
||||||
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ) Q_DECL_OVERRIDE;
|
|
||||||
virtual void RefreshPointGeometry(const VPointF &point);
|
|
||||||
virtual void RefreshLine(quint32 id) Q_DECL_OVERRIDE;
|
|
||||||
virtual QVariant itemChange ( GraphicsItemChange change, const QVariant &value ) Q_DECL_OVERRIDE;
|
|
||||||
virtual void keyReleaseEvent(QKeyEvent * event) Q_DECL_OVERRIDE;
|
|
||||||
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE;
|
|
||||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VToolSinglePoint)
|
Q_DISABLE_COPY(VToolSinglePoint)
|
||||||
};
|
};
|
||||||
|
|
|
@ -74,10 +74,6 @@ protected:
|
||||||
|
|
||||||
|
|
||||||
virtual void UpdateNamePosition(quint32 id)=0;
|
virtual void UpdateNamePosition(quint32 id)=0;
|
||||||
virtual void RefreshLine(quint32 id)=0;
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
void SetToolEnabled(T *item, const QColor &color, bool enabled);
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static void InitToolConnections(VMainGraphicsScene *scene, T *tool);
|
static void InitToolConnections(VMainGraphicsScene *scene, T *tool);
|
||||||
|
@ -111,22 +107,6 @@ void VAbstractPoint::ShowToolVisualization(bool show)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
template <typename T>
|
|
||||||
void VAbstractPoint::SetToolEnabled(T *item, const QColor &color, bool enabled)
|
|
||||||
{
|
|
||||||
item->setEnabled(enabled);
|
|
||||||
if (enabled)
|
|
||||||
{
|
|
||||||
item->setPen(QPen(color,
|
|
||||||
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
item->setPen(QPen(Qt::gray, qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void VAbstractPoint::ChangePosition(T *item, quint32 id, const QPointF &pos)
|
void VAbstractPoint::ChangePosition(T *item, quint32 id, const QPointF &pos)
|
||||||
|
|
|
@ -49,8 +49,6 @@
|
||||||
|
|
||||||
template <class T> class QSharedPointer;
|
template <class T> class QSharedPointer;
|
||||||
|
|
||||||
qreal VDrawTool::factor = 1;
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief VDrawTool constructor.
|
* @brief VDrawTool constructor.
|
||||||
|
@ -61,8 +59,7 @@ qreal VDrawTool::factor = 1;
|
||||||
VDrawTool::VDrawTool(VAbstractPattern *doc, VContainer *data, quint32 id, QObject *parent)
|
VDrawTool::VDrawTool(VAbstractPattern *doc, VContainer *data, quint32 id, QObject *parent)
|
||||||
: VInteractiveTool(doc, data, id, parent),
|
: VInteractiveTool(doc, data, id, parent),
|
||||||
nameActivDraw(doc->GetNameActivPP()),
|
nameActivDraw(doc->GetNameActivPP()),
|
||||||
m_lineType(TypeLineLine),
|
m_lineType(TypeLineLine)
|
||||||
enabled(true)
|
|
||||||
{
|
{
|
||||||
connect(this->doc, &VAbstractPattern::ChangedActivPP, this, &VDrawTool::ChangedActivDraw);
|
connect(this->doc, &VAbstractPattern::ChangedActivPP, this, &VDrawTool::ChangedActivDraw);
|
||||||
connect(this->doc, &VAbstractPattern::ChangedNameDraw, this, &VDrawTool::ChangedNameDraw);
|
connect(this->doc, &VAbstractPattern::ChangedNameDraw, this, &VDrawTool::ChangedNameDraw);
|
||||||
|
@ -184,19 +181,6 @@ void VDrawTool::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
|
||||||
doc->SetAttribute(tag, VDomDocument::AttrId, id);
|
doc->SetAttribute(tag, VDomDocument::AttrId, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
QColor VDrawTool::CorrectColor(const QColor &color) const
|
|
||||||
{
|
|
||||||
if (enabled)
|
|
||||||
{
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return Qt::gray;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool VDrawTool::CorrectDisable(bool disable, const QString &namePP) const
|
bool VDrawTool::CorrectDisable(bool disable, const QString &namePP) const
|
||||||
{
|
{
|
||||||
|
@ -224,16 +208,6 @@ void VDrawTool::ReadAttributes()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief SetFactor set current scale factor of scene.
|
|
||||||
* @param factor scene scale factor.
|
|
||||||
*/
|
|
||||||
void VDrawTool::SetFactor(qreal factor)
|
|
||||||
{
|
|
||||||
CheckFactor(VDrawTool::factor, factor);
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VDrawTool::EnableToolMove(bool move)
|
void VDrawTool::EnableToolMove(bool move)
|
||||||
{
|
{
|
||||||
|
|
|
@ -63,9 +63,6 @@ public:
|
||||||
VDrawTool(VAbstractPattern *doc, VContainer *data, quint32 id, QObject *parent = nullptr);
|
VDrawTool(VAbstractPattern *doc, VContainer *data, quint32 id, QObject *parent = nullptr);
|
||||||
virtual ~VDrawTool() Q_DECL_EQ_DEFAULT;
|
virtual ~VDrawTool() Q_DECL_EQ_DEFAULT;
|
||||||
|
|
||||||
/** @brief factor scene scale factor. */
|
|
||||||
static qreal factor;
|
|
||||||
|
|
||||||
QString getLineType() const;
|
QString getLineType() const;
|
||||||
virtual void SetTypeLine(const QString &value);
|
virtual void SetTypeLine(const QString &value);
|
||||||
|
|
||||||
|
@ -76,7 +73,6 @@ public slots:
|
||||||
virtual void ShowTool(quint32 id, bool enable);
|
virtual void ShowTool(quint32 id, bool enable);
|
||||||
virtual void ChangedActivDraw(const QString &newName);
|
virtual void ChangedActivDraw(const QString &newName);
|
||||||
void ChangedNameDraw(const QString &oldName, const QString &newName);
|
void ChangedNameDraw(const QString &oldName, const QString &newName);
|
||||||
virtual void SetFactor(qreal factor);
|
|
||||||
virtual void EnableToolMove(bool move);
|
virtual void EnableToolMove(bool move);
|
||||||
virtual void Disable(bool disable, const QString &namePP)=0;
|
virtual void Disable(bool disable, const QString &namePP)=0;
|
||||||
virtual void DetailsMode(bool mode);
|
virtual void DetailsMode(bool mode);
|
||||||
|
@ -91,8 +87,6 @@ protected:
|
||||||
/** @brief typeLine line type. */
|
/** @brief typeLine line type. */
|
||||||
QString m_lineType;
|
QString m_lineType;
|
||||||
|
|
||||||
bool enabled;
|
|
||||||
|
|
||||||
void AddToCalculation(const QDomElement &domElement);
|
void AddToCalculation(const QDomElement &domElement);
|
||||||
|
|
||||||
/** @brief SaveDialog save options into file after change in dialog. */
|
/** @brief SaveDialog save options into file after change in dialog. */
|
||||||
|
@ -103,7 +97,6 @@ protected:
|
||||||
void SaveOption(QSharedPointer<VGObject> &obj);
|
void SaveOption(QSharedPointer<VGObject> &obj);
|
||||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
|
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
|
||||||
|
|
||||||
QColor CorrectColor(const QColor &color) const;
|
|
||||||
bool CorrectDisable(bool disable, const QString &namePP) const;
|
bool CorrectDisable(bool disable, const QString &namePP) const;
|
||||||
|
|
||||||
void ReadAttributes();
|
void ReadAttributes();
|
||||||
|
@ -247,7 +240,6 @@ void VDrawTool::InitDrawToolConnections(VMainGraphicsScene *scene, T *tool)
|
||||||
|
|
||||||
QObject::connect(tool, &T::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
QObject::connect(tool, &T::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
||||||
QObject::connect(tool, &T::ChangedToolSelection, scene, &VMainGraphicsScene::SelectedItem);
|
QObject::connect(tool, &T::ChangedToolSelection, scene, &VMainGraphicsScene::SelectedItem);
|
||||||
QObject::connect(scene, &VMainGraphicsScene::NewFactor, tool, &T::SetFactor);
|
|
||||||
QObject::connect(scene, &VMainGraphicsScene::DisableItem, tool, &T::Disable);
|
QObject::connect(scene, &VMainGraphicsScene::DisableItem, tool, &T::Disable);
|
||||||
QObject::connect(scene, &VMainGraphicsScene::EnableToolMove, tool, &T::EnableToolMove);
|
QObject::connect(scene, &VMainGraphicsScene::EnableToolMove, tool, &T::EnableToolMove);
|
||||||
QObject::connect(scene, &VMainGraphicsScene::CurveDetailsMode, tool, &T::DetailsMode);
|
QObject::connect(scene, &VMainGraphicsScene::CurveDetailsMode, tool, &T::DetailsMode);
|
||||||
|
|
|
@ -69,8 +69,12 @@ template <class T> class QSharedPointer;
|
||||||
VToolLine::VToolLine(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 firstPoint, quint32 secondPoint,
|
VToolLine::VToolLine(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 firstPoint, quint32 secondPoint,
|
||||||
const QString &typeLine, const QString &lineColor, const Source &typeCreation,
|
const QString &typeLine, const QString &lineColor, const Source &typeCreation,
|
||||||
QGraphicsItem *parent)
|
QGraphicsItem *parent)
|
||||||
:VDrawTool(doc, data, id), QGraphicsLineItem(parent), firstPoint(firstPoint), secondPoint(secondPoint),
|
:VDrawTool(doc, data, id),
|
||||||
lineColor(lineColor)
|
QGraphicsLineItem(parent),
|
||||||
|
firstPoint(firstPoint),
|
||||||
|
secondPoint(secondPoint),
|
||||||
|
lineColor(lineColor),
|
||||||
|
m_isHovered(false)
|
||||||
{
|
{
|
||||||
this->m_lineType = typeLine;
|
this->m_lineType = typeLine;
|
||||||
//Line
|
//Line
|
||||||
|
@ -80,9 +84,6 @@ VToolLine::VToolLine(VAbstractPattern *doc, VContainer *data, quint32 id, quint3
|
||||||
this->setFlag(QGraphicsItem::ItemStacksBehindParent, true);
|
this->setFlag(QGraphicsItem::ItemStacksBehindParent, true);
|
||||||
this->setFlag(QGraphicsItem::ItemIsFocusable, true);// For keyboard input focus
|
this->setFlag(QGraphicsItem::ItemIsFocusable, true);// For keyboard input focus
|
||||||
this->setAcceptHoverEvents(true);
|
this->setAcceptHoverEvents(true);
|
||||||
this->setPen(QPen(CorrectColor(lineColor),
|
|
||||||
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor,
|
|
||||||
LineStyleToPenStyle(typeLine)));
|
|
||||||
|
|
||||||
ToolCreation(typeCreation);
|
ToolCreation(typeCreation);
|
||||||
}
|
}
|
||||||
|
@ -193,6 +194,16 @@ QString VToolLine::getTagName() const
|
||||||
return VAbstractPattern::TagLine;
|
return VAbstractPattern::TagLine;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VToolLine::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||||
|
{
|
||||||
|
const qreal width = ScaleWidth(m_isHovered ? widthMainLine : widthHairLine, SceneScale(scene()));
|
||||||
|
|
||||||
|
setPen(QPen(CorrectColor(this, lineColor), width, LineStyleToPenStyle(m_lineType)));
|
||||||
|
|
||||||
|
QGraphicsLineItem::paint(painter, option, widget);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VToolLine::FirstPointName() const
|
QString VToolLine::FirstPointName() const
|
||||||
{
|
{
|
||||||
|
@ -227,25 +238,11 @@ void VToolLine::ShowTool(quint32 id, bool enable)
|
||||||
ShowItem(this, id, enable);
|
ShowItem(this, id, enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief SetFactor set current scale factor of scene.
|
|
||||||
* @param factor scene scale factor.
|
|
||||||
*/
|
|
||||||
void VToolLine::SetFactor(qreal factor)
|
|
||||||
{
|
|
||||||
VDrawTool::SetFactor(factor);
|
|
||||||
RefreshGeometry();
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolLine::Disable(bool disable, const QString &namePP)
|
void VToolLine::Disable(bool disable, const QString &namePP)
|
||||||
{
|
{
|
||||||
enabled = !CorrectDisable(disable, namePP);
|
const bool enabled = !CorrectDisable(disable, namePP);
|
||||||
this->setEnabled(enabled);
|
this->setEnabled(enabled);
|
||||||
this->setPen(QPen(CorrectColor(lineColor),
|
|
||||||
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor,
|
|
||||||
LineStyleToPenStyle(m_lineType)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -315,10 +312,8 @@ void VToolLine::RefreshDataInFile()
|
||||||
*/
|
*/
|
||||||
void VToolLine::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
void VToolLine::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
||||||
{
|
{
|
||||||
Q_UNUSED(event)
|
m_isHovered = true;
|
||||||
this->setPen(QPen(CorrectColor(lineColor),
|
QGraphicsLineItem::hoverEnterEvent(event);
|
||||||
qApp->toPixel(WidthMainLine(*VAbstractTool::data.GetPatternUnit()))/factor,
|
|
||||||
LineStyleToPenStyle(m_lineType)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -328,12 +323,10 @@ void VToolLine::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
||||||
*/
|
*/
|
||||||
void VToolLine::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
void VToolLine::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||||
{
|
{
|
||||||
Q_UNUSED(event)
|
|
||||||
if (vis.isNull())
|
if (vis.isNull())
|
||||||
{
|
{
|
||||||
this->setPen(QPen(CorrectColor(lineColor),
|
m_isHovered = false;
|
||||||
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor,
|
QGraphicsLineItem::hoverLeaveEvent(event);
|
||||||
LineStyleToPenStyle(m_lineType)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -544,5 +537,4 @@ void VToolLine::RefreshGeometry()
|
||||||
const QSharedPointer<VPointF> first = VAbstractTool::data.GeometricObject<VPointF>(firstPoint);
|
const QSharedPointer<VPointF> first = VAbstractTool::data.GeometricObject<VPointF>(firstPoint);
|
||||||
const QSharedPointer<VPointF> second = VAbstractTool::data.GeometricObject<VPointF>(secondPoint);
|
const QSharedPointer<VPointF> second = VAbstractTool::data.GeometricObject<VPointF>(secondPoint);
|
||||||
this->setLine(QLineF(static_cast<QPointF>(*first), static_cast<QPointF>(*second)));
|
this->setLine(QLineF(static_cast<QPointF>(*first), static_cast<QPointF>(*second)));
|
||||||
this->setPen(QPen(CorrectColor(lineColor), pen().widthF(), LineStyleToPenStyle(m_lineType)));
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,6 +64,9 @@ public:
|
||||||
enum { Type = UserType + static_cast<int>(Tool::Line)};
|
enum { Type = UserType + static_cast<int>(Tool::Line)};
|
||||||
virtual QString getTagName() const Q_DECL_OVERRIDE;
|
virtual QString getTagName() const Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
|
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||||
|
QWidget *widget = nullptr) Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
QString FirstPointName() const;
|
QString FirstPointName() const;
|
||||||
QString SecondPointName() const;
|
QString SecondPointName() const;
|
||||||
|
|
||||||
|
@ -83,7 +86,6 @@ public:
|
||||||
public slots:
|
public slots:
|
||||||
virtual void FullUpdateFromFile() Q_DECL_OVERRIDE;
|
virtual void FullUpdateFromFile() Q_DECL_OVERRIDE;
|
||||||
virtual void ShowTool(quint32 id, bool enable) Q_DECL_OVERRIDE;
|
virtual void ShowTool(quint32 id, bool enable) Q_DECL_OVERRIDE;
|
||||||
virtual void SetFactor(qreal factor) Q_DECL_OVERRIDE;
|
|
||||||
virtual void Disable(bool disable, const QString &namePP) Q_DECL_OVERRIDE;
|
virtual void Disable(bool disable, const QString &namePP) Q_DECL_OVERRIDE;
|
||||||
virtual void AllowHover(bool enabled) Q_DECL_OVERRIDE;
|
virtual void AllowHover(bool enabled) Q_DECL_OVERRIDE;
|
||||||
virtual void AllowSelecting(bool enabled) Q_DECL_OVERRIDE;
|
virtual void AllowSelecting(bool enabled) Q_DECL_OVERRIDE;
|
||||||
|
@ -112,6 +114,8 @@ private:
|
||||||
/** @brief lineColor color of a line. */
|
/** @brief lineColor color of a line. */
|
||||||
QString lineColor;
|
QString lineColor;
|
||||||
|
|
||||||
|
bool m_isHovered;
|
||||||
|
|
||||||
VToolLine(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 firstPoint, quint32 secondPoint,
|
VToolLine(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 firstPoint, quint32 secondPoint,
|
||||||
const QString &typeLine, const QString &lineColor, const Source &typeCreation,
|
const QString &typeLine, const QString &lineColor, const Source &typeCreation,
|
||||||
QGraphicsItem * parent = nullptr);
|
QGraphicsItem * parent = nullptr);
|
||||||
|
|
|
@ -62,7 +62,6 @@ VAbstractNode::VAbstractNode(VAbstractPattern *doc, VContainer *data, const quin
|
||||||
parentType(ParentType::Item),
|
parentType(ParentType::Item),
|
||||||
idNode(idNode),
|
idNode(idNode),
|
||||||
idTool(idTool),
|
idTool(idTool),
|
||||||
currentColor(Qt::black),
|
|
||||||
m_drawName(drawName),
|
m_drawName(drawName),
|
||||||
m_exluded(false)
|
m_exluded(false)
|
||||||
{
|
{
|
||||||
|
|
|
@ -73,9 +73,6 @@ protected:
|
||||||
/** @brief idTool id tool. */
|
/** @brief idTool id tool. */
|
||||||
quint32 idTool;
|
quint32 idTool;
|
||||||
|
|
||||||
/** @brief currentColor current tool color. */
|
|
||||||
QColor currentColor;
|
|
||||||
|
|
||||||
QString m_drawName;
|
QString m_drawName;
|
||||||
|
|
||||||
bool m_exluded;
|
bool m_exluded;
|
||||||
|
|
|
@ -71,24 +71,16 @@ const QString VNodePoint::ToolType = QStringLiteral("modeling");
|
||||||
*/
|
*/
|
||||||
VNodePoint::VNodePoint(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 idPoint, const Source &typeCreation,
|
VNodePoint::VNodePoint(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 idPoint, const Source &typeCreation,
|
||||||
const QString &drawName, const quint32 &idTool, QObject *qoParent, QGraphicsItem *parent)
|
const QString &drawName, const quint32 &idTool, QObject *qoParent, QGraphicsItem *parent)
|
||||||
:VAbstractNode(doc, data, id, idPoint, drawName, idTool, qoParent), QGraphicsEllipseItem(parent), radius(0),
|
: VAbstractNode(doc, data, id, idPoint, drawName, idTool, qoParent),
|
||||||
namePoint(nullptr), lineName(nullptr)
|
VScenePoint(parent)
|
||||||
{
|
{
|
||||||
radius = ToPixel(DefPointRadius/*mm*/, Unit::Mm);
|
connect(m_namePoint, &VGraphicsSimpleTextItem::PointChoosed, this, &VNodePoint::PointChoosed);
|
||||||
namePoint = new VGraphicsSimpleTextItem(this);
|
connect(m_namePoint, &VGraphicsSimpleTextItem::NameChangePosition, this, &VNodePoint::NameChangePosition);
|
||||||
connect(namePoint, &VGraphicsSimpleTextItem::PointChoosed, this, &VNodePoint::PointChoosed);
|
connect(m_namePoint, &VGraphicsSimpleTextItem::ShowContextMenu,
|
||||||
lineName = new QGraphicsLineItem(this);
|
|
||||||
connect(namePoint, &VGraphicsSimpleTextItem::NameChangePosition, this,
|
|
||||||
&VNodePoint::NameChangePosition);
|
|
||||||
connect(namePoint, &VGraphicsSimpleTextItem::ShowContextMenu,
|
|
||||||
this, [this](QGraphicsSceneContextMenuEvent *event)
|
this, [this](QGraphicsSceneContextMenuEvent *event)
|
||||||
{
|
{
|
||||||
emit ShowContextMenu(event);
|
emit ShowContextMenu(event);
|
||||||
});
|
});
|
||||||
this->setPen(QPen(Qt::black, qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))));
|
|
||||||
this->setBrush(QBrush(Qt::NoBrush));
|
|
||||||
this->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
|
||||||
this->setAcceptHoverEvents(true);
|
|
||||||
RefreshPointGeometry(*VAbstractTool::data.GeometricObject<VPointF>(id));
|
RefreshPointGeometry(*VAbstractTool::data.GeometricObject<VPointF>(id));
|
||||||
ToolCreation(typeCreation);
|
ToolCreation(typeCreation);
|
||||||
}
|
}
|
||||||
|
@ -234,28 +226,6 @@ void VNodePoint::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||||
QGraphicsEllipseItem::mouseReleaseEvent(event);
|
QGraphicsEllipseItem::mouseReleaseEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief hoverMoveEvent handle hover move events.
|
|
||||||
* @param event hover move event.
|
|
||||||
*/
|
|
||||||
void VNodePoint::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
|
||||||
{
|
|
||||||
Q_UNUSED(event)
|
|
||||||
this->setPen(QPen(currentColor, qApp->toPixel(WidthMainLine(*VAbstractTool::data.GetPatternUnit()))));
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief hoverLeaveEvent handle hover leave events.
|
|
||||||
* @param event hover leave event.
|
|
||||||
*/
|
|
||||||
void VNodePoint::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
|
||||||
{
|
|
||||||
Q_UNUSED(event)
|
|
||||||
this->setPen(QPen(currentColor, qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))));
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief NameChangePosition label change position.
|
* @brief NameChangePosition label change position.
|
||||||
|
@ -289,35 +259,6 @@ void VNodePoint::UpdateNamePosition(qreal mx, qreal my)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief RefreshPointGeometry refresh point on scene.
|
|
||||||
* @param point point position.
|
|
||||||
*/
|
|
||||||
void VNodePoint::RefreshPointGeometry(const VPointF &point)
|
|
||||||
{
|
|
||||||
QRectF rec = QRectF(0, 0, radius*2, radius*2);
|
|
||||||
rec.translate(-rec.center().x(), -rec.center().y());
|
|
||||||
this->setRect(rec);
|
|
||||||
this->setPos(static_cast<QPointF>(point));
|
|
||||||
|
|
||||||
namePoint->blockSignals(true);
|
|
||||||
namePoint->setText(point.name());
|
|
||||||
namePoint->setPos(QPointF(point.mx(), point.my()));
|
|
||||||
namePoint->blockSignals(false);
|
|
||||||
|
|
||||||
RefreshLine();
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief RefreshLine refresh label line on scene.
|
|
||||||
*/
|
|
||||||
void VNodePoint::RefreshLine()
|
|
||||||
{
|
|
||||||
VAbstractTool::RefreshLine(this, namePoint, lineName, radius);
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VNodePoint::ShowNode()
|
void VNodePoint::ShowNode()
|
||||||
{
|
{
|
||||||
|
@ -336,7 +277,7 @@ void VNodePoint::HideNode()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VNodePoint::EnableToolMove(bool move)
|
void VNodePoint::EnableToolMove(bool move)
|
||||||
{
|
{
|
||||||
namePoint->setFlag(QGraphicsItem::ItemIsMovable, move);
|
m_namePoint->setFlag(QGraphicsItem::ItemIsMovable, move);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -354,11 +295,11 @@ void VNodePoint::AllowSelecting(bool enabled)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VNodePoint::AllowLabelHover(bool enabled)
|
void VNodePoint::AllowLabelHover(bool enabled)
|
||||||
{
|
{
|
||||||
namePoint->setAcceptHoverEvents(enabled);
|
m_namePoint->setAcceptHoverEvents(enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VNodePoint::AllowLabelSelecting(bool enabled)
|
void VNodePoint::AllowLabelSelecting(bool enabled)
|
||||||
{
|
{
|
||||||
namePoint->setFlag(QGraphicsItem::ItemIsSelectable, enabled);
|
m_namePoint->setFlag(QGraphicsItem::ItemIsSelectable, enabled);
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,11 +41,12 @@
|
||||||
#include "../ifc/xml/vabstractpattern.h"
|
#include "../ifc/xml/vabstractpattern.h"
|
||||||
#include "../vmisc/def.h"
|
#include "../vmisc/def.h"
|
||||||
#include "vabstractnode.h"
|
#include "vabstractnode.h"
|
||||||
|
#include "../vwidgets/vscenepoint.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The VNodePoint class point detail node.
|
* @brief The VNodePoint class point detail node.
|
||||||
*/
|
*/
|
||||||
class VNodePoint: public VAbstractNode, public QGraphicsEllipseItem
|
class VNodePoint: public VAbstractNode, public VScenePoint
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
@ -75,24 +76,11 @@ public slots:
|
||||||
void AllowLabelHover(bool enabled);
|
void AllowLabelHover(bool enabled);
|
||||||
void AllowLabelSelecting(bool enabled);
|
void AllowLabelSelecting(bool enabled);
|
||||||
protected:
|
protected:
|
||||||
/** @brief radius radius circle. */
|
|
||||||
qreal radius;
|
|
||||||
|
|
||||||
/** @brief namePoint label name. */
|
|
||||||
VGraphicsSimpleTextItem *namePoint;
|
|
||||||
|
|
||||||
/** @brief lineName pointer to label line. */
|
|
||||||
QGraphicsLineItem *lineName;
|
|
||||||
|
|
||||||
virtual void AddToFile() Q_DECL_OVERRIDE;
|
virtual void AddToFile() Q_DECL_OVERRIDE;
|
||||||
virtual void RefreshDataInFile() Q_DECL_OVERRIDE;
|
virtual void RefreshDataInFile() Q_DECL_OVERRIDE;
|
||||||
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
|
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
|
||||||
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ) Q_DECL_OVERRIDE;
|
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ) Q_DECL_OVERRIDE;
|
||||||
virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ) Q_DECL_OVERRIDE;
|
|
||||||
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ) Q_DECL_OVERRIDE;
|
|
||||||
virtual void UpdateNamePosition(qreal mx, qreal my);
|
virtual void UpdateNamePosition(qreal mx, qreal my);
|
||||||
virtual void RefreshPointGeometry(const VPointF &point);
|
|
||||||
void RefreshLine();
|
|
||||||
virtual void ShowNode() Q_DECL_OVERRIDE;
|
virtual void ShowNode() Q_DECL_OVERRIDE;
|
||||||
virtual void HideNode() Q_DECL_OVERRIDE;
|
virtual void HideNode() Q_DECL_OVERRIDE;
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -112,6 +112,25 @@ QString VToolPiecePath::getTagName() const
|
||||||
return VAbstractPattern::TagPath;
|
return VAbstractPattern::TagPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VToolPiecePath::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||||
|
{
|
||||||
|
qreal width = widthHairLine;
|
||||||
|
|
||||||
|
const qreal scale = SceneScale(scene());
|
||||||
|
if (scale > 1)
|
||||||
|
{
|
||||||
|
width = qMax(1., width/scale);
|
||||||
|
}
|
||||||
|
|
||||||
|
QPen toolPen = pen();
|
||||||
|
toolPen.setWidthF(width);
|
||||||
|
|
||||||
|
setPen(toolPen);
|
||||||
|
|
||||||
|
QGraphicsPathItem::paint(painter, option, widget);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolPiecePath::incrementReferens()
|
void VToolPiecePath::incrementReferens()
|
||||||
{
|
{
|
||||||
|
|
|
@ -50,6 +50,9 @@ public:
|
||||||
enum { Type = UserType + static_cast<int>(Tool::PiecePath)};
|
enum { Type = UserType + static_cast<int>(Tool::PiecePath)};
|
||||||
virtual QString getTagName() const Q_DECL_OVERRIDE;
|
virtual QString getTagName() const Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
|
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||||
|
QWidget *widget = nullptr) Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
virtual void incrementReferens() Q_DECL_OVERRIDE;
|
virtual void incrementReferens() Q_DECL_OVERRIDE;
|
||||||
virtual void decrementReferens() Q_DECL_OVERRIDE;
|
virtual void decrementReferens() Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
|
|
|
@ -121,7 +121,10 @@ quint32 CreateNodeSplinePath(VContainer *data, quint32 id)
|
||||||
* @param parent parent object.
|
* @param parent parent object.
|
||||||
*/
|
*/
|
||||||
VAbstractTool::VAbstractTool(VAbstractPattern *doc, VContainer *data, quint32 id, QObject *parent)
|
VAbstractTool::VAbstractTool(VAbstractPattern *doc, VContainer *data, quint32 id, QObject *parent)
|
||||||
:VDataTool(data, parent), doc(doc), id(id), baseColor(Qt::black), vis(),
|
:VDataTool(data, parent),
|
||||||
|
doc(doc),
|
||||||
|
id(id),
|
||||||
|
vis(),
|
||||||
selectionType(SelectionType::ByMouseRelease)
|
selectionType(SelectionType::ByMouseRelease)
|
||||||
{
|
{
|
||||||
SCASSERT(doc != nullptr)
|
SCASSERT(doc != nullptr)
|
||||||
|
@ -470,43 +473,6 @@ void VAbstractTool::AddNodes(VAbstractPattern *doc, QDomElement &domElement, con
|
||||||
AddNodes(doc, domElement, piece.GetPath());
|
AddNodes(doc, domElement, piece.GetPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief RefreshLine refresh line to label on scene.
|
|
||||||
*/
|
|
||||||
void VAbstractTool::RefreshLine(QGraphicsEllipseItem *point, VGraphicsSimpleTextItem *namePoint,
|
|
||||||
QGraphicsLineItem *lineName, const qreal radius)
|
|
||||||
{
|
|
||||||
SCASSERT(point != nullptr)
|
|
||||||
SCASSERT(namePoint != nullptr)
|
|
||||||
SCASSERT(lineName != nullptr)
|
|
||||||
|
|
||||||
QRectF nRec = namePoint->sceneBoundingRect();
|
|
||||||
nRec.translate(- point->scenePos());
|
|
||||||
if (point->rect().intersects(nRec) == false)
|
|
||||||
{
|
|
||||||
const QRectF nameRec = namePoint->sceneBoundingRect();
|
|
||||||
QPointF p1, p2;
|
|
||||||
VGObject::LineIntersectCircle(QPointF(), radius, QLineF(QPointF(), nameRec.center() - point->scenePos()), p1,
|
|
||||||
p2);
|
|
||||||
const QPointF pRec = VGObject::LineIntersectRect(nameRec, QLineF(point->scenePos(), nameRec.center()));
|
|
||||||
lineName->setLine(QLineF(p1, pRec - point->scenePos()));
|
|
||||||
|
|
||||||
if (QLineF(p1, pRec - point->scenePos()).length() <= ToPixel(4, Unit::Mm))
|
|
||||||
{
|
|
||||||
lineName->setVisible(false);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
lineName->setVisible(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
lineName->setVisible(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QDomElement VAbstractTool::AddSANode(VAbstractPattern *doc, const QString &tagName, const VPieceNode &node)
|
QDomElement VAbstractTool::AddSANode(VAbstractPattern *doc, const QString &tagName, const VPieceNode &node)
|
||||||
{
|
{
|
||||||
|
|
|
@ -111,9 +111,6 @@ protected:
|
||||||
/** @brief id object id. */
|
/** @brief id object id. */
|
||||||
const quint32 id;
|
const quint32 id;
|
||||||
|
|
||||||
/** @brief baseColor base color for tool. */
|
|
||||||
Qt::GlobalColor baseColor;
|
|
||||||
|
|
||||||
QPointer<Visualization> vis;
|
QPointer<Visualization> vis;
|
||||||
SelectionType selectionType;
|
SelectionType selectionType;
|
||||||
|
|
||||||
|
@ -138,9 +135,6 @@ protected:
|
||||||
virtual void SetVisualization()=0;
|
virtual void SetVisualization()=0;
|
||||||
virtual void ToolCreation(const Source &typeCreation);
|
virtual void ToolCreation(const Source &typeCreation);
|
||||||
|
|
||||||
static void RefreshLine(QGraphicsEllipseItem *point, VGraphicsSimpleTextItem *namePoint,
|
|
||||||
QGraphicsLineItem *lineName, const qreal radius);
|
|
||||||
|
|
||||||
static QDomElement AddSANode(VAbstractPattern *doc, const QString &tagName, const VPieceNode &node);
|
static QDomElement AddSANode(VAbstractPattern *doc, const QString &tagName, const VPieceNode &node);
|
||||||
static void AddNode(VAbstractPattern *doc, QDomElement &domElement, const VPieceNode &node);
|
static void AddNode(VAbstractPattern *doc, QDomElement &domElement, const VPieceNode &node);
|
||||||
|
|
||||||
|
@ -179,7 +173,6 @@ inline void VAbstractTool::AddVisualization()
|
||||||
T *visual = new T(getData());
|
T *visual = new T(getData());
|
||||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||||
SCASSERT(scene != nullptr)
|
SCASSERT(scene != nullptr)
|
||||||
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
|
||||||
scene->addItem(visual);
|
scene->addItem(visual);
|
||||||
|
|
||||||
connect(visual, &Visualization::ToolTip, this, &VAbstractTool::ToolTip);
|
connect(visual, &Visualization::ToolTip, this, &VAbstractTool::ToolTip);
|
||||||
|
|
|
@ -788,6 +788,12 @@ void VToolSeamAllowance::SaveRotateGrainline(qreal dRot, const QPointF& ptPos)
|
||||||
*/
|
*/
|
||||||
void VToolSeamAllowance::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
void VToolSeamAllowance::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||||
{
|
{
|
||||||
|
QPen toolPen = pen();
|
||||||
|
toolPen.setWidthF(ScaleWidth(widthHairLine, SceneScale(scene())));
|
||||||
|
|
||||||
|
setPen(toolPen);
|
||||||
|
m_seamAllowance->setPen(toolPen);
|
||||||
|
|
||||||
if ((m_dataLabel->IsIdle() == false
|
if ((m_dataLabel->IsIdle() == false
|
||||||
|| m_patternInfo->IsIdle() == false
|
|| m_patternInfo->IsIdle() == false
|
||||||
|| m_grainLine->IsIdle() == false) && not isSelected())
|
|| m_grainLine->IsIdle() == false) && not isSelected())
|
||||||
|
@ -979,22 +985,22 @@ void VToolSeamAllowance::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolSeamAllowance::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
void VToolSeamAllowance::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
||||||
{
|
{
|
||||||
Q_UNUSED(event);
|
|
||||||
if (flags() & QGraphicsItem::ItemIsMovable)
|
if (flags() & QGraphicsItem::ItemIsMovable)
|
||||||
{
|
{
|
||||||
SetOverrideCursor(cursorArrowOpenHand, 1, 1);
|
SetOverrideCursor(cursorArrowOpenHand, 1, 1);
|
||||||
}
|
}
|
||||||
|
QGraphicsPathItem::hoverEnterEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolSeamAllowance::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
void VToolSeamAllowance::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||||
{
|
{
|
||||||
Q_UNUSED(event);
|
|
||||||
//Disable cursor-arrow-openhand
|
//Disable cursor-arrow-openhand
|
||||||
if (flags() & QGraphicsItem::ItemIsMovable)
|
if (flags() & QGraphicsItem::ItemIsMovable)
|
||||||
{
|
{
|
||||||
RestoreOverrideCursor(cursorArrowOpenHand);
|
RestoreOverrideCursor(cursorArrowOpenHand);
|
||||||
}
|
}
|
||||||
|
QGraphicsPathItem::hoverLeaveEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -94,6 +94,8 @@ public:
|
||||||
virtual QString getTagName() const Q_DECL_OVERRIDE;
|
virtual QString getTagName() const Q_DECL_OVERRIDE;
|
||||||
virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE;
|
virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE;
|
||||||
virtual void GroupVisibility(quint32 object, bool visible) Q_DECL_OVERRIDE;
|
virtual void GroupVisibility(quint32 object, bool visible) Q_DECL_OVERRIDE;
|
||||||
|
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||||
|
QWidget *widget) Q_DECL_OVERRIDE;
|
||||||
public slots:
|
public slots:
|
||||||
virtual void FullUpdateFromFile () Q_DECL_OVERRIDE;
|
virtual void FullUpdateFromFile () Q_DECL_OVERRIDE;
|
||||||
void EnableToolMove(bool move);
|
void EnableToolMove(bool move);
|
||||||
|
@ -117,8 +119,6 @@ protected slots:
|
||||||
void SaveResizeGrainline(qreal dLength);
|
void SaveResizeGrainline(qreal dLength);
|
||||||
void SaveRotateGrainline(qreal dRot, const QPointF& ptPos);
|
void SaveRotateGrainline(qreal dRot, const QPointF& ptPos);
|
||||||
protected:
|
protected:
|
||||||
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
|
||||||
QWidget *widget) Q_DECL_OVERRIDE;
|
|
||||||
virtual void AddToFile () Q_DECL_OVERRIDE;
|
virtual void AddToFile () Q_DECL_OVERRIDE;
|
||||||
virtual void RefreshDataInFile() Q_DECL_OVERRIDE;
|
virtual void RefreshDataInFile() Q_DECL_OVERRIDE;
|
||||||
virtual QVariant itemChange ( GraphicsItemChange change, const QVariant &value ) Q_DECL_OVERRIDE;
|
virtual QVariant itemChange ( GraphicsItemChange change, const QVariant &value ) Q_DECL_OVERRIDE;
|
||||||
|
|
|
@ -77,7 +77,7 @@ void VisOperation::VisualMode(const quint32 &pointId)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QGraphicsEllipseItem *VisOperation::GetPoint(quint32 i, const QColor &color)
|
QGraphicsEllipseItem *VisOperation::GetPoint(quint32 i, const QColor &color)
|
||||||
{
|
{
|
||||||
return GetPointItem(Visualization::data, factor, points, i, color, this);
|
return GetPointItem(points, i, color, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -38,11 +38,6 @@ VisToolFlippingByAxis::VisToolFlippingByAxis(const VContainer *data, QGraphicsIt
|
||||||
point1 = InitPoint(supportColor2, this);
|
point1 = InitPoint(supportColor2, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
VisToolFlippingByAxis::~VisToolFlippingByAxis()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VisToolFlippingByAxis::RefreshGeometry()
|
void VisToolFlippingByAxis::RefreshGeometry()
|
||||||
{
|
{
|
||||||
|
@ -85,3 +80,21 @@ void VisToolFlippingByAxis::SetAxisType(AxisType value)
|
||||||
{
|
{
|
||||||
m_axisType = value;
|
m_axisType = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VisToolFlippingByAxis::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||||
|
{
|
||||||
|
const qreal scale = SceneScale(scene());
|
||||||
|
|
||||||
|
ScalePoint(point1, scale);
|
||||||
|
|
||||||
|
VisOperation::paint(painter, option, widget);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QRectF VisToolFlippingByAxis::boundingRect() const
|
||||||
|
{
|
||||||
|
QRectF rect = VisOperation::boundingRect();
|
||||||
|
rect = rect.united(point1->boundingRect());
|
||||||
|
return rect;
|
||||||
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ class VisToolFlippingByAxis : public VisOperation
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit VisToolFlippingByAxis(const VContainer *data, QGraphicsItem *parent = nullptr);
|
explicit VisToolFlippingByAxis(const VContainer *data, QGraphicsItem *parent = nullptr);
|
||||||
virtual ~VisToolFlippingByAxis();
|
virtual ~VisToolFlippingByAxis() = default;
|
||||||
|
|
||||||
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
|
@ -48,6 +48,10 @@ public:
|
||||||
|
|
||||||
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
||||||
enum { Type = UserType + static_cast<int>(Vis::ToolFlippingByAxis)};
|
enum { Type = UserType + static_cast<int>(Vis::ToolFlippingByAxis)};
|
||||||
|
|
||||||
|
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||||
|
QWidget *widget = nullptr) Q_DECL_OVERRIDE;
|
||||||
|
virtual QRectF boundingRect() const Q_DECL_OVERRIDE;
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VisToolFlippingByAxis)
|
Q_DISABLE_COPY(VisToolFlippingByAxis)
|
||||||
|
|
||||||
|
|
|
@ -40,11 +40,6 @@ VisToolFlippingByLine::VisToolFlippingByLine(const VContainer *data, QGraphicsIt
|
||||||
point2 = InitPoint(supportColor2, this);
|
point2 = InitPoint(supportColor2, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
VisToolFlippingByLine::~VisToolFlippingByLine()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VisToolFlippingByLine::RefreshGeometry()
|
void VisToolFlippingByLine::RefreshGeometry()
|
||||||
{
|
{
|
||||||
|
@ -77,6 +72,26 @@ void VisToolFlippingByLine::RefreshGeometry()
|
||||||
RefreshFlippedObjects(firstPoint, secondPoint);
|
RefreshFlippedObjects(firstPoint, secondPoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VisToolFlippingByLine::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||||
|
{
|
||||||
|
const qreal scale = SceneScale(scene());
|
||||||
|
|
||||||
|
ScalePoint(point1, scale);
|
||||||
|
ScalePoint(point2, scale);
|
||||||
|
|
||||||
|
VisOperation::paint(painter, option, widget);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QRectF VisToolFlippingByLine::boundingRect() const
|
||||||
|
{
|
||||||
|
QRectF rect = VisOperation::boundingRect();
|
||||||
|
rect = rect.united(point1->boundingRect());
|
||||||
|
rect = rect.united(point2->boundingRect());
|
||||||
|
return rect;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VisToolFlippingByLine::SetFirstLinePointId(quint32 value)
|
void VisToolFlippingByLine::SetFirstLinePointId(quint32 value)
|
||||||
{
|
{
|
||||||
|
|
|
@ -38,9 +38,12 @@ class VisToolFlippingByLine : public VisOperation
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit VisToolFlippingByLine(const VContainer *data, QGraphicsItem *parent = nullptr);
|
explicit VisToolFlippingByLine(const VContainer *data, QGraphicsItem *parent = nullptr);
|
||||||
virtual ~VisToolFlippingByLine();
|
virtual ~VisToolFlippingByLine() = default;
|
||||||
|
|
||||||
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
||||||
|
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||||
|
QWidget *widget = nullptr) Q_DECL_OVERRIDE;
|
||||||
|
virtual QRectF boundingRect() const Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
void SetFirstLinePointId(quint32 value);
|
void SetFirstLinePointId(quint32 value);
|
||||||
void SetSecondLinePointId(quint32 value);
|
void SetSecondLinePointId(quint32 value);
|
||||||
|
|
|
@ -128,6 +128,26 @@ void VisToolMove::RefreshGeometry()
|
||||||
CreateMovedObjects(iPoint, iCurve, tempLength, tempAngle);
|
CreateMovedObjects(iPoint, iCurve, tempLength, tempAngle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VisToolMove::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||||
|
{
|
||||||
|
const qreal scale = SceneScale(scene());
|
||||||
|
|
||||||
|
ScalePoint(pointOrigin, scale);
|
||||||
|
ScalePoint(pointFinish, scale);
|
||||||
|
|
||||||
|
VisOperation::paint(painter, option, widget);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QRectF VisToolMove::boundingRect() const
|
||||||
|
{
|
||||||
|
QRectF rect = VisOperation::boundingRect();
|
||||||
|
rect = rect.united(pointOrigin->boundingRect());
|
||||||
|
rect = rect.united(pointFinish->boundingRect());
|
||||||
|
return rect;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VisToolMove::Angle() const
|
QString VisToolMove::Angle() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -50,7 +50,10 @@ public:
|
||||||
explicit VisToolMove(const VContainer *data, QGraphicsItem *parent = nullptr);
|
explicit VisToolMove(const VContainer *data, QGraphicsItem *parent = nullptr);
|
||||||
virtual ~VisToolMove();
|
virtual ~VisToolMove();
|
||||||
|
|
||||||
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
||||||
|
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||||
|
QWidget *widget = nullptr) Q_DECL_OVERRIDE;
|
||||||
|
virtual QRectF boundingRect() const Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
QString Angle() const;
|
QString Angle() const;
|
||||||
void SetAngle(const QString &expression);
|
void SetAngle(const QString &expression);
|
||||||
|
|
|
@ -116,7 +116,7 @@ void VisToolRotation::RefreshGeometry()
|
||||||
DrawLine(xAxis, QLineF(static_cast<QPointF>(*origin), Ray(static_cast<QPointF>(*origin), 0)), supportColor2,
|
DrawLine(xAxis, QLineF(static_cast<QPointF>(*origin), Ray(static_cast<QPointF>(*origin), 0)), supportColor2,
|
||||||
Qt::DashLine);
|
Qt::DashLine);
|
||||||
|
|
||||||
VArc arc(*origin, ToPixel(DefPointRadius/*mm*/*2, Unit::Mm), 0, tempAngle);
|
VArc arc(*origin, defPointRadiusPixel*2, 0, tempAngle);
|
||||||
DrawPath(angleArc, arc.GetPath(PathDirection::Hide), supportColor2, Qt::SolidLine, Qt::RoundCap);
|
DrawPath(angleArc, arc.GetPath(PathDirection::Hide), supportColor2, Qt::SolidLine, Qt::RoundCap);
|
||||||
|
|
||||||
Visualization::toolTip = tr("Rotating angle = %1°, <b>Shift</b> - sticking angle, "
|
Visualization::toolTip = tr("Rotating angle = %1°, <b>Shift</b> - sticking angle, "
|
||||||
|
@ -188,9 +188,30 @@ void VisToolRotation::RefreshGeometry()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QT_WARNING_POP
|
QT_WARNING_POP
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VisToolRotation::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||||
|
{
|
||||||
|
const qreal scale = SceneScale(scene());
|
||||||
|
|
||||||
|
ScalePoint(point, scale);
|
||||||
|
ScalePenWidth(angleArc, scale);
|
||||||
|
ScalePenWidth(xAxis, scale);
|
||||||
|
|
||||||
|
VisOperation::paint(painter, option, widget);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QRectF VisToolRotation::boundingRect() const
|
||||||
|
{
|
||||||
|
QRectF rect = VisOperation::boundingRect();
|
||||||
|
rect = rect.united(point->boundingRect());
|
||||||
|
rect = rect.united(angleArc->boundingRect());
|
||||||
|
rect = rect.united(xAxis->boundingRect());
|
||||||
|
return rect;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VisToolRotation::SetOriginPointId(quint32 value)
|
void VisToolRotation::SetOriginPointId(quint32 value)
|
||||||
{
|
{
|
||||||
|
|
|
@ -50,7 +50,10 @@ public:
|
||||||
explicit VisToolRotation(const VContainer *data, QGraphicsItem *parent = nullptr);
|
explicit VisToolRotation(const VContainer *data, QGraphicsItem *parent = nullptr);
|
||||||
virtual ~VisToolRotation();
|
virtual ~VisToolRotation();
|
||||||
|
|
||||||
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
||||||
|
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||||
|
QWidget *widget = nullptr) Q_DECL_OVERRIDE;
|
||||||
|
virtual QRectF boundingRect() const Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
void SetOriginPointId(quint32 value);
|
void SetOriginPointId(quint32 value);
|
||||||
|
|
||||||
|
|
|
@ -47,10 +47,6 @@ VisLine::VisLine(const VContainer *data, QGraphicsItem *parent)
|
||||||
InitPen();
|
InitPen();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
VisLine::~VisLine()
|
|
||||||
{}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
qreal VisLine::CorrectAngle(const qreal &angle)
|
qreal VisLine::CorrectAngle(const qreal &angle)
|
||||||
{
|
{
|
||||||
|
@ -82,6 +78,14 @@ qreal VisLine::CorrectAngle(const qreal &angle)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VisLine::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||||
|
{
|
||||||
|
ScalePenWidth(this, SceneScale(scene()));
|
||||||
|
|
||||||
|
QGraphicsLineItem::paint(painter, option, widget);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QPointF VisLine::Ray(const QPointF &firstPoint, const qreal &angle) const
|
QPointF VisLine::Ray(const QPointF &firstPoint, const qreal &angle) const
|
||||||
{
|
{
|
||||||
|
@ -138,8 +142,11 @@ QLineF VisLine::Axis(const QPointF &p1, const QPointF &p2) const
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VisLine::InitPen()
|
void VisLine::InitPen()
|
||||||
{
|
{
|
||||||
this->setPen(QPen(mainColor, qApp->toPixel(WidthHairLine(*Visualization::data->GetPatternUnit()))/factor,
|
QPen visPen = pen();
|
||||||
lineStyle));
|
visPen.setColor(mainColor);
|
||||||
|
visPen.setStyle(lineStyle);
|
||||||
|
|
||||||
|
setPen(visPen);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -48,12 +48,15 @@ class VisLine: public Visualization, public QGraphicsLineItem
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit VisLine(const VContainer *data, QGraphicsItem *parent = 0);
|
explicit VisLine(const VContainer *data, QGraphicsItem *parent = nullptr);
|
||||||
virtual ~VisLine() Q_DECL_OVERRIDE;
|
virtual ~VisLine() = default;
|
||||||
|
|
||||||
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
||||||
enum { Type = UserType + static_cast<int>(Vis::Line)};
|
enum { Type = UserType + static_cast<int>(Vis::Line)};
|
||||||
static qreal CorrectAngle(const qreal &angle);
|
static qreal CorrectAngle(const qreal &angle);
|
||||||
|
|
||||||
|
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||||
|
QWidget *widget = nullptr) Q_DECL_OVERRIDE;
|
||||||
protected:
|
protected:
|
||||||
QPointF Ray(const QPointF &firstPoint, const qreal &angle) const;
|
QPointF Ray(const QPointF &firstPoint, const qreal &angle) const;
|
||||||
QPointF Ray(const QPointF &firstPoint) const;
|
QPointF Ray(const QPointF &firstPoint) const;
|
||||||
|
|
|
@ -57,10 +57,6 @@ VisToolAlongLine::VisToolAlongLine(const VContainer *data, QGraphicsItem *parent
|
||||||
point = InitPoint(mainColor, this);
|
point = InitPoint(mainColor, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
VisToolAlongLine::~VisToolAlongLine()
|
|
||||||
{}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VisToolAlongLine::setObject2Id(const quint32 &value)
|
void VisToolAlongLine::setObject2Id(const quint32 &value)
|
||||||
{
|
{
|
||||||
|
@ -73,6 +69,30 @@ void VisToolAlongLine::setLength(const QString &expression)
|
||||||
length = FindLength(expression, Visualization::data->PlainVariables());
|
length = FindLength(expression, Visualization::data->PlainVariables());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VisToolAlongLine::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||||
|
{
|
||||||
|
const qreal scale = SceneScale(scene());
|
||||||
|
|
||||||
|
ScalePoint(point, scale);
|
||||||
|
ScalePoint(lineP1, scale);
|
||||||
|
ScalePoint(lineP2, scale);
|
||||||
|
ScalePenWidth(line, scale);
|
||||||
|
|
||||||
|
VisLine::paint(painter, option, widget);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QRectF VisToolAlongLine::boundingRect() const
|
||||||
|
{
|
||||||
|
QRectF rect = VisLine::boundingRect();
|
||||||
|
rect = rect.united(point->boundingRect());
|
||||||
|
rect = rect.united(lineP1->boundingRect());
|
||||||
|
rect = rect.united(lineP2->boundingRect());
|
||||||
|
rect = rect.united(line->boundingRect());
|
||||||
|
return rect;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VisToolAlongLine::RefreshGeometry()
|
void VisToolAlongLine::RefreshGeometry()
|
||||||
{
|
{
|
||||||
|
|
|
@ -43,14 +43,18 @@ class VisToolAlongLine :public VisLine
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit VisToolAlongLine(const VContainer *data, QGraphicsItem *parent = 0);
|
explicit VisToolAlongLine(const VContainer *data, QGraphicsItem *parent = nullptr);
|
||||||
virtual ~VisToolAlongLine() Q_DECL_OVERRIDE;
|
virtual ~VisToolAlongLine() = default;
|
||||||
|
|
||||||
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
||||||
void setObject2Id(const quint32 &value);
|
void setObject2Id(const quint32 &value);
|
||||||
void setLength(const QString &expression);
|
void setLength(const QString &expression);
|
||||||
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
||||||
enum { Type = UserType + static_cast<int>(Vis::ToolAlongLine)};
|
enum { Type = UserType + static_cast<int>(Vis::ToolAlongLine)};
|
||||||
|
|
||||||
|
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||||
|
QWidget *widget = nullptr) Q_DECL_OVERRIDE;
|
||||||
|
virtual QRectF boundingRect() const Q_DECL_OVERRIDE;
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VisToolAlongLine)
|
Q_DISABLE_COPY(VisToolAlongLine)
|
||||||
quint32 object2Id;
|
quint32 object2Id;
|
||||||
|
|
|
@ -76,8 +76,32 @@ void VisToolBisector::setLength(const QString &expression)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VisToolBisector::~VisToolBisector()
|
void VisToolBisector::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||||
{}
|
{
|
||||||
|
const qreal scale = SceneScale(scene());
|
||||||
|
|
||||||
|
ScalePoint(point, scale);
|
||||||
|
ScalePoint(line1P1, scale);
|
||||||
|
ScalePoint(line1P2, scale);
|
||||||
|
ScalePenWidth(line1, scale);
|
||||||
|
ScalePoint(line2P2, scale);
|
||||||
|
ScalePenWidth(line2, scale);
|
||||||
|
|
||||||
|
VisLine::paint(painter, option, widget);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QRectF VisToolBisector::boundingRect() const
|
||||||
|
{
|
||||||
|
QRectF rect = VisLine::boundingRect();
|
||||||
|
rect = rect.united(point->boundingRect());
|
||||||
|
rect = rect.united(line1P1->boundingRect());
|
||||||
|
rect = rect.united(line1P2->boundingRect());
|
||||||
|
rect = rect.united(line1->boundingRect());
|
||||||
|
rect = rect.united(line2P2->boundingRect());
|
||||||
|
rect = rect.united(line2->boundingRect());
|
||||||
|
return rect;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VisToolBisector::RefreshGeometry()
|
void VisToolBisector::RefreshGeometry()
|
||||||
|
|
|
@ -43,8 +43,8 @@ class VisToolBisector :public VisLine
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit VisToolBisector(const VContainer *data, QGraphicsItem *parent = 0);
|
explicit VisToolBisector(const VContainer *data, QGraphicsItem *parent = nullptr);
|
||||||
virtual ~VisToolBisector() Q_DECL_OVERRIDE;
|
virtual ~VisToolBisector() = default;
|
||||||
|
|
||||||
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
||||||
void setObject2Id(const quint32 &value);
|
void setObject2Id(const quint32 &value);
|
||||||
|
@ -52,6 +52,10 @@ public:
|
||||||
void setLength(const QString &expression);
|
void setLength(const QString &expression);
|
||||||
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
||||||
enum { Type = UserType + static_cast<int>(Vis::ToolBisector)};
|
enum { Type = UserType + static_cast<int>(Vis::ToolBisector)};
|
||||||
|
|
||||||
|
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||||
|
QWidget *widget = nullptr) Q_DECL_OVERRIDE;
|
||||||
|
virtual QRectF boundingRect() const Q_DECL_OVERRIDE;
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VisToolBisector)
|
Q_DISABLE_COPY(VisToolBisector)
|
||||||
quint32 object2Id;
|
quint32 object2Id;
|
||||||
|
|
|
@ -60,10 +60,6 @@ VisToolCurveIntersectAxis::VisToolCurveIntersectAxis(const VContainer *data, QGr
|
||||||
point = InitPoint(mainColor, this);
|
point = InitPoint(mainColor, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
VisToolCurveIntersectAxis::~VisToolCurveIntersectAxis()
|
|
||||||
{}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VisToolCurveIntersectAxis::RefreshGeometry()
|
void VisToolCurveIntersectAxis::RefreshGeometry()
|
||||||
{
|
{
|
||||||
|
@ -117,3 +113,29 @@ void VisToolCurveIntersectAxis::setAxisPointId(const quint32 &value)
|
||||||
{
|
{
|
||||||
axisPointId = value;
|
axisPointId = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VisToolCurveIntersectAxis::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||||
|
{
|
||||||
|
const qreal scale = SceneScale(scene());
|
||||||
|
|
||||||
|
ScalePoint(point, scale);
|
||||||
|
ScalePoint(basePoint, scale);
|
||||||
|
ScalePenWidth(baseLine, scale);
|
||||||
|
ScalePenWidth(axisLine, scale);
|
||||||
|
ScalePenWidth(visCurve, scale);
|
||||||
|
|
||||||
|
VisLine::paint(painter, option, widget);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QRectF VisToolCurveIntersectAxis::boundingRect() const
|
||||||
|
{
|
||||||
|
QRectF rect = VisLine::boundingRect();
|
||||||
|
rect = rect.united(point->boundingRect());
|
||||||
|
rect = rect.united(basePoint->boundingRect());
|
||||||
|
rect = rect.united(baseLine->boundingRect());
|
||||||
|
rect = rect.united(axisLine->boundingRect());
|
||||||
|
rect = rect.united(visCurve->boundingRect());
|
||||||
|
return rect;
|
||||||
|
}
|
||||||
|
|
|
@ -43,8 +43,8 @@ class VisToolCurveIntersectAxis : public VisLine
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit VisToolCurveIntersectAxis(const VContainer *data, QGraphicsItem *parent = 0);
|
explicit VisToolCurveIntersectAxis(const VContainer *data, QGraphicsItem *parent = nullptr);
|
||||||
virtual ~VisToolCurveIntersectAxis() Q_DECL_OVERRIDE;
|
virtual ~VisToolCurveIntersectAxis() = default;
|
||||||
|
|
||||||
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
|
@ -54,6 +54,10 @@ public:
|
||||||
|
|
||||||
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
||||||
enum { Type = UserType + static_cast<int>(Vis::ToolLineIntersectAxis)};
|
enum { Type = UserType + static_cast<int>(Vis::ToolLineIntersectAxis)};
|
||||||
|
|
||||||
|
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||||
|
QWidget *widget = nullptr) Q_DECL_OVERRIDE;
|
||||||
|
virtual QRectF boundingRect() const Q_DECL_OVERRIDE;
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VisToolCurveIntersectAxis)
|
Q_DISABLE_COPY(VisToolCurveIntersectAxis)
|
||||||
quint32 axisPointId;
|
quint32 axisPointId;
|
||||||
|
|
|
@ -55,10 +55,6 @@ VisToolEndLine::VisToolEndLine(const VContainer *data, QGraphicsItem *parent)
|
||||||
point = InitPoint(mainColor, this);
|
point = InitPoint(mainColor, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
VisToolEndLine::~VisToolEndLine()
|
|
||||||
{}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VisToolEndLine::RefreshGeometry()
|
void VisToolEndLine::RefreshGeometry()
|
||||||
{
|
{
|
||||||
|
@ -114,3 +110,21 @@ void VisToolEndLine::setLength(const QString &expression)
|
||||||
{
|
{
|
||||||
length = FindLength(expression, Visualization::data->PlainVariables());
|
length = FindLength(expression, Visualization::data->PlainVariables());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VisToolEndLine::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||||
|
{
|
||||||
|
const qreal scale = SceneScale(scene());
|
||||||
|
|
||||||
|
ScalePoint(point, scale);
|
||||||
|
|
||||||
|
VisLine::paint(painter, option, widget);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QRectF VisToolEndLine::boundingRect() const
|
||||||
|
{
|
||||||
|
QRectF rect = VisLine::boundingRect();
|
||||||
|
rect = rect.united(point->boundingRect());
|
||||||
|
return rect;
|
||||||
|
}
|
||||||
|
|
|
@ -43,8 +43,8 @@ class VisToolEndLine : public VisLine
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit VisToolEndLine(const VContainer *data, QGraphicsItem *parent = 0);
|
explicit VisToolEndLine(const VContainer *data, QGraphicsItem *parent = nullptr);
|
||||||
virtual ~VisToolEndLine() Q_DECL_OVERRIDE;
|
virtual ~VisToolEndLine() = default;
|
||||||
|
|
||||||
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
|
@ -56,6 +56,10 @@ public:
|
||||||
|
|
||||||
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
||||||
enum { Type = UserType + static_cast<int>(Vis::ToolEndLine)};
|
enum { Type = UserType + static_cast<int>(Vis::ToolEndLine)};
|
||||||
|
|
||||||
|
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||||
|
QWidget *widget = nullptr) Q_DECL_OVERRIDE;
|
||||||
|
virtual QRectF boundingRect() const Q_DECL_OVERRIDE;
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VisToolEndLine)
|
Q_DISABLE_COPY(VisToolEndLine)
|
||||||
qreal length;
|
qreal length;
|
||||||
|
|
|
@ -56,10 +56,6 @@ VisToolHeight::VisToolHeight(const VContainer *data, QGraphicsItem *parent)
|
||||||
point = InitPoint(mainColor, this);
|
point = InitPoint(mainColor, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
VisToolHeight::~VisToolHeight()
|
|
||||||
{}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VisToolHeight::RefreshGeometry()
|
void VisToolHeight::RefreshGeometry()
|
||||||
{
|
{
|
||||||
|
@ -116,6 +112,34 @@ void VisToolHeight::setLineP2Id(const quint32 &value)
|
||||||
lineP2Id = value;
|
lineP2Id = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VisToolHeight::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||||
|
{
|
||||||
|
const qreal scale = SceneScale(scene());
|
||||||
|
|
||||||
|
ScalePoint(point, scale);
|
||||||
|
ScalePoint(base_point, scale);
|
||||||
|
ScalePoint(lineP1, scale);
|
||||||
|
ScalePoint(lineP2, scale);
|
||||||
|
ScalePenWidth(line, scale);
|
||||||
|
ScalePenWidth(line_intersection, scale);
|
||||||
|
|
||||||
|
VisLine::paint(painter, option, widget);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QRectF VisToolHeight::boundingRect() const
|
||||||
|
{
|
||||||
|
QRectF rect = VisLine::boundingRect();
|
||||||
|
rect = rect.united(point->boundingRect());
|
||||||
|
rect = rect.united(base_point->boundingRect());
|
||||||
|
rect = rect.united(lineP1->boundingRect());
|
||||||
|
rect = rect.united(lineP2->boundingRect());
|
||||||
|
rect = rect.united(line->boundingRect());
|
||||||
|
rect = rect.united(line_intersection->boundingRect());
|
||||||
|
return rect;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VisToolHeight::ShowIntersection(const QLineF &height_line, const QLineF &base_line)
|
void VisToolHeight::ShowIntersection(const QLineF &height_line, const QLineF &base_line)
|
||||||
{
|
{
|
||||||
|
|
|
@ -44,8 +44,8 @@ class VisToolHeight : public VisLine
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit VisToolHeight(const VContainer *data, QGraphicsItem *parent = 0);
|
explicit VisToolHeight(const VContainer *data, QGraphicsItem *parent = nullptr);
|
||||||
virtual ~VisToolHeight() Q_DECL_OVERRIDE;
|
virtual ~VisToolHeight() = default;
|
||||||
|
|
||||||
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
|
@ -53,6 +53,10 @@ public:
|
||||||
void setLineP2Id(const quint32 &value);
|
void setLineP2Id(const quint32 &value);
|
||||||
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
||||||
enum { Type = UserType + static_cast<int>(Vis::ToolHeight)};
|
enum { Type = UserType + static_cast<int>(Vis::ToolHeight)};
|
||||||
|
|
||||||
|
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||||
|
QWidget *widget = nullptr) Q_DECL_OVERRIDE;
|
||||||
|
virtual QRectF boundingRect() const Q_DECL_OVERRIDE;
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VisToolHeight)
|
Q_DISABLE_COPY(VisToolHeight)
|
||||||
//base point in parent class
|
//base point in parent class
|
||||||
|
|
|
@ -48,10 +48,6 @@ VisToolLine::VisToolLine(const VContainer *data, QGraphicsItem *parent)
|
||||||
this->mainColor = Qt::red;
|
this->mainColor = Qt::red;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
VisToolLine::~VisToolLine()
|
|
||||||
{}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VisToolLine::RefreshGeometry()
|
void VisToolLine::RefreshGeometry()
|
||||||
{
|
{
|
||||||
|
@ -80,6 +76,10 @@ void VisToolLine::DrawLine(QGraphicsLineItem *lineItem, const QLineF &line, cons
|
||||||
{
|
{
|
||||||
SCASSERT (lineItem != nullptr)
|
SCASSERT (lineItem != nullptr)
|
||||||
|
|
||||||
lineItem->setPen(QPen(color, qApp->toPixel(WidthMainLine(*Visualization::data->GetPatternUnit()))/factor, style));
|
QPen visPen = lineItem->pen();
|
||||||
|
visPen.setColor(color);
|
||||||
|
visPen.setStyle(style);
|
||||||
|
|
||||||
|
lineItem->setPen(visPen);
|
||||||
lineItem->setLine(line);
|
lineItem->setLine(line);
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,8 +46,8 @@ class VisToolLine : public VisLine
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit VisToolLine(const VContainer *data, QGraphicsItem *parent = 0);
|
explicit VisToolLine(const VContainer *data, QGraphicsItem *parent = nullptr);
|
||||||
virtual ~VisToolLine() Q_DECL_OVERRIDE;
|
virtual ~VisToolLine() = default;
|
||||||
|
|
||||||
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
||||||
void setPoint2Id(const quint32 &value);
|
void setPoint2Id(const quint32 &value);
|
||||||
|
|
|
@ -56,10 +56,6 @@ VisToolLineIntersect::VisToolLineIntersect(const VContainer *data, QGraphicsItem
|
||||||
point = InitPoint(mainColor, this);
|
point = InitPoint(mainColor, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
VisToolLineIntersect::~VisToolLineIntersect()
|
|
||||||
{}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VisToolLineIntersect::RefreshGeometry()
|
void VisToolLineIntersect::RefreshGeometry()
|
||||||
{
|
{
|
||||||
|
@ -139,3 +135,31 @@ void VisToolLineIntersect::setLine2P2Id(const quint32 &value)
|
||||||
{
|
{
|
||||||
line2P2Id = value;
|
line2P2Id = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VisToolLineIntersect::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||||
|
{
|
||||||
|
const qreal scale = SceneScale(scene());
|
||||||
|
|
||||||
|
ScalePoint(point, scale);
|
||||||
|
ScalePoint(line1P1, scale);
|
||||||
|
ScalePoint(line1P2, scale);
|
||||||
|
ScalePenWidth(line1, scale);
|
||||||
|
ScalePoint(line2P1, scale);
|
||||||
|
ScalePoint(line2P2, scale);
|
||||||
|
|
||||||
|
VisLine::paint(painter, option, widget);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QRectF VisToolLineIntersect::boundingRect() const
|
||||||
|
{
|
||||||
|
QRectF rect = VisLine::boundingRect();
|
||||||
|
rect = rect.united(point->boundingRect());
|
||||||
|
rect = rect.united(line1P1->boundingRect());
|
||||||
|
rect = rect.united(line1P2->boundingRect());
|
||||||
|
rect = rect.united(line1->boundingRect());
|
||||||
|
rect = rect.united(line2P1->boundingRect());
|
||||||
|
rect = rect.united(line2P2->boundingRect());
|
||||||
|
return rect;
|
||||||
|
}
|
||||||
|
|
|
@ -43,8 +43,8 @@ class VisToolLineIntersect :public VisLine
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit VisToolLineIntersect(const VContainer *data, QGraphicsItem *parent = 0);
|
explicit VisToolLineIntersect(const VContainer *data, QGraphicsItem *parent = nullptr);
|
||||||
virtual ~VisToolLineIntersect() Q_DECL_OVERRIDE;
|
virtual ~VisToolLineIntersect() = default;
|
||||||
|
|
||||||
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
|
@ -53,6 +53,10 @@ public:
|
||||||
void setLine2P2Id(const quint32 &value);
|
void setLine2P2Id(const quint32 &value);
|
||||||
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
||||||
enum { Type = UserType + static_cast<int>(Vis::ToolLineIntersect)};
|
enum { Type = UserType + static_cast<int>(Vis::ToolLineIntersect)};
|
||||||
|
|
||||||
|
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||||
|
QWidget *widget = nullptr) Q_DECL_OVERRIDE;
|
||||||
|
virtual QRectF boundingRect() const Q_DECL_OVERRIDE;
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VisToolLineIntersect)
|
Q_DISABLE_COPY(VisToolLineIntersect)
|
||||||
quint32 line1P2Id;
|
quint32 line1P2Id;
|
||||||
|
|
|
@ -59,10 +59,6 @@ VisToolLineIntersectAxis::VisToolLineIntersectAxis(const VContainer *data, QGrap
|
||||||
point = InitPoint(mainColor, this);
|
point = InitPoint(mainColor, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
VisToolLineIntersectAxis::~VisToolLineIntersectAxis()
|
|
||||||
{}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VisToolLineIntersectAxis::RefreshGeometry()
|
void VisToolLineIntersectAxis::RefreshGeometry()
|
||||||
{
|
{
|
||||||
|
@ -137,6 +133,36 @@ void VisToolLineIntersectAxis::setAxisPointId(const quint32 &value)
|
||||||
axisPointId = value;
|
axisPointId = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VisToolLineIntersectAxis::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||||
|
{
|
||||||
|
const qreal scale = SceneScale(scene());
|
||||||
|
|
||||||
|
ScalePoint(point, scale);
|
||||||
|
ScalePoint(lineP1, scale);
|
||||||
|
ScalePoint(lineP2, scale);
|
||||||
|
ScalePoint(basePoint, scale);
|
||||||
|
ScalePenWidth(baseLine, scale);
|
||||||
|
ScalePenWidth(axisLine, scale);
|
||||||
|
ScalePenWidth(line_intersection, scale);
|
||||||
|
|
||||||
|
VisLine::paint(painter, option, widget);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QRectF VisToolLineIntersectAxis::boundingRect() const
|
||||||
|
{
|
||||||
|
QRectF rect = VisLine::boundingRect();
|
||||||
|
rect = rect.united(point->boundingRect());
|
||||||
|
rect = rect.united(lineP1->boundingRect());
|
||||||
|
rect = rect.united(lineP2->boundingRect());
|
||||||
|
rect = rect.united(basePoint->boundingRect());
|
||||||
|
rect = rect.united(baseLine->boundingRect());
|
||||||
|
rect = rect.united(axisLine->boundingRect());
|
||||||
|
rect = rect.united(line_intersection->boundingRect());
|
||||||
|
return rect;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VisToolLineIntersectAxis::ShowIntersection(const QLineF &axis_line, const QLineF &base_line)
|
void VisToolLineIntersectAxis::ShowIntersection(const QLineF &axis_line, const QLineF &base_line)
|
||||||
{
|
{
|
||||||
|
|
|
@ -44,8 +44,8 @@ class VisToolLineIntersectAxis : public VisLine
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit VisToolLineIntersectAxis(const VContainer *data, QGraphicsItem *parent = 0);
|
explicit VisToolLineIntersectAxis(const VContainer *data, QGraphicsItem *parent = nullptr);
|
||||||
virtual ~VisToolLineIntersectAxis() Q_DECL_OVERRIDE;
|
virtual ~VisToolLineIntersectAxis() = default;
|
||||||
|
|
||||||
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
|
@ -56,6 +56,10 @@ public:
|
||||||
|
|
||||||
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
||||||
enum { Type = UserType + static_cast<int>(Vis::ToolLineIntersectAxis)};
|
enum { Type = UserType + static_cast<int>(Vis::ToolLineIntersectAxis)};
|
||||||
|
|
||||||
|
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||||
|
QWidget *widget = nullptr) Q_DECL_OVERRIDE;
|
||||||
|
virtual QRectF boundingRect() const Q_DECL_OVERRIDE;
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VisToolLineIntersectAxis)
|
Q_DISABLE_COPY(VisToolLineIntersectAxis)
|
||||||
quint32 point2Id;
|
quint32 point2Id;
|
||||||
|
|
|
@ -57,10 +57,6 @@ VisToolNormal::VisToolNormal(const VContainer *data, QGraphicsItem *parent)
|
||||||
point = InitPoint(mainColor, this);
|
point = InitPoint(mainColor, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
VisToolNormal::~VisToolNormal()
|
|
||||||
{}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VisToolNormal::RefreshGeometry()
|
void VisToolNormal::RefreshGeometry()
|
||||||
{
|
{
|
||||||
|
@ -128,3 +124,27 @@ void VisToolNormal::SetAngle(const qreal &value)
|
||||||
{
|
{
|
||||||
angle = value;
|
angle = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VisToolNormal::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||||
|
{
|
||||||
|
const qreal scale = SceneScale(scene());
|
||||||
|
|
||||||
|
ScalePoint(point, scale);
|
||||||
|
ScalePoint(lineP1, scale);
|
||||||
|
ScalePoint(lineP2, scale);
|
||||||
|
ScalePenWidth(line, scale);
|
||||||
|
|
||||||
|
VisLine::paint(painter, option, widget);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QRectF VisToolNormal::boundingRect() const
|
||||||
|
{
|
||||||
|
QRectF rect = VisLine::boundingRect();
|
||||||
|
rect = rect.united(point->boundingRect());
|
||||||
|
rect = rect.united(lineP1->boundingRect());
|
||||||
|
rect = rect.united(lineP2->boundingRect());
|
||||||
|
rect = rect.united(line->boundingRect());
|
||||||
|
return rect;
|
||||||
|
}
|
||||||
|
|
|
@ -43,8 +43,8 @@ class VisToolNormal : public VisLine
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit VisToolNormal(const VContainer *data, QGraphicsItem *parent = 0);
|
explicit VisToolNormal(const VContainer *data, QGraphicsItem *parent = nullptr);
|
||||||
virtual ~VisToolNormal() Q_DECL_OVERRIDE;
|
virtual ~VisToolNormal() = default;
|
||||||
|
|
||||||
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
|
@ -54,6 +54,10 @@ public:
|
||||||
void SetAngle(const qreal &value);
|
void SetAngle(const qreal &value);
|
||||||
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
||||||
enum { Type = UserType + static_cast<int>(Vis::ToolNormal)};
|
enum { Type = UserType + static_cast<int>(Vis::ToolNormal)};
|
||||||
|
|
||||||
|
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||||
|
QWidget *widget = nullptr) Q_DECL_OVERRIDE;
|
||||||
|
virtual QRectF boundingRect() const Q_DECL_OVERRIDE;
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VisToolNormal)
|
Q_DISABLE_COPY(VisToolNormal)
|
||||||
quint32 object2Id;
|
quint32 object2Id;
|
||||||
|
|
|
@ -38,7 +38,7 @@ VisToolPin::VisToolPin(const VContainer *data, QGraphicsItem *parent)
|
||||||
this->mainColor = Qt::red;
|
this->mainColor = Qt::red;
|
||||||
this->setZValue(2);// Show on top real tool
|
this->setZValue(2);// Show on top real tool
|
||||||
|
|
||||||
m_point = new VSimplePoint(NULL_ID, mainColor, *Visualization::data->GetPatternUnit(), &factor);
|
m_point = new VSimplePoint(NULL_ID, mainColor);
|
||||||
m_point->SetPointHighlight(true);
|
m_point->SetPointHighlight(true);
|
||||||
m_point->setParentItem(this);
|
m_point->setParentItem(this);
|
||||||
m_point->SetVisualizationMode(true);
|
m_point->SetVisualizationMode(true);
|
||||||
|
@ -62,7 +62,7 @@ void VisToolPin::RefreshGeometry()
|
||||||
const QSharedPointer<VPointF> point = Visualization::data->GeometricObject<VPointF>(object1Id);
|
const QSharedPointer<VPointF> point = Visualization::data->GeometricObject<VPointF>(object1Id);
|
||||||
|
|
||||||
m_point->SetOnlyPoint(mode == Mode::Creation);
|
m_point->SetOnlyPoint(mode == Mode::Creation);
|
||||||
m_point->RefreshGeometry(*point);
|
m_point->RefreshPointGeometry(*point);
|
||||||
m_point->setVisible(true);
|
m_point->setVisible(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ class VisToolPin : public VisLine
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit VisToolPin(const VContainer *data, QGraphicsItem *parent = nullptr);
|
explicit VisToolPin(const VContainer *data, QGraphicsItem *parent = nullptr);
|
||||||
virtual ~VisToolPin() Q_DECL_OVERRIDE;
|
virtual ~VisToolPin();
|
||||||
|
|
||||||
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
||||||
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
||||||
|
|
|
@ -57,10 +57,6 @@ VisToolPointFromArcAndTangent::VisToolPointFromArcAndTangent(const VContainer *d
|
||||||
tangentLine2 = InitItem<QGraphicsLineItem>(supportColor, this);
|
tangentLine2 = InitItem<QGraphicsLineItem>(supportColor, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
VisToolPointFromArcAndTangent::~VisToolPointFromArcAndTangent()
|
|
||||||
{}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VisToolPointFromArcAndTangent::RefreshGeometry()
|
void VisToolPointFromArcAndTangent::RefreshGeometry()
|
||||||
{
|
{
|
||||||
|
@ -95,6 +91,30 @@ void VisToolPointFromArcAndTangent::setCrossPoint(const CrossCirclesPoint &value
|
||||||
crossPoint = value;
|
crossPoint = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VisToolPointFromArcAndTangent::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||||
|
{
|
||||||
|
const qreal scale = SceneScale(scene());
|
||||||
|
|
||||||
|
ScalePoint(point, scale);
|
||||||
|
ScalePoint(tangent, scale);
|
||||||
|
ScalePenWidth(arcPath, scale);
|
||||||
|
ScalePenWidth(tangentLine2, scale);
|
||||||
|
|
||||||
|
VisLine::paint(painter, option, widget);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QRectF VisToolPointFromArcAndTangent::boundingRect() const
|
||||||
|
{
|
||||||
|
QRectF rect = VisLine::boundingRect();
|
||||||
|
rect = rect.united(point->boundingRect());
|
||||||
|
rect = rect.united(tangent->boundingRect());
|
||||||
|
rect = rect.united(arcPath->boundingRect());
|
||||||
|
rect = rect.united(tangentLine2->boundingRect());
|
||||||
|
return rect;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VisToolPointFromArcAndTangent::FindRays(const QPointF &p, const VArc *arc)
|
void VisToolPointFromArcAndTangent::FindRays(const QPointF &p, const VArc *arc)
|
||||||
{
|
{
|
||||||
|
|
|
@ -45,8 +45,8 @@ class VisToolPointFromArcAndTangent : public VisLine
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit VisToolPointFromArcAndTangent(const VContainer *data, QGraphicsItem *parent = 0);
|
explicit VisToolPointFromArcAndTangent(const VContainer *data, QGraphicsItem *parent = nullptr);
|
||||||
virtual ~VisToolPointFromArcAndTangent() Q_DECL_OVERRIDE;
|
virtual ~VisToolPointFromArcAndTangent() = default;
|
||||||
|
|
||||||
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
|
@ -55,6 +55,10 @@ public:
|
||||||
|
|
||||||
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
||||||
enum { Type = UserType + static_cast<int>(Vis::ToolPointFromArcAndTangent)};
|
enum { Type = UserType + static_cast<int>(Vis::ToolPointFromArcAndTangent)};
|
||||||
|
|
||||||
|
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||||
|
QWidget *widget = nullptr) Q_DECL_OVERRIDE;
|
||||||
|
virtual QRectF boundingRect() const Q_DECL_OVERRIDE;
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VisToolPointFromArcAndTangent)
|
Q_DISABLE_COPY(VisToolPointFromArcAndTangent)
|
||||||
quint32 arcId;
|
quint32 arcId;
|
||||||
|
|
|
@ -54,10 +54,6 @@ VisToolPointFromCircleAndTangent::VisToolPointFromCircleAndTangent(const VContai
|
||||||
tangent2 = InitItem<QGraphicsLineItem>(supportColor, this);
|
tangent2 = InitItem<QGraphicsLineItem>(supportColor, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
VisToolPointFromCircleAndTangent::~VisToolPointFromCircleAndTangent()
|
|
||||||
{}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VisToolPointFromCircleAndTangent::RefreshGeometry()
|
void VisToolPointFromCircleAndTangent::RefreshGeometry()
|
||||||
{
|
{
|
||||||
|
@ -105,6 +101,32 @@ void VisToolPointFromCircleAndTangent::setCrossPoint(const CrossCirclesPoint &va
|
||||||
crossPoint = value;
|
crossPoint = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VisToolPointFromCircleAndTangent::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||||
|
{
|
||||||
|
const qreal scale = SceneScale(scene());
|
||||||
|
|
||||||
|
ScalePoint(point, scale);
|
||||||
|
ScalePoint(tangent, scale);
|
||||||
|
ScalePoint(cCenter, scale);
|
||||||
|
ScalePoint(cPath, scale);
|
||||||
|
ScalePenWidth(tangent2, scale);
|
||||||
|
|
||||||
|
VisLine::paint(painter, option, widget);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QRectF VisToolPointFromCircleAndTangent::boundingRect() const
|
||||||
|
{
|
||||||
|
QRectF rect = VisLine::boundingRect();
|
||||||
|
rect = rect.united(point->boundingRect());
|
||||||
|
rect = rect.united(tangent->boundingRect());
|
||||||
|
rect = rect.united(cCenter->boundingRect());
|
||||||
|
rect = rect.united(cPath->boundingRect());
|
||||||
|
rect = rect.united(tangent2->boundingRect());
|
||||||
|
return rect;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VisToolPointFromCircleAndTangent::FindRays(const QPointF &p, const QPointF ¢er, qreal radius)
|
void VisToolPointFromCircleAndTangent::FindRays(const QPointF &p, const QPointF ¢er, qreal radius)
|
||||||
{
|
{
|
||||||
|
|
|
@ -45,8 +45,8 @@ class VisToolPointFromCircleAndTangent : public VisLine
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit VisToolPointFromCircleAndTangent(const VContainer *data, QGraphicsItem *parent = 0);
|
explicit VisToolPointFromCircleAndTangent(const VContainer *data, QGraphicsItem *parent = nullptr);
|
||||||
virtual ~VisToolPointFromCircleAndTangent() Q_DECL_OVERRIDE;
|
virtual ~VisToolPointFromCircleAndTangent() = default;
|
||||||
|
|
||||||
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
|
@ -56,6 +56,10 @@ public:
|
||||||
|
|
||||||
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
||||||
enum { Type = UserType + static_cast<int>(Vis::ToolPointFromCircleAndTangent)};
|
enum { Type = UserType + static_cast<int>(Vis::ToolPointFromCircleAndTangent)};
|
||||||
|
|
||||||
|
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||||
|
QWidget *widget = nullptr) Q_DECL_OVERRIDE;
|
||||||
|
virtual QRectF boundingRect() const Q_DECL_OVERRIDE;
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VisToolPointFromCircleAndTangent)
|
Q_DISABLE_COPY(VisToolPointFromCircleAndTangent)
|
||||||
quint32 object2Id;
|
quint32 object2Id;
|
||||||
|
|
|
@ -55,10 +55,6 @@ VisToolPointOfContact::VisToolPointOfContact(const VContainer *data, QGraphicsIt
|
||||||
point = InitPoint(mainColor, this);
|
point = InitPoint(mainColor, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
VisToolPointOfContact::~VisToolPointOfContact()
|
|
||||||
{}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VisToolPointOfContact::RefreshGeometry()
|
void VisToolPointOfContact::RefreshGeometry()
|
||||||
{
|
{
|
||||||
|
@ -118,3 +114,29 @@ void VisToolPointOfContact::setRadius(const QString &expression)
|
||||||
{
|
{
|
||||||
radius = FindLength(expression, Visualization::data->PlainVariables());
|
radius = FindLength(expression, Visualization::data->PlainVariables());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VisToolPointOfContact::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||||
|
{
|
||||||
|
const qreal scale = SceneScale(scene());
|
||||||
|
|
||||||
|
ScalePoint(point, scale);
|
||||||
|
ScalePoint(lineP1, scale);
|
||||||
|
ScalePoint(lineP2, scale);
|
||||||
|
ScalePoint(arc_point, scale);
|
||||||
|
ScalePoint(circle, scale);
|
||||||
|
|
||||||
|
VisLine::paint(painter, option, widget);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QRectF VisToolPointOfContact::boundingRect() const
|
||||||
|
{
|
||||||
|
QRectF rect = VisLine::boundingRect();
|
||||||
|
rect = rect.united(point->boundingRect());
|
||||||
|
rect = rect.united(lineP1->boundingRect());
|
||||||
|
rect = rect.united(lineP2->boundingRect());
|
||||||
|
rect = rect.united(arc_point->boundingRect());
|
||||||
|
rect = rect.united(circle->boundingRect());
|
||||||
|
return rect;
|
||||||
|
}
|
||||||
|
|
|
@ -43,8 +43,8 @@ class VisToolPointOfContact : public VisLine
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit VisToolPointOfContact(const VContainer *data, QGraphicsItem *parent = 0);
|
explicit VisToolPointOfContact(const VContainer *data, QGraphicsItem *parent = nullptr);
|
||||||
virtual ~VisToolPointOfContact() Q_DECL_OVERRIDE;
|
virtual ~VisToolPointOfContact() = default;
|
||||||
|
|
||||||
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
||||||
void setLineP2Id(const quint32 &value);
|
void setLineP2Id(const quint32 &value);
|
||||||
|
@ -52,6 +52,10 @@ public:
|
||||||
void setRadius(const QString &expression);
|
void setRadius(const QString &expression);
|
||||||
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
||||||
enum { Type = UserType + static_cast<int>(Vis::ToolPointOfContact)};
|
enum { Type = UserType + static_cast<int>(Vis::ToolPointOfContact)};
|
||||||
|
|
||||||
|
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||||
|
QWidget *widget = nullptr) Q_DECL_OVERRIDE;
|
||||||
|
virtual QRectF boundingRect() const Q_DECL_OVERRIDE;
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VisToolPointOfContact)
|
Q_DISABLE_COPY(VisToolPointOfContact)
|
||||||
quint32 lineP2Id;
|
quint32 lineP2Id;
|
||||||
|
|
|
@ -53,10 +53,6 @@ VisToolPointOfIntersection::VisToolPointOfIntersection(const VContainer *data, Q
|
||||||
point = InitPoint(mainColor, this);
|
point = InitPoint(mainColor, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
VisToolPointOfIntersection::~VisToolPointOfIntersection()
|
|
||||||
{}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VisToolPointOfIntersection::RefreshGeometry()
|
void VisToolPointOfIntersection::RefreshGeometry()
|
||||||
{
|
{
|
||||||
|
@ -97,6 +93,30 @@ void VisToolPointOfIntersection::setPoint2Id(const quint32 &value)
|
||||||
point2Id = value;
|
point2Id = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VisToolPointOfIntersection::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||||
|
{
|
||||||
|
const qreal scale = SceneScale(scene());
|
||||||
|
|
||||||
|
ScalePoint(point, scale);
|
||||||
|
ScalePoint(axisP1, scale);
|
||||||
|
ScalePoint(axisP2, scale);
|
||||||
|
ScalePenWidth(axis2, scale);
|
||||||
|
|
||||||
|
VisLine::paint(painter, option, widget);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QRectF VisToolPointOfIntersection::boundingRect() const
|
||||||
|
{
|
||||||
|
QRectF rect = VisLine::boundingRect();
|
||||||
|
rect = rect.united(point->boundingRect());
|
||||||
|
rect = rect.united(axisP1->boundingRect());
|
||||||
|
rect = rect.united(axisP2->boundingRect());
|
||||||
|
rect = rect.united(axis2->boundingRect());
|
||||||
|
return rect;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VisToolPointOfIntersection::ShowIntersection(const QLineF &axis1, const QLineF &axis2, const QColor &color)
|
void VisToolPointOfIntersection::ShowIntersection(const QLineF &axis1, const QLineF &axis2, const QColor &color)
|
||||||
{
|
{
|
||||||
|
|
|
@ -45,14 +45,18 @@ class VisToolPointOfIntersection : public VisLine
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit VisToolPointOfIntersection(const VContainer *data, QGraphicsItem *parent = 0);
|
explicit VisToolPointOfIntersection(const VContainer *data, QGraphicsItem *parent = nullptr);
|
||||||
virtual ~VisToolPointOfIntersection() Q_DECL_OVERRIDE;
|
virtual ~VisToolPointOfIntersection() = default;
|
||||||
|
|
||||||
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
void setPoint2Id(const quint32 &value);
|
void setPoint2Id(const quint32 &value);
|
||||||
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
||||||
enum { Type = UserType + static_cast<int>(Vis::ToolPointOfIntersection)};
|
enum { Type = UserType + static_cast<int>(Vis::ToolPointOfIntersection)};
|
||||||
|
|
||||||
|
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||||
|
QWidget *widget = nullptr) Q_DECL_OVERRIDE;
|
||||||
|
virtual QRectF boundingRect() const Q_DECL_OVERRIDE;
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VisToolPointOfIntersection)
|
Q_DISABLE_COPY(VisToolPointOfIntersection)
|
||||||
quint32 point2Id;
|
quint32 point2Id;
|
||||||
|
|
|
@ -65,10 +65,6 @@ VisToolPointOfIntersectionArcs::VisToolPointOfIntersectionArcs(const VContainer
|
||||||
point->setFlag(QGraphicsItem::ItemStacksBehindParent, false);
|
point->setFlag(QGraphicsItem::ItemStacksBehindParent, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
VisToolPointOfIntersectionArcs::~VisToolPointOfIntersectionArcs()
|
|
||||||
{}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VisToolPointOfIntersectionArcs::RefreshGeometry()
|
void VisToolPointOfIntersectionArcs::RefreshGeometry()
|
||||||
{
|
{
|
||||||
|
@ -118,3 +114,25 @@ void VisToolPointOfIntersectionArcs::setCrossPoint(const CrossCirclesPoint &valu
|
||||||
{
|
{
|
||||||
crossPoint = value;
|
crossPoint = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VisToolPointOfIntersectionArcs::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||||
|
{
|
||||||
|
const qreal scale = SceneScale(scene());
|
||||||
|
|
||||||
|
ScalePoint(point, scale);
|
||||||
|
ScalePenWidth(arc1Path, scale);
|
||||||
|
ScalePenWidth(arc2Path, scale);
|
||||||
|
|
||||||
|
VisLine::paint(painter, option, widget);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QRectF VisToolPointOfIntersectionArcs::boundingRect() const
|
||||||
|
{
|
||||||
|
QRectF rect = VisLine::boundingRect();
|
||||||
|
rect = rect.united(point->boundingRect());
|
||||||
|
rect = rect.united(arc1Path->boundingRect());
|
||||||
|
rect = rect.united(arc2Path->boundingRect());
|
||||||
|
return rect;
|
||||||
|
}
|
||||||
|
|
|
@ -44,8 +44,8 @@ class VisToolPointOfIntersectionArcs : public VisLine
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit VisToolPointOfIntersectionArcs(const VContainer *data, QGraphicsItem *parent = 0);
|
explicit VisToolPointOfIntersectionArcs(const VContainer *data, QGraphicsItem *parent = nullptr);
|
||||||
virtual ~VisToolPointOfIntersectionArcs() Q_DECL_OVERRIDE;
|
virtual ~VisToolPointOfIntersectionArcs() = default;
|
||||||
|
|
||||||
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
||||||
virtual void VisualMode(const quint32 &id) Q_DECL_OVERRIDE;
|
virtual void VisualMode(const quint32 &id) Q_DECL_OVERRIDE;
|
||||||
|
@ -56,6 +56,10 @@ public:
|
||||||
|
|
||||||
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
||||||
enum { Type = UserType + static_cast<int>(Vis::ToolPointOfIntersectionArcs)};
|
enum { Type = UserType + static_cast<int>(Vis::ToolPointOfIntersectionArcs)};
|
||||||
|
|
||||||
|
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||||
|
QWidget *widget = nullptr) Q_DECL_OVERRIDE;
|
||||||
|
virtual QRectF boundingRect() const Q_DECL_OVERRIDE;
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VisToolPointOfIntersectionArcs)
|
Q_DISABLE_COPY(VisToolPointOfIntersectionArcs)
|
||||||
quint32 arc1Id;
|
quint32 arc1Id;
|
||||||
|
|
|
@ -59,10 +59,6 @@ VisToolPointOfIntersectionCircles::VisToolPointOfIntersectionCircles(const VCont
|
||||||
c2Center = InitPoint(supportColor, this); //-V656
|
c2Center = InitPoint(supportColor, this); //-V656
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
VisToolPointOfIntersectionCircles::~VisToolPointOfIntersectionCircles()
|
|
||||||
{}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VisToolPointOfIntersectionCircles::RefreshGeometry()
|
void VisToolPointOfIntersectionCircles::RefreshGeometry()
|
||||||
{
|
{
|
||||||
|
@ -129,3 +125,30 @@ void VisToolPointOfIntersectionCircles::setCrossPoint(const CrossCirclesPoint &v
|
||||||
{
|
{
|
||||||
crossPoint = value;
|
crossPoint = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VisToolPointOfIntersectionCircles::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||||
|
QWidget *widget)
|
||||||
|
{
|
||||||
|
const qreal scale = SceneScale(scene());
|
||||||
|
|
||||||
|
ScalePoint(point, scale);
|
||||||
|
ScalePoint(c1Center, scale);
|
||||||
|
ScalePoint(c2Center, scale);
|
||||||
|
ScalePoint(c1Path, scale);
|
||||||
|
ScalePoint(c2Path, scale);
|
||||||
|
|
||||||
|
VisLine::paint(painter, option, widget);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QRectF VisToolPointOfIntersectionCircles::boundingRect() const
|
||||||
|
{
|
||||||
|
QRectF rect = VisLine::boundingRect();
|
||||||
|
rect = rect.united(point->boundingRect());
|
||||||
|
rect = rect.united(c1Center->boundingRect());
|
||||||
|
rect = rect.united(c2Center->boundingRect());
|
||||||
|
rect = rect.united(c1Path->boundingRect());
|
||||||
|
rect = rect.united(c2Path->boundingRect());
|
||||||
|
return rect;
|
||||||
|
}
|
||||||
|
|
|
@ -44,8 +44,8 @@ class VisToolPointOfIntersectionCircles : public VisLine
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit VisToolPointOfIntersectionCircles(const VContainer *data, QGraphicsItem *parent = 0);
|
explicit VisToolPointOfIntersectionCircles(const VContainer *data, QGraphicsItem *parent = nullptr);
|
||||||
virtual ~VisToolPointOfIntersectionCircles() Q_DECL_OVERRIDE;
|
virtual ~VisToolPointOfIntersectionCircles() = default;
|
||||||
|
|
||||||
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
||||||
virtual void VisualMode(const quint32 &id) Q_DECL_OVERRIDE;
|
virtual void VisualMode(const quint32 &id) Q_DECL_OVERRIDE;
|
||||||
|
@ -57,6 +57,10 @@ public:
|
||||||
|
|
||||||
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
||||||
enum { Type = UserType + static_cast<int>(Vis::ToolPointOfIntersectionCircles)};
|
enum { Type = UserType + static_cast<int>(Vis::ToolPointOfIntersectionCircles)};
|
||||||
|
|
||||||
|
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||||
|
QWidget *widget = nullptr) Q_DECL_OVERRIDE;
|
||||||
|
virtual QRectF boundingRect() const Q_DECL_OVERRIDE;
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VisToolPointOfIntersectionCircles)
|
Q_DISABLE_COPY(VisToolPointOfIntersectionCircles)
|
||||||
quint32 object2Id;
|
quint32 object2Id;
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user