// Copyright (C) 2014-2015 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 // %ExportedHeaderCode #include #include %End class HYDROData_CompleteCalcCase { %TypeHeaderCode //#define _DEVDEBUG_ #include "HYDRO_trace.hxx" #include #include %End public: /** * Add new geometry object for calculation case. */ static SIP_PYTUPLE AddObjects( HYDROData_Document doc, HYDROData_CalculationCase theCalcCase, std::vector theNewObjects, bool IsUseOrigNamingOfNewRegions) [ bool ( const opencascade::handle&, opencascade::handle&, NCollection_Sequence >, bool, bool&, NCollection_Sequence< opencascade::handle >& )]; %MethodCode Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(); Handle(HYDROData_CalculationCase) aCase = Handle(HYDROData_CalculationCase)::DownCast( createHandle( a1 ) ); NCollection_Sequence objs; for (size_t i = 0; i != a2->size(); i++) { DEBTRACE("item " << i); Handle(HYDROData_Entity) anEnt = createHandle( (*a2)[i] ); objs.Append(anEnt); } bool res = false; bool isIntersectionOfNewObj = false; NCollection_Sequence theNewRegions; DEBTRACE(" --- 0"); if ( !aDoc.IsNull() && !aCase.IsNull() ) { DEBTRACE("before HYDROData_CompleteCalcCase::AddObjects"); Py_BEGIN_ALLOW_THREADS res = HYDROData_CompleteCalcCase::AddObjects( aDoc, aCase, objs, a3, isIntersectionOfNewObj, theNewRegions ); Py_END_ALLOW_THREADS DEBTRACE("after"); DEBTRACE("res " << res); DEBTRACE("isIntersectionOfNewObj " << isIntersectionOfNewObj); DEBTRACE("theNewRegions size " << theNewRegions.Size()); } PyObject* t; if (res && isIntersectionOfNewObj) { DEBTRACE(" --- 1a"); t = Py_BuildValue("(iiO)", res, isIntersectionOfNewObj, theNewRegions); DEBTRACE(" --- 2a"); } else { DEBTRACE(" --- 1b"); t = Py_BuildValue("(ii)", res, isIntersectionOfNewObj); DEBTRACE(" --- 2b"); } sipRes = t; %End protected: /** * Creates new object in the internal data structure. Use higher level objects * to create objects with real content. */ HYDROData_CompleteCalcCase(); /** * Destructs properties of the object and object itself, removes it from the document. */ ~HYDROData_CompleteCalcCase(); };