X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModel%2FModel_ResultPart.cpp;h=1ec015c90c4d117a2c83468d615fbb35d383f6ef;hb=6268ce56824c1df106da799af34f4575f247061a;hp=b3602c0b5301b46aa729a97571d5e546da0e8607;hpb=82f94d044ced40be786427ddee839e3c263fe277;p=modules%2Fshaper.git diff --git a/src/Model/Model_ResultPart.cpp b/src/Model/Model_ResultPart.cpp index b3602c0b5..1ec015c90 100644 --- a/src/Model/Model_ResultPart.cpp +++ b/src/Model/Model_ResultPart.cpp @@ -1,3 +1,5 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + // File: ModelAPI_ResultPart.cpp // Created: 07 Jul 2014 // Author: Mikhail PONIKAROV @@ -5,17 +7,47 @@ #include #include #include +#include -boost::shared_ptr Model_ResultPart::partDoc() +std::shared_ptr Model_ResultPart::partDoc() { - return data()->docRef("PartDocument")->value(); + return data()->document("PartDocument")->value(); } -boost::shared_ptr Model_ResultPart::owner() +std::shared_ptr Model_ResultPart::owner() { - return boost::shared_ptr(); // return empty pointer + return std::shared_ptr(); // return empty pointer } Model_ResultPart::Model_ResultPart() { + setIsConcealed(false); +} + +void Model_ResultPart::setData(std::shared_ptr theData) +{ + ModelAPI_Result::setData(theData); + if (theData) { + data()->addAttribute(DOC_REF(), ModelAPI_AttributeDocRef::type()); + } +} + +void Model_ResultPart::activate() +{ + std::shared_ptr aDocRef = data()->document(DOC_REF()); + + if (!aDocRef->value().get()) { // create (or open) a document if it is not yet created + std::shared_ptr aDoc = document()->subDocument(data()->name()); + if (aDoc) { + aDocRef->setValue(aDoc); + } + } + if (aDocRef->value()) + ModelAPI_Session::get()->setActiveDocument(aDocRef->value()); +} + +bool Model_ResultPart::isActivated() +{ + std::shared_ptr aDocRef = data()->document(DOC_REF()); + return aDocRef->value().get(); }