b311480e |
1 | // Created on: 1994-11-30 |
2 | // Created by: Frederic MAUPAS |
3 | // Copyright (c) 1994-1999 Matra Datavision |
4 | // Copyright (c) 1999-2012 OPEN CASCADE SAS |
5 | // |
6 | // The content of this file is subject to the Open CASCADE Technology Public |
7 | // License Version 6.5 (the "License"). You may not use the content of this file |
8 | // except in compliance with the License. Please obtain a copy of the License |
9 | // at http://www.opencascade.org and read it completely before using this file. |
10 | // |
11 | // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
12 | // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
13 | // |
14 | // The Original Code and all software distributed under the License is |
15 | // distributed on an "AS IS" basis, without warranty of any kind, and the |
16 | // Initial Developer hereby disclaims all such warranties, including without |
17 | // limitation, any warranties of merchantability, fitness for a particular |
18 | // purpose or non-infringement. Please see the License for the specific terms |
19 | // and conditions governing the rights and limitations under the License. |
20 | |
7fd59977 |
21 | |
22 | #include <TopoDSToStep_MakeStepVertex.ixx> |
23 | |
24 | #include <GeomToStep_MakeCartesianPoint.hxx> |
25 | |
26 | #include <BRep_Tool.hxx> |
27 | |
28 | #include <StepGeom_CartesianPoint.hxx> |
29 | #include <StepShape_VertexPoint.hxx> |
30 | |
31 | #include <gp_Pnt.hxx> |
32 | #include <TransferBRep_ShapeMapper.hxx> |
33 | |
34 | #include <TCollection_HAsciiString.hxx> |
35 | |
36 | // Processing of non-manifold topology (ssv; 11.11.2010) |
37 | #include <TransferBRep.hxx> |
38 | #include <Interface_Static.hxx> |
39 | |
40 | // ---------------------------------------------------------------------------- |
41 | // Constructors |
42 | // ---------------------------------------------------------------------------- |
43 | |
44 | TopoDSToStep_MakeStepVertex::TopoDSToStep_MakeStepVertex() |
45 | { |
46 | done = Standard_False; |
47 | } |
48 | |
49 | TopoDSToStep_MakeStepVertex::TopoDSToStep_MakeStepVertex |
50 | (const TopoDS_Vertex& V, |
51 | TopoDSToStep_Tool& T, |
52 | const Handle(Transfer_FinderProcess)& FP) |
53 | { |
54 | done = Standard_False; |
55 | Init(V, T, FP); |
56 | } |
57 | |
58 | // ---------------------------------------------------------------------------- |
59 | // Method : Init |
60 | // Purpose : |
61 | // ---------------------------------------------------------------------------- |
62 | |
63 | void TopoDSToStep_MakeStepVertex::Init(const TopoDS_Vertex& aVertex, |
64 | TopoDSToStep_Tool& aTool, |
65 | const Handle(Transfer_FinderProcess)& FP) |
66 | { |
67 | |
68 | aTool.SetCurrentVertex(aVertex); |
69 | |
70 | // [BEGIN] Processing non-manifold topology (ssv; 11.11.2010) |
71 | Standard_Boolean isNMMode = Interface_Static::IVal("write.step.nonmanifold"); |
72 | if (isNMMode) { |
73 | Handle(StepShape_VertexPoint) aVP; |
74 | Handle(TransferBRep_ShapeMapper) aSTEPMapper = TransferBRep::ShapeMapper(FP, aVertex); |
75 | if ( FP->FindTypedTransient(aSTEPMapper, STANDARD_TYPE(StepShape_VertexPoint), aVP) ) { |
76 | // Non-manifold topology detected |
77 | myError = TopoDSToStep_VertexOther; |
78 | myResult = aVP; |
79 | done = Standard_True; |
80 | return; |
81 | } |
82 | } |
83 | // [END] Processing non-manifold topology (ssv; 11.11.2010) |
84 | |
85 | if (aTool.IsBound(aVertex)) { |
86 | myError = TopoDSToStep_VertexOther; |
87 | done = Standard_True; |
88 | myResult = aTool.Find(aVertex); |
89 | return; |
90 | } |
91 | |
92 | gp_Pnt P; |
93 | |
94 | P = BRep_Tool::Pnt(aVertex); |
95 | GeomToStep_MakeCartesianPoint MkPoint(P); |
96 | Handle(StepGeom_CartesianPoint) Gpms = MkPoint.Value(); |
97 | Handle(StepShape_VertexPoint) Vpms = |
98 | new StepShape_VertexPoint(); |
99 | Handle(TCollection_HAsciiString) aName = |
100 | new TCollection_HAsciiString(""); |
101 | |
102 | Vpms->Init(aName, Gpms); |
103 | |
104 | aTool.Bind(aVertex,Vpms); |
105 | myError = TopoDSToStep_VertexDone; |
106 | done = Standard_True; |
107 | myResult = Vpms; |
108 | } |
109 | |
110 | |
111 | // ---------------------------------------------------------------------------- |
112 | // Method : Value |
113 | // Purpose : |
114 | // ---------------------------------------------------------------------------- |
115 | |
116 | const Handle(StepShape_TopologicalRepresentationItem)& TopoDSToStep_MakeStepVertex::Value() const |
117 | { |
118 | StdFail_NotDone_Raise_if(!done,""); |
119 | return myResult; |
120 | } |
121 | |
122 | // ---------------------------------------------------------------------------- |
123 | // Method : Error |
124 | // Purpose : |
125 | // ---------------------------------------------------------------------------- |
126 | |
127 | TopoDSToStep_MakeVertexError TopoDSToStep_MakeStepVertex::Error() const |
128 | { |
129 | return myError; |
130 | } |
131 | |