7bd071ed |
1 | // Created on: 2016-04-19 |
2 | // Copyright (c) 2016 OPEN CASCADE SAS |
3 | // Created by: Oleg AGASHIN |
4 | // |
5 | // This file is part of Open CASCADE Technology software library. |
6 | // |
7 | // This library is free software; you can redistribute it and/or modify it under |
8 | // the terms of the GNU Lesser General Public License version 2.1 as published |
9 | // by the Free Software Foundation, with special exception defined in the file |
10 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
11 | // distribution for complete text of the license and disclaimer of any warranty. |
12 | // |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
15 | |
16 | #include <BRepMesh_MeshAlgoFactory.hxx> |
17 | #include <BRepMesh_DefaultRangeSplitter.hxx> |
18 | #include <BRepMesh_NURBSRangeSplitter.hxx> |
19 | #include <BRepMesh_SphereRangeSplitter.hxx> |
20 | #include <BRepMesh_CylinderRangeSplitter.hxx> |
21 | #include <BRepMesh_ConeRangeSplitter.hxx> |
22 | #include <BRepMesh_TorusRangeSplitter.hxx> |
23 | #include <BRepMesh_DelaunayBaseMeshAlgo.hxx> |
24 | #include <BRepMesh_DelaunayNodeInsertionMeshAlgo.hxx> |
25 | #include <BRepMesh_DelaunayDeflectionControlMeshAlgo.hxx> |
26 | #include <BRepMesh_BoundaryParamsRangeSplitter.hxx> |
27 | |
28 | namespace |
29 | { |
30 | struct BaseMeshAlgo |
31 | { |
32 | typedef BRepMesh_DelaunayBaseMeshAlgo Type; |
33 | }; |
34 | |
35 | template<class RangeSplitter> |
36 | struct NodeInsertionMeshAlgo |
37 | { |
4c04741d |
38 | typedef BRepMesh_DelaunayNodeInsertionMeshAlgo<RangeSplitter, BRepMesh_DelaunayBaseMeshAlgo> Type; |
7bd071ed |
39 | }; |
40 | |
41 | template<class RangeSplitter> |
42 | struct DeflectionControlMeshAlgo |
43 | { |
4c04741d |
44 | typedef BRepMesh_DelaunayDeflectionControlMeshAlgo<RangeSplitter, BRepMesh_DelaunayBaseMeshAlgo> Type; |
7bd071ed |
45 | }; |
46 | } |
47 | |
48 | //======================================================================= |
49 | // Function: Constructor |
50 | // Purpose : |
51 | //======================================================================= |
52 | BRepMesh_MeshAlgoFactory::BRepMesh_MeshAlgoFactory() |
53 | { |
54 | } |
55 | |
56 | //======================================================================= |
57 | // Function: Destructor |
58 | // Purpose : |
59 | //======================================================================= |
60 | BRepMesh_MeshAlgoFactory::~BRepMesh_MeshAlgoFactory() |
61 | { |
62 | } |
63 | |
64 | //======================================================================= |
65 | // Function: GetAlgo |
66 | // Purpose : |
67 | //======================================================================= |
68 | Handle(IMeshTools_MeshAlgo) BRepMesh_MeshAlgoFactory::GetAlgo( |
69 | const GeomAbs_SurfaceType theSurfaceType, |
70 | const IMeshTools_Parameters& theParameters) const |
71 | { |
72 | switch (theSurfaceType) |
73 | { |
74 | case GeomAbs_Plane: |
75 | return theParameters.InternalVerticesMode ? |
76 | new NodeInsertionMeshAlgo<BRepMesh_DefaultRangeSplitter>::Type : |
77 | new BaseMeshAlgo::Type; |
78 | break; |
79 | |
80 | case GeomAbs_Sphere: |
81 | return new NodeInsertionMeshAlgo<BRepMesh_SphereRangeSplitter>::Type; |
82 | break; |
83 | |
84 | case GeomAbs_Cylinder: |
4c04741d |
85 | return theParameters.InternalVerticesMode ? |
86 | new NodeInsertionMeshAlgo<BRepMesh_CylinderRangeSplitter>::Type : |
87 | new BaseMeshAlgo::Type; |
7bd071ed |
88 | break; |
89 | |
90 | case GeomAbs_Cone: |
91 | return new NodeInsertionMeshAlgo<BRepMesh_ConeRangeSplitter>::Type; |
92 | break; |
93 | |
94 | case GeomAbs_Torus: |
95 | return new NodeInsertionMeshAlgo<BRepMesh_TorusRangeSplitter>::Type; |
96 | break; |
97 | |
98 | case GeomAbs_SurfaceOfRevolution: |
99 | return new DeflectionControlMeshAlgo<BRepMesh_BoundaryParamsRangeSplitter>::Type; |
100 | break; |
101 | |
102 | default: |
103 | return new DeflectionControlMeshAlgo<BRepMesh_NURBSRangeSplitter>::Type; |
104 | } |
105 | } |