Refactoring.

--HG--
branch : develop
This commit is contained in:
dismine 2014-07-16 15:47:31 +03:00
parent d7dfcb8898
commit 356209abfa
2 changed files with 13 additions and 22 deletions

View File

@ -268,7 +268,7 @@ void VPattern::Parse(const Document &parse)
{ {
ChangeActivPP(GetParametrString(domElement, AttrName), Document::LiteParse); ChangeActivPP(GetParametrString(domElement, AttrName), Document::LiteParse);
} }
ParseDrawElement(sceneDraw, sceneDetail, domElement, parse); ParseDrawElement(domElement, parse);
break; break;
case 1: // TagIncrements case 1: // TagIncrements
ParseIncrementsElement(domElement); ParseIncrementsElement(domElement);
@ -762,8 +762,7 @@ void VPattern::customEvent(QEvent *event)
* @param node node. * @param node node.
* @param parse parser file mode. * @param parse parser file mode.
*/ */
void VPattern::ParseDrawElement(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail, const QDomNode &node, void VPattern::ParseDrawElement(const QDomNode &node, const Document &parse)
const Document &parse)
{ {
QStringList tags{TagCalculation, TagModeling, TagDetails}; QStringList tags{TagCalculation, TagModeling, TagDetails};
QDomNode domNode = node.firstChild(); QDomNode domNode = node.firstChild();
@ -778,13 +777,13 @@ void VPattern::ParseDrawElement(VMainGraphicsScene *sceneDraw, VMainGraphicsScen
{ {
case 0: // TagCalculation case 0: // TagCalculation
data->ClearCalculationGObjects(); data->ClearCalculationGObjects();
ParseDrawMode(sceneDraw, sceneDetail, domElement, parse, Draw::Calculation); ParseDrawMode(domElement, parse, Draw::Calculation);
break; break;
case 1: // TagModeling case 1: // TagModeling
ParseDrawMode(sceneDraw, sceneDetail, domElement, parse, Draw::Modeling); ParseDrawMode(domElement, parse, Draw::Modeling);
break; break;
case 2: // TagDetails case 2: // TagDetails
ParseDetails(sceneDetail, domElement, parse); ParseDetails(domElement, parse);
break; break;
default: default:
qDebug()<<"Wrong tag name"<<Q_FUNC_INFO; qDebug()<<"Wrong tag name"<<Q_FUNC_INFO;
@ -805,8 +804,7 @@ void VPattern::ParseDrawElement(VMainGraphicsScene *sceneDraw, VMainGraphicsScen
* @param parse parser file mode. * @param parse parser file mode.
* @param mode draw mode. * @param mode draw mode.
*/ */
void VPattern::ParseDrawMode(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail, const QDomNode &node, void VPattern::ParseDrawMode(const QDomNode &node, const Document &parse, const Draw &mode)
const Document &parse, const Draw &mode)
{ {
SCASSERT(sceneDraw != nullptr); SCASSERT(sceneDraw != nullptr);
SCASSERT(sceneDetail != nullptr); SCASSERT(sceneDetail != nullptr);
@ -859,10 +857,8 @@ void VPattern::ParseDrawMode(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *
* @param domElement tag in xml tree. * @param domElement tag in xml tree.
* @param parse parser file mode. * @param parse parser file mode.
*/ */
void VPattern::ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDomElement &domElement, void VPattern::ParseDetailElement(const QDomElement &domElement, const Document &parse)
const Document &parse)
{ {
SCASSERT(sceneDetail != nullptr);
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
try try
{ {
@ -934,10 +930,8 @@ void VPattern::ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDomEle
* @param domElement tag in xml tree. * @param domElement tag in xml tree.
* @param parse parser file mode. * @param parse parser file mode.
*/ */
void VPattern::ParseDetails(VMainGraphicsScene *sceneDetail, const QDomElement &domElement, void VPattern::ParseDetails(const QDomElement &domElement, const Document &parse)
const Document &parse)
{ {
SCASSERT(sceneDetail != nullptr);
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
QDomNode domNode = domElement.firstChild(); QDomNode domNode = domElement.firstChild();
while (domNode.isNull() == false) while (domNode.isNull() == false)
@ -949,7 +943,7 @@ void VPattern::ParseDetails(VMainGraphicsScene *sceneDetail, const QDomElement &
{ {
if (domElement.tagName() == VToolDetail::TagName) if (domElement.tagName() == VToolDetail::TagName)
{ {
ParseDetailElement(sceneDetail, domElement, parse); ParseDetailElement(domElement, parse);
} }
} }
} }

View File

@ -180,14 +180,11 @@ private:
VMainGraphicsScene *sceneDetail; VMainGraphicsScene *sceneDetail;
void SetActivPP(const QString& name); void SetActivPP(const QString& name);
void ParseDrawElement(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail, void ParseDrawElement(const QDomNode& node, const Document &parse);
const QDomNode& node, const Document &parse); void ParseDrawMode(const QDomNode& node, const Document &parse, const Draw &mode);
void ParseDrawMode(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail, void ParseDetailElement(const QDomElement &domElement,
const QDomNode& node, const Document &parse, const Draw &mode);
void ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDomElement &domElement,
const Document &parse);
void ParseDetails(VMainGraphicsScene *sceneDetail, const QDomElement &domElement,
const Document &parse); const Document &parse);
void ParseDetails(const QDomElement &domElement, const Document &parse);
void ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElement, void ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElement,
const Document &parse, const QString &type); const Document &parse, const QString &type);
void ParseLineElement(VMainGraphicsScene *scene, const QDomElement& domElement, void ParseLineElement(VMainGraphicsScene *scene, const QDomElement& domElement,