Refactoring.

--HG--
branch : develop
This commit is contained in:
dismine 2013-10-27 09:47:01 +02:00
parent f0a9bdf4d2
commit f2860076ee
4 changed files with 94 additions and 147 deletions

View File

@ -20,21 +20,19 @@
****************************************************************************/
#include "vdomdocument.h"
#include <QDebug>
#include "tools/drawTools/drawtools.h"
#include "tools/nodeDetails/nodedetails.h"
#include "tools/modelingTools/modelingtools.h"
#include "tools/vtooldetail.h"
#include "options.h"
#include "container/calculator.h"
#include "geometry/vsplinepoint.h"
#include "exception/vexceptionwrongparameterid.h"
#include "exception/vexceptionconversionerror.h"
#include "exception/vexceptionemptyparameter.h"
#include "exception/vexceptionbadid.h"
#include "exception/vexceptionobjecterror.h"
#include "exception/vexceptionuniqueid.h"
#include <QMessageBox>
#include <exception/vexceptionwrongparameterid.h>
#include <exception/vexceptionconversionerror.h>
#include <exception/vexceptionemptyparameter.h>
#include <exception/vexceptionuniqueid.h>
#include <tools/vtooldetail.h>
#include <exception/vexceptionobjecterror.h>
#include <exception/vexceptionbadid.h>
#include <tools/drawTools/drawtools.h>
#include <tools/modelingTools/modelingtools.h>
#include <tools/nodeDetails/vnodepoint.h>
#include <tools/nodeDetails/vnodespline.h>
#include <tools/nodeDetails/vnodesplinepath.h>
#include <tools/nodeDetails/vnodearc.h>
VDomDocument::VDomDocument(VContainer *data, QComboBox *comboBoxDraws, Draw::Draws *mode) : QDomDocument(),
map(QHash<QString, QDomElement>()), nameActivDraw(QString()), data(data),
@ -56,9 +54,6 @@ VDomDocument::VDomDocument(const QDomDocumentType& doctype, VContainer *data, QC
comboBoxDraws(comboBoxDraws), mode(mode){
}
VDomDocument::~VDomDocument(){
}
QDomElement VDomDocument::elementById(const QString& id){
if (map.contains(id)) {
QDomElement e = map[id];
@ -190,10 +185,6 @@ void VDomDocument::SetActivDraw(const QString& name){
this->nameActivDraw = name;
}
QString VDomDocument::GetNameActivDraw() const{
return nameActivDraw;
}
bool VDomDocument::GetActivDrawElement(QDomElement &element){
if(!nameActivDraw.isEmpty()){
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){
QDomNode domNode = node.firstChild();
while(!domNode.isNull()){
@ -1134,10 +1117,6 @@ void VDomDocument::ShowHistoryTool(qint64 id, Qt::GlobalColor color, bool enable
emit ShowTool(id, color, enable);
}
qint64 VDomDocument::getCursor() const{
return cursor;
}
void VDomDocument::setCursor(const qint64 &value){
cursor = value;
emit ChangedCursor(cursor);

View File

@ -23,10 +23,9 @@
#define VDOMDOCUMENT_H
#include <QDomDocument>
#include <QHash>
#include <QComboBox>
#include "widgets/vmaingraphicsscene.h"
#include "tools/vdatatool.h"
#include <container/vcontainer.h>
#include <widgets/vmaingraphicsscene.h>
#include <tools/vdatatool.h>
#include "vtoolrecord.h"
namespace Document {
@ -45,11 +44,11 @@ public:
Draw::Draws *mode);
VDomDocument(const QDomDocumentType& doctype, VContainer *data, QComboBox *comboBoxDraws,
Draw::Draws *mode);
~VDomDocument();
~VDomDocument(){}
QDomElement elementById(const QString& id);
void CreateEmptyFile();
void ChangeActivDraw(const QString& name, Document::Documents parse = Document::FullParse);
QString GetNameActivDraw() const;
inline QString GetNameActivDraw() const {return nameActivDraw;}
bool GetActivDrawElement(QDomElement &element);
bool GetActivCalculationElement(QDomElement &element);
bool GetActivModelingElement(QDomElement &element);
@ -57,9 +56,9 @@ public:
bool appendDraw(const QString& name);
bool SetNameDraw(const QString& name);
void Parse(Document::Documents parse, VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail);
QHash<qint64, VDataTool*>* getTools();
QVector<VToolRecord> *getHistory();
qint64 getCursor() const;
inline QHash<qint64, VDataTool*>* getTools() {return &tools;}
inline QVector<VToolRecord> *getHistory() {return &history;}
inline qint64 getCursor() const {return cursor;}
void setCursor(const qint64 &value);
void setCurrentData();
void AddTool(const qint64 &id, VDataTool *tool);

View File

@ -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),
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;
}

View File

@ -22,23 +22,16 @@
#ifndef VTOOLRECORD_H
#define VTOOLRECORD_H
#include <QString>
#include "options.h"
class VToolRecord
{
class VToolRecord{
public:
VToolRecord();
VToolRecord(const qint64 &id, const Tool::Tools &typeTool, const QString &nameDraw);
qint64 getId() const;
void setId(const qint64 &value);
Tool::Tools getTypeTool() const;
void setTypeTool(const Tool::Tools &value);
QString getNameDraw() const;
void setNameDraw(const QString &value);
inline qint64 getId() const {return id;}
inline void setId(const qint64 &value) {id = value;}
inline Tool::Tools getTypeTool() const {return typeTool;}
inline void setTypeTool(const Tool::Tools &value) {typeTool = value;}
inline QString getNameDraw() const {return nameDraw;}
inline void setNameDraw(const QString &value) {nameDraw = value;}
private:
qint64 id;
Tool::Tools typeTool;