1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include "GEOMImpl_FieldDriver.hxx"
22 #include "GEOM_Field.hxx"
23 #include "GEOM_Function.hxx"
24 #include "GEOM_IField.hxx"
26 //=======================================================================
29 //=======================================================================
30 const Standard_GUID& GEOMImpl_FieldDriver::GetID()
32 return GEOM_Field::GetFieldID();
35 //=======================================================================
36 //function : GEOMImpl_FieldDriver
38 //=======================================================================
39 GEOMImpl_FieldDriver::GEOMImpl_FieldDriver()
43 //=======================================================================
46 //=======================================================================
47 Standard_Integer GEOMImpl_FieldDriver::Execute(LOGBOOK& log) const
52 //================================================================================
54 * \brief Returns a name of creation operation and names and values of creation parameters
56 //================================================================================
58 bool GEOMImpl_FieldDriver::
59 GetCreationInformation(std::string& theOperationName,
60 std::vector<GEOM_Param>& theParams)
62 if (Label().IsNull()) return false;
63 Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label());
65 GEOM_IField data( function );
66 Standard_Integer funType = function->GetType();
68 if ( funType == GEOM_Field::FUN_ADD_FIELD )
70 theOperationName = "FIELD_CREATE";
71 // geompy.CreateField(shape, name, type, dimension, componentNames)
72 Handle(GEOM_Field) f = GEOM_Field::GetField( function->GetOwnerEntry() );
73 AddParam( theParams, "Shape", data.GetShape() );
74 AddParam( theParams, "Name", f->GetName() );
75 AddParam( theParams, "Type", f->GetDataTypeString( data.GetDataType() ));
76 AddParam( theParams, "Dimension", data.GetDimension() );
77 GEOM_Param comps = AddParam( theParams, "Components", f->GetComponentsForPython() );
79 else if ( funType == GEOM_Field::FUN_ADD_STEP )
81 theOperationName = "ADD_FIELD_STEP";
82 // field.addStep(step, stamp, values)
83 AddParam( theParams, "Step", data.GetStepID() );
84 AddParam( theParams, "Stamp", data.GetStepStamp() );
86 else if ( funType == GEOM_Field::FUN_CHANGE_COMP_NAMES )
88 theOperationName = "Change component names";
90 else if ( funType == GEOM_Field::FUN_CHANGE_STEP_STAMP )
92 theOperationName = "Change stamp";
93 AddParam( theParams, "Stamp", data.GetStepStamp() );
95 else if ( funType == GEOM_Field::FUN_CHANGE_VALUE )
97 theOperationName = "FIELD_EDIT";//"Change values";
98 AddParam( theParams, "Values", "..." );
108 OCCT_IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_FieldDriver,GEOM_BaseDriver);