973c2be1 |
1 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
2 | // |
973c2be1 |
3 | // This file is part of Open CASCADE Technology software library. |
b311480e |
4 | // |
d5f74e42 |
5 | // This library is free software; you can redistribute it and/or modify it under |
6 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
7 | // by the Free Software Foundation, with special exception defined in the file |
8 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
9 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
10 | // |
973c2be1 |
11 | // Alternatively, this file may be used under the terms of Open CASCADE |
12 | // commercial license or contractual agreement. |
b311480e |
13 | |
42cf5bc1 |
14 | |
7fd59977 |
15 | #include <IGESData_IGESEntity.hxx> |
16 | #include <IGESData_UndefinedEntity.hxx> |
42cf5bc1 |
17 | #include <IGESSelect_IGESTypeForm.hxx> |
18 | #include <Interface_InterfaceModel.hxx> |
7fd59977 |
19 | #include <Interface_Macros.hxx> |
42cf5bc1 |
20 | #include <Standard_Transient.hxx> |
21 | #include <Standard_Type.hxx> |
7fd59977 |
22 | |
42cf5bc1 |
23 | #include <stdio.h> |
92efcf78 |
24 | IMPLEMENT_STANDARD_RTTIEXT(IGESSelect_IGESTypeForm,IFSelect_Signature) |
25 | |
7fd59977 |
26 | static char falsetype [] = "?"; |
27 | static char typeval [30]; // une seule reponse a la fois ... |
28 | |
29 | |
30 | |
31 | IGESSelect_IGESTypeForm::IGESSelect_IGESTypeForm |
32 | (const Standard_Boolean withform) |
33 | //JR/Hp |
34 | : IFSelect_Signature ((Standard_CString ) (withform ? "IGES Type & Form Numbers" : "IGES Type Number")) |
35 | //: IFSelect_Signature (withform ? "IGES Type & Form Numbers" : "IGES Type Number") |
36 | { theform = withform; } |
37 | |
38 | void IGESSelect_IGESTypeForm::SetForm (const Standard_Boolean withform) |
39 | { theform = withform; thename.Clear(); |
40 | //JR/Hp |
41 | Standard_CString astr = (Standard_CString ) (withform ? "IGES Type & Form Numbers" : "IGES Type Number") ; |
42 | thename.AssignCat ( astr ); } |
43 | // thename.AssignCat (withform ? "IGES Type & Form Numbers" : "IGES Type Number") ; |
44 | |
45 | Standard_CString IGESSelect_IGESTypeForm::Value |
46 | (const Handle(Standard_Transient)& ent, |
35e08fe8 |
47 | const Handle(Interface_InterfaceModel)& /*model*/) const |
7fd59977 |
48 | { |
49 | DeclareAndCast(IGESData_IGESEntity,igesent,ent); |
50 | if (igesent.IsNull()) return &falsetype[0]; |
51 | Standard_Boolean unk = ent->IsKind(STANDARD_TYPE(IGESData_UndefinedEntity)); |
52 | Standard_Integer typenum = igesent->TypeNumber(); |
53 | Standard_Integer formnum = igesent->FormNumber(); |
54 | if (unk) { |
55 | if (theform) sprintf (typeval,"%d %d (?)",typenum,formnum); |
56 | else sprintf (typeval,"%d (?)",typenum); |
57 | } else { |
58 | if (theform) sprintf (typeval,"%d %d",typenum,formnum); |
59 | else sprintf (typeval,"%d", typenum); |
60 | } |
61 | return &typeval[0]; |
62 | } |