From b7f731802dc045a35a917550456710f1a71658ce Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Fri, 19 Jun 2015 14:58:13 +0300 Subject: [PATCH] Reserve one name outside a pattern data base. --HG-- branch : develop --- src/app/xml/vpattern.cpp | 10 ++++++++-- src/app/xml/vpattern.h | 2 +- src/libs/ifc/xml/vabstractpattern.h | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/app/xml/vpattern.cpp b/src/app/xml/vpattern.cpp index a251be714..fe923ca49 100644 --- a/src/app/xml/vpattern.cpp +++ b/src/app/xml/vpattern.cpp @@ -1749,7 +1749,13 @@ void VPattern::SetAuthor(const QString &text) } //--------------------------------------------------------------------------------------------------------------------- -QString VPattern::GenerateLabel(const LabelType &type) const +/** + * @brief GenerateLabel create label for pattern piece of point. + * @param type type of the label. + * @param reservedName reversed point name. Use when need reserve name, but point is not in data base yet. + * @return unique name for current pattern piece. + */ +QString VPattern::GenerateLabel(const LabelType &type, const QString &reservedName) const { QDomNodeList drawList = elementsByTagName(TagDraw); @@ -1805,7 +1811,7 @@ QString VPattern::GenerateLabel(const LabelType &type) const { break; } - } while (data->IsUnique(name) == false); + } while (data->IsUnique(name) == false || name == reservedName); qCDebug(vXML, "Point label: %s", name.toUtf8().constData()); return name; } diff --git a/src/app/xml/vpattern.h b/src/app/xml/vpattern.h index cf2e7496b..936b92326 100644 --- a/src/app/xml/vpattern.h +++ b/src/app/xml/vpattern.h @@ -65,7 +65,7 @@ public: QString GetAuthor() const; void SetAuthor(const QString &text); - virtual QString GenerateLabel(const LabelType &type)const; + virtual QString GenerateLabel(const LabelType &type, const QString &reservedName = QString())const; public slots: void LiteParseTree(const Document &parse); diff --git a/src/libs/ifc/xml/vabstractpattern.h b/src/libs/ifc/xml/vabstractpattern.h index 201d9009c..61af69997 100644 --- a/src/libs/ifc/xml/vabstractpattern.h +++ b/src/libs/ifc/xml/vabstractpattern.h @@ -67,7 +67,7 @@ public: virtual void IncrementReferens(quint32 id) const=0; virtual void DecrementReferens(quint32 id) const=0; - virtual QString GenerateLabel(const LabelType &type)const=0; + virtual QString GenerateLabel(const LabelType &type, const QString &reservedName = QString())const=0; virtual void UpdateToolData(const quint32 &id, VContainer *data)=0;