Fix some gcc warning.

This commit is contained in:
dismine 2013-09-12 17:18:31 +03:00
parent ea072a35f4
commit fb99e19f27
24 changed files with 79 additions and 68 deletions

View File

@ -134,13 +134,13 @@ qint64 VContainer::getId(){
} }
qint64 VContainer::getNextId(){ qint64 VContainer::getNextId(){
this->_id++; _id++;
return _id; return _id;
} }
void VContainer::UpdateId(qint64 newId){ void VContainer::UpdateId(qint64 newId){
if(newId > this->_id){ if(newId > _id){
this->_id = newId; _id = newId;
} }
} }
@ -208,6 +208,9 @@ void VContainer::IncrementReferens(qint64 id, Scene::Type obj, Draw::Mode mode){
} }
} }
break; break;
default:
qWarning()<<"Get wrong scene type.";
break;
} }
} }
@ -254,7 +257,10 @@ QPainterPath VContainer::ContourPath(qint64 idDetail) const{
} }
} }
break; break;
} default:
qWarning()<<"Get wrong tool type. Ignore.";
break;
}
} }
QPainterPath ekv = Equidistant(points, Detail::CloseEquidistant, toPixel(10)); QPainterPath ekv = Equidistant(points, Detail::CloseEquidistant, toPixel(10));
QPainterPath path; QPainterPath path;

View File

@ -1,4 +1,5 @@
#include "dialogdetail.h" #include "dialogdetail.h"
#include <QDebug>
DialogDetail::DialogDetail(const VContainer *data, Draw::Mode mode, QWidget *parent) : DialogDetail::DialogDetail(const VContainer *data, Draw::Mode mode, QWidget *parent) :
DialogTool(data, mode, parent), ui(), details(VDetail()){ DialogTool(data, mode, parent), ui(), details(VDetail()){
@ -36,6 +37,9 @@ void DialogDetail::ChoosedObject(qint64 id, Scene::Type type){
case(Scene::SplinePath): case(Scene::SplinePath):
NewItem(id, Tools::NodeSplinePath, mode, NodeDetail::Contour); NewItem(id, Tools::NodeSplinePath, mode, NodeDetail::Contour);
break; break;
default:
qWarning()<<"Get wrong scene object. Ignore.";
break;
} }
this->show(); this->show();
} }
@ -94,6 +98,9 @@ void DialogDetail::NewItem(qint64 id, Tools::Enum typeTool, Draw::Mode mode, Nod
name = data->GetNameSplinePath(splPath, mode); name = data->GetNameSplinePath(splPath, mode);
break; break;
} }
default:
qWarning()<<"Get wrong tools. Ignore.";
break;
} }
QListWidgetItem *item = new QListWidgetItem(name); QListWidgetItem *item = new QListWidgetItem(name);

View File

