|
|
|
@ -82,6 +82,7 @@ void VDomDocument::CreateEmptyFile(){
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool VDomDocument::CheckNameDraw(const QString& name) const{
|
|
|
|
|
Q_ASSERT_X(!name.isEmpty(), "CheckNameDraw", "name draw is empty");
|
|
|
|
|
QDomNodeList elements = this->documentElement().elementsByTagName( "draw" );
|
|
|
|
|
if(elements.size() == 0){
|
|
|
|
|
return false;
|
|
|
|
@ -99,6 +100,7 @@ bool VDomDocument::CheckNameDraw(const QString& name) const{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool VDomDocument::appendDraw(const QString& name){
|
|
|
|
|
Q_ASSERT_X(!name.isEmpty(), "appendDraw", "name draw is empty");
|
|
|
|
|
if(name.isEmpty()){
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
@ -132,6 +134,7 @@ bool VDomDocument::appendDraw(const QString& name){
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void VDomDocument::ChangeActivDraw(const QString& name, Document::Enum parse){
|
|
|
|
|
Q_ASSERT_X(!name.isEmpty(), "ChangeActivDraw", "name draw is empty");
|
|
|
|
|
if(CheckNameDraw(name) == true){
|
|
|
|
|
this->nameActivDraw = name;
|
|
|
|
|
if(parse == Document::FullParse){
|
|
|
|
@ -141,12 +144,14 @@ void VDomDocument::ChangeActivDraw(const QString& name, Document::Enum parse){
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void VDomDocument::SetNameDraw(const QString& name){
|
|
|
|
|
Q_ASSERT_X(!name.isEmpty(), "SetNameDraw", "name draw is empty");
|
|
|
|
|
QString oldName = nameActivDraw;
|
|
|
|
|
nameActivDraw = name;
|
|
|
|
|
emit ChangedNameDraw(oldName, nameActivDraw);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void VDomDocument::SetActivDraw(const QString& name){
|
|
|
|
|
Q_ASSERT_X(!name.isEmpty(), "SetActivDraw", "name draw is empty");
|
|
|
|
|
this->nameActivDraw = name;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -201,6 +206,7 @@ bool VDomDocument::GetActivDetailsElement(QDomElement &element){
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool VDomDocument::GetActivNodeElement(const QString& name, QDomElement &element){
|
|
|
|
|
Q_ASSERT_X(!name.isEmpty(), "GetActivNodeElement", "name draw is empty");
|
|
|
|
|
QDomElement drawElement;
|
|
|
|
|
bool drawOk = this->GetActivDrawElement(drawElement);
|
|
|
|
|
if(drawOk == true){
|
|
|
|
@ -219,7 +225,10 @@ bool VDomDocument::GetActivNodeElement(const QString& name, QDomElement &element
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void VDomDocument::Parse(Document::Enum parse, VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail){
|
|
|
|
|
void VDomDocument::Parse(Document::Enum parse, VMainGraphicsScene *sceneDraw,
|
|
|
|
|
VMainGraphicsScene *sceneDetail){
|
|
|
|
|
Q_CHECK_PTR(sceneDraw);
|
|
|
|
|
Q_CHECK_PTR(sceneDetail);
|
|
|
|
|
if(parse == Document::FullParse){
|
|
|
|
|
data->Clear();
|
|
|
|
|
nameActivDraw.clear();
|
|
|
|
@ -277,16 +286,12 @@ void VDomDocument::ParseIncrementsElement(const QDomNode &node){
|
|
|
|
|
QDomElement domElement = domNode.toElement();
|
|
|
|
|
if(!domElement.isNull()){
|
|
|
|
|
if(domElement.tagName() == "increment"){
|
|
|
|
|
QString name,desc;
|
|
|
|
|
qreal base;
|
|
|
|
|
qreal ksize, kgrowth;
|
|
|
|
|
qint64 id;
|
|
|
|
|
id = domElement.attribute("id", "").toLongLong();
|
|
|
|
|
name = domElement.attribute("name", "");
|
|
|
|
|
base = domElement.attribute("base","").toDouble();
|
|
|
|
|
ksize = domElement.attribute("ksize","").toDouble();
|
|
|
|
|
kgrowth = domElement.attribute("kgrowth","").toDouble();
|
|
|
|
|
desc = domElement.attribute("description","");
|
|
|
|
|
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");
|
|
|
|
|
data->UpdateId(id);
|
|
|
|
|
data->AddIncrementTableRow(name,
|
|
|
|
|
VIncrementTableRow(id, base, ksize, kgrowth, desc));
|
|
|
|
@ -297,6 +302,48 @@ void VDomDocument::ParseIncrementsElement(const QDomNode &node){
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
qint64 VDomDocument::GetParametrId(const QDomElement &domElement) const{
|
|
|
|
|
qint64 id = GetParametrLongLong(domElement, "id");
|
|
|
|
|
Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0");
|
|
|
|
|
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);
|
|
|
|
|
QString error("can't convert parametr ");
|
|
|
|
|
error.append(name);
|
|
|
|
|
Q_ASSERT_X(ok, Q_FUNC_INFO, error.toLatin1().data());
|
|
|
|
|
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");
|
|
|
|
|
QString parametr = domElement.attribute(name, "");
|
|
|
|
|
QString error("get empty parametr ");
|
|
|
|
|
error.append(name);
|
|
|
|
|
Q_ASSERT_X(!parametr.isEmpty(), Q_FUNC_INFO, error.toLatin1().data());
|
|
|
|
|
return parametr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
QString error("can't convert parametr ");
|
|
|
|
|
error.append(name);
|
|
|
|
|
Q_ASSERT_X(ok, Q_FUNC_INFO, error.toLatin1().data());
|
|
|
|
|
return param;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void VDomDocument::ParseDrawElement(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail,
|
|
|
|
|
const QDomNode& node, Document::Enum parse){
|
|
|
|
|
QDomNode domNode = node.firstChild();
|
|
|
|
@ -322,6 +369,8 @@ void VDomDocument::ParseDrawElement(VMainGraphicsScene *sceneDraw, VMainGraphics
|
|
|
|
|
|
|
|
|
|
void VDomDocument::ParseDrawMode(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail,
|
|
|
|
|
const QDomNode& node, Document::Enum parse, Draw::Mode mode){
|
|
|
|
|
Q_CHECK_PTR(sceneDraw);
|
|
|
|
|
Q_CHECK_PTR(sceneDetail);
|
|
|
|
|
VMainGraphicsScene *scene = 0;
|
|
|
|
|
if(mode == Draw::Calculation){
|
|
|
|
|
scene = sceneDraw;
|
|
|
|
@ -351,13 +400,14 @@ void VDomDocument::ParseDrawMode(VMainGraphicsScene *sceneDraw, VMainGraphicsSce
|
|
|
|
|
|
|
|
|
|
void VDomDocument::ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDomElement &domElement,
|
|
|
|
|
Document::Enum parse){
|
|
|
|
|
if(!domElement.isNull()){
|
|
|
|
|
Q_CHECK_PTR(sceneDetail);
|
|
|
|
|
Q_ASSERT_X(!domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
|
|
|
|
VDetail detail;
|
|
|
|
|
VDetail oldDetail;
|
|
|
|
|
qint64 id = domElement.attribute("id", "").toLongLong();
|
|
|
|
|
detail.setName(domElement.attribute("name", ""));
|
|
|
|
|
detail.setMx(toPixel(domElement.attribute("mx","").toDouble()));
|
|
|
|
|
detail.setMy(toPixel(domElement.attribute("my","").toDouble()));
|
|
|
|
|
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();
|
|
|
|
@ -365,11 +415,11 @@ void VDomDocument::ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDo
|
|
|
|
|
QDomElement element = nodeList.at(i).toElement();
|
|
|
|
|
if(!element.isNull()){
|
|
|
|
|
if(element.tagName() == "node"){
|
|
|
|
|
qint64 id = element.attribute("id","").toLongLong();
|
|
|
|
|
qint64 id = GetParametrLongLong(element, "idObject");
|
|
|
|
|
Tools::Enum tool;
|
|
|
|
|
Draw::Mode mode;
|
|
|
|
|
NodeDetail::Type nodeType = NodeDetail::Contour;
|
|
|
|
|
QString t = element.attribute("type","");
|
|
|
|
|
QString t = GetParametrString(element, "type");
|
|
|
|
|
if(t == "NodePoint"){
|
|
|
|
|
tool = Tools::NodePoint;
|
|
|
|
|
VPointF point = data->GetModelingPoint(id);
|
|
|
|
@ -419,10 +469,11 @@ void VDomDocument::ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDo
|
|
|
|
|
}
|
|
|
|
|
VToolDetail::Create(id, detail, oldDetail, sceneDetail, this, data, parse, Tool::FromFile);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void VDomDocument::ParseDetails(VMainGraphicsScene *sceneDetail, const QDomElement &domElement,
|
|
|
|
|
Document::Enum parse){
|
|
|
|
|
Q_CHECK_PTR(sceneDetail);
|
|
|
|
|
Q_ASSERT_X(!domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
|
|
|
|
QDomNode domNode = domElement.firstChild();
|
|
|
|
|
while(!domNode.isNull()){
|
|
|
|
|
if(domNode.isElement()){
|
|
|
|
@ -439,42 +490,40 @@ void VDomDocument::ParseDetails(VMainGraphicsScene *sceneDetail, const QDomEleme
|
|
|
|
|
|
|
|
|
|
void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElement& domElement,
|
|
|
|
|
Document::Enum parse, const QString& type, Draw::Mode 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");
|
|
|
|
|
if(type == "single"){
|
|
|
|
|
if(!domElement.isNull()){
|
|
|
|
|
qint64 id = domElement.attribute("id", "").toLongLong();
|
|
|
|
|
Q_ASSERT(id > 0);
|
|
|
|
|
QString name = domElement.attribute("name", "");
|
|
|
|
|
qreal x = domElement.attribute("x","").toDouble()*PrintDPI/25.4;
|
|
|
|
|
qreal y = domElement.attribute("y","").toDouble()*PrintDPI/25.4;
|
|
|
|
|
qreal mx = domElement.attribute("mx","").toDouble()*PrintDPI/25.4;
|
|
|
|
|
qreal my = domElement.attribute("my","").toDouble()*PrintDPI/25.4;
|
|
|
|
|
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));
|
|
|
|
|
VDrawTool::AddRecord(id, Tools::SinglePointTool, this);
|
|
|
|
|
if(parse != Document::FullParse){
|
|
|
|
|
VDataTool *tool = tools.value(id);
|
|
|
|
|
Q_CHECK_PTR(tool);
|
|
|
|
|
tool->VDataTool::setData(data);
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
if(type == "endLine"){
|
|
|
|
|
if(!domElement.isNull()){
|
|
|
|
|
qint64 id = domElement.attribute("id", "").toLongLong();
|
|
|
|
|
QString name = domElement.attribute("name", "");
|
|
|
|
|
qreal mx = domElement.attribute("mx","").toDouble()*PrintDPI/25.4;
|
|
|
|
|
qreal my = domElement.attribute("my","").toDouble()*PrintDPI/25.4;
|
|
|
|
|
QString typeLine = domElement.attribute("typeLine", "");
|
|
|
|
|
QString formula = domElement.attribute("length", "");
|
|
|
|
|
qint64 basePointId = domElement.attribute("basePoint", "").toLongLong();
|
|
|
|
|
qint32 angle = domElement.attribute("angle", "").toInt();
|
|
|
|
|
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,
|
|
|
|
|
data, parse, Tool::FromFile);
|
|
|
|
@ -482,19 +531,17 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen
|
|
|
|
|
VModelingEndLine::Create(id, name, typeLine, formula, angle, basePointId, mx, my, this,
|
|
|
|
|
data, parse, Tool::FromFile);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if(type == "alongLine"){
|
|
|
|
|
if(!domElement.isNull()){
|
|
|
|
|
qint64 id = domElement.attribute("id", "").toLongLong();
|
|
|
|
|
QString name = domElement.attribute("name", "");
|
|
|
|
|
qreal mx = domElement.attribute("mx","").toDouble()*PrintDPI/25.4;
|
|
|
|
|
qreal my = domElement.attribute("my","").toDouble()*PrintDPI/25.4;
|
|
|
|
|
QString typeLine = domElement.attribute("typeLine", "");
|
|
|
|
|
QString formula = domElement.attribute("length", "");
|
|
|
|
|
qint64 firstPointId = domElement.attribute("firstPoint", "").toLongLong();
|
|
|
|
|
qint64 secondPointId = domElement.attribute("secondPoint", "").toLongLong();
|
|
|
|
|
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");
|
|
|
|
|
if(mode == Draw::Calculation){
|
|
|
|
|
VToolAlongLine::Create(id, name, typeLine, formula, firstPointId, secondPointId, mx, my,
|
|
|
|
|
scene, this, data, parse, Tool::FromFile);
|
|
|
|
@ -502,20 +549,18 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen
|
|
|
|
|
VModelingAlongLine::Create(id, name, typeLine, formula, firstPointId, secondPointId, mx, my,
|
|
|
|
|
this, data, parse, Tool::FromFile);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if(type == "shoulder"){
|
|
|
|
|
if(!domElement.isNull()){
|
|
|
|
|
qint64 id = domElement.attribute("id", "").toLongLong();
|
|
|
|
|
QString name = domElement.attribute("name", "");
|
|
|
|
|
qreal mx = domElement.attribute("mx","").toDouble()*PrintDPI/25.4;
|
|
|
|
|
qreal my = domElement.attribute("my","").toDouble()*PrintDPI/25.4;
|
|
|
|
|
QString typeLine = domElement.attribute("typeLine", "");
|
|
|
|
|
QString formula = domElement.attribute("length", "");
|
|
|
|
|
qint64 p1Line = domElement.attribute("p1Line", "").toLongLong();
|
|
|
|
|
qint64 p2Line = domElement.attribute("p2Line", "").toLongLong();
|
|
|
|
|
qint64 pShoulder = domElement.attribute("pShoulder", "").toLongLong();
|
|
|
|
|
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");
|
|
|
|
|
if(mode == Draw::Calculation){
|
|
|
|
|
VToolShoulderPoint::Create(id, formula, p1Line, p2Line, pShoulder, typeLine, name, mx, my,
|
|
|
|
|
scene, this, data, parse, Tool::FromFile);
|
|
|
|
@ -523,20 +568,18 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen
|
|
|
|
|
VModelingShoulderPoint::Create(id, formula, p1Line, p2Line, pShoulder, typeLine, name, mx,
|
|
|
|
|
my, this, data, parse, Tool::FromFile);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if(type == "normal"){
|
|
|
|
|
if(!domElement.isNull()){
|
|
|
|
|
qint64 id = domElement.attribute("id", "").toLongLong();
|
|
|
|
|
QString name = domElement.attribute("name", "");
|
|
|
|
|
qreal mx = domElement.attribute("mx","").toDouble()*PrintDPI/25.4;
|
|
|
|
|
qreal my = domElement.attribute("my","").toDouble()*PrintDPI/25.4;
|
|
|
|
|
QString typeLine = domElement.attribute("typeLine", "");
|
|
|
|
|
QString formula = domElement.attribute("length", "");
|
|
|
|
|
qint64 firstPointId = domElement.attribute("firstPoint", "").toLongLong();
|
|
|
|
|
qint64 secondPointId = domElement.attribute("secondPoint", "").toLongLong();
|
|
|
|
|
qreal angle = domElement.attribute("angle", "").toDouble();
|
|
|
|
|
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");
|
|
|
|
|
if(mode == Draw::Calculation){
|
|
|
|
|
VToolNormal::Create(id, formula, firstPointId, secondPointId, typeLine, name, angle,
|
|
|
|
|
mx, my, scene, this, data, parse, Tool::FromFile);
|
|
|
|
@ -544,20 +587,18 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen
|
|
|
|
|
VModelingNormal::Create(id, formula, firstPointId, secondPointId, typeLine, name, angle,
|
|
|
|
|
mx, my, this, data, parse, Tool::FromFile);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if(type == "bisector"){
|
|
|
|
|
if(!domElement.isNull()){
|
|
|
|
|
qint64 id = domElement.attribute("id", "").toLongLong();
|
|
|
|
|
QString name = domElement.attribute("name", "");
|
|
|
|
|
qreal mx = domElement.attribute("mx","").toDouble()*PrintDPI/25.4;
|
|
|
|
|
qreal my = domElement.attribute("my","").toDouble()*PrintDPI/25.4;
|
|
|
|
|
QString typeLine = domElement.attribute("typeLine", "");
|
|
|
|
|
QString formula = domElement.attribute("length", "");
|
|
|
|
|
qint64 firstPointId = domElement.attribute("firstPoint", "").toLongLong();
|
|
|
|
|
qint64 secondPointId = domElement.attribute("secondPoint", "").toLongLong();
|
|
|
|
|
qint64 thirdPointId = domElement.attribute("thirdPoint", "").toLongLong();
|
|
|
|
|
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");
|
|
|
|
|
if(mode == Draw::Calculation){
|
|
|
|
|
VToolBisector::Create(id, formula, firstPointId, secondPointId, thirdPointId, typeLine,
|
|
|
|
|
name, mx, my, scene, this, data, parse, Tool::FromFile);
|
|
|
|
@ -565,19 +606,17 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen
|
|
|
|
|
VModelingBisector::Create(id, formula, firstPointId, secondPointId, thirdPointId, typeLine,
|
|
|
|
|
name, mx, my, this, data, parse, Tool::FromFile);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if(type == "lineIntersect"){
|
|
|
|
|
if(!domElement.isNull()){
|
|
|
|
|
qint64 id = domElement.attribute("id", "").toLongLong();
|
|
|
|
|
QString name = domElement.attribute("name", "");
|
|
|
|
|
qreal mx = domElement.attribute("mx","").toDouble()*PrintDPI/25.4;
|
|
|
|
|
qreal my = domElement.attribute("my","").toDouble()*PrintDPI/25.4;
|
|
|
|
|
qint64 p1Line1Id = domElement.attribute("p1Line1", "").toLongLong();
|
|
|
|
|
qint64 p2Line1Id = domElement.attribute("p2Line1", "").toLongLong();
|
|
|
|
|
qint64 p1Line2Id = domElement.attribute("p1Line2", "").toLongLong();
|
|
|
|
|
qint64 p2Line2Id = domElement.attribute("p2Line2", "").toLongLong();
|
|
|
|
|
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");
|
|
|
|
|
if(mode == Draw::Calculation){
|
|
|
|
|
VToolLineIntersect::Create(id, p1Line1Id, p2Line1Id, p1Line2Id, p2Line2Id, name, mx, my,
|
|
|
|
|
scene, this, data, parse, Tool::FromFile);
|
|
|
|
@ -585,19 +624,17 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen
|
|
|
|
|
VModelingLineIntersect::Create(id, p1Line1Id, p2Line1Id, p1Line2Id, p2Line2Id, name, mx, my,
|
|
|
|
|
this, data, parse, Tool::FromFile);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if(type == "pointOfContact"){
|
|
|
|
|
if(!domElement.isNull()){
|
|
|
|
|
qint64 id = domElement.attribute("id", "").toLongLong();
|
|
|
|
|
QString name = domElement.attribute("name", "");
|
|
|
|
|
qreal mx = domElement.attribute("mx","").toDouble()*PrintDPI/25.4;
|
|
|
|
|
qreal my = domElement.attribute("my","").toDouble()*PrintDPI/25.4;
|
|
|
|
|
QString radius = domElement.attribute("radius", "");
|
|
|
|
|
qint64 center = domElement.attribute("center", "").toLongLong();
|
|
|
|
|
qint64 firstPointId = domElement.attribute("firstPoint", "").toLongLong();
|
|
|
|
|
qint64 secondPointId = domElement.attribute("secondPoint", "").toLongLong();
|
|
|
|
|
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");
|
|
|
|
|
if(mode == Draw::Calculation){
|
|
|
|
|
VToolPointOfContact::Create(id, radius, center, firstPointId, secondPointId, name, mx, my,
|
|
|
|
|
scene, this, data, parse, Tool::FromFile);
|
|
|
|
@ -605,14 +642,12 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen
|
|
|
|
|
VModelingPointOfContact::Create(id, radius, center, firstPointId, secondPointId, name, mx,
|
|
|
|
|
my, this, data, parse, Tool::FromFile);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if(type == "modeling"){
|
|
|
|
|
if(!domElement.isNull()){
|
|
|
|
|
qint64 id = domElement.attribute("id", "").toLongLong();
|
|
|
|
|
qint64 idObject = domElement.attribute("idObject", "").toLongLong();
|
|
|
|
|
QString tObject = domElement.attribute("typeObject", "");
|
|
|
|
|
qint64 id = GetParametrId(domElement);
|
|
|
|
|
qint64 idObject = GetParametrLongLong(domElement, "idObject");
|
|
|
|
|
QString tObject = GetParametrString(domElement, "typeObject");
|
|
|
|
|
VPointF point;
|
|
|
|
|
Draw::Mode typeObject;
|
|
|
|
|
if(tObject == "Calculation"){
|
|
|
|
@ -622,42 +657,43 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen
|
|
|
|
|
typeObject = Draw::Modeling;
|
|
|
|
|
point = data->GetModelingPoint(idObject);
|
|
|
|
|
}
|
|
|
|
|
qreal mx = toPixel(domElement.attribute("mx","").toDouble());
|
|
|
|
|
qreal my = toPixel(domElement.attribute("my","").toDouble());
|
|
|
|
|
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 ));
|
|
|
|
|
data->IncrementReferens(idObject, Scene::Point, typeObject);
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void VDomDocument::ParseLineElement(VMainGraphicsScene *scene, const QDomElement &domElement,
|
|
|
|
|
Document::Enum parse, Draw::Mode mode){
|
|
|
|
|
if(!domElement.isNull()){
|
|
|
|
|
qint64 id = domElement.attribute("id", "").toLongLong();
|
|
|
|
|
qint64 firstPoint = domElement.attribute("firstPoint", "").toLongLong();
|
|
|
|
|
qint64 secondPoint = domElement.attribute("secondPoint", "").toLongLong();
|
|
|
|
|
Q_CHECK_PTR(scene);
|
|
|
|
|
Q_ASSERT_X(!domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
|
|
|
|
qint64 id = GetParametrId(domElement);
|
|
|
|
|
qint64 firstPoint = GetParametrLongLong(domElement, "firstPoint");
|
|
|
|
|
qint64 secondPoint = GetParametrLongLong(domElement, "secondPoint");
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void VDomDocument::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement &domElement,
|
|
|
|
|
Document::Enum parse, const QString &type, Draw::Mode 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 spline is empty");
|
|
|
|
|
if(type == "simple"){
|
|
|
|
|
if(!domElement.isNull()){
|
|
|
|
|
qint64 id = domElement.attribute("id", "").toLongLong();
|
|
|
|
|
qint64 point1 = domElement.attribute("point1", "").toLongLong();
|
|
|
|
|
qint64 point4 = domElement.attribute("point4", "").toLongLong();
|
|
|
|
|
qreal angle1 = domElement.attribute("angle1","").toDouble();
|
|
|
|
|
qreal angle2 = domElement.attribute("angle2","").toDouble();
|
|
|
|
|
qreal kAsm1 = domElement.attribute("kAsm1","").toDouble();
|
|
|
|
|
qreal kAsm2 = domElement.attribute("kAsm2","").toDouble();
|
|
|
|
|
qreal kCurve = domElement.attribute("kCurve","").toDouble();
|
|
|
|
|
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");
|
|
|
|
|
if(mode == Draw::Calculation){
|
|
|
|
|
VToolSpline::Create(id, point1, point4, kAsm1, kAsm2, angle1, angle2, kCurve, scene, this,
|
|
|
|
|
data, parse, Tool::FromFile);
|
|
|
|
@ -665,13 +701,11 @@ void VDomDocument::ParseSplineElement(VMainGraphicsScene *scene, const QDomEleme
|
|
|
|
|
VModelingSpline::Create(id, point1, point4, kAsm1, kAsm2, angle1, angle2, kCurve, this,
|
|
|
|
|
data, parse, Tool::FromFile);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if(type == "path"){
|
|
|
|
|
if(!domElement.isNull()){
|
|
|
|
|
qint64 id = domElement.attribute("id", "").toLongLong();
|
|
|
|
|
qreal kCurve = domElement.attribute("kCurve","").toDouble();
|
|
|
|
|
qint64 id = GetParametrId(domElement);
|
|
|
|
|
qreal kCurve = GetParametrDouble(domElement, "kCurve");
|
|
|
|
|
VSplinePath path(data->DataPoints(), kCurve);
|
|
|
|
|
|
|
|
|
|
QDomNodeList nodeList = domElement.childNodes();
|
|
|
|
@ -680,10 +714,10 @@ void VDomDocument::ParseSplineElement(VMainGraphicsScene *scene, const QDomEleme
|
|
|
|
|
QDomElement element = nodeList.at(i).toElement();
|
|
|
|
|
if(!element.isNull()){
|
|
|
|
|
if(element.tagName() == "pathPoint"){
|
|
|
|
|
qint64 pSpline = element.attribute("pSpline","").toLongLong();
|
|
|
|
|
qreal kAsm1 = element.attribute("kAsm1","").toDouble();
|
|
|
|
|
qreal angle = element.attribute("angle","").toDouble();
|
|
|
|
|
qreal kAsm2 = element.attribute("kAsm2","").toDouble();
|
|
|
|
|
qint64 pSpline = GetParametrLongLong(domElement, "pSpline");
|
|
|
|
|
qreal kAsm1 = GetParametrDouble(domElement, "kAsm1");
|
|
|
|
|
qreal angle = GetParametrDouble(domElement, "angle");
|
|
|
|
|
qreal kAsm2 = GetParametrDouble(domElement, "kAsm2");
|
|
|
|
|
VSplinePoint splPoint(pSpline, kAsm1, angle, kAsm2);
|
|
|
|
|
path.append(splPoint);
|
|
|
|
|
}
|
|
|
|
@ -694,14 +728,12 @@ void VDomDocument::ParseSplineElement(VMainGraphicsScene *scene, const QDomEleme
|
|
|
|
|
} else {
|
|
|
|
|
VModelingSplinePath::Create(id, path, this, data, parse, Tool::FromFile);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if(type == "modelingSpline"){
|
|
|
|
|
if(!domElement.isNull()){
|
|
|
|
|
qint64 id = domElement.attribute("id", "").toLongLong();
|
|
|
|
|
qint64 idObject = domElement.attribute("idObject", "").toLongLong();
|
|
|
|
|
QString tObject = domElement.attribute("typeObject", "");
|
|
|
|
|
qint64 id = GetParametrId(domElement);
|
|
|
|
|
qint64 idObject = GetParametrLongLong(domElement, "idObject");
|
|
|
|
|
QString tObject = GetParametrString(domElement, "typeObject");
|
|
|
|
|
VSpline spl;
|
|
|
|
|
Draw::Mode typeObject;
|
|
|
|
|
if(tObject == "Calculation"){
|
|
|
|
@ -716,14 +748,12 @@ void VDomDocument::ParseSplineElement(VMainGraphicsScene *scene, const QDomEleme
|
|
|
|
|
data->UpdateModelingSpline(id, spl);
|
|
|
|
|
data->IncrementReferens(spl.GetP1(), Scene::Point, Draw::Modeling);
|
|
|
|
|
data->IncrementReferens(spl.GetP4(), Scene::Point, Draw::Modeling);
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if(type == "modelingPath"){
|
|
|
|
|
if(!domElement.isNull()){
|
|
|
|
|
qint64 id = domElement.attribute("id", "").toLongLong();
|
|
|
|
|
qint64 idObject = domElement.attribute("idObject", "").toLongLong();
|
|
|
|
|
QString tObject = domElement.attribute("typeObject", "");
|
|
|
|
|
qint64 id = GetParametrId(domElement);
|
|
|
|
|
qint64 idObject = GetParametrLongLong(domElement, "idObject");
|
|
|
|
|
QString tObject = GetParametrString(domElement, "typeObject");
|
|
|
|
|
VSplinePath path;
|
|
|
|
|
Draw::Mode typeObject;
|
|
|
|
|
if(tObject == "Calculation"){
|
|
|
|
@ -740,33 +770,32 @@ void VDomDocument::ParseSplineElement(VMainGraphicsScene *scene, const QDomEleme
|
|
|
|
|
for(qint32 i = 0; i<points->size(); ++i){
|
|
|
|
|
data->IncrementReferens(points->at(i).P(), Scene::Point, Draw::Modeling);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void VDomDocument::ParseArcElement(VMainGraphicsScene *scene, const QDomElement &domElement,
|
|
|
|
|
Document::Enum parse, const QString &type, Draw::Mode 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 spline is empty");
|
|
|
|
|
if(type == "simple"){
|
|
|
|
|
if(!domElement.isNull()){
|
|
|
|
|
qint64 id = domElement.attribute("id", "").toLongLong();
|
|
|
|
|
qint64 center = domElement.attribute("center", "").toLongLong();
|
|
|
|
|
QString radius = domElement.attribute("radius", "");
|
|
|
|
|
QString f1 = domElement.attribute("angle1", "");
|
|
|
|
|
QString f2 = domElement.attribute("angle2","");
|
|
|
|
|
qint64 id = GetParametrId(domElement);
|
|
|
|
|
qint64 center = GetParametrLongLong(domElement, "center");
|
|
|
|
|
QString radius = GetParametrString(domElement, "radius");
|
|
|
|
|
QString f1 = GetParametrString(domElement, "angle1");
|
|
|
|
|
QString f2 = GetParametrString(domElement, "angle2");
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if(type == "modeling"){
|
|
|
|
|
if(!domElement.isNull()){
|
|
|
|
|
qint64 id = domElement.attribute("id", "").toLongLong();
|
|
|
|
|
qint64 idObject = domElement.attribute("idObject", "").toLongLong();
|
|
|
|
|
QString tObject = domElement.attribute("typeObject", "");
|
|
|
|
|
qint64 id = GetParametrId(domElement);
|
|
|
|
|
qint64 idObject = GetParametrLongLong(domElement, "idObject");
|
|
|
|
|
QString tObject = GetParametrString(domElement, "typeObject");
|
|
|
|
|
VArc arc;
|
|
|
|
|
Draw::Mode typeObject;
|
|
|
|
|
if(tObject == "Calculation"){
|
|
|
|
@ -779,13 +808,13 @@ void VDomDocument::ParseArcElement(VMainGraphicsScene *scene, const QDomElement
|
|
|
|
|
arc.setMode(typeObject);
|
|
|
|
|
arc.setIdObject(idObject);
|
|
|
|
|
data->UpdateModelingArc(id, arc);
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void VDomDocument::FullUpdateTree(){
|
|
|
|
|
VMainGraphicsScene *scene = new VMainGraphicsScene();
|
|
|
|
|
Q_CHECK_PTR(scene);
|
|
|
|
|
data->ClearObject();
|
|
|
|
|
Parse(Document::LiteParse, scene, scene);
|
|
|
|
|
delete scene;
|
|
|
|
@ -843,6 +872,7 @@ void VDomDocument::setCurrentData(){
|
|
|
|
|
|
|
|
|
|
void VDomDocument::GarbageCollector(){
|
|
|
|
|
const QMap<qint64, VPointF> *points = data->DataPoints();
|
|
|
|
|
Q_CHECK_PTR(points);
|
|
|
|
|
QMapIterator<qint64, VPointF> p(*points);
|
|
|
|
|
while (p.hasNext()) {
|
|
|
|
|
p.next();
|
|
|
|
@ -860,6 +890,7 @@ void VDomDocument::GarbageCollector(){
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const QMap<qint64, VArc> *arc = data->DataArcs();
|
|
|
|
|
Q_CHECK_PTR(arc);
|
|
|
|
|
QMapIterator<qint64, VArc> a(*arc);
|
|
|
|
|
while (a.hasNext()) {
|
|
|
|
|
a.next();
|
|
|
|
@ -877,6 +908,7 @@ void VDomDocument::GarbageCollector(){
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const QMap<qint64, VSpline> *spl = data->DataSplines();
|
|
|
|
|
Q_CHECK_PTR(spl);
|
|
|
|
|
QMapIterator<qint64, VSpline> s(*spl);
|
|
|
|
|
while (s.hasNext()) {
|
|
|
|
|
s.next();
|
|
|
|
@ -894,6 +926,7 @@ void VDomDocument::GarbageCollector(){
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const QMap<qint64, VSplinePath> *splPath = data->DataSplinePaths();
|
|
|
|
|
Q_CHECK_PTR(splPath);
|
|
|
|
|
QMapIterator<qint64, VSplinePath> q(*splPath);
|
|
|
|
|
while (q.hasNext()) {
|
|
|
|
|
q.next();
|
|
|
|
@ -912,15 +945,15 @@ void VDomDocument::GarbageCollector(){
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void VDomDocument::AddTool(const qint64 &id, VDataTool *tool){
|
|
|
|
|
Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0");
|
|
|
|
|
Q_CHECK_PTR(tool);
|
|
|
|
|
tools.insert(id, tool);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void VDomDocument::UpdateToolData(const qint64 &id, VContainer *data){
|
|
|
|
|
Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0");
|
|
|
|
|
Q_CHECK_PTR(data);
|
|
|
|
|
VDataTool *tool = tools.value(id);
|
|
|
|
|
if(tool != 0){
|
|
|
|
|
Q_CHECK_PTR(tool);
|
|
|
|
|
tool->VDataTool::setData(data);
|
|
|
|
|
} else {
|
|
|
|
|
qWarning()<<"Can't find tool with id ="<< id<<".";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|