Refactoring.
--HG-- branch : develop
This commit is contained in:
parent
f0a9bdf4d2
commit
f2860076ee
|
@ -20,21 +20,19 @@
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "vdomdocument.h"
|
#include "vdomdocument.h"
|
||||||
#include <QDebug>
|
#include <exception/vexceptionwrongparameterid.h>
|
||||||
#include "tools/drawTools/drawtools.h"
|
#include <exception/vexceptionconversionerror.h>
|
||||||
#include "tools/nodeDetails/nodedetails.h"
|
#include <exception/vexceptionemptyparameter.h>
|
||||||
#include "tools/modelingTools/modelingtools.h"
|
#include <exception/vexceptionuniqueid.h>
|
||||||
#include "tools/vtooldetail.h"
|
#include <tools/vtooldetail.h>
|
||||||
#include "options.h"
|
#include <exception/vexceptionobjecterror.h>
|
||||||
#include "container/calculator.h"
|
#include <exception/vexceptionbadid.h>
|
||||||
#include "geometry/vsplinepoint.h"
|
#include <tools/drawTools/drawtools.h>
|
||||||
#include "exception/vexceptionwrongparameterid.h"
|
#include <tools/modelingTools/modelingtools.h>
|
||||||
#include "exception/vexceptionconversionerror.h"
|
#include <tools/nodeDetails/vnodepoint.h>
|
||||||
#include "exception/vexceptionemptyparameter.h"
|
#include <tools/nodeDetails/vnodespline.h>
|
||||||
#include "exception/vexceptionbadid.h"
|
#include <tools/nodeDetails/vnodesplinepath.h>
|
||||||
#include "exception/vexceptionobjecterror.h"
|
#include <tools/nodeDetails/vnodearc.h>
|
||||||
#include "exception/vexceptionuniqueid.h"
|
|
||||||
#include <QMessageBox>
|
|
||||||
|
|
||||||
VDomDocument::VDomDocument(VContainer *data, QComboBox *comboBoxDraws, Draw::Draws *mode) : QDomDocument(),
|
VDomDocument::VDomDocument(VContainer *data, QComboBox *comboBoxDraws, Draw::Draws *mode) : QDomDocument(),
|
||||||
map(QHash<QString, QDomElement>()), nameActivDraw(QString()), data(data),
|
map(QHash<QString, QDomElement>()), nameActivDraw(QString()), data(data),
|
||||||
|
@ -56,9 +54,6 @@ VDomDocument::VDomDocument(const QDomDocumentType& doctype, VContainer *data, QC
|
||||||
comboBoxDraws(comboBoxDraws), mode(mode){
|
comboBoxDraws(comboBoxDraws), mode(mode){
|
||||||
}
|
}
|
||||||
|
|
||||||
VDomDocument::~VDomDocument(){
|
|
||||||
}
|
|
||||||
|
|
||||||
QDomElement VDomDocument::elementById(const QString& id){
|
QDomElement VDomDocument::elementById(const QString& id){
|
||||||
if (map.contains(id)) {
|
if (map.contains(id)) {
|
||||||
QDomElement e = map[id];
|
QDomElement e = map[id];
|
||||||
|
@ -190,10 +185,6 @@ void VDomDocument::SetActivDraw(const QString& name){
|
||||||
this->nameActivDraw = name;
|
this->nameActivDraw = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString VDomDocument::GetNameActivDraw() const{
|
|
||||||
return nameActivDraw;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool VDomDocument::GetActivDrawElement(QDomElement &element){
|
bool VDomDocument::GetActivDrawElement(QDomElement &element){
|
||||||
if(!nameActivDraw.isEmpty()){
|
if(!nameActivDraw.isEmpty()){
|
||||||
QDomNodeList elements = this->documentElement().elementsByTagName( "draw" );
|
QDomNodeList elements = this->documentElement().elementsByTagName( "draw" );
|
||||||
|
@ -307,14 +298,6 @@ void VDomDocument::Parse(Document::Documents parse, VMainGraphicsScene *sceneDra
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QHash<qint64, VDataTool *> *VDomDocument::getTools(){
|
|
||||||
return &tools;
|
|
||||||
}
|
|
||||||
|
|
||||||
QVector<VToolRecord> *VDomDocument::getHistory(){
|
|
||||||
return &history;
|
|
||||||
}
|
|
||||||
|
|
||||||
void VDomDocument::ParseIncrementsElement(const QDomNode &node){
|
void VDomDocument::ParseIncrementsElement(const QDomNode &node){
|
||||||
QDomNode domNode = node.firstChild();
|
QDomNode domNode = node.firstChild();
|
||||||
while(!domNode.isNull()){
|
while(!domNode.isNull()){
|
||||||
|
@ -1134,10 +1117,6 @@ void VDomDocument::ShowHistoryTool(qint64 id, Qt::GlobalColor color, bool enable
|
||||||
emit ShowTool(id, color, enable);
|
emit ShowTool(id, color, enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
qint64 VDomDocument::getCursor() const{
|
|
||||||
return cursor;
|
|
||||||
}
|
|
||||||
|
|
||||||
void VDomDocument::setCursor(const qint64 &value){
|
void VDomDocument::setCursor(const qint64 &value){
|
||||||
cursor = value;
|
cursor = value;
|
||||||
emit ChangedCursor(cursor);
|
emit ChangedCursor(cursor);
|
||||||
|
|
|
@ -23,10 +23,9 @@
|
||||||
#define VDOMDOCUMENT_H
|
#define VDOMDOCUMENT_H
|
||||||
|
|
||||||
#include <QDomDocument>
|
#include <QDomDocument>
|
||||||
#include <QHash>
|
#include <container/vcontainer.h>
|
||||||
#include <QComboBox>
|
#include <widgets/vmaingraphicsscene.h>
|
||||||
#include "widgets/vmaingraphicsscene.h"
|
#include <tools/vdatatool.h>
|
||||||
#include "tools/vdatatool.h"
|
|
||||||
#include "vtoolrecord.h"
|
#include "vtoolrecord.h"
|
||||||
|
|
||||||
namespace Document {
|
namespace Document {
|
||||||
|
@ -45,11 +44,11 @@ public:
|
||||||
Draw::Draws *mode);
|
Draw::Draws *mode);
|
||||||
VDomDocument(const QDomDocumentType& doctype, VContainer *data, QComboBox *comboBoxDraws,
|
VDomDocument(const QDomDocumentType& doctype, VContainer *data, QComboBox *comboBoxDraws,
|
||||||
Draw::Draws *mode);
|
Draw::Draws *mode);
|
||||||
~VDomDocument();
|
~VDomDocument(){}
|
||||||
QDomElement elementById(const QString& id);
|
QDomElement elementById(const QString& id);
|
||||||
void CreateEmptyFile();
|
void CreateEmptyFile();
|
||||||
void ChangeActivDraw(const QString& name, Document::Documents parse = Document::FullParse);
|
void ChangeActivDraw(const QString& name, Document::Documents parse = Document::FullParse);
|
||||||
QString GetNameActivDraw() const;
|
inline QString GetNameActivDraw() const {return nameActivDraw;}
|
||||||
bool GetActivDrawElement(QDomElement &element);
|
bool GetActivDrawElement(QDomElement &element);
|
||||||
bool GetActivCalculationElement(QDomElement &element);
|
bool GetActivCalculationElement(QDomElement &element);
|
||||||
bool GetActivModelingElement(QDomElement &element);
|
bool GetActivModelingElement(QDomElement &element);
|
||||||
|
@ -57,9 +56,9 @@ public:
|
||||||
bool appendDraw(const QString& name);
|
bool appendDraw(const QString& name);
|
||||||
bool SetNameDraw(const QString& name);
|
bool SetNameDraw(const QString& name);
|
||||||
void Parse(Document::Documents parse, VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail);
|
void Parse(Document::Documents parse, VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail);
|
||||||
QHash<qint64, VDataTool*>* getTools();
|
inline QHash<qint64, VDataTool*>* getTools() {return &tools;}
|
||||||
QVector<VToolRecord> *getHistory();
|
inline QVector<VToolRecord> *getHistory() {return &history;}
|
||||||
qint64 getCursor() const;
|
inline qint64 getCursor() const {return cursor;}
|
||||||
void setCursor(const qint64 &value);
|
void setCursor(const qint64 &value);
|
||||||
void setCurrentData();
|
void setCurrentData();
|
||||||
void AddTool(const qint64 &id, VDataTool *tool);
|
void AddTool(const qint64 &id, VDataTool *tool);
|
||||||
|
|
|
@ -27,27 +27,3 @@ VToolRecord::VToolRecord():id(0), typeTool(Tool::ArrowTool), nameDraw(QString())
|
||||||
VToolRecord::VToolRecord(const qint64 &id, const Tool::Tools &typeTool, const QString &nameDraw):id(id),
|
VToolRecord::VToolRecord(const qint64 &id, const Tool::Tools &typeTool, const QString &nameDraw):id(id),
|
||||||
typeTool(typeTool), nameDraw(nameDraw){
|
typeTool(typeTool), nameDraw(nameDraw){
|
||||||
}
|
}
|
||||||
|
|
||||||
QString VToolRecord::getNameDraw() const{
|
|
||||||
return nameDraw;
|
|
||||||
}
|
|
||||||
|
|
||||||
void VToolRecord::setNameDraw(const QString &value){
|
|
||||||
nameDraw = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
Tool::Tools VToolRecord::getTypeTool() const{
|
|
||||||
return typeTool;
|
|
||||||
}
|
|
||||||
|
|
||||||
void VToolRecord::setTypeTool(const Tool::Tools &value){
|
|
||||||
typeTool = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
qint64 VToolRecord::getId() const{
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
void VToolRecord::setId(const qint64 &value){
|
|
||||||
id = value;
|
|
||||||
}
|
|
||||||
|
|
|
@ -22,23 +22,16 @@
|
||||||
#ifndef VTOOLRECORD_H
|
#ifndef VTOOLRECORD_H
|
||||||
#define VTOOLRECORD_H
|
#define VTOOLRECORD_H
|
||||||
|
|
||||||
#include <QString>
|
class VToolRecord{
|
||||||
#include "options.h"
|
|
||||||
|
|
||||||
class VToolRecord
|
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
VToolRecord();
|
VToolRecord();
|
||||||
VToolRecord(const qint64 &id, const Tool::Tools &typeTool, const QString &nameDraw);
|
VToolRecord(const qint64 &id, const Tool::Tools &typeTool, const QString &nameDraw);
|
||||||
qint64 getId() const;
|
inline qint64 getId() const {return id;}
|
||||||
void setId(const qint64 &value);
|
inline void setId(const qint64 &value) {id = value;}
|
||||||
|
inline Tool::Tools getTypeTool() const {return typeTool;}
|
||||||
Tool::Tools getTypeTool() const;
|
inline void setTypeTool(const Tool::Tools &value) {typeTool = value;}
|
||||||
void setTypeTool(const Tool::Tools &value);
|
inline QString getNameDraw() const {return nameDraw;}
|
||||||
|
inline void setNameDraw(const QString &value) {nameDraw = value;}
|
||||||
QString getNameDraw() const;
|
|
||||||
void setNameDraw(const QString &value);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
qint64 id;
|
qint64 id;
|
||||||
Tool::Tools typeTool;
|
Tool::Tools typeTool;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user