@ -9,7 +9,7 @@ DialogEndLine::DialogEndLine(const VContainer *data, Draw::Mode mode, QWidget *p
DialogTool(data, mode, parent), ui(new Ui::DialogEndLine), pointName(QString()), typeLine(QString()), DialogTool(data, mode, parent), ui(new Ui::DialogEndLine), pointName(QString()), typeLine(QString()),
formula(QString()), angle(0), basePointId(0){ formula(QString()), angle(0), basePointId(0){
ui->setupUi(this); ui->setupUi(this);
spinBoxAngle = ui->spinBoxAngle; spinBoxAngle = ui->doubleSpinBoxAngle;
listWidget = ui->listWidget; listWidget = ui->listWidget;
labelResultCalculation = ui->labelResultCalculation; labelResultCalculation = ui->labelResultCalculation;
labelDescription = ui->labelDescription; labelDescription = ui->labelDescription;
@ -109,13 +109,13 @@ void DialogEndLine::setFormula(const QString &value){
ui->lineEditFormula->setText(formula); ui->lineEditFormula->setText(formula);
} }
qint32 DialogEndLine::getAngle() const{ qreal DialogEndLine::getAngle() const{
return angle; return angle;
} }
void DialogEndLine::setAngle(const qint32 &value){ void DialogEndLine::setAngle(const qreal &value){
angle = value; angle = value;
ui->spinBoxAngle->setValue(angle); ui->doubleSpinBoxAngle->setValue(angle);
} }
qint64 DialogEndLine::getBasePointId() const{ qint64 DialogEndLine::getBasePointId() const{
@ -130,7 +130,7 @@ void DialogEndLine::DialogAccepted(){
pointName = ui->lineEditNamePoint->text(); pointName = ui->lineEditNamePoint->text();
typeLine = GetTypeLine(ui->comboBoxLineType); typeLine = GetTypeLine(ui->comboBoxLineType);
formula = ui->lineEditFormula->text(); formula = ui->lineEditFormula->text();
angle = ui->spinBoxAngle->value(); angle = ui->doubleSpinBoxAngle->value();
basePointId = getCurrentPointId(ui->comboBoxBasePoint); basePointId = getCurrentPointId(ui->comboBoxBasePoint);
emit DialogClosed(QDialog::Accepted); emit DialogClosed(QDialog::Accepted);
} }

View File

@ -26,8 +26,8 @@ public:
void setTypeLine(const QString &value); void setTypeLine(const QString &value);
QString getFormula() const; QString getFormula() const;
void setFormula(const QString &value); void setFormula(const QString &value);
qint32 getAngle() const; qreal getAngle() const;
void setAngle(const qint32 &value); void setAngle(const qreal &value);
qint64 getBasePointId() const; qint64 getBasePointId() const;
void setBasePointId(const qint64 &value, const qint64 &id); void setBasePointId(const qint64 &value, const qint64 &id);
public slots: public slots:
@ -38,7 +38,7 @@ private:
QString pointName; QString pointName;
QString typeLine; QString typeLine;
QString formula; QString formula;
qint32 angle; qreal angle;
qint64 basePointId; qint64 basePointId;
DialogEndLine(const DialogEndLine &dialog); DialogEndLine(const DialogEndLine &dialog);
const DialogEndLine &operator=(const DialogEndLine& dialog); const DialogEndLine &operator=(const DialogEndLine& dialog);

View File

@ -315,7 +315,7 @@
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="1" column="1">
<widget class="QSpinBox" name="spinBoxAngle"> <widget class="QDoubleSpinBox" name="doubleSpinBoxAngle">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Fixed"> <sizepolicy hsizetype="Ignored" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -324,16 +324,10 @@
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>52</width> <width>57</width>
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
<property name="maximum">
<number>360</number>
</property>
<property name="value">
<number>0</number>
</property>
</widget> </widget>
</item> </item>
</layout> </layout>

View File

@ -1,14 +1,13 @@
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
#include "dialoghistory.h" #include "dialoghistory.h"
#include "ui_dialoghistory.h" #include "ui_dialoghistory.h"
#pragma GCC diagnostic pop
#include "geometry/varc.h" #include "geometry/varc.h"
#include "geometry/vspline.h" #include "geometry/vspline.h"
#include "geometry/vsplinepath.h" #include "geometry/vsplinepath.h"
#include <QDebug>
DialogHistory::DialogHistory(VContainer *data, VDomDocument *doc, QWidget *parent) : DialogHistory::DialogHistory(VContainer *data, VDomDocument *doc, QWidget *parent) :
DialogTool(data, Draw::Calculation, parent), ui(new Ui::DialogHistory), doc(doc), cursorRow(0), cursorToolRecordRow(0){ DialogTool(data, Draw::Calculation, parent), ui(new Ui::DialogHistory), doc(doc), cursorRow(0),
cursorToolRecordRow(0){
ui->setupUi(this); ui->setupUi(this);
bOk = ui->buttonBox->button(QDialogButtonBox::Ok); bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
connect(bOk, &QPushButton::clicked, this, &DialogHistory::DialogAccepted); connect(bOk, &QPushButton::clicked, this, &DialogHistory::DialogAccepted);
@ -230,6 +229,9 @@ QString DialogHistory::Record(const VToolRecord &tool){
data->GetPoint(secondPointId).name(), data->GetPoint(secondPointId).name(),
data->GetPoint(tool.getId()).name()); data->GetPoint(tool.getId()).name());
break; break;
default:
qWarning()<<"Get wrong tool type. Ignore.";
break;
} }
return record; return record;
} }

