X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModel%2FModel_ResultPart.cpp;h=0392787f3c7a2b7a44558b0b851a81a3914a5eb6;hb=c44da4cdb21b305f2350bb4b2c9044eaba08f171;hp=38b72fad98b2c268f8724a80b14fb22c4673757f;hpb=c0565e75ce0bd2f2994dc9874c4775cf7a4cb7ad;p=modules%2Fshaper.git diff --git a/src/Model/Model_ResultPart.cpp b/src/Model/Model_ResultPart.cpp index 38b72fad9..0392787f3 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,18 +7,48 @@ #include #include #include +#include + +std::shared_ptr Model_ResultPart::partDoc() +{ + return data()->document("PartDocument")->value(); +} + +std::shared_ptr Model_ResultPart::owner() +{ + return std::shared_ptr(); // return empty pointer +} + +Model_ResultPart::Model_ResultPart() +{ + setIsConcealed(false); +} -boost::shared_ptr Model_ResultPart::partDoc() +void Model_ResultPart::setData(std::shared_ptr theData) { - return data()->docRef("PartDocument")->value(); + ModelAPI_Result::setData(theData); + if (theData) { + data()->addAttribute(DOC_REF(), ModelAPI_AttributeDocRef::type()); + } } -boost::shared_ptr Model_ResultPart::owner() +void Model_ResultPart::activate() { - return boost::shared_ptr(); // return empty pointer + 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().get()) { + ModelAPI_Session::get()->setActiveDocument(aDocRef->value()); + } } -Model_ResultPart::Model_ResultPart( -const boost::shared_ptr& theFeature) +bool Model_ResultPart::isActivated() { + std::shared_ptr aDocRef = data()->document(DOC_REF()); + return aDocRef->value().get(); }