X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FInitializationPlugin%2FInitializationPlugin_Plugin.cpp;h=5d4781494052ee0537e05832c291c8482f9b5397;hb=4c267a52f180b3702b45642314545356805cd428;hp=0c47e2a52586263d639d9e850d9f6a053846ee9c;hpb=69ed966e5a75e545b5e9ae71499fd08790819484;p=modules%2Fshaper.git diff --git a/src/InitializationPlugin/InitializationPlugin_Plugin.cpp b/src/InitializationPlugin/InitializationPlugin_Plugin.cpp index 0c47e2a52..5d4781494 100644 --- a/src/InitializationPlugin/InitializationPlugin_Plugin.cpp +++ b/src/InitializationPlugin/InitializationPlugin_Plugin.cpp @@ -1,9 +1,29 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D +// Copyright (C) 2014-2017 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or +// email : webmaster.salome@opencascade.com +// #include +#include #include #include +#include #include #include #include @@ -24,6 +44,9 @@ InitializationPlugin_Plugin::InitializationPlugin_Plugin() Events_Loop* aLoop = Events_Loop::loop(); const Events_ID kDocCreatedEvent = ModelAPI_DocumentCreatedMessage::eventId(); aLoop->registerListener(this, kDocCreatedEvent, NULL, true); + + myEvalListener = + std::shared_ptr(new InitializationPlugin_EvalListener()); } void InitializationPlugin_Plugin::processEvent(const std::shared_ptr& theMessage) @@ -70,18 +93,12 @@ void InitializationPlugin_Plugin::processEvent(const std::shared_ptrflush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); - // the viewer update should be unblocked in order to avoid the features blinking before they are // hidden aMsg = std::shared_ptr( new Events_Message(Events_Loop::eventByName(EVENT_UPDATE_VIEWER_UNBLOCKED))); Events_Loop::loop()->send(aMsg); - - } else if (theMessage.get()) { - Events_InfoMessage("InitializationPlugin_Plugin", - "InitializationPlugin_Plugin::processEvent: unhandled message caught: %1") - .arg(theMessage->eventID().eventText()).send(); } } @@ -89,7 +106,7 @@ FeaturePtr InitializationPlugin_Plugin::createPlane(DocumentPtr theDoc, double t double theZ) { FeaturePtr aPlane = theDoc->addFeature("Plane"); - aPlane->string("CreationMethod")->setValue("PlaneByGeneralEquation"); + aPlane->string("creation_method")->setValue("by_general_equation"); aPlane->real("A")->setValue(theX); aPlane->real("B")->setValue(theY); aPlane->real("C")->setValue(theZ); @@ -102,7 +119,8 @@ FeaturePtr InitializationPlugin_Plugin::createPlane(DocumentPtr theDoc, double t } else if (theZ) { aPlane->data()->setName("XOY"); } - aPlane->setInHistory(aPlane, false); // don't show automatically created feature in the features history + // don't show automatically created feature in the features history + aPlane->setInHistory(aPlane, false); // the plane should be executed in order to build the feature result immediatelly // the results are to be hidden in the plugin @@ -119,11 +137,14 @@ FeaturePtr InitializationPlugin_Plugin::createPoint(DocumentPtr theDoc, const st double theX, double theY, double theZ) { std::shared_ptr aPoint = theDoc->addFeature("Point"); + //aPoint->string("creation_method")->setValue("by_xyz"); aPoint->real("x")->setValue(theX); aPoint->real("y")->setValue(theY); aPoint->real("z")->setValue(theZ); + aPoint->string("creation_method")->setValue("by_xyz"); aPoint->data()->setName(theName); - aPoint->setInHistory(aPoint, false); // don't show automatically created feature in the features history + // don't show automatically created feature in the features history + aPoint->setInHistory(aPoint, false); // the point should be executed in order to build the feature result immediatelly // the results are to be hidden in the plugin @@ -154,7 +175,8 @@ FeaturePtr InitializationPlugin_Plugin::createAxis(DocumentPtr theDoc, FeaturePt } else if (theZ != 0) { aAxis->data()->setName("OZ"); } - aAxis->setInHistory(aAxis, false); // don't show automatically created feature in the features history + // don't show automatically created feature in the features history + aAxis->setInHistory(aAxis, false); aAxis->execute(); aAxis->data()->execState(ModelAPI_StateDone); aAxis->firstResult()->data()->execState(ModelAPI_StateDone);