Back to index

salome-geom  6.5.0
GEOMImpl_IShapes.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 //  NOTE: This is an interface to a function for the Shapes
00024 //  (Edge, Wire, Face, Shell, Solid and Compound) creation.
00025 
00026 #include "GEOM_Function.hxx"
00027 
00028 #include "TColStd_HSequenceOfTransient.hxx"
00029 #include "TColStd_HArray1OfInteger.hxx"
00030 
00031 class GEOMImpl_IShapes
00032 {
00033  public:
00034 
00035   enum {
00036     SHAPE_ARG_SHAPES    = 1, // for Wire, Shell, Solid and Compound
00037     SHAPE_ARG_BASE      = 2, // for Face, Solid and Sub-shape
00038     SHAPE_ARG_PLANAR    = 3, // for Face
00039     SHAPE_ARG_SUBTYPE   = 4, // for Sub-shape
00040     SHAPE_ARG_INDICES   = 5, // for Sub-shape
00041     SHAPE_ARG_TOLERANCE = 6, // linear tolerance (for Wire, Edge)
00042     SHAPE_ARG_ANGLE_TOL = 7, // angular tolerance (for Edge)
00043   };
00044 
00045   GEOMImpl_IShapes(Handle(GEOM_Function) theFunction): _func(theFunction) {}
00046 
00047   void SetShapes(const Handle(TColStd_HSequenceOfTransient)& theShapes)
00048   { _func->SetReferenceList(SHAPE_ARG_SHAPES, theShapes); }
00049 
00050   Handle(TColStd_HSequenceOfTransient) GetShapes()
00051   { return _func->GetReferenceList(SHAPE_ARG_SHAPES); }
00052 
00053   void SetBase(Handle(GEOM_Function) theRefBase)
00054   { _func->SetReference(SHAPE_ARG_BASE, theRefBase); }
00055 
00056   Handle(GEOM_Function) GetBase() { return _func->GetReference(SHAPE_ARG_BASE); }
00057 
00058   void SetIsPlanar(const Standard_Boolean isPlanarWanted)
00059   { _func->SetInteger(SHAPE_ARG_PLANAR, isPlanarWanted ? 1 : 0); }
00060 
00061   Standard_Boolean GetIsPlanar() { return (_func->GetInteger(SHAPE_ARG_PLANAR) == 1); }
00062 
00063   void SetSubShapeType(const Standard_Integer theType)
00064   { _func->SetInteger(SHAPE_ARG_SUBTYPE, theType); }
00065 
00066   Standard_Integer GetSubShapeType() { return _func->GetInteger(SHAPE_ARG_SUBTYPE); }
00067 
00068   void SetIndices(const Handle(TColStd_HArray1OfInteger)& theIndices)
00069   { _func->SetIntegerArray(SHAPE_ARG_INDICES, theIndices); }
00070 
00071   Handle(TColStd_HArray1OfInteger) GetIndices()
00072   { return _func->GetIntegerArray(SHAPE_ARG_INDICES); }
00073 
00074   void SetTolerance(const Standard_Real theValue)
00075   { _func->SetReal(SHAPE_ARG_TOLERANCE, theValue); }
00076 
00077   Standard_Real GetTolerance() { return _func->GetReal(SHAPE_ARG_TOLERANCE); }
00078 
00079   void SetAngularTolerance(const Standard_Real theValue)
00080   { _func->SetReal(SHAPE_ARG_ANGLE_TOL, theValue); }
00081 
00082   Standard_Real GetAngularTolerance() { return _func->GetReal(SHAPE_ARG_ANGLE_TOL); }
00083 
00084  private:
00085 
00086   Handle(GEOM_Function) _func;
00087 };