Merge with develop

--HG--
branch : feature
This commit is contained in:
dismine 2013-10-09 19:24:59 +03:00
commit 6922fbc24c
9 changed files with 58 additions and 20 deletions

View File

@ -73,8 +73,8 @@ void DialogDetail::DialogAccepted(){
details.append( qvariant_cast<VNodeDetail>(item->data(Qt::UserRole)));
}
details.setName(ui.lineEditNameDetail->text());
emit DialogClosed(QDialog::Accepted);
emit ToolTip("");
emit DialogClosed(QDialog::Accepted);
}
void DialogDetail::NewItem(qint64 id, Tool::Tools typeTool, Draw::Draws mode, NodeDetail::NodeDetails typeNode){

View File

@ -87,7 +87,7 @@ QVector<QPointF> VSplinePath::GetPathPoints() const{
VSpline spl(points, path[i-1].P(), path[i].P(), path[i-1].Angle2(), path[i].Angle1(), path[i-1].KAsm2(),
path[i].KAsm1(), this->kCurve);
QVector<QPointF> splP = spl.GetPoints();
for(qint32 j = 0; i < splP.size(); ++j){
for(qint32 j = 0; j < splP.size(); ++j){
pathPoints.append(splP[j]);
}
}

View File

@ -51,19 +51,23 @@ void VToolLine::Create(QSharedPointer<DialogLine> &dialog, VMainGraphicsScene *s
Create(0, firstPoint, secondPoint, scene, doc, data, Document::FullParse, Tool::FromGui);
}
void VToolLine::Create(const qint64 &id, const qint64 &firstPoint, const qint64 &secondPoint,
void VToolLine::Create(const qint64 &_id, const qint64 &firstPoint, const qint64 &secondPoint,
VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data,
const Document::Documents &parse, Tool::Sources typeCreation){
Q_CHECK_PTR(scene);
Q_CHECK_PTR(doc);
Q_CHECK_PTR(data);
data->AddLine(firstPoint, secondPoint);
if(parse != Document::FullParse){
doc->UpdateToolData(id, data);
qint64 id = _id;
if(typeCreation == Tool::FromGui){
id = data->getNextId();
} else {
if(parse != Document::FullParse){
doc->UpdateToolData(id, data);
}
}
data->AddLine(firstPoint, secondPoint);
VDrawTool::AddRecord(id, Tool::LineTool, doc);
if(parse == Document::FullParse){
qint64 id = data->getNextId();
VToolLine *line = new VToolLine(doc, data, id, firstPoint, secondPoint, typeCreation);
Q_CHECK_PTR(line);
scene->addItem(line);

View File

@ -34,7 +34,7 @@ public:
virtual void setDialog();
static void Create(QSharedPointer<DialogLine> &dialog, VMainGraphicsScene *scene, VDomDocument *doc,
VContainer *data);
static void Create(const qint64 &id, const qint64 &firstPoint, const qint64 &secondPoint,
static void Create(const qint64 &_id, const qint64 &firstPoint, const qint64 &secondPoint,
VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data,
const Document::Documents &parse, Tool::Sources typeCreation);
public slots:

View File

@ -51,18 +51,22 @@ VModelingLine *VModelingLine::Create(QSharedPointer<DialogLine> &dialog, VDomDoc
return Create(0, firstPoint, secondPoint, doc, data, Document::FullParse, Tool::FromGui);
}
VModelingLine *VModelingLine::Create(const qint64 &id, const qint64 &firstPoint, const qint64 &secondPoint,
VModelingLine *VModelingLine::Create(const qint64 &_id, const qint64 &firstPoint, const qint64 &secondPoint,
VDomDocument *doc, VContainer *data, const Document::Documents &parse,
Tool::Sources typeCreation){
VModelingLine *line = 0;
Q_CHECK_PTR(doc);
Q_CHECK_PTR(data);
data->AddLine(firstPoint, secondPoint, Draw::Modeling);
if(parse != Document::FullParse){
doc->UpdateToolData(id, data);
qint64 id = _id;
if(typeCreation == Tool::FromGui){
id = data->getNextId();
} else {
if(parse != Document::FullParse){
doc->UpdateToolData(id, data);
}
}
data->AddLine(firstPoint, secondPoint, Draw::Modeling);
if(parse == Document::FullParse){
qint64 id = data->getNextId();
line = new VModelingLine(doc, data, id, firstPoint, secondPoint, typeCreation);
doc->AddTool(id, line);
doc->IncrementReferens(firstPoint);

View File

@ -34,7 +34,7 @@ public:
QGraphicsItem * parent = 0);
virtual void setDialog();
static VModelingLine* Create(QSharedPointer<DialogLine> &dialog, VDomDocument *doc, VContainer *data);
static VModelingLine* Create(const qint64 &id, const qint64 &firstPoint, const qint64 &secondPoint,
static VModelingLine* Create(const qint64 &_id, const qint64 &firstPoint, const qint64 &secondPoint,
VDomDocument *doc, VContainer *data, const Document::Documents &parse,
Tool::Sources typeCreation);
public slots:

View File

@ -35,7 +35,8 @@ VNodeSpline::VNodeSpline(VDomDocument *doc, VContainer *data, qint64 id, qint64
}
VNodeSpline *VNodeSpline::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline,
Draw::Draws typeobject, const Document::Documents &parse, Tool::Sources typeCreation){
Draw::Draws typeobject, const Document::Documents &parse,
Tool::Sources typeCreation){
VNodeSpline *spl = 0;
if(parse == Document::FullParse){
spl = new VNodeSpline(doc, data, id, idSpline, typeobject, typeCreation);

View File

@ -189,6 +189,8 @@ void VToolDetail::Create(QSharedPointer<DialogDetail> &dialog, VMainGraphicsScen
point = data->GetModelingPoint(detail[i].getId());
}
id = data->AddModelingPoint(point);
VNodePoint::Create(doc, data, id, detail[i].getId(), detail[i].getMode(),
Document::FullParse, Tool::FromGui);
}
break;
case(Tool::NodeArc):{
@ -199,6 +201,8 @@ void VToolDetail::Create(QSharedPointer<DialogDetail> &dialog, VMainGraphicsScen
arc = data->GetModelingArc(detail[i].getId());
}
id = data->AddModelingArc(arc);
VNodeArc::Create(doc, data, id, detail[i].getId(), detail[i].getMode(),
Document::FullParse, Tool::FromGui);
}
break;
case(Tool::NodeSpline):{
@ -209,6 +213,8 @@ void VToolDetail::Create(QSharedPointer<DialogDetail> &dialog, VMainGraphicsScen
spline = data->GetModelingSpline(detail[i].getId());
}
id = data->AddModelingSpline(spline);
VNodeSpline::Create(doc, data, id, detail[i].getId(), detail[i].getMode(),
Document::FullParse, Tool::FromGui);
}
break;
case(Tool::NodeSplinePath):{
@ -219,6 +225,8 @@ void VToolDetail::Create(QSharedPointer<DialogDetail> &dialog, VMainGraphicsScen
splinePath = data->GetModelingSplinePath(detail[i].getId());
}
id = data->AddModelingSplinePath(splinePath);
VNodeSplinePath::Create(doc, data, id, detail[i].getId(), detail[i].getMode(),
Document::FullParse, Tool::FromGui);
}
break;
default:
@ -328,19 +336,24 @@ void VToolDetail::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
// dialog->show();
// }
if(selectedAction == actionRemove){
//deincrement referens
RemoveReferens();
//remove form xml file
QDomElement domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
QDomNode element = domElement.parentNode();
if(!element.isNull()){
//deincrement referens
RemoveReferens();
element.removeChild(domElement);
//update xml file
emit FullUpdateTree();
//remove form scene
emit RemoveTool(this);
} else {
qWarning()<<"parentNode isNull"<<Q_FUNC_INFO;
}
} else {
qWarning()<<"Can't get element by id = "<<id<<Q_FUNC_INFO;
}
}
}

View File

@ -34,6 +34,7 @@
#include "exception/vexceptionbadid.h"
#include "exception/vexceptionobjecterror.h"
#include "exception/vexceptionuniqueid.h"
#include <QMessageBox>
VDomDocument::VDomDocument(VContainer *data, QComboBox *comboBoxDraws, Draw::Draws *mode) : QDomDocument(),
map(QHash<QString, QDomElement>()), nameActivDraw(QString()), data(data),
@ -417,7 +418,8 @@ void VDomDocument::ParseDrawElement(VMainGraphicsScene *sceneDraw, VMainGraphics
}
void VDomDocument::ParseDrawMode(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail,
const QDomNode& node, const Document::Documents &parse, Draw::Draws mode){
const QDomNode& node, const Document::Documents &parse,
Draw::Draws mode){
Q_CHECK_PTR(sceneDraw);
Q_CHECK_PTR(sceneDetail);
VMainGraphicsScene *scene = 0;
@ -545,7 +547,8 @@ void VDomDocument::ParseDetails(VMainGraphicsScene *sceneDetail, const QDomEleme
}
void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElement& domElement,
const Document::Documents &parse, const QString& type, Draw::Draws mode){
const Document::Documents &parse, const QString& type,
Draw::Draws mode){
Q_CHECK_PTR(scene);
Q_ASSERT_X(!domElement.isNull(), Q_FUNC_INFO, "domElement is null");
Q_ASSERT_X(!type.isEmpty(), Q_FUNC_INFO, "type of point is empty");
@ -901,7 +904,7 @@ void VDomDocument::ParseSplineElement(VMainGraphicsScene *scene, const QDomEleme
spl.setMode(typeObject);
spl.setIdObject(idObject);
data->UpdateModelingSpline(id, spl);
VNodeSpline::Create(this, data, id, idObject,mode, parse, Tool::FromFile);
VNodeSpline::Create(this, data, id, idObject, mode, parse, Tool::FromFile);
return;
}
catch(const VExceptionBadId &e){
@ -1000,10 +1003,23 @@ void VDomDocument::FullUpdateTree(){
data->ClearObject();
Parse(Document::LiteParse, scene, scene);
}
catch (const std::bad_alloc &) {
delete scene;
QMessageBox msgBox;
msgBox.setWindowTitle(tr("Error!"));
msgBox.setText(tr("Error parsing file."));
msgBox.setInformativeText("std::bad_alloc");
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setDefaultButton(QMessageBox::Ok);
msgBox.setIcon(QMessageBox::Warning);
msgBox.exec();
return;
}
catch(...){
delete scene;
throw;
}
delete scene;
setCurrentData();
emit FullUpdateFromFile();