Back to index

salome-med  6.5.0
InterpolationOptions.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 
00020 #ifndef __INTERPOLATIONOPTIONS_HXX__
00021 #define __INTERPOLATIONOPTIONS_HXX__
00022 
00023 #include "INTERPKERNELDefines.hxx"
00024 
00025 #include <string>
00026 
00027 namespace INTERP_KERNEL
00028 {
00029   typedef enum { Triangulation, Convex, Geometric2D, PointLocator } IntersectionType;
00034   typedef enum  { PLANAR_FACE_5 = 5, PLANAR_FACE_6 = 6, GENERAL_24 = 24, GENERAL_48 = 48 } SplittingPolicy;
00035   
00043   class INTERPKERNEL_EXPORT InterpolationOptions
00044   {
00045   private:
00046     int _print_level ;
00047     IntersectionType _intersection_type;
00048     double _precision;
00049     double _median_plane ;
00050     bool _do_rotate ;
00052     double _bounding_box_adjustment ;
00054     double _bounding_box_adjustment_abs ;
00055     double _max_distance_for_3Dsurf_intersect;
00056     int _orientation ;
00057     bool _measure_abs;
00058     SplittingPolicy _splitting_policy ;
00059     bool _P1P0_bary_method; // issue 0020440
00060 
00061   public:
00062     InterpolationOptions() { init(); }
00063     int getPrintLevel() const { return _print_level; }
00064     void setPrintLevel(int pl) { _print_level=pl; }
00065 
00066     IntersectionType getIntersectionType() const { return _intersection_type; }
00067     void setIntersectionType(IntersectionType it) { _intersection_type=it; }
00068     std::string getIntersectionTypeRepr() const;
00069 
00070     double getPrecision() const { return _precision; }
00071     void setPrecision(double p) { _precision=p; }
00072 
00073     double getMedianPlane() const { return _median_plane; }
00074     void setMedianPlane(double mp) { _median_plane=mp; }
00075     
00076     bool getDoRotate() const { return _do_rotate; }
00077     void setDoRotate( bool dr) { _do_rotate = dr; }
00078     
00079     double getBoundingBoxAdjustment() const { return _bounding_box_adjustment; }
00080     void setBoundingBoxAdjustment(double bba) { _bounding_box_adjustment=bba; }
00081 
00082     double getBoundingBoxAdjustmentAbs() const { return _bounding_box_adjustment_abs; }
00083     void setBoundingBoxAdjustmentAbs(double bba) { _bounding_box_adjustment_abs=bba; }
00084     
00085     double getMaxDistance3DSurfIntersect() const { return _max_distance_for_3Dsurf_intersect; }
00086     void setMaxDistance3DSurfIntersect(double bba) { _max_distance_for_3Dsurf_intersect=bba; }
00087 
00088     int getOrientation() const { return _orientation; }
00089     void setOrientation(int o) { _orientation=o; }
00090 
00091     bool getMeasureAbsStatus() const { return _measure_abs; }
00092     void setMeasureAbsStatus(bool newStatus) { _measure_abs=newStatus; }
00093     
00094     SplittingPolicy getSplittingPolicy() const { return _splitting_policy; }
00095     void setSplittingPolicy(SplittingPolicy sp) { _splitting_policy=sp; }
00096     std::string getSplittingPolicyRepr() const;
00097 
00098     void setP1P0BaryMethod(bool isP1P0) { _P1P0_bary_method=isP1P0; }
00099     bool getP1P0BaryMethod() const { return _P1P0_bary_method; }
00100 
00101     std::string filterInterpolationMethod(const std::string& meth) const;
00102 
00103     void init()
00104     {  
00105       _print_level=0;
00106       _intersection_type=Triangulation;
00107       _precision=1e-12;
00108       _median_plane=DFT_MEDIAN_PLANE;
00109       _do_rotate=true;
00110       _bounding_box_adjustment=DFT_SURF3D_ADJ_EPS;
00111       _bounding_box_adjustment_abs=0.;
00112       _max_distance_for_3Dsurf_intersect=DFT_MAX_DIST_3DSURF_INTERSECT;
00113       _orientation=0;
00114       _measure_abs=true;
00115       _splitting_policy=GENERAL_48;
00116       _P1P0_bary_method=false;
00117     }
00118     bool setInterpolationOptions(long print_level,
00119                                  std::string intersection_type,
00120                                  double precision,
00121                                  double median_plane,
00122                                  bool do_rotate,
00123                                  double bounding_box_adjustment,
00124                                  double bounding_box_adjustment_abs,
00125                                  double max_distance_for_3Dsurf_intersect,
00126                                  long orientation,
00127                                  bool measure_abs,
00128                                  std::string splitting_policy,
00129                                  bool P1P0_bary_method );
00130     void copyOptions(const InterpolationOptions & other) { *this = other; }
00131     bool setOptionDouble(const std::string& key, double value);
00132     bool setOptionInt(const std::string& key, int value);
00133     bool setOptionString(const std::string& key, const std::string& value);
00134     std::string printOptions() const;
00135   private:
00136     static const double DFT_MEDIAN_PLANE;
00137     static const double DFT_SURF3D_ADJ_EPS;
00138     static const double DFT_MAX_DIST_3DSURF_INTERSECT;
00139   public:
00140     static const char PRECISION_STR[];
00141     static const char MEDIANE_PLANE_STR[];
00142     static const char BOUNDING_BOX_ADJ_STR[];
00143     static const char BOUNDING_BOX_ADJ_ABS_STR[];
00144     static const char MAX_DISTANCE_3DSURF_INSECT_STR[];
00145     static const char PRINT_LEV_STR[];
00146     static const char DO_ROTATE_STR[];
00147     static const char ORIENTATION_STR[];
00148     static const char MEASURE_ABS_STR[];
00149     static const char INTERSEC_TYPE_STR[];
00150     static const char SPLITTING_POLICY_STR[];
00151     static const char TRIANGULATION_INTERSECT2D_STR[];
00152     static const char CONVEX_INTERSECT2D_STR[];
00153     static const char GEOMETRIC_INTERSECT2D_STR[];
00154     static const char POINTLOCATOR_INTERSECT_STR[];
00155     static const char PLANAR_SPLIT_FACE_5_STR[];
00156     static const char PLANAR_SPLIT_FACE_6_STR[];
00157     static const char GENERAL_SPLIT_24_STR[];
00158     static const char GENERAL_SPLIT_48_STR[];
00159   };
00160 
00161 }
00162 #endif