Rename VToolSinglePoint to VToolBasePoint.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2015-06-19 15:08:27 +03:00
parent b7f731802d
commit dfd717fb24
9 changed files with 62 additions and 62 deletions

View File

@ -74,7 +74,7 @@ void VToolOptionsPropertyBrowser::ShowItemOptions(QGraphicsItem *item)
{
switch (item->type())
{
case VToolSinglePoint::Type:
case VToolBasePoint::Type:
ShowOptionsToolSinglePoint(item);
break;
case VToolEndLine::Type:
@ -176,7 +176,7 @@ void VToolOptionsPropertyBrowser::UpdateOptions()
switch (currentItem->type())
{
case VToolSinglePoint::Type:
case VToolBasePoint::Type:
UpdateOptionsToolSinglePoint();
break;
case VToolEndLine::Type:
@ -293,7 +293,7 @@ void VToolOptionsPropertyBrowser::userChangedData(VProperty *property)
switch (currentItem->type())
{
case VToolSinglePoint::Type:
case VToolBasePoint::Type:
ChangeDataToolSinglePoint(prop);
break;
case VToolEndLine::Type:
@ -555,7 +555,7 @@ void VToolOptionsPropertyBrowser::ChangeDataToolSinglePoint(VProperty *property)
switch (PropertiesList().indexOf(id))
{
case 0: // VAbstractTool::AttrName
SetPointName<VToolSinglePoint>(value.toString());
SetPointName<VToolBasePoint>(value.toString());
break;
case 1: // QLatin1String("position")
currentItem->setPos(value.toPointF());
@ -1227,7 +1227,7 @@ void VToolOptionsPropertyBrowser::ChangeDataToolCurveIntersectAxis(VProperty *pr
//---------------------------------------------------------------------------------------------------------------------
void VToolOptionsPropertyBrowser::ShowOptionsToolSinglePoint(QGraphicsItem *item)
{
VToolSinglePoint *i = qgraphicsitem_cast<VToolSinglePoint *>(item);
VToolBasePoint *i = qgraphicsitem_cast<VToolBasePoint *>(item);
i->ShowVisualization(true);
formView->setTitle(tr("Base point"));
@ -1551,7 +1551,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolCurveIntersectAxis(QGraphicsIte
//---------------------------------------------------------------------------------------------------------------------
void VToolOptionsPropertyBrowser::UpdateOptionsToolSinglePoint()
{
VToolSinglePoint *i = qgraphicsitem_cast<VToolSinglePoint *>(currentItem);
VToolBasePoint *i = qgraphicsitem_cast<VToolBasePoint *>(currentItem);
idToProperty[VAbstractTool::AttrName]->setValue(i->name());
idToProperty[QLatin1String("position")]->setValue(i->pos());
}

View File

@ -213,7 +213,7 @@ QString DialogHistory::Record(const VToolRecord &tool)
case Tool::Arrow:
Q_UNREACHABLE();
break;
case Tool::SinglePoint:
case Tool::BasePoint:
{
return QString(tr("%1 - Base point")).arg(PointName(tool.getId()));
}

View File

@ -174,19 +174,19 @@ void MainWindow::AddPP(const QString &PPName, const QString &path)
ui->view->itemClicked(nullptr);//hide options previous tool
const QString label = doc->GenerateLabel(LabelType::NewPatternPiece);
const quint32 id = pattern->AddGObject(new VPointF(30+comboBoxDraws->count()*5, 40, label, 5, 10));
VToolSinglePoint *spoint = new VToolSinglePoint(doc, pattern, id, Source::FromGui, PPName, path);
VToolBasePoint *spoint = new VToolBasePoint(doc, pattern, id, Source::FromGui, PPName, path);
sceneDraw->addItem(spoint);
ui->view->itemClicked(spoint);
connect(spoint, &VToolPoint::ChoosedTool, sceneDraw, &VMainGraphicsScene::ChoosedItem);
connect(sceneDraw, &VMainGraphicsScene::DisableItem, spoint, &VToolSinglePoint::Disable);
connect(sceneDraw, &VMainGraphicsScene::NewFactor, spoint, &VToolSinglePoint::SetFactor);
connect(sceneDraw, &VMainGraphicsScene::EnableToolMove, spoint, &VToolSinglePoint::EnableToolMove);
connect(sceneDraw, &VMainGraphicsScene::DisableItem, spoint, &VToolBasePoint::Disable);
connect(sceneDraw, &VMainGraphicsScene::NewFactor, spoint, &VToolBasePoint::SetFactor);
connect(sceneDraw, &VMainGraphicsScene::EnableToolMove, spoint, &VToolBasePoint::EnableToolMove);
QHash<quint32, VDataTool*>* tools = doc->getTools();
SCASSERT(tools != nullptr);
tools->insert(id, spoint);
VDrawTool::AddRecord(id, Tool::SinglePoint, doc);
VDrawTool::AddRecord(id, Tool::BasePoint, doc);
SetEnableTool(true);
SetEnableWidgets(true);
@ -1093,7 +1093,7 @@ void MainWindow::CancelTool()
helpLabel->setText("");
ui->actionStopTool->setEnabled(true);
return;
case Tool::SinglePoint:
case Tool::BasePoint:
Q_UNREACHABLE();
//Nothing to do here because we can't create this tool from main window.
break;
@ -2476,7 +2476,7 @@ void MainWindow::LastUsedTool()
ui->actionArrowTool->setChecked(true);
ArrowTool();
break;
case Tool::SinglePoint:
case Tool::BasePoint:
Q_UNREACHABLE();
//Nothing to do here because we can't create this tool from main window.
break;

View File

@ -294,7 +294,7 @@ quint32 VPattern::SPointActiveDraw()
if (domElement.isNull() == false)
{
if (domElement.tagName() == VToolPoint::TagName &&
domElement.attribute(AttrType, "") == VToolSinglePoint::ToolType)
domElement.attribute(AttrType, "") == VToolBasePoint::ToolType)
{
return GetParametrId(domElement);
}
@ -666,7 +666,7 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
QString typeLine;
QString lineColor;
QStringList points = QStringList() << VToolSinglePoint::ToolType << VToolEndLine::ToolType
QStringList points = QStringList() << VToolBasePoint::ToolType << VToolEndLine::ToolType
<< VToolAlongLine::ToolType << VToolShoulderPoint::ToolType
<< VToolNormal::ToolType << VToolBisector::ToolType
<< VToolLineIntersect::ToolType << VToolPointOfContact::ToolType
@ -680,9 +680,9 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
<< VToolPointFromArcAndTangent::ToolType;
switch (points.indexOf(type))
{
case 0: //VToolSinglePoint::ToolType
case 0: //VToolBasePoint::ToolType
{
VToolSinglePoint *spoint = 0;
VToolBasePoint *spoint = 0;
try
{
PointsCommonAttributes(domElement, id, name, mx, my);
@ -690,19 +690,19 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
const qreal y = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrY, "10.0"));
data->UpdateGObject(id, new VPointF(x, y, name, mx, my));
VDrawTool::AddRecord(id, Tool::SinglePoint, this);
VDrawTool::AddRecord(id, Tool::BasePoint, this);
if (parse != Document::FullParse)
{
UpdateToolData(id, data);
}
if (parse == Document::FullParse)
{
spoint = new VToolSinglePoint(this, data, id, Source::FromFile, nameActivPP, MPath());
spoint = new VToolBasePoint(this, data, id, Source::FromFile, nameActivPP, MPath());
scene->addItem(spoint);
connect(spoint, &VToolSinglePoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
connect(scene, &VMainGraphicsScene::NewFactor, spoint, &VToolSinglePoint::SetFactor);
connect(scene, &VMainGraphicsScene::DisableItem, spoint, &VToolSinglePoint::Disable);
connect(scene, &VMainGraphicsScene::EnableToolMove, spoint, &VToolSinglePoint::EnableToolMove);
connect(spoint, &VToolBasePoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
connect(scene, &VMainGraphicsScene::NewFactor, spoint, &VToolBasePoint::SetFactor);
connect(scene, &VMainGraphicsScene::DisableItem, spoint, &VToolBasePoint::Disable);
connect(scene, &VMainGraphicsScene::EnableToolMove, spoint, &VToolBasePoint::EnableToolMove);
tools[id] = spoint;
}
}
@ -1900,8 +1900,8 @@ QRectF VPattern::ActiveDrawBoundingRect() const
case Tool::Arrow:
Q_UNREACHABLE();
break;
case Tool::SinglePoint:
rec = ToolBoundingRect<VToolSinglePoint>(rec, tool.getId());
case Tool::BasePoint:
rec = ToolBoundingRect<VToolBasePoint>(rec, tool.getId());
break;
case Tool::EndLine:
rec = ToolBoundingRect<VToolEndLine>(rec, tool.getId());

View File

@ -49,7 +49,7 @@ enum class Tool : unsigned char
LinePoint,
AbstractSpline,
Cut,
SinglePoint,
BasePoint,
EndLine,
Line,
AlongLine,

View File

@ -39,7 +39,7 @@
#include "vtoolnormal.h"
#include "vtoolpointofcontact.h"
#include "vtoolshoulderpoint.h"
#include "vtoolsinglepoint.h"
#include "vtoolbasepoint.h"
#include "vtoolspline.h"
#include "vtoolsplinepath.h"
#include "vtoolheight.h"

View File

@ -26,7 +26,7 @@
**
*************************************************************************/
#include "vtoolsinglepoint.h"
#include "vtoolbasepoint.h"
#include "../../dialogs/tools/dialogsinglepoint.h"
#include "../../../vwidgets/vgraphicssimpletextitem.h"
#include "../../undocommands/movespoint.h"
@ -36,18 +36,18 @@
#include <QMessageBox>
const QString VToolSinglePoint::ToolType = QStringLiteral("single");
const QString VToolBasePoint::ToolType = QStringLiteral("single");
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief VToolSinglePoint constructor.
* @brief VToolBasePoint constructor.
* @param doc dom document container.
* @param data container with variables.
* @param id object id in container.
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolSinglePoint::VToolSinglePoint (VAbstractPattern *doc, VContainer *data, quint32 id, const Source &typeCreation,
VToolBasePoint::VToolBasePoint (VAbstractPattern *doc, VContainer *data, quint32 id, const Source &typeCreation,
const QString &namePP, const QString &mPath, QGraphicsItem * parent )
:VToolPoint(doc, data, id, parent), namePP(namePP), mPath(mPath)
{
@ -61,7 +61,7 @@ VToolSinglePoint::VToolSinglePoint (VAbstractPattern *doc, VContainer *data, qui
}
//---------------------------------------------------------------------------------------------------------------------
VToolSinglePoint::~VToolSinglePoint()
VToolBasePoint::~VToolBasePoint()
{
//Disable cursor-arrow-openhand
RestoreOverrideCursor(cursorArrowOpenHand);
@ -71,7 +71,7 @@ VToolSinglePoint::~VToolSinglePoint()
/**
* @brief setDialog set dialog when user want change tool option.
*/
void VToolSinglePoint::setDialog()
void VToolBasePoint::setDialog()
{
SCASSERT(dialog != nullptr);
DialogSinglePoint *dialogTool = qobject_cast<DialogSinglePoint*>(dialog);
@ -81,7 +81,7 @@ void VToolSinglePoint::setDialog()
}
//---------------------------------------------------------------------------------------------------------------------
void VToolSinglePoint::ShowVisualization(bool show)
void VToolBasePoint::ShowVisualization(bool show)
{
Q_UNUSED(show); //don't have any visualization for base point yet
}
@ -90,7 +90,7 @@ void VToolSinglePoint::ShowVisualization(bool show)
/**
* @brief AddToFile add tag with informations about tool into file.
*/
void VToolSinglePoint::AddToFile()
void VToolBasePoint::AddToFile()
{
Q_ASSERT_X(namePP.isEmpty() == false, "AddToFile", "name pattern piece is empty");
@ -124,7 +124,7 @@ void VToolSinglePoint::AddToFile()
* @param value value.
* @return value.
*/
QVariant VToolSinglePoint::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value)
QVariant VToolBasePoint::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value)
{
if (change == ItemPositionChange && scene())
{
@ -155,7 +155,7 @@ QVariant VToolSinglePoint::itemChange(QGraphicsItem::GraphicsItemChange change,
/**
* @brief decrementReferens decrement referens parents objects.
*/
void VToolSinglePoint::decrementReferens()
void VToolBasePoint::decrementReferens()
{
if (_referens > 1)
{
@ -164,7 +164,7 @@ void VToolSinglePoint::decrementReferens()
}
//---------------------------------------------------------------------------------------------------------------------
void VToolSinglePoint::DeleteTool(bool ask)
void VToolBasePoint::DeleteTool(bool ask)
{
if (_referens <= 1)
{
@ -187,7 +187,7 @@ void VToolSinglePoint::DeleteTool(bool ask)
/**
* @brief SaveDialog save options into file after change in dialog.
*/
void VToolSinglePoint::SaveDialog(QDomElement &domElement)
void VToolBasePoint::SaveDialog(QDomElement &domElement)
{
SCASSERT(dialog != nullptr);
DialogSinglePoint *dialogTool = qobject_cast<DialogSinglePoint*>(dialog);
@ -200,7 +200,7 @@ void VToolSinglePoint::SaveDialog(QDomElement &domElement)
}
//---------------------------------------------------------------------------------------------------------------------
void VToolSinglePoint::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
void VToolBasePoint::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
{
VToolPoint::hoverEnterEvent(event);
@ -211,7 +211,7 @@ void VToolSinglePoint::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
}
//---------------------------------------------------------------------------------------------------------------------
void VToolSinglePoint::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
void VToolBasePoint::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{
VToolPoint::hoverLeaveEvent(event);
@ -223,7 +223,7 @@ void VToolSinglePoint::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
}
//---------------------------------------------------------------------------------------------------------------------
void VToolSinglePoint::mousePressEvent(QGraphicsSceneMouseEvent *event)
void VToolBasePoint::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
if (flags() & QGraphicsItem::ItemIsMovable)
{
@ -236,7 +236,7 @@ void VToolSinglePoint::mousePressEvent(QGraphicsSceneMouseEvent *event)
}
//---------------------------------------------------------------------------------------------------------------------
void VToolSinglePoint::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
void VToolBasePoint::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
if (flags() & QGraphicsItem::ItemIsMovable)
{
@ -254,14 +254,14 @@ void VToolSinglePoint::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
* @brief SetColorLabel change color for label and label line.
* @param color new color.
*/
void VToolSinglePoint::SetColorLabel(const Qt::GlobalColor &color)
void VToolBasePoint::SetColorLabel(const Qt::GlobalColor &color)
{
namePoint->setBrush(color);
lineName->setPen(QPen(color, qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
}
//---------------------------------------------------------------------------------------------------------------------
void VToolSinglePoint::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
void VToolBasePoint::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
{
VToolPoint::SaveOptions(tag, obj);
@ -274,7 +274,7 @@ void VToolSinglePoint::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &o
}
//---------------------------------------------------------------------------------------------------------------------
void VToolSinglePoint::ReadToolAttributes(const QDomElement &domElement)
void VToolBasePoint::ReadToolAttributes(const QDomElement &domElement)
{
Q_UNUSED(domElement);
// This tool doesn't need read attributes from file.
@ -285,7 +285,7 @@ void VToolSinglePoint::ReadToolAttributes(const QDomElement &domElement)
* @brief contextMenuEvent handle context menu events.
* @param event context menu event.
*/
void VToolSinglePoint::contextMenuEvent ( QGraphicsSceneContextMenuEvent * event )
void VToolBasePoint::contextMenuEvent ( QGraphicsSceneContextMenuEvent * event )
{
#ifndef QT_NO_CURSOR
QApplication::restoreOverrideCursor();
@ -308,7 +308,7 @@ void VToolSinglePoint::contextMenuEvent ( QGraphicsSceneContextMenuEvent * event
/**
* @brief FullUpdateFromFile update tool data form file.
*/
void VToolSinglePoint::FullUpdateFromFile()
void VToolBasePoint::FullUpdateFromFile()
{
VPointF point = *VAbstractTool::data.GeometricObject<VPointF>(id);
RefreshPointGeometry(point);
@ -319,14 +319,14 @@ void VToolSinglePoint::FullUpdateFromFile()
* @brief SetFactor set current scale factor of scene.
* @param factor scene scale factor.
*/
void VToolSinglePoint::SetFactor(qreal factor)
void VToolBasePoint::SetFactor(qreal factor)
{
VDrawTool::SetFactor(factor);
RefreshPointGeometry(*(VAbstractTool::data.GeometricObject<VPointF>(id)));
}
//---------------------------------------------------------------------------------------------------------------------
void VToolSinglePoint::EnableToolMove(bool move)
void VToolBasePoint::EnableToolMove(bool move)
{
this->setFlag(QGraphicsItem::ItemIsMovable, move);
VToolPoint::EnableToolMove(move);

View File

@ -26,26 +26,26 @@
**
*************************************************************************/
#ifndef VTOOLSINGLEPOINT_H
#define VTOOLSINGLEPOINT_H
#ifndef VTOOLBASEPOINT_H
#define VTOOLBASEPOINT_H
#include "vtoolpoint.h"
/**
* @brief The VToolSinglePoint class tool for creation pattern base point. Obly base point can move. All object
* @brief The VToolBasePoint class tool for creation pattern base point. Obly base point can move. All object
* pattern peace depend on base point.
*/
class VToolSinglePoint : public VToolPoint
class VToolBasePoint : public VToolPoint
{
Q_OBJECT
public:
VToolSinglePoint (VAbstractPattern *doc, VContainer *data, quint32 id, const Source &typeCreation,
VToolBasePoint (VAbstractPattern *doc, VContainer *data, quint32 id, const Source &typeCreation,
const QString &namePP, const QString &mPath, QGraphicsItem * parent = nullptr );
virtual ~VToolSinglePoint();
virtual ~VToolBasePoint();
virtual void setDialog();
static const QString ToolType;
virtual int type() const {return Type;}
enum { Type = UserType + static_cast<int>(Tool::SinglePoint)};
enum { Type = UserType + static_cast<int>(Tool::BasePoint)};
virtual void ShowVisualization(bool show);
public slots:
virtual void FullUpdateFromFile();
@ -77,4 +77,4 @@ private:
};
#endif // VTOOLSINGLEPOINT_H
#endif // VTOOLBASEPOINT_H

View File

@ -9,7 +9,7 @@ HEADERS += \
$$PWD/drawTools/vtooltriangle.h \
$$PWD/drawTools/vtoolsplinepath.h \
$$PWD/drawTools/vtoolspline.h \
$$PWD/drawTools/vtoolsinglepoint.h \
$$PWD/drawTools/vtoolbasepoint.h \
$$PWD/drawTools/vtoolshoulderpoint.h \
$$PWD/drawTools/vtoolpointofintersection.h \
$$PWD/drawTools/vtoolpointofcontact.h \
@ -52,7 +52,7 @@ SOURCES += \
$$PWD/drawTools/vtooltriangle.cpp \
$$PWD/drawTools/vtoolsplinepath.cpp \
$$PWD/drawTools/vtoolspline.cpp \
$$PWD/drawTools/vtoolsinglepoint.cpp \
$$PWD/drawTools/vtoolbasepoint.cpp \
$$PWD/drawTools/vtoolshoulderpoint.cpp \
$$PWD/drawTools/vtoolpointofintersection.cpp \
$$PWD/drawTools/vtoolpointofcontact.cpp \