View File

@ -6,7 +6,7 @@ DialogNormal::DialogNormal(const VContainer *data, Draw::Mode mode, QWidget *par
DialogTool(data, mode, parent), ui(new Ui::DialogNormal), number(0), pointName(QString()), DialogTool(data, mode, parent), ui(new Ui::DialogNormal), number(0), pointName(QString()),
typeLine(QString()), formula(QString()), angle(0), firstPointId(0), secondPointId(0){ typeLine(QString()), formula(QString()), angle(0), firstPointId(0), secondPointId(0){
ui->setupUi(this); ui->setupUi(this);
spinBoxAngle = ui->spinBoxAngle; spinBoxAngle = ui->doubleSpinBoxAngle;
listWidget = ui->listWidget; listWidget = ui->listWidget;
labelResultCalculation = ui->labelResultCalculation; labelResultCalculation = ui->labelResultCalculation;
labelDescription = ui->labelDescription; labelDescription = ui->labelDescription;
@ -105,7 +105,7 @@ void DialogNormal::DialogAccepted(){
pointName = ui->lineEditNamePoint->text(); pointName = ui->lineEditNamePoint->text();
typeLine = GetTypeLine(ui->comboBoxLineType); typeLine = GetTypeLine(ui->comboBoxLineType);
formula = ui->lineEditFormula->text(); formula = ui->lineEditFormula->text();
angle = ui->spinBoxAngle->value(); angle = ui->doubleSpinBoxAngle->value();
firstPointId = getCurrentPointId(ui->comboBoxFirstPoint); firstPointId = getCurrentPointId(ui->comboBoxFirstPoint);
secondPointId = getCurrentPointId(ui->comboBoxSecondPoint); secondPointId = getCurrentPointId(ui->comboBoxSecondPoint);
emit DialogClosed(QDialog::Accepted); emit DialogClosed(QDialog::Accepted);
@ -127,13 +127,13 @@ void DialogNormal::setFirstPointId(const qint64 &value, const qint64 &id){
setCurrentPointId(ui->comboBoxFirstPoint, firstPointId, value, id); setCurrentPointId(ui->comboBoxFirstPoint, firstPointId, value, id);
} }
qint32 DialogNormal::getAngle() const{ qreal DialogNormal::getAngle() const{
return angle; return angle;
} }
void DialogNormal::setAngle(const qint32 &value){ void DialogNormal::setAngle(const qreal &value){
angle = value; angle = value;
ui->spinBoxAngle->setValue(angle); ui->doubleSpinBoxAngle->setValue(angle);
} }
QString DialogNormal::getFormula() const{ QString DialogNormal::getFormula() const{

View File

@ -26,8 +26,8 @@ public:
void setTypeLine(const QString &value); void setTypeLine(const QString &value);
QString getFormula() const; QString getFormula() const;
void setFormula(const QString &value); void setFormula(const QString &value);
qint32 getAngle() const; qreal getAngle() const;
void setAngle(const qint32 &value); void setAngle(const qreal &value);
qint64 getFirstPointId() const; qint64 getFirstPointId() const;
void setFirstPointId(const qint64 &value, const qint64 &id); void setFirstPointId(const qint64 &value, const qint64 &id);
qint64 getSecondPointId() const; qint64 getSecondPointId() const;
@ -41,7 +41,7 @@ private:
QString pointName; QString pointName;
QString typeLine; QString typeLine;
QString formula; QString formula;
qint32 angle; qreal angle;
qint64 firstPointId; qint64 firstPointId;
qint64 secondPointId; qint64 secondPointId;
DialogNormal(const DialogNormal &dialog); DialogNormal(const DialogNormal &dialog);

View File

@ -338,7 +338,7 @@
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="1" column="1">
<widget class="QSpinBox" name="spinBoxAngle"> <widget class="QDoubleSpinBox" name="doubleSpinBoxAngle">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Fixed"> <sizepolicy hsizetype="Ignored" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -347,16 +347,10 @@
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>52</width> <width>56</width>
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
<property name="maximum">
<number>360</number>
</property>
<property name="value">
<number>0</number>
</property>
</widget> </widget>
</item> </item>
</layout> </layout>

View File

@ -3,7 +3,7 @@
#include <QDialog> #include <QDialog>
#include <QComboBox> #include <QComboBox>
#include <QSpinBox> #include <QDoubleSpinBox>
#include <QPushButton> #include <QPushButton>
#include <QLineEdit> #include <QLineEdit>
#include <QListWidget> #include <QListWidget>
@ -54,7 +54,7 @@ protected:
bool flagFormula; bool flagFormula;
QTimer *timerFormula; QTimer *timerFormula;
QPushButton *bOk; QPushButton *bOk;
QSpinBox *spinBoxAngle; QDoubleSpinBox *spinBoxAngle;
QLineEdit *lineEditFormula; QLineEdit *lineEditFormula;
QListWidget *listWidget; QListWidget *listWidget;
QLabel *labelResultCalculation; QLabel *labelResultCalculation;

View File

@ -589,6 +589,9 @@ void MainWindow::CanselTool(){
dialogDetail.clear(); dialogDetail.clear();
ui->toolButtonNewDetail->setChecked(false); ui->toolButtonNewDetail->setChecked(false);
break; break;
default:
qWarning()<<"Get wrong tool type. Ignore.";
break;
} }
} }

View File

@ -317,7 +317,7 @@ void TableWindow::PngFile(const QString &name) const{
QRectF r = paper->rect(); QRectF r = paper->rect();
qreal x=0, y=0, w=0, h=0; qreal x=0, y=0, w=0, h=0;
r.getRect(&x,&y,&w,&h);// Re-shrink the scene to it's bounding contents r.getRect(&x,&y,&w,&h);// Re-shrink the scene to it's bounding contents
QImage image(QSize(w, h), QImage::Format_ARGB32); // Create the image with the exact size of the shrunk scene QImage image(QSize(static_cast<qint32>(w), static_cast<qint32>(h)), QImage::Format_ARGB32); // Create the image with the exact size of the shrunk scene
image.fill(Qt::transparent); // Start all pixels transparent image.fill(Qt::transparent); // Start all pixels transparent
QPainter painter(&image); QPainter painter(&image);
painter.setFont( QFont( "Arial", 8, QFont::Normal ) ); painter.setFont( QFont( "Arial", 8, QFont::Normal ) );

View File

@ -1,10 +1,10 @@
#include "vtoolendline.h" #include "vtoolendline.h"
#include <QDebug> #include <QDebug>
#include <QMenu> #include <QMenu>
#include "../../widgets/vmaingraphicsscene.h" #include "widgets/vmaingraphicsscene.h"
VToolEndLine::VToolEndLine(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, VToolEndLine::VToolEndLine(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine,
const QString &formula, const qint32 &angle, const qint64 &basePointId, const QString &formula, const qreal &angle, const qint64 &basePointId,
Tool::Enum typeCreation, QGraphicsItem *parent): Tool::Enum typeCreation, QGraphicsItem *parent):
VToolLinePoint(doc, data, id, typeLine, formula, basePointId, angle, parent), VToolLinePoint(doc, data, id, typeLine, formula, basePointId, angle, parent),
dialogEndLine(QSharedPointer<DialogEndLine>()){ dialogEndLine(QSharedPointer<DialogEndLine>()){
@ -26,19 +26,19 @@ void VToolEndLine::setDialog(){
} }
} }
void VToolEndLine::Create(QSharedPointer<DialogEndLine> &dialog, VMainGraphicsScene *scene, VDomDocument *doc, void VToolEndLine::Create(QSharedPointer<DialogEndLine> &dialog, VMainGraphicsScene *scene,
VContainer *data){ VDomDocument *doc, VContainer *data){
QString pointName = dialog->getPointName(); QString pointName = dialog->getPointName();
QString typeLine = dialog->getTypeLine(); QString typeLine = dialog->getTypeLine();
QString formula = dialog->getFormula(); QString formula = dialog->getFormula();
qint32 angle = dialog->getAngle(); qreal angle = dialog->getAngle();
qint64 basePointId = dialog->getBasePointId(); qint64 basePointId = dialog->getBasePointId();
Create(0, pointName, typeLine, formula, angle, basePointId, 5, 10, scene, doc, data, Document::FullParse, Create(0, pointName, typeLine, formula, angle, basePointId, 5, 10, scene, doc, data, Document::FullParse,
Tool::FromGui); Tool::FromGui);
} }
void VToolEndLine::Create(const qint64 _id, const QString &pointName, const QString &typeLine, void VToolEndLine::Create(const qint64 _id, const QString &pointName, const QString &typeLine,
const QString &formula, const qint32 &angle, const qint64 &basePointId, const QString &formula, const qreal &angle, const qint64 &basePointId,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc,
VContainer *data, Document::Enum parse, Tool::Enum typeCreation){ VContainer *data, Document::Enum parse, Tool::Enum typeCreation){

View File

@ -10,14 +10,14 @@ class VToolEndLine : public VToolLinePoint
Q_OBJECT Q_OBJECT
public: public:
VToolEndLine(VDomDocument *doc, VContainer *data, const qint64 &id, VToolEndLine(VDomDocument *doc, VContainer *data, const qint64 &id,
const QString &typeLine, const QString &formula, const qint32 &angle, const QString &typeLine, const QString &formula, const qreal &angle,
const qint64 &basePointId, Tool::Enum typeCreation, const qint64 &basePointId, Tool::Enum typeCreation,
QGraphicsItem * parent = 0); QGraphicsItem * parent = 0);
virtual void setDialog(); virtual void setDialog();
static void Create(QSharedPointer<DialogEndLine> &dialog, VMainGraphicsScene *scene, VDomDocument *doc, static void Create(QSharedPointer<DialogEndLine> &dialog, VMainGraphicsScene *scene, VDomDocument *doc,
VContainer *data); VContainer *data);
static void Create(const qint64 _id, const QString &pointName, const QString &typeLine, static void Create(const qint64 _id, const QString &pointName, const QString &typeLine,
const QString &formula, const qint32 &angle, const qint64 &basePointId, const qreal &mx, const qreal &my, const QString &formula, const qreal &angle, const qint64 &basePointId, const qreal &mx, const qreal &my,
VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, Document::Enum parse, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, Document::Enum parse,
Tool::Enum typeCreation); Tool::Enum typeCreation);
public slots: public slots:

View File

@ -2,13 +2,13 @@
VToolLinePoint::VToolLinePoint(VDomDocument *doc, VContainer *data, const qint64 &id, VToolLinePoint::VToolLinePoint(VDomDocument *doc, VContainer *data, const qint64 &id,
const QString &typeLine, const QString &formula, const qint64 &basePointId, const QString &typeLine, const QString &formula, const qint64 &basePointId,
const qint32 &angle, QGraphicsItem *parent):VToolPoint(doc, data, id, parent), const qreal &angle, QGraphicsItem *parent):VToolPoint(doc, data, id, parent),
typeLine(typeLine), formula(formula), angle(angle), basePointId(basePointId), mainLine(0){ typeLine(typeLine), formula(formula), angle(angle), basePointId(basePointId), mainLine(0){
Q_ASSERT_X(basePointId > 0, Q_FUNC_INFO, "basePointId <= 0"); Q_ASSERT_X(basePointId > 0, Q_FUNC_INFO, "basePointId <= 0");
//Лінія, що з'єднує дві точки //Лінія, що з'єднує дві точки
QPointF point1 = data->GetPoint(basePointId).toQPointF(); QPointF point1 = data->GetPoint(basePointId).toQPointF();
QPointF point2 = data->GetPoint(id).toQPointF(); QPointF point2 = data->GetPoint(id).toQPointF();
mainLine = new QGraphicsLineItem(QLineF(point1 - point2, 0), this); mainLine = new QGraphicsLineItem(QLineF(point1 - point2, QPointF()), this);
mainLine->setPen(QPen(Qt::black, widthHairLine)); mainLine->setPen(QPen(Qt::black, widthHairLine));
mainLine->setFlag(QGraphicsItem::ItemStacksBehindParent, true); mainLine->setFlag(QGraphicsItem::ItemStacksBehindParent, true);
if(typeLine == "none"){ if(typeLine == "none"){
@ -32,7 +32,7 @@ void VToolLinePoint::RefreshGeometry(){
VToolPoint::RefreshPointGeometry(VDrawTool::data.GetPoint(id)); VToolPoint::RefreshPointGeometry(VDrawTool::data.GetPoint(id));
QPointF point = VDrawTool::data.GetPoint(id).toQPointF(); QPointF point = VDrawTool::data.GetPoint(id).toQPointF();
QPointF basePoint = VDrawTool::data.GetPoint(basePointId).toQPointF(); QPointF basePoint = VDrawTool::data.GetPoint(basePointId).toQPointF();
mainLine->setLine(QLineF(basePoint - point, 0)); mainLine->setLine(QLineF(basePoint - point, QPointF()));
if(typeLine == "none"){ if(typeLine == "none"){
mainLine->setVisible(false); mainLine->setVisible(false);
} else { } else {

View File

@ -9,13 +9,13 @@ class VToolLinePoint : public VToolPoint
public: public:
VToolLinePoint(VDomDocument *doc, VContainer *data, const qint64 &id, VToolLinePoint(VDomDocument *doc, VContainer *data, const qint64 &id,
const QString &typeLine, const QString &formula, const QString &typeLine, const QString &formula,
const qint64 &basePointId, const qint32 &angle, QGraphicsItem * parent = 0); const qint64 &basePointId, const qreal &angle, QGraphicsItem * parent = 0);
public slots: public slots:
virtual void ChangedActivDraw(const QString newName); virtual void ChangedActivDraw(const QString newName);
protected: protected:
QString typeLine; QString typeLine;
QString formula; QString formula;
qint32 angle; qreal angle;
qint64 basePointId; qint64 basePointId;
QGraphicsLineItem *mainLine; QGraphicsLineItem *mainLine;
virtual void RefreshGeometry(); virtual void RefreshGeometry();

View File

@ -34,7 +34,7 @@ void VToolNormal::Create(QSharedPointer<DialogNormal> &dialog, VMainGraphicsScen
qint64 secondPointId = dialog->getSecondPointId(); qint64 secondPointId = dialog->getSecondPointId();
QString typeLine = dialog->getTypeLine(); QString typeLine = dialog->getTypeLine();
QString pointName = dialog->getPointName(); QString pointName = dialog->getPointName();
qint32 angle = dialog->getAngle(); qreal angle = dialog->getAngle();
Create(0, formula, firstPointId, secondPointId, typeLine, pointName, angle, 5, 10, scene, doc, data, Create(0, formula, firstPointId, secondPointId, typeLine, pointName, angle, 5, 10, scene, doc, data,
Document::FullParse, Tool::FromGui); Document::FullParse, Tool::FromGui);
} }

View File

@ -4,7 +4,7 @@
#include "widgets/vmaingraphicsscene.h" #include "widgets/vmaingraphicsscene.h"
VModelingEndLine::VModelingEndLine(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, VModelingEndLine::VModelingEndLine(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine,
const QString &formula, const qint32 &angle, const qint64 &basePointId, const QString &formula, const qreal &angle, const qint64 &basePointId,
Tool::Enum typeCreation, QGraphicsItem *parent): Tool::Enum typeCreation, QGraphicsItem *parent):
VModelingLinePoint(doc, data, id, typeLine, formula, basePointId, angle, parent), VModelingLinePoint(doc, data, id, typeLine, formula, basePointId, angle, parent),
dialogEndLine(QSharedPointer<DialogEndLine>()){ dialogEndLine(QSharedPointer<DialogEndLine>()){
@ -31,7 +31,7 @@ VModelingEndLine *VModelingEndLine::Create(QSharedPointer<DialogEndLine> &dialog
QString pointName = dialog->getPointName(); QString pointName = dialog->getPointName();
QString typeLine = dialog->getTypeLine(); QString typeLine = dialog->getTypeLine();
QString formula = dialog->getFormula(); QString formula = dialog->getFormula();
qint32 angle = dialog->getAngle(); qreal angle = dialog->getAngle();
qint64 basePointId = dialog->getBasePointId(); qint64 basePointId = dialog->getBasePointId();
return Create(0, pointName, typeLine, formula, angle, basePointId, 5, 10, doc, data, Document::FullParse, return Create(0, pointName, typeLine, formula, angle, basePointId, 5, 10, doc, data, Document::FullParse,
Tool::FromGui); Tool::FromGui);
@ -39,7 +39,7 @@ VModelingEndLine *VModelingEndLine::Create(QSharedPointer<DialogEndLine> &dialog
VModelingEndLine *VModelingEndLine::Create(const qint64 _id, const QString &pointName, VModelingEndLine *VModelingEndLine::Create(const qint64 _id, const QString &pointName,
const QString &typeLine, const QString &formula, const QString &typeLine, const QString &formula,
const qint32 &angle, const qint64 &basePointId, const qreal &mx, const qreal &angle, const qint64 &basePointId, const qreal &mx,
const qreal &my, VDomDocument *doc, VContainer *data, const qreal &my, VDomDocument *doc, VContainer *data,
Document::Enum parse, Tool::Enum typeCreation){ Document::Enum parse, Tool::Enum typeCreation){
VModelingEndLine *point = 0; VModelingEndLine *point = 0;

View File

@ -10,14 +10,14 @@ class VModelingEndLine : public VModelingLinePoint
Q_OBJECT Q_OBJECT
public: public:
VModelingEndLine(VDomDocument *doc, VContainer *data, const qint64 &id, VModelingEndLine(VDomDocument *doc, VContainer *data, const qint64 &id,
const QString &typeLine, const QString &formula, const qint32 &angle, const QString &typeLine, const QString &formula, const qreal &angle,
const qint64 &basePointId, Tool::Enum typeCreation, const qint64 &basePointId, Tool::Enum typeCreation,
QGraphicsItem * parent = 0); QGraphicsItem * parent = 0);
virtual void setDialog(); virtual void setDialog();
static VModelingEndLine* Create(QSharedPointer<DialogEndLine> &dialog, VDomDocument *doc, static VModelingEndLine* Create(QSharedPointer<DialogEndLine> &dialog, VDomDocument *doc,
VContainer *data); VContainer *data);
static VModelingEndLine* Create(const qint64 _id, const QString &pointName, const QString &typeLine, static VModelingEndLine* Create(const qint64 _id, const QString &pointName, const QString &typeLine,
const QString &formula, const qint32 &angle, const qint64 &basePointId, const QString &formula, const qreal &angle, const qint64 &basePointId,
const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data, const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data,
Document::Enum parse, Tool::Enum typeCreation); Document::Enum parse, Tool::Enum typeCreation);
public slots: public slots:

View File

@ -2,13 +2,13 @@
VModelingLinePoint::VModelingLinePoint(VDomDocument *doc, VContainer *data, const qint64 &id, VModelingLinePoint::VModelingLinePoint(VDomDocument *doc, VContainer *data, const qint64 &id,
const QString &typeLine, const QString &formula, const qint64 &basePointId, const QString &typeLine, const QString &formula, const qint64 &basePointId,
const qint32 &angle, QGraphicsItem *parent): const qreal &angle, QGraphicsItem *parent):
VModelingPoint(doc, data, id, parent), typeLine(typeLine), formula(formula), angle(angle), VModelingPoint(doc, data, id, parent), typeLine(typeLine), formula(formula), angle(angle),
basePointId(basePointId), mainLine(0){ basePointId(basePointId), mainLine(0){
//Лінія, що з'єднує дві точки //Лінія, що з'єднує дві точки
QPointF point1 = data->GetModelingPoint(basePointId).toQPointF(); QPointF point1 = data->GetModelingPoint(basePointId).toQPointF();
QPointF point2 = data->GetModelingPoint(id).toQPointF(); QPointF point2 = data->GetModelingPoint(id).toQPointF();
mainLine = new QGraphicsLineItem(QLineF(point1 - point2, 0), this); mainLine = new QGraphicsLineItem(QLineF(point1 - point2, QPointF()), this);
mainLine->setPen(QPen(Qt::black, widthHairLine)); mainLine->setPen(QPen(Qt::black, widthHairLine));
mainLine->setFlag(QGraphicsItem::ItemStacksBehindParent, true); mainLine->setFlag(QGraphicsItem::ItemStacksBehindParent, true);
if(typeLine == "none"){ if(typeLine == "none"){
@ -22,7 +22,7 @@ void VModelingLinePoint::RefreshGeometry(){
VModelingPoint::RefreshPointGeometry(VModelingTool::data.GetModelingPoint(id)); VModelingPoint::RefreshPointGeometry(VModelingTool::data.GetModelingPoint(id));
QPointF point = VModelingTool::data.GetModelingPoint(id).toQPointF(); QPointF point = VModelingTool::data.GetModelingPoint(id).toQPointF();
QPointF basePoint = VModelingTool::data.GetModelingPoint(basePointId).toQPointF(); QPointF basePoint = VModelingTool::data.GetModelingPoint(basePointId).toQPointF();
mainLine->setLine(QLineF(basePoint - point, 0)); mainLine->setLine(QLineF(basePoint - point, QPointF()));
if(typeLine == "none"){ if(typeLine == "none"){
mainLine->setVisible(false); mainLine->setVisible(false);
} else { } else {

View File

@ -9,11 +9,11 @@ class VModelingLinePoint : public VModelingPoint
public: public:
VModelingLinePoint(VDomDocument *doc, VContainer *data, const qint64 &id, VModelingLinePoint(VDomDocument *doc, VContainer *data, const qint64 &id,
const QString &typeLine, const QString &formula, const QString &typeLine, const QString &formula,
const qint64 &basePointId, const qint32 &angle, QGraphicsItem * parent = 0); const qint64 &basePointId, const qreal &angle, QGraphicsItem * parent = 0);
protected: protected:
QString typeLine; QString typeLine;
QString formula; QString formula;
qint32 angle; qreal angle;
qint64 basePointId; qint64 basePointId;
QGraphicsLineItem *mainLine; QGraphicsLineItem *mainLine;
virtual void RefreshGeometry(); virtual void RefreshGeometry();

View File

@ -34,7 +34,7 @@ VModelingNormal* VModelingNormal::Create(QSharedPointer<DialogNormal> &dialog, V
qint64 secondPointId = dialog->getSecondPointId(); qint64 secondPointId = dialog->getSecondPointId();
QString typeLine = dialog->getTypeLine(); QString typeLine = dialog->getTypeLine();
QString pointName = dialog->getPointName(); QString pointName = dialog->getPointName();
qint32 angle = dialog->getAngle(); qreal angle = dialog->getAngle();
return Create(0, formula, firstPointId, secondPointId, typeLine, pointName, angle, 5, 10, doc, data, return Create(0, formula, firstPointId, secondPointId, typeLine, pointName, angle, 5, 10, doc, data,
Document::FullParse, Tool::FromGui); Document::FullParse, Tool::FromGui);
} }

View File

@ -137,6 +137,9 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id,
tool->setParentItem(this); tool->setParentItem(this);
break; break;
} }
default:
qWarning()<<"Get wrong tool type. Ignore.";
break;
} }
} }
this->setFlag(QGraphicsItem::ItemIsMovable, true); this->setFlag(QGraphicsItem::ItemIsMovable, true);

View File

@ -43,6 +43,8 @@ private:
VMainGraphicsScene *sceneDetails; VMainGraphicsScene *sceneDetails;
void RefreshGeometry (); void RefreshGeometry ();
void AddNode(QDomElement &domElement, VNodeDetail &node); void AddNode(QDomElement &domElement, VNodeDetail &node);
VToolDetail(const VToolDetail &tool);
VToolDetail &operator=(const VToolDetail &tool);
}; };
#endif // VTOOLDETAIL_H #endif // VTOOLDETAIL_H