2013-09-18 21:16:19 +02:00
|
|
|
/****************************************************************************
|
|
|
|
**
|
|
|
|
** Copyright (C) 2013 Valentina project All Rights Reserved.
|
|
|
|
**
|
|
|
|
** This file is part of Valentina.
|
|
|
|
**
|
|
|
|
** Tox is free software: you can redistribute it and/or modify
|
|
|
|
** it under the terms of the GNU General Public License as published by
|
|
|
|
** the Free Software Foundation, either version 3 of the License, or
|
|
|
|
** (at your option) any later version.
|
|
|
|
**
|
|
|
|
** Tox is distributed in the hope that it will be useful,
|
|
|
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
** GNU General Public License for more details.
|
|
|
|
**
|
|
|
|
** You should have received a copy of the GNU General Public License
|
|
|
|
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
**
|
|
|
|
****************************************************************************/
|
|
|
|
|
2013-07-13 12:51:31 +02:00
|
|
|
#include "vdomdocument.h"
|
2013-07-25 14:00:51 +02:00
|
|
|
#include <QDebug>
|
2013-09-10 14:29:06 +02:00
|
|
|
#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"
|
2013-09-23 14:08:06 +02:00
|
|
|
#include "exception/vexceptionwrongparameterid.h"
|
|
|
|
#include "exception/vexceptionconversionerror.h"
|
|
|
|
#include "exception/vexceptionemptyparameter.h"
|
|
|
|
#include "exception/vexceptionbadid.h"
|
|
|
|
#include "exception/vexceptionobjecterror.h"
|
2013-10-07 11:13:24 +02:00
|
|
|
#include "exception/vexceptionuniqueid.h"
|
2013-10-09 18:24:28 +02:00
|
|
|
#include <QMessageBox>
|
2013-08-13 18:48:36 +02:00
|
|
|
|
2013-09-27 11:17:00 +02:00
|
|
|
VDomDocument::VDomDocument(VContainer *data, QComboBox *comboBoxDraws, Draw::Draws *mode) : QDomDocument(),
|
2013-10-04 13:32:42 +02:00
|
|
|
map(QHash<QString, QDomElement>()), nameActivDraw(QString()), data(data),
|
|
|
|
tools(QHash<qint64, VDataTool*>()), history(QVector<VToolRecord>()), cursor(0),
|
2013-08-29 12:31:50 +02:00
|
|
|
comboBoxDraws(comboBoxDraws), mode(mode){
|
2013-07-13 12:51:31 +02:00
|
|
|
}
|
|
|
|
|
2013-08-29 12:31:50 +02:00
|
|
|
VDomDocument::VDomDocument(const QString& name, VContainer *data, QComboBox *comboBoxDraws,
|
2013-09-27 11:17:00 +02:00
|
|
|
Draw::Draws *mode) :
|
2013-10-04 13:32:42 +02:00
|
|
|
QDomDocument(name), map(QHash<QString, QDomElement>()), nameActivDraw(QString()), data(data),
|
|
|
|
tools(QHash<qint64, VDataTool*>()), history(QVector<VToolRecord>()), cursor(0),
|
2013-08-29 12:31:50 +02:00
|
|
|
comboBoxDraws(comboBoxDraws), mode(mode){
|
2013-07-13 12:51:31 +02:00
|
|
|
}
|
|
|
|
|
2013-08-29 12:31:50 +02:00
|
|
|
VDomDocument::VDomDocument(const QDomDocumentType& doctype, VContainer *data, QComboBox *comboBoxDraws,
|
2013-09-27 11:17:00 +02:00
|
|
|
Draw::Draws *mode) :
|
2013-10-04 13:32:42 +02:00
|
|
|
QDomDocument(doctype), map(QHash<QString, QDomElement>()), nameActivDraw(QString()), data(data),
|
|
|
|
tools(QHash<qint64, VDataTool*>()), history(QVector<VToolRecord>()), cursor(0),
|
2013-08-29 12:31:50 +02:00
|
|
|
comboBoxDraws(comboBoxDraws), mode(mode){
|
2013-07-13 12:51:31 +02:00
|
|
|
}
|
|
|
|
|
2013-08-13 18:48:36 +02:00
|
|
|
VDomDocument::~VDomDocument(){
|
|
|
|
}
|
|
|
|
|
2013-07-13 12:51:31 +02:00
|
|
|
QDomElement VDomDocument::elementById(const QString& id){
|
|
|
|
if (map.contains(id)) {
|
|
|
|
QDomElement e = map[id];
|
|
|
|
if (e.parentNode().nodeType() != QDomNode::BaseNode) {
|
|
|
|
return e;
|
|
|
|
}
|
|
|
|
map.remove(id);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool res = this->find(this->documentElement(), id);
|
|
|
|
if (res) {
|
|
|
|
return map[id];
|
|
|
|
}
|
|
|
|
|
|
|
|
return QDomElement();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool VDomDocument::find(QDomElement node, const QString& id){
|
|
|
|
if (node.hasAttribute("id")) {
|
|
|
|
QString value = node.attribute("id");
|
|
|
|
this->map[value] = node;
|
|
|
|
if (value == id) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (qint32 i=0; i<node.childNodes().length(); ++i) {
|
|
|
|
QDomNode n = node.childNodes().at(i);
|
|
|
|
if (n.isElement()) {
|
|
|
|
bool res = this->find(n.toElement(), id);
|
|
|
|
if (res) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void VDomDocument::CreateEmptyFile(){
|
|
|
|
QDomElement domElement = this->createElement("lekalo");
|
|
|
|
this->appendChild(domElement);
|
|
|
|
QDomNode xmlNode = this->createProcessingInstruction("xml", "version=\"1.0\" encoding=\"UTF-8\"");
|
|
|
|
this->insertBefore(xmlNode, this->firstChild());
|
2013-07-17 13:38:11 +02:00
|
|
|
QDomElement incrElement = this->createElement("increments");
|
|
|
|
domElement.appendChild(incrElement);
|
2013-07-13 12:51:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
bool VDomDocument::CheckNameDraw(const QString& name) const{
|
2013-09-11 16:14:21 +02:00
|
|
|
Q_ASSERT_X(!name.isEmpty(), "CheckNameDraw", "name draw is empty");
|
2013-07-13 12:51:31 +02:00
|
|
|
QDomNodeList elements = this->documentElement().elementsByTagName( "draw" );
|
|
|
|
if(elements.size() == 0){
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
for ( qint32 i = 0; i < elements.count(); i++ ){
|
|
|
|
QDomElement elem = elements.at( i ).toElement();
|
|
|
|
if(!elem.isNull()){
|
|
|
|
QString fieldName = elem.attribute( "name" );
|
|
|
|
if ( fieldName == name ){
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool VDomDocument::appendDraw(const QString& name){
|
2013-09-11 16:14:21 +02:00
|
|
|
Q_ASSERT_X(!name.isEmpty(), "appendDraw", "name draw is empty");
|
2013-07-13 12:51:31 +02:00
|
|
|
if(name.isEmpty()){
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if(CheckNameDraw(name)== false){
|
|
|
|
QDomElement rootElement = this->documentElement();
|
|
|
|
|
|
|
|
QDomElement drawElement = this->createElement("draw");
|
|
|
|
QDomAttr drawAttr = this->createAttribute("name");
|
|
|
|
drawAttr.setValue(name);
|
|
|
|
drawElement.setAttributeNode(drawAttr);
|
|
|
|
|
|
|
|
QDomElement calculationElement = this->createElement("calculation");
|
|
|
|
QDomElement modelingElement = this->createElement("modeling");
|
2013-08-28 10:55:11 +02:00
|
|
|
QDomElement pathsElement = this->createElement("details");
|
2013-07-13 12:51:31 +02:00
|
|
|
drawElement.appendChild(calculationElement);
|
|
|
|
drawElement.appendChild(modelingElement);
|
|
|
|
drawElement.appendChild(pathsElement);
|
|
|
|
|
|
|
|
rootElement.appendChild(drawElement);
|
|
|
|
|
|
|
|
if(nameActivDraw.isEmpty()){
|
|
|
|
SetActivDraw(name);
|
|
|
|
} else {
|
|
|
|
ChangeActivDraw(name);
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2013-09-27 11:17:00 +02:00
|
|
|
void VDomDocument::ChangeActivDraw(const QString& name, Document::Documents parse){
|
2013-09-11 16:14:21 +02:00
|
|
|
Q_ASSERT_X(!name.isEmpty(), "ChangeActivDraw", "name draw is empty");
|
2013-07-13 12:51:31 +02:00
|
|
|
if(CheckNameDraw(name) == true){
|
|
|
|
this->nameActivDraw = name;
|
2013-08-15 22:39:00 +02:00
|
|
|
if(parse == Document::FullParse){
|
|
|
|
emit ChangedActivDraw(name);
|
2013-07-13 12:51:31 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-10 12:00:04 +02:00
|
|
|
bool VDomDocument::SetNameDraw(const QString& name){
|
2013-09-11 16:14:21 +02:00
|
|
|
Q_ASSERT_X(!name.isEmpty(), "SetNameDraw", "name draw is empty");
|
2013-07-13 12:51:31 +02:00
|
|
|
QString oldName = nameActivDraw;
|
2013-10-10 12:00:04 +02:00
|
|
|
QDomElement element;
|
|
|
|
if(GetActivDrawElement(element)){
|
|
|
|
nameActivDraw = name;
|
|
|
|
element.setAttribute("name", nameActivDraw);
|
|
|
|
emit haveChange();
|
|
|
|
emit ChangedNameDraw(oldName, nameActivDraw);
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
qWarning()<<"Can't find activ draw"<<Q_FUNC_INFO;
|
|
|
|
return false;
|
|
|
|
}
|
2013-07-13 12:51:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void VDomDocument::SetActivDraw(const QString& name){
|
2013-09-11 16:14:21 +02:00
|
|
|
Q_ASSERT_X(!name.isEmpty(), "SetActivDraw", "name draw is empty");
|
2013-07-13 12:51:31 +02:00
|
|
|
this->nameActivDraw = name;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString VDomDocument::GetNameActivDraw() const{
|
|
|
|
return nameActivDraw;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool VDomDocument::GetActivDrawElement(QDomElement &element){
|
|
|
|
if(!nameActivDraw.isEmpty()){
|
|
|
|
QDomNodeList elements = this->documentElement().elementsByTagName( "draw" );
|
|
|
|
if(elements.size() == 0){
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
for ( qint32 i = 0; i < elements.count(); i++ ){
|
|
|
|
element = elements.at( i ).toElement();
|
|
|
|
if(!element.isNull()){
|
|
|
|
QString fieldName = element.attribute( "name" );
|
|
|
|
if ( fieldName == nameActivDraw ){
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool VDomDocument::GetActivCalculationElement(QDomElement &element){
|
|
|
|
bool ok = GetActivNodeElement("calculation", element);
|
|
|
|
if(ok){
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool VDomDocument::GetActivModelingElement(QDomElement &element){
|
|
|
|
bool ok = GetActivNodeElement("modeling", element);
|
|
|
|
if(ok){
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-08-28 10:55:11 +02:00
|
|
|
bool VDomDocument::GetActivDetailsElement(QDomElement &element){
|
|
|
|
bool ok = GetActivNodeElement("details", element);
|
2013-07-13 12:51:31 +02:00
|
|
|
if(ok){
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool VDomDocument::GetActivNodeElement(const QString& name, QDomElement &element){
|
2013-09-11 16:14:21 +02:00
|
|
|
Q_ASSERT_X(!name.isEmpty(), "GetActivNodeElement", "name draw is empty");
|
2013-07-13 12:51:31 +02:00
|
|
|
QDomElement drawElement;
|
|
|
|
bool drawOk = this->GetActivDrawElement(drawElement);
|
|
|
|
if(drawOk == true){
|
|
|
|
QDomNodeList listElement = drawElement.elementsByTagName(name);
|
|
|
|
if(listElement.size() == 0 || listElement.size() > 1){
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
element = listElement.at( 0 ).toElement();
|
|
|
|
if(!element.isNull()){
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-27 11:17:00 +02:00
|
|
|
void VDomDocument::Parse(Document::Documents parse, VMainGraphicsScene *sceneDraw,
|
2013-09-11 16:14:21 +02:00
|
|
|
VMainGraphicsScene *sceneDetail){
|
|
|
|
Q_CHECK_PTR(sceneDraw);
|
|
|
|
Q_CHECK_PTR(sceneDetail);
|
2013-07-13 12:51:31 +02:00
|
|
|
if(parse == Document::FullParse){
|
2013-10-07 11:13:24 +02:00
|
|
|
TestUniqueId();
|
2013-07-13 12:51:31 +02:00
|
|
|
data->Clear();
|
|
|
|
nameActivDraw.clear();
|
2013-08-28 10:55:11 +02:00
|
|
|
sceneDraw->clear();
|
|
|
|
sceneDetail->clear();
|
2013-07-13 12:51:31 +02:00
|
|
|
comboBoxDraws->clear();
|
2013-08-13 18:48:36 +02:00
|
|
|
tools.clear();
|
2013-08-15 22:39:00 +02:00
|
|
|
cursor = 0;
|
2013-07-13 12:51:31 +02:00
|
|
|
}
|
2013-08-15 22:39:00 +02:00
|
|
|
data->ClearLengthLines();
|
|
|
|
data->ClearLengthArcs();
|
|
|
|
data->ClearLengthSplines();
|
2013-08-21 10:03:53 +02:00
|
|
|
data->ClearLineAngles();
|
2013-08-15 22:39:00 +02:00
|
|
|
history.clear();
|
2013-07-13 12:51:31 +02:00
|
|
|
QDomElement rootElement = this->documentElement();
|
|
|
|
QDomNode domNode = rootElement.firstChild();
|
|
|
|
while(!domNode.isNull()){
|
|
|
|
if(domNode.isElement()){
|
|
|
|
QDomElement domElement = domNode.toElement();
|
|
|
|
if(!domElement.isNull()){
|
|
|
|
if(domElement.tagName()=="draw"){
|
|
|
|
if(parse == Document::FullParse){
|
|
|
|
if(nameActivDraw.isEmpty()){
|
|
|
|
SetActivDraw(domElement.attribute("name"));
|
|
|
|
} else {
|
|
|
|
ChangeActivDraw(domElement.attribute("name"));
|
|
|
|
}
|
2013-08-15 22:39:00 +02:00
|
|
|
comboBoxDraws->addItem(domElement.attribute("name"));
|
|
|
|
} else {
|
|
|
|
ChangeActivDraw(domElement.attribute("name"), Document::LiteParse);
|
2013-07-13 12:51:31 +02:00
|
|
|
}
|
2013-08-28 10:55:11 +02:00
|
|
|
ParseDrawElement(sceneDraw, sceneDetail, domElement, parse);
|
2013-07-17 13:38:11 +02:00
|
|
|
}
|
|
|
|
if(domElement.tagName()=="increments"){
|
|
|
|
ParseIncrementsElement(domElement);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
domNode = domNode.nextSibling();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-04 13:32:42 +02:00
|
|
|
QHash<qint64, VDataTool *> *VDomDocument::getTools(){
|
2013-08-13 18:48:36 +02:00
|
|
|
return &tools;
|
|
|
|
}
|
|
|
|
|
2013-08-15 22:39:00 +02:00
|
|
|
QVector<VToolRecord> *VDomDocument::getHistory(){
|
|
|
|
return &history;
|
|
|
|
}
|
|
|
|
|
2013-07-17 13:38:11 +02:00
|
|
|
void VDomDocument::ParseIncrementsElement(const QDomNode &node){
|
|
|
|
QDomNode domNode = node.firstChild();
|
|
|
|
while(!domNode.isNull()){
|
|
|
|
if(domNode.isElement()){
|
|
|
|
QDomElement domElement = domNode.toElement();
|
|
|
|
if(!domElement.isNull()){
|
|
|
|
if(domElement.tagName() == "increment"){
|
2013-09-11 16:14:21 +02:00
|
|
|
qint64 id = GetParametrId(domElement);
|
|
|
|
QString name = GetParametrString(domElement, "name");
|
|
|
|
qreal base = GetParametrDouble(domElement, "base");
|
|
|
|
qreal ksize = GetParametrDouble(domElement, "ksize");
|
|
|
|
qreal kgrowth = GetParametrDouble(domElement, "kgrowth");
|
|
|
|
QString desc = GetParametrString(domElement, "description");
|
2013-08-13 18:48:36 +02:00
|
|
|
data->UpdateId(id);
|
2013-07-17 13:38:11 +02:00
|
|
|
data->AddIncrementTableRow(name,
|
|
|
|
VIncrementTableRow(id, base, ksize, kgrowth, desc));
|
2013-07-13 12:51:31 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
domNode = domNode.nextSibling();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-11 16:14:21 +02:00
|
|
|
qint64 VDomDocument::GetParametrId(const QDomElement &domElement) const{
|
2013-09-23 14:08:06 +02:00
|
|
|
Q_ASSERT_X(!domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
2013-09-11 16:14:21 +02:00
|
|
|
qint64 id = GetParametrLongLong(domElement, "id");
|
2013-09-23 14:08:06 +02:00
|
|
|
if(id <= 0){
|
|
|
|
throw VExceptionWrongParameterId(tr("Got wrong parameter id. Need only id > 0."), domElement);
|
|
|
|
}
|
2013-09-11 16:14:21 +02:00
|
|
|
return id;
|
|
|
|
}
|
|
|
|
|
|
|
|
qint64 VDomDocument::GetParametrLongLong(const QDomElement &domElement, const QString &name) const{
|
|
|
|
Q_ASSERT_X(!name.isEmpty(), Q_FUNC_INFO, "name of parametr is empty");
|
|
|
|
Q_ASSERT_X(!domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
|
|
|
bool ok = false;
|
|
|
|
QString parametr = GetParametrString(domElement, name);
|
|
|
|
qint64 id = parametr.toLongLong(&ok);
|
2013-09-23 14:08:06 +02:00
|
|
|
if(ok == false){
|
|
|
|
throw VExceptionConversionError(tr("Can't convert toLongLong parameter"), name);
|
|
|
|
}
|
2013-09-11 16:14:21 +02:00
|
|
|
return id;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString VDomDocument::GetParametrString(const QDomElement &domElement, const QString &name) const{
|
|
|
|
Q_ASSERT_X(!name.isEmpty(), Q_FUNC_INFO, "name of parametr is empty");
|
|
|
|
Q_ASSERT_X(!domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
2013-09-23 14:08:06 +02:00
|
|
|
QString parameter = domElement.attribute(name, "");
|
|
|
|
if(parameter.isEmpty()){
|
|
|
|
throw VExceptionEmptyParameter(tr("Got empty parameter"), name, domElement);
|
|
|
|
}
|
|
|
|
return parameter;
|
2013-09-11 16:14:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
qreal VDomDocument::GetParametrDouble(const QDomElement &domElement, const QString &name) const{
|
|
|
|
Q_ASSERT_X(!name.isEmpty(), Q_FUNC_INFO, "name of parametr is empty");
|
|
|
|
Q_ASSERT_X(!domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
|
|
|
bool ok = false;
|
|
|
|
QString parametr = GetParametrString(domElement, name);
|
|
|
|
qreal param = parametr.toDouble(&ok);
|
2013-09-23 14:08:06 +02:00
|
|
|
if(ok == false){
|
|
|
|
throw VExceptionConversionError(tr("Can't convert toDouble parameter"), name);
|
|
|
|
}
|
2013-09-11 16:14:21 +02:00
|
|
|
return param;
|
|
|
|
}
|
|
|
|
|
2013-10-07 11:13:24 +02:00
|
|
|
void VDomDocument::TestUniqueId() const{
|
|
|
|
QVector<qint64> vector;
|
|
|
|
CollectId(this->documentElement(), vector);
|
|
|
|
}
|
|
|
|
|
|
|
|
void VDomDocument::CollectId(QDomElement node, QVector<qint64> &vector) const{
|
|
|
|
if (node.hasAttribute("id")) {
|
|
|
|
qint64 id = GetParametrId(node);
|
|
|
|
if(vector.contains(id)){
|
|
|
|
throw VExceptionUniqueId(tr("This id is not unique."), node);
|
|
|
|
}
|
|
|
|
vector.append(id);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (qint32 i=0; i<node.childNodes().length(); ++i) {
|
|
|
|
QDomNode n = node.childNodes().at(i);
|
|
|
|
if (n.isElement()) {
|
|
|
|
CollectId(n.toElement(), vector);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-08-28 10:55:11 +02:00
|
|
|
void VDomDocument::ParseDrawElement(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail,
|
2013-09-27 11:17:00 +02:00
|
|
|
const QDomNode& node, const Document::Documents &parse){
|
2013-07-13 12:51:31 +02:00
|
|
|
QDomNode domNode = node.firstChild();
|
|
|
|
while(!domNode.isNull()){
|
|
|
|
if(domNode.isElement()){
|
|
|
|
QDomElement domElement = domNode.toElement();
|
|
|
|
if(!domElement.isNull()){
|
|
|
|
if(domElement.tagName() == "calculation"){
|
2013-08-15 22:39:00 +02:00
|
|
|
data->ClearObject();
|
2013-08-28 10:55:11 +02:00
|
|
|
ParseDrawMode(sceneDraw, sceneDetail, domElement, parse, Draw::Calculation);
|
2013-07-13 12:51:31 +02:00
|
|
|
}
|
|
|
|
if(domElement.tagName() == "modeling"){
|
2013-08-28 10:55:11 +02:00
|
|
|
ParseDrawMode(sceneDraw, sceneDetail, domElement, parse, Draw::Modeling);
|
2013-07-13 12:51:31 +02:00
|
|
|
}
|
2013-08-28 10:55:11 +02:00
|
|
|
if(domElement.tagName() == "details"){
|
|
|
|
ParseDetails(sceneDetail, domElement, parse);
|
2013-07-13 12:51:31 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
domNode = domNode.nextSibling();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-08-28 10:55:11 +02:00
|
|
|
void VDomDocument::ParseDrawMode(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail,
|
2013-10-09 18:24:28 +02:00
|
|
|
const QDomNode& node, const Document::Documents &parse,
|
|
|
|
Draw::Draws mode){
|
2013-09-11 16:14:21 +02:00
|
|
|
Q_CHECK_PTR(sceneDraw);
|
|
|
|
Q_CHECK_PTR(sceneDetail);
|
2013-08-28 10:55:11 +02:00
|
|
|
VMainGraphicsScene *scene = 0;
|
|
|
|
if(mode == Draw::Calculation){
|
|
|
|
scene = sceneDraw;
|
|
|
|
} else {
|
|
|
|
scene = sceneDetail;
|
|
|
|
}
|
2013-07-13 12:51:31 +02:00
|
|
|
QDomNodeList nodeList = node.childNodes();
|
|
|
|
qint32 num = nodeList.size();
|
|
|
|
for(qint32 i = 0; i < num; ++i){
|
|
|
|
QDomElement domElement = nodeList.at(i).toElement();
|
|
|
|
if(!domElement.isNull()){
|
|
|
|
if(domElement.tagName() == "point"){
|
2013-08-28 10:55:11 +02:00
|
|
|
ParsePointElement(scene, domElement, parse, domElement.attribute("type", ""), mode);
|
2013-10-13 20:51:59 +02:00
|
|
|
continue;
|
2013-07-13 12:51:31 +02:00
|
|
|
}
|
2013-07-25 20:39:51 +02:00
|
|
|
if(domElement.tagName() == "line"){
|
2013-08-28 10:55:11 +02:00
|
|
|
ParseLineElement(scene, domElement, parse, mode);
|
2013-10-13 20:51:59 +02:00
|
|
|
continue;
|
2013-07-25 20:39:51 +02:00
|
|
|
}
|
2013-08-05 10:37:56 +02:00
|
|
|
if(domElement.tagName() == "spline"){
|
2013-08-28 10:55:11 +02:00
|
|
|
ParseSplineElement(scene, domElement, parse, domElement.attribute("type", ""), mode);
|
2013-10-13 20:51:59 +02:00
|
|
|
continue;
|
2013-08-05 10:37:56 +02:00
|
|
|
}
|
2013-08-06 09:56:09 +02:00
|
|
|
if(domElement.tagName() == "arc"){
|
2013-08-28 10:55:11 +02:00
|
|
|
ParseArcElement(scene, domElement, parse, domElement.attribute("type", ""), mode);
|
2013-10-13 20:51:59 +02:00
|
|
|
continue;
|
2013-08-28 10:55:11 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void VDomDocument::ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDomElement &domElement,
|
2013-09-27 11:17:00 +02:00
|
|
|
const Document::Documents &parse){
|
2013-09-11 16:14:21 +02:00
|
|
|
Q_CHECK_PTR(sceneDetail);
|
|
|
|
Q_ASSERT_X(!domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
2013-09-23 14:08:06 +02:00
|
|
|
try{
|
|
|
|
VDetail detail;
|
|
|
|
VDetail oldDetail;
|
|
|
|
qint64 id = GetParametrId(domElement);
|
|
|
|
detail.setName(GetParametrString(domElement, "name"));
|
|
|
|
detail.setMx(toPixel(GetParametrDouble(domElement, "mx")));
|
|
|
|
detail.setMy(toPixel(GetParametrDouble(domElement, "my")));
|
|
|
|
|
|
|
|
QDomNodeList nodeList = domElement.childNodes();
|
|
|
|
qint32 num = nodeList.size();
|
|
|
|
for(qint32 i = 0; i < num; ++i){
|
|
|
|
QDomElement element = nodeList.at(i).toElement();
|
|
|
|
if(!element.isNull()){
|
|
|
|
if(element.tagName() == "node"){
|
|
|
|
qint64 id = GetParametrLongLong(element, "idObject");
|
2013-09-27 11:17:00 +02:00
|
|
|
Tool::Tools tool;
|
|
|
|
Draw::Draws mode;
|
|
|
|
NodeDetail::NodeDetails nodeType = NodeDetail::Contour;
|
2013-09-23 14:08:06 +02:00
|
|
|
QString t = GetParametrString(element, "type");
|
|
|
|
if(t == "NodePoint"){
|
2013-09-27 11:17:00 +02:00
|
|
|
tool = Tool::NodePoint;
|
2013-09-23 14:08:06 +02:00
|
|
|
VPointF point = data->GetModelingPoint(id);
|
|
|
|
mode = point.getMode();
|
|
|
|
oldDetail.append(VNodeDetail(point.getIdObject(), tool, mode, NodeDetail::Contour));
|
|
|
|
} else if(t == "NodeArc"){
|
2013-09-27 11:17:00 +02:00
|
|
|
tool = Tool::NodeArc;
|
2013-09-23 14:08:06 +02:00
|
|
|
VArc arc = data->GetModelingArc(id);
|
|
|
|
mode = arc.getMode();
|
|
|
|
oldDetail.append(VNodeDetail(arc.getIdObject(), tool, mode, NodeDetail::Contour));
|
|
|
|
} else if(t == "NodeSpline"){
|
2013-09-27 11:17:00 +02:00
|
|
|
tool = Tool::NodeSpline;
|
2013-09-23 14:08:06 +02:00
|
|
|
VSpline spl = data->GetModelingSpline(id);
|
|
|
|
mode = spl.getMode();
|
|
|
|
oldDetail.append(VNodeDetail(spl.getIdObject(), tool, mode, NodeDetail::Contour));
|
|
|
|
} else if(t == "NodeSplinePath"){
|
2013-09-27 11:17:00 +02:00
|
|
|
tool = Tool::NodeSplinePath;
|
2013-09-23 14:08:06 +02:00
|
|
|
VSplinePath splPath = data->GetModelingSplinePath(id);
|
|
|
|
mode = splPath.getMode();
|
|
|
|
oldDetail.append(VNodeDetail(splPath.getIdObject(), tool, mode, NodeDetail::Contour));
|
|
|
|
} else if(t == "AlongLineTool"){
|
2013-09-27 11:17:00 +02:00
|
|
|
tool = Tool::AlongLineTool;
|
2013-09-23 14:08:06 +02:00
|
|
|
} else if(t == "ArcTool"){
|
2013-09-27 11:17:00 +02:00
|
|
|
tool = Tool::ArcTool;
|
2013-09-23 14:08:06 +02:00
|
|
|
} else if(t == "BisectorTool"){
|
2013-09-27 11:17:00 +02:00
|
|
|
tool = Tool::BisectorTool;
|
2013-09-23 14:08:06 +02:00
|
|
|
} else if(t == "EndLineTool"){
|
2013-09-27 11:17:00 +02:00
|
|
|
tool = Tool::EndLineTool;
|
2013-09-23 14:08:06 +02:00
|
|
|
} else if(t == "LineIntersectTool"){
|
2013-09-27 11:17:00 +02:00
|
|
|
tool = Tool::LineIntersectTool;
|
2013-09-23 14:08:06 +02:00
|
|
|
} else if(t == "LineTool"){
|
2013-09-27 11:17:00 +02:00
|
|
|
tool = Tool::LineTool;
|
2013-09-23 14:08:06 +02:00
|
|
|
} else if(t == "NormalTool"){
|
2013-09-27 11:17:00 +02:00
|
|
|
tool = Tool::NormalTool;
|
2013-09-23 14:08:06 +02:00
|
|
|
} else if(t == "PointOfContact"){
|
2013-09-27 11:17:00 +02:00
|
|
|
tool = Tool::PointOfContact;
|
2013-09-23 14:08:06 +02:00
|
|
|
} else if(t == "ShoulderPointTool"){
|
2013-09-27 11:17:00 +02:00
|
|
|
tool = Tool::ShoulderPointTool;
|
2013-09-23 14:08:06 +02:00
|
|
|
} else if(t == "SplinePathTool"){
|
2013-09-27 11:17:00 +02:00
|
|
|
tool = Tool::SplinePathTool;
|
2013-09-23 14:08:06 +02:00
|
|
|
} else if(t == "SplineTool"){
|
2013-09-27 11:17:00 +02:00
|
|
|
tool = Tool::SplineTool;
|
2013-09-23 14:08:06 +02:00
|
|
|
}
|
|
|
|
detail.append(VNodeDetail(id, tool, mode, nodeType));
|
2013-08-28 10:55:11 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-09-30 18:29:03 +02:00
|
|
|
VToolDetail::Create(id, detail, sceneDetail, this, data, parse, Tool::FromFile);
|
2013-09-23 14:08:06 +02:00
|
|
|
}
|
|
|
|
catch(const VExceptionBadId &e){
|
|
|
|
VExceptionObjectError excep(tr("Error creating or updating detail"), domElement);
|
|
|
|
excep.AddMoreInformation(e.ErrorMessage());
|
|
|
|
throw excep;
|
2013-08-28 10:55:11 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void VDomDocument::ParseDetails(VMainGraphicsScene *sceneDetail, const QDomElement &domElement,
|
2013-09-27 11:17:00 +02:00
|
|
|
const Document::Documents &parse){
|
2013-09-11 16:14:21 +02:00
|
|
|
Q_CHECK_PTR(sceneDetail);
|
|
|
|
Q_ASSERT_X(!domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
2013-08-28 10:55:11 +02:00
|
|
|
QDomNode domNode = domElement.firstChild();
|
|
|
|
while(!domNode.isNull()){
|
|
|
|
if(domNode.isElement()){
|
|
|
|
QDomElement domElement = domNode.toElement();
|
|
|
|
if(!domElement.isNull()){
|
|
|
|
if(domElement.tagName() == "detail"){
|
|
|
|
ParseDetailElement(sceneDetail, domElement, parse);
|
|
|
|
}
|
2013-08-06 09:56:09 +02:00
|
|
|
}
|
2013-07-13 12:51:31 +02:00
|
|
|
}
|
2013-08-28 10:55:11 +02:00
|
|
|
domNode = domNode.nextSibling();
|
2013-07-13 12:51:31 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElement& domElement,
|
2013-10-09 18:24:28 +02:00
|
|
|
const Document::Documents &parse, const QString& type,
|
|
|
|
Draw::Draws mode){
|
2013-09-11 16:14:21 +02:00
|
|
|
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");
|
2013-08-05 10:37:56 +02:00
|
|
|
if(type == "single"){
|
2013-09-23 14:08:06 +02:00
|
|
|
try{
|
|
|
|
qint64 id = GetParametrId(domElement);
|
|
|
|
QString name = GetParametrString(domElement, "name");
|
|
|
|
qreal x = toPixel(GetParametrDouble(domElement, "x"));
|
|
|
|
qreal y = toPixel(GetParametrDouble(domElement, "y"));
|
|
|
|
qreal mx = toPixel(GetParametrDouble(domElement, "mx"));
|
|
|
|
qreal my = toPixel(GetParametrDouble(domElement, "my"));
|
|
|
|
|
|
|
|
data->UpdatePoint(id, VPointF(x, y, name, mx, my));
|
2013-09-27 11:17:00 +02:00
|
|
|
VDrawTool::AddRecord(id, Tool::SinglePointTool, this);
|
2013-09-23 14:08:06 +02:00
|
|
|
if(parse != Document::FullParse){
|
|
|
|
UpdateToolData(id, data);
|
|
|
|
}
|
|
|
|
if(parse == Document::FullParse){
|
|
|
|
VToolSinglePoint *spoint = new VToolSinglePoint(this, data, id, Tool::FromFile);
|
|
|
|
Q_CHECK_PTR(spoint);
|
|
|
|
scene->addItem(spoint);
|
|
|
|
connect(spoint, &VToolSinglePoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
|
|
|
tools[id] = spoint;
|
|
|
|
}
|
|
|
|
return;
|
2013-09-11 16:14:21 +02:00
|
|
|
}
|
2013-09-23 14:08:06 +02:00
|
|
|
catch(const VExceptionBadId &e){
|
|
|
|
VExceptionObjectError excep(tr("Error creating or updating single point"), domElement);
|
|
|
|
excep.AddMoreInformation(e.ErrorMessage());
|
|
|
|
throw excep;
|
2013-07-25 14:00:51 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if(type == "endLine"){
|
2013-09-23 14:08:06 +02:00
|
|
|
try{
|
|
|
|
qint64 id = GetParametrId(domElement);
|
|
|
|
QString name = GetParametrString(domElement, "name");
|
|
|
|
qreal mx = toPixel(GetParametrDouble(domElement, "mx"));
|
|
|
|
qreal my = toPixel(GetParametrDouble(domElement, "my"));
|
|
|
|
QString typeLine = GetParametrString(domElement, "typeLine");
|
|
|
|
QString formula = GetParametrString(domElement, "length");
|
|
|
|
qint64 basePointId = GetParametrLongLong(domElement, "basePoint");
|
|
|
|
qreal angle = GetParametrDouble(domElement, "angle");
|
|
|
|
if(mode == Draw::Calculation){
|
|
|
|
VToolEndLine::Create(id, name, typeLine, formula, angle, basePointId, mx, my, scene, this,
|
2013-09-10 14:29:06 +02:00
|
|
|
data, parse, Tool::FromFile);
|
2013-09-23 14:08:06 +02:00
|
|
|
} else {
|
|
|
|
VModelingEndLine::Create(id, name, typeLine, formula, angle, basePointId, mx, my, this,
|
|
|
|
data, parse, Tool::FromFile);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
catch(const VExceptionBadId &e){
|
|
|
|
VExceptionObjectError excep(tr("Error creating or updating point of end line"), domElement);
|
|
|
|
excep.AddMoreInformation(e.ErrorMessage());
|
|
|
|
throw excep;
|
2013-07-13 12:51:31 +02:00
|
|
|
}
|
2013-07-28 00:18:06 +02:00
|
|
|
}
|
|
|
|
if(type == "alongLine"){
|
2013-09-23 14:08:06 +02:00
|
|
|
try{
|
|
|
|
qint64 id = GetParametrId(domElement);
|
|
|
|
QString name = GetParametrString(domElement, "name");
|
|
|
|
qreal mx = toPixel(GetParametrDouble(domElement, "mx"));
|
|
|
|
qreal my = toPixel(GetParametrDouble(domElement, "my"));
|
|
|
|
QString typeLine = GetParametrString(domElement, "typeLine");
|
|
|
|
QString formula = GetParametrString(domElement, "length");
|
|
|
|
qint64 firstPointId = GetParametrLongLong(domElement, "firstPoint");
|
|
|
|
qint64 secondPointId = GetParametrLongLong(domElement, "secondPoint");
|
2013-09-30 18:29:03 +02:00
|
|
|
|
2013-09-23 14:08:06 +02:00
|
|
|
if(mode == Draw::Calculation){
|
|
|
|
VToolAlongLine::Create(id, name, typeLine, formula, firstPointId, secondPointId, mx, my,
|
|
|
|
scene, this, data, parse, Tool::FromFile);
|
|
|
|
} else {
|
|
|
|
VModelingAlongLine::Create(id, name, typeLine, formula, firstPointId, secondPointId, mx, my,
|
|
|
|
this, data, parse, Tool::FromFile);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
catch(const VExceptionBadId &e){
|
|
|
|
VExceptionObjectError excep(tr("Error creating or updating point along line"), domElement);
|
|
|
|
excep.AddMoreInformation(e.ErrorMessage());
|
|
|
|
throw excep;
|
2013-07-28 00:18:06 +02:00
|
|
|
}
|
2013-07-13 12:51:31 +02:00
|
|
|
}
|
2013-07-29 14:55:40 +02:00
|
|
|
if(type == "shoulder"){
|
2013-09-23 14:08:06 +02:00
|
|
|
try{
|
|
|
|
qint64 id = GetParametrId(domElement);
|
|
|
|
QString name = GetParametrString(domElement, "name");
|
|
|
|
qreal mx = toPixel(GetParametrDouble(domElement, "mx"));
|
|
|
|
qreal my = toPixel(GetParametrDouble(domElement, "my"));
|
|
|
|
QString typeLine = GetParametrString(domElement, "typeLine");
|
|
|
|
QString formula = GetParametrString(domElement, "length");
|
|
|
|
qint64 p1Line = GetParametrLongLong(domElement, "p1Line");
|
|
|
|
qint64 p2Line = GetParametrLongLong(domElement, "p2Line");
|
|
|
|
qint64 pShoulder = GetParametrLongLong(domElement, "pShoulder");
|
2013-09-30 18:29:03 +02:00
|
|
|
|
2013-09-23 14:08:06 +02:00
|
|
|
if(mode == Draw::Calculation){
|
|
|
|
VToolShoulderPoint::Create(id, formula, p1Line, p2Line, pShoulder, typeLine, name, mx, my,
|
|
|
|
scene, this, data, parse, Tool::FromFile);
|
|
|
|
} else {
|
|
|
|
VModelingShoulderPoint::Create(id, formula, p1Line, p2Line, pShoulder, typeLine, name, mx,
|
|
|
|
my, this, data, parse, Tool::FromFile);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
catch(const VExceptionBadId &e){
|
|
|
|
VExceptionObjectError excep(tr("Error creating or updating point of shoulder"), domElement);
|
|
|
|
excep.AddMoreInformation(e.ErrorMessage());
|
|
|
|
throw excep;
|
2013-07-29 14:55:40 +02:00
|
|
|
}
|
|
|
|
}
|
2013-07-30 15:09:34 +02:00
|
|
|
if(type == "normal"){
|
2013-09-23 14:08:06 +02:00
|
|
|
try{
|
|
|
|
qint64 id = GetParametrId(domElement);
|
|
|
|
QString name = GetParametrString(domElement, "name");
|
|
|
|
qreal mx = toPixel(GetParametrDouble(domElement, "mx"));
|
|
|
|
qreal my = toPixel(GetParametrDouble(domElement, "my"));
|
|
|
|
QString typeLine = GetParametrString(domElement, "typeLine");
|
|
|
|
QString formula = GetParametrString(domElement, "length");
|
|
|
|
qint64 firstPointId = GetParametrLongLong(domElement, "firstPoint");
|
|
|
|
qint64 secondPointId = GetParametrLongLong(domElement, "secondPoint");
|
|
|
|
qreal angle = GetParametrDouble(domElement, "angle");
|
2013-09-30 18:29:03 +02:00
|
|
|
|
2013-09-23 14:08:06 +02:00
|
|
|
if(mode == Draw::Calculation){
|
|
|
|
VToolNormal::Create(id, formula, firstPointId, secondPointId, typeLine, name, angle,
|
|
|
|
mx, my, scene, this, data, parse, Tool::FromFile);
|
|
|
|
} else {
|
|
|
|
VModelingNormal::Create(id, formula, firstPointId, secondPointId, typeLine, name, angle,
|
|
|
|
mx, my, this, data, parse, Tool::FromFile);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
catch(const VExceptionBadId &e){
|
|
|
|
VExceptionObjectError excep(tr("Error creating or updating point of normal"), domElement);
|
|
|
|
excep.AddMoreInformation(e.ErrorMessage());
|
|
|
|
throw excep;
|
2013-07-30 15:09:34 +02:00
|
|
|
}
|
|
|
|
}
|
2013-07-30 20:46:40 +02:00
|
|
|
if(type == "bisector"){
|
2013-09-23 14:08:06 +02:00
|
|
|
try{
|
|
|
|
qint64 id = GetParametrId(domElement);
|
|
|
|
QString name = GetParametrString(domElement, "name");
|
|
|
|
qreal mx = toPixel(GetParametrDouble(domElement, "mx"));
|
|
|
|
qreal my = toPixel(GetParametrDouble(domElement, "my"));
|
|
|
|
QString typeLine = GetParametrString(domElement, "typeLine");
|
|
|
|
QString formula = GetParametrString(domElement, "length");
|
|
|
|
qint64 firstPointId = GetParametrLongLong(domElement, "firstPoint");
|
|
|
|
qint64 secondPointId = GetParametrLongLong(domElement, "secondPoint");
|
|
|
|
qint64 thirdPointId = GetParametrLongLong(domElement, "thirdPoint");
|
2013-09-30 18:29:03 +02:00
|
|
|
|
2013-09-23 14:08:06 +02:00
|
|
|
if(mode == Draw::Calculation){
|
|
|
|
VToolBisector::Create(id, formula, firstPointId, secondPointId, thirdPointId, typeLine,
|
|
|
|
name, mx, my, scene, this, data, parse, Tool::FromFile);
|
|
|
|
} else {
|
|
|
|
VModelingBisector::Create(id, formula, firstPointId, secondPointId, thirdPointId, typeLine,
|
|
|
|
name, mx, my, this, data, parse, Tool::FromFile);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
catch(const VExceptionBadId &e){
|
|
|
|
VExceptionObjectError excep(tr("Error creating or updating point of bisector"), domElement);
|
|
|
|
excep.AddMoreInformation(e.ErrorMessage());
|
|
|
|
throw excep;
|
2013-07-30 20:46:40 +02:00
|
|
|
}
|
|
|
|
}
|
2013-07-31 13:34:39 +02:00
|
|
|
if(type == "lineIntersect"){
|
2013-09-23 14:08:06 +02:00
|
|
|
try{
|
|
|
|
qint64 id = GetParametrId(domElement);
|
|
|
|
QString name = GetParametrString(domElement, "name");
|
|
|
|
qreal mx = toPixel(GetParametrDouble(domElement, "mx"));
|
|
|
|
qreal my = toPixel(GetParametrDouble(domElement, "my"));
|
|
|
|
qint64 p1Line1Id = GetParametrLongLong(domElement, "p1Line1");
|
|
|
|
qint64 p2Line1Id = GetParametrLongLong(domElement, "p2Line1");
|
|
|
|
qint64 p1Line2Id = GetParametrLongLong(domElement, "p1Line2");
|
|
|
|
qint64 p2Line2Id = GetParametrLongLong(domElement, "p2Line2");
|
2013-09-30 18:29:03 +02:00
|
|
|
|
2013-09-23 14:08:06 +02:00
|
|
|
if(mode == Draw::Calculation){
|
|
|
|
VToolLineIntersect::Create(id, p1Line1Id, p2Line1Id, p1Line2Id, p2Line2Id, name, mx, my,
|
|
|
|
scene, this, data, parse, Tool::FromFile);
|
|
|
|
} else {
|
|
|
|
VModelingLineIntersect::Create(id, p1Line1Id, p2Line1Id, p1Line2Id, p2Line2Id, name, mx, my,
|
|
|
|
this, data, parse, Tool::FromFile);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
catch(const VExceptionBadId &e){
|
|
|
|
VExceptionObjectError excep(tr("Error creating or updating point of lineintersection"), domElement);
|
|
|
|
excep.AddMoreInformation(e.ErrorMessage());
|
|
|
|
throw excep;
|
2013-07-31 13:34:39 +02:00
|
|
|
}
|
|
|
|
}
|
2013-08-21 10:03:53 +02:00
|
|
|
if(type == "pointOfContact"){
|
2013-09-23 14:08:06 +02:00
|
|
|
try{
|
|
|
|
qint64 id = GetParametrId(domElement);
|
|
|
|
QString name = GetParametrString(domElement, "name");
|
|
|
|
qreal mx = toPixel(GetParametrDouble(domElement, "mx"));
|
|
|
|
qreal my = toPixel(GetParametrDouble(domElement, "my"));
|
|
|
|
QString radius = GetParametrString(domElement, "radius");
|
|
|
|
qint64 center = GetParametrLongLong(domElement, "center");
|
|
|
|
qint64 firstPointId = GetParametrLongLong(domElement, "firstPoint");
|
|
|
|
qint64 secondPointId = GetParametrLongLong(domElement, "secondPoint");
|
2013-09-30 18:29:03 +02:00
|
|
|
|
2013-09-23 14:08:06 +02:00
|
|
|
if(mode == Draw::Calculation){
|
|
|
|
VToolPointOfContact::Create(id, radius, center, firstPointId, secondPointId, name, mx, my,
|
|
|
|
scene, this, data, parse, Tool::FromFile);
|
|
|
|
} else {
|
|
|
|
VModelingPointOfContact::Create(id, radius, center, firstPointId, secondPointId, name, mx,
|
|
|
|
my, this, data, parse, Tool::FromFile);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
catch(const VExceptionBadId &e){
|
|
|
|
VExceptionObjectError excep(tr("Error creating or updating point of contact"), domElement);
|
|
|
|
excep.AddMoreInformation(e.ErrorMessage());
|
|
|
|
throw excep;
|
2013-08-28 10:55:11 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if(type == "modeling"){
|
2013-09-23 14:08:06 +02:00
|
|
|
try{
|
|
|
|
qint64 id = GetParametrId(domElement);
|
|
|
|
qint64 idObject = GetParametrLongLong(domElement, "idObject");
|
|
|
|
QString tObject = GetParametrString(domElement, "typeObject");
|
|
|
|
VPointF point;
|
2013-09-27 11:17:00 +02:00
|
|
|
Draw::Draws typeObject;
|
2013-09-23 14:08:06 +02:00
|
|
|
if(tObject == "Calculation"){
|
|
|
|
typeObject = Draw::Calculation;
|
|
|
|
point = data->GetPoint(idObject );
|
|
|
|
} else {
|
|
|
|
typeObject = Draw::Modeling;
|
|
|
|
point = data->GetModelingPoint(idObject);
|
|
|
|
}
|
|
|
|
qreal mx = toPixel(GetParametrDouble(domElement, "mx"));
|
|
|
|
qreal my = toPixel(GetParametrDouble(domElement, "my"));
|
|
|
|
data->UpdateModelingPoint(id, VPointF(point.x(), point.y(), point.name(), mx, my, typeObject,
|
|
|
|
idObject ));
|
2013-09-30 18:29:03 +02:00
|
|
|
VNodePoint::Create(this, data, id, idObject, mode, parse, Tool::FromFile);
|
2013-09-23 14:08:06 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
catch(const VExceptionBadId &e){
|
|
|
|
VExceptionObjectError excep(tr("Error creating or updating modeling point"), domElement);
|
|
|
|
excep.AddMoreInformation(e.ErrorMessage());
|
|
|
|
throw excep;
|
2013-09-11 16:14:21 +02:00
|
|
|
}
|
2013-08-21 10:03:53 +02:00
|
|
|
}
|
2013-07-13 12:51:31 +02:00
|
|
|
}
|
|
|
|
|
2013-07-25 20:39:51 +02:00
|
|
|
void VDomDocument::ParseLineElement(VMainGraphicsScene *scene, const QDomElement &domElement,
|
2013-09-27 11:17:00 +02:00
|
|
|
const Document::Documents &parse, Draw::Draws mode){
|
2013-09-11 16:14:21 +02:00
|
|
|
Q_CHECK_PTR(scene);
|
|
|
|
Q_ASSERT_X(!domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
2013-09-23 14:08:06 +02:00
|
|
|
try{
|
|
|
|
qint64 id = GetParametrId(domElement);
|
|
|
|
qint64 firstPoint = GetParametrLongLong(domElement, "firstPoint");
|
|
|
|
qint64 secondPoint = GetParametrLongLong(domElement, "secondPoint");
|
2013-09-30 18:29:03 +02:00
|
|
|
|
2013-09-23 14:08:06 +02:00
|
|
|
if(mode == Draw::Calculation){
|
|
|
|
VToolLine::Create(id, firstPoint, secondPoint, scene, this, data, parse, Tool::FromFile);
|
|
|
|
} else {
|
|
|
|
VModelingLine::Create(id, firstPoint, secondPoint, this, data, parse, Tool::FromFile);
|
|
|
|
}
|
2013-09-27 17:00:51 +02:00
|
|
|
|
2013-09-23 14:08:06 +02:00
|
|
|
}
|
|
|
|
catch(const VExceptionBadId &e){
|
|
|
|
VExceptionObjectError excep(tr("Error creating or updating line"), domElement);
|
|
|
|
excep.AddMoreInformation(e.ErrorMessage());
|
|
|
|
throw excep;
|
2013-08-05 10:37:56 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void VDomDocument::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement &domElement,
|
2013-09-30 18:29:03 +02:00
|
|
|
const Document::Documents &parse, const QString &type,
|
|
|
|
Draw::Draws mode){
|
2013-09-11 16:14:21 +02:00
|
|
|
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 spline is empty");
|
2013-08-05 10:37:56 +02:00
|
|
|
if(type == "simple"){
|
2013-09-23 14:08:06 +02:00
|
|
|
try{
|
|
|
|
qint64 id = GetParametrId(domElement);
|
|
|
|
qint64 point1 = GetParametrLongLong(domElement, "point1");
|
|
|
|
qint64 point4 = GetParametrLongLong(domElement, "point4");
|
|
|
|
qreal angle1 = GetParametrDouble(domElement, "angle1");
|
|
|
|
qreal angle2 = GetParametrDouble(domElement, "angle2");
|
|
|
|
qreal kAsm1 = GetParametrDouble(domElement, "kAsm1");
|
|
|
|
qreal kAsm2 = GetParametrDouble(domElement, "kAsm2");
|
|
|
|
qreal kCurve = GetParametrDouble(domElement, "kCurve");
|
2013-09-30 18:29:03 +02:00
|
|
|
|
2013-09-23 14:08:06 +02:00
|
|
|
if(mode == Draw::Calculation){
|
|
|
|
VToolSpline::Create(id, point1, point4, kAsm1, kAsm2, angle1, angle2, kCurve, scene, this,
|
2013-09-10 14:29:06 +02:00
|
|
|
data, parse, Tool::FromFile);
|
2013-09-23 14:08:06 +02:00
|
|
|
} else {
|
|
|
|
VModelingSpline::Create(id, point1, point4, kAsm1, kAsm2, angle1, angle2, kCurve, this,
|
|
|
|
data, parse, Tool::FromFile);
|
|
|
|
}
|
2013-09-27 17:00:51 +02:00
|
|
|
|
2013-09-23 14:08:06 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
catch(const VExceptionBadId &e){
|
|
|
|
VExceptionObjectError excep(tr("Error creating or updating simple curve"), domElement);
|
|
|
|
excep.AddMoreInformation(e.ErrorMessage());
|
|
|
|
throw excep;
|
2013-08-09 08:49:34 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if(type == "path"){
|
2013-09-23 14:08:06 +02:00
|
|
|
try{
|
|
|
|
qint64 id = GetParametrId(domElement);
|
|
|
|
qreal kCurve = GetParametrDouble(domElement, "kCurve");
|
|
|
|
VSplinePath path(data->DataPoints(), kCurve);
|
|
|
|
|
|
|
|
QDomNodeList nodeList = domElement.childNodes();
|
|
|
|
qint32 num = nodeList.size();
|
|
|
|
for(qint32 i = 0; i < num; ++i){
|
|
|
|
QDomElement element = nodeList.at(i).toElement();
|
|
|
|
if(!element.isNull()){
|
|
|
|
if(element.tagName() == "pathPoint"){
|
|
|
|
qreal kAsm1 = GetParametrDouble(element, "kAsm1");
|
|
|
|
qreal angle = GetParametrDouble(element, "angle");
|
|
|
|
qreal kAsm2 = GetParametrDouble(element, "kAsm2");
|
|
|
|
qint64 pSpline = GetParametrLongLong(element, "pSpline");
|
|
|
|
VSplinePoint splPoint(pSpline, kAsm1, angle, kAsm2);
|
|
|
|
path.append(splPoint);
|
2013-09-30 18:29:03 +02:00
|
|
|
if(parse == Document::FullParse){
|
|
|
|
IncrementReferens(pSpline);
|
|
|
|
}
|
2013-09-23 14:08:06 +02:00
|
|
|
}
|
2013-08-05 10:37:56 +02:00
|
|
|
}
|
2013-07-25 20:39:51 +02:00
|
|
|
}
|
2013-09-23 14:08:06 +02:00
|
|
|
if(mode == Draw::Calculation){
|
|
|
|
VToolSplinePath::Create(id, path, scene, this, data, parse, Tool::FromFile);
|
|
|
|
} else {
|
|
|
|
VModelingSplinePath::Create(id, path, this, data, parse, Tool::FromFile);
|
|
|
|
}
|
|
|
|
return;
|
2013-09-11 16:14:21 +02:00
|
|
|
}
|
2013-09-23 14:08:06 +02:00
|
|
|
catch(const VExceptionBadId &e){
|
|
|
|
VExceptionObjectError excep(tr("Error creating or updating curve path"), domElement);
|
|
|
|
excep.AddMoreInformation(e.ErrorMessage());
|
|
|
|
throw excep;
|
2013-08-28 10:55:11 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if(type == "modelingSpline"){
|
2013-09-23 14:08:06 +02:00
|
|
|
try{
|
|
|
|
qint64 id = GetParametrId(domElement);
|
|
|
|
qint64 idObject = GetParametrLongLong(domElement, "idObject");
|
|
|
|
QString tObject = GetParametrString(domElement, "typeObject");
|
|
|
|
VSpline spl;
|
2013-09-27 11:17:00 +02:00
|
|
|
Draw::Draws typeObject;
|
2013-09-23 14:08:06 +02:00
|
|
|
if(tObject == "Calculation"){
|
|
|
|
typeObject = Draw::Calculation;
|
|
|
|
spl = data->GetSpline(idObject);
|
|
|
|
} else {
|
|
|
|
typeObject = Draw::Modeling;
|
|
|
|
spl = data->GetModelingSpline(idObject);
|
|
|
|
}
|
|
|
|
spl.setMode(typeObject);
|
|
|
|
spl.setIdObject(idObject);
|
2013-09-27 17:00:51 +02:00
|
|
|
data->UpdateModelingSpline(id, spl);
|
2013-10-09 18:24:28 +02:00
|
|
|
VNodeSpline::Create(this, data, id, idObject, mode, parse, Tool::FromFile);
|
2013-09-23 14:08:06 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
catch(const VExceptionBadId &e){
|
|
|
|
VExceptionObjectError excep(tr("Error creating or updating modeling simple curve"), domElement);
|
|
|
|
excep.AddMoreInformation(e.ErrorMessage());
|
|
|
|
throw excep;
|
2013-09-18 21:23:46 +02:00
|
|
|
}
|
2013-08-28 10:55:11 +02:00
|
|
|
}
|
|
|
|
if(type == "modelingPath"){
|
2013-09-23 14:08:06 +02:00
|
|
|
try{
|
|
|
|
qint64 id = GetParametrId(domElement);
|
|
|
|
qint64 idObject = GetParametrLongLong(domElement, "idObject");
|
|
|
|
QString tObject = GetParametrString(domElement, "typeObject");
|
|
|
|
VSplinePath path;
|
2013-09-27 11:17:00 +02:00
|
|
|
Draw::Draws typeObject;
|
2013-09-23 14:08:06 +02:00
|
|
|
if(tObject == "Calculation"){
|
|
|
|
typeObject = Draw::Calculation;
|
|
|
|
path = data->GetSplinePath(idObject);
|
2013-09-18 21:23:46 +02:00
|
|
|
} else {
|
2013-09-23 14:08:06 +02:00
|
|
|
typeObject = Draw::Modeling;
|
|
|
|
path = data->GetModelingSplinePath(idObject);
|
2013-09-18 21:23:46 +02:00
|
|
|
}
|
2013-09-23 14:08:06 +02:00
|
|
|
path.setMode(typeObject);
|
|
|
|
path.setIdObject(idObject);
|
|
|
|
data->UpdateModelingSplinePath(id, path);
|
2013-09-30 18:29:03 +02:00
|
|
|
VNodeSplinePath::Create(this, data, id, idObject, mode, parse, Tool::FromFile);
|
2013-09-23 14:08:06 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
catch(const VExceptionBadId &e){
|
|
|
|
VExceptionObjectError excep(tr("Error creating or updating modeling curve path"), domElement);
|
|
|
|
excep.AddMoreInformation(e.ErrorMessage());
|
|
|
|
throw excep;
|
2013-07-25 20:39:51 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-08-06 09:56:09 +02:00
|
|
|
void VDomDocument::ParseArcElement(VMainGraphicsScene *scene, const QDomElement &domElement,
|
2013-09-27 11:17:00 +02:00
|
|
|
const Document::Documents &parse, const QString &type, Draw::Draws mode){
|
2013-09-11 16:14:21 +02:00
|
|
|
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 spline is empty");
|
2013-08-06 09:56:09 +02:00
|
|
|
if(type == "simple"){
|
2013-09-23 14:08:06 +02:00
|
|
|
try{
|
|
|
|
qint64 id = GetParametrId(domElement);
|
|
|
|
qint64 center = GetParametrLongLong(domElement, "center");
|
|
|
|
QString radius = GetParametrString(domElement, "radius");
|
|
|
|
QString f1 = GetParametrString(domElement, "angle1");
|
|
|
|
QString f2 = GetParametrString(domElement, "angle2");
|
2013-09-30 18:29:03 +02:00
|
|
|
|
2013-09-23 14:08:06 +02:00
|
|
|
if(mode == Draw::Calculation){
|
|
|
|
VToolArc::Create(id, center, radius, f1, f2, scene, this, data, parse, Tool::FromFile);
|
|
|
|
} else {
|
|
|
|
VModelingArc::Create(id, center, radius, f1, f2, this, data, parse, Tool::FromFile);
|
|
|
|
}
|
2013-09-27 17:00:51 +02:00
|
|
|
|
2013-09-23 14:08:06 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
catch(const VExceptionBadId &e){
|
|
|
|
VExceptionObjectError excep(tr("Error creating or updating simple arc"), domElement);
|
|
|
|
excep.AddMoreInformation(e.ErrorMessage());
|
|
|
|
throw excep;
|
2013-08-28 10:55:11 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if(type == "modeling"){
|
2013-09-23 14:08:06 +02:00
|
|
|
try{
|
|
|
|
qint64 id = GetParametrId(domElement);
|
|
|
|
qint64 idObject = GetParametrLongLong(domElement, "idObject");
|
|
|
|
QString tObject = GetParametrString(domElement, "typeObject");
|
|
|
|
VArc arc;
|
2013-09-27 11:17:00 +02:00
|
|
|
Draw::Draws typeObject;
|
2013-09-23 14:08:06 +02:00
|
|
|
if(tObject == "Calculation"){
|
|
|
|
typeObject = Draw::Calculation;
|
|
|
|
arc = data->GetArc(idObject);
|
|
|
|
} else {
|
|
|
|
typeObject = Draw::Modeling;
|
|
|
|
arc = data->GetModelingArc(idObject);
|
|
|
|
}
|
|
|
|
arc.setMode(typeObject);
|
|
|
|
arc.setIdObject(idObject);
|
|
|
|
data->UpdateModelingArc(id, arc);
|
2013-09-30 18:29:03 +02:00
|
|
|
VNodeArc::Create(this, data, id, idObject, mode, parse, Tool::FromFile);
|
2013-09-23 14:08:06 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
catch(const VExceptionBadId &e){
|
|
|
|
VExceptionObjectError excep(tr("Error creating or updating modeling arc"), domElement);
|
|
|
|
excep.AddMoreInformation(e.ErrorMessage());
|
|
|
|
throw excep;
|
2013-08-06 09:56:09 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-13 12:51:31 +02:00
|
|
|
void VDomDocument::FullUpdateTree(){
|
|
|
|
VMainGraphicsScene *scene = new VMainGraphicsScene();
|
2013-09-11 16:14:21 +02:00
|
|
|
Q_CHECK_PTR(scene);
|
2013-09-23 14:08:06 +02:00
|
|
|
try{
|
|
|
|
data->ClearObject();
|
|
|
|
Parse(Document::LiteParse, scene, scene);
|
|
|
|
}
|
2013-10-09 18:24:28 +02:00
|
|
|
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;
|
|
|
|
}
|
2013-09-23 14:08:06 +02:00
|
|
|
catch(...){
|
|
|
|
delete scene;
|
|
|
|
throw;
|
|
|
|
}
|
2013-10-09 18:24:28 +02:00
|
|
|
|
2013-07-13 12:51:31 +02:00
|
|
|
delete scene;
|
2013-08-15 22:39:00 +02:00
|
|
|
setCurrentData();
|
2013-07-13 12:51:31 +02:00
|
|
|
emit FullUpdateFromFile();
|
|
|
|
emit haveChange();
|
|
|
|
}
|
|
|
|
|
|
|
|
void VDomDocument::haveLiteChange(){
|
|
|
|
emit haveChange();
|
|
|
|
}
|
2013-08-15 22:39:00 +02:00
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
void VDomDocument::setCurrentData(){
|
2013-08-29 12:31:50 +02:00
|
|
|
if(*mode == Draw::Calculation){
|
|
|
|
QString nameDraw = comboBoxDraws->itemText(comboBoxDraws->currentIndex());
|
|
|
|
if(nameActivDraw != nameDraw){
|
|
|
|
nameActivDraw = nameDraw;
|
|
|
|
qint64 id = 0;
|
|
|
|
if(history.size() == 0){
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
for(qint32 i = 0; i < history.size(); ++i){
|
|
|
|
VToolRecord tool = history.at(i);
|
|
|
|
if(tool.getNameDraw() == nameDraw){
|
|
|
|
id = tool.getId();
|
|
|
|
}
|
2013-08-21 10:03:53 +02:00
|
|
|
}
|
|
|
|
if(id == 0){
|
2013-08-29 12:31:50 +02:00
|
|
|
VToolRecord tool = history.at(history.size()-1);
|
|
|
|
id = tool.getId();
|
|
|
|
if(id == 0){
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(tools.size() > 0){
|
|
|
|
VDataTool *vTool = tools.value(id);
|
|
|
|
data->setData(vTool->getData());
|
2013-08-21 10:03:53 +02:00
|
|
|
}
|
2013-08-15 22:39:00 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-08-28 10:55:11 +02:00
|
|
|
|
2013-09-10 14:29:06 +02:00
|
|
|
void VDomDocument::AddTool(const qint64 &id, VDataTool *tool){
|
2013-09-11 16:14:21 +02:00
|
|
|
Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0");
|
|
|
|
Q_CHECK_PTR(tool);
|
2013-09-10 14:29:06 +02:00
|
|
|
tools.insert(id, tool);
|
|
|
|
}
|
|
|
|
|
|
|
|
void VDomDocument::UpdateToolData(const qint64 &id, VContainer *data){
|
2013-09-11 16:14:21 +02:00
|
|
|
Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0");
|
|
|
|
Q_CHECK_PTR(data);
|
2013-09-10 14:29:06 +02:00
|
|
|
VDataTool *tool = tools.value(id);
|
2013-09-11 16:14:21 +02:00
|
|
|
Q_CHECK_PTR(tool);
|
|
|
|
tool->VDataTool::setData(data);
|
2013-09-10 14:29:06 +02:00
|
|
|
}
|
2013-09-30 18:29:03 +02:00
|
|
|
|
|
|
|
void VDomDocument::IncrementReferens(qint64 id) const{
|
|
|
|
Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0");
|
|
|
|
VDataTool *tool = tools.value(id);
|
|
|
|
Q_CHECK_PTR(tool);
|
|
|
|
tool->incrementReferens();
|
|
|
|
}
|
|
|
|
|
|
|
|
void VDomDocument::DecrementReferens(qint64 id) const{
|
|
|
|
Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0");
|
|
|
|
VDataTool *tool = tools.value(id);
|
|
|
|
Q_CHECK_PTR(tool);
|
|
|
|
tool->decrementReferens();
|
|
|
|
}
|