7fd59977 |
1 | #include <IGESSelect_SignLevelNumber.ixx> |
2 | #include <IGESData_IGESEntity.hxx> |
3 | #include <IGESGraph_DefinitionLevel.hxx> |
4 | #include <TCollection_AsciiString.hxx> |
5 | #include <Interface_Macros.hxx> |
6 | #include <stdio.h> |
7 | |
8 | static TCollection_AsciiString laval; |
9 | |
10 | |
11 | IGESSelect_SignLevelNumber::IGESSelect_SignLevelNumber |
12 | (const Standard_Boolean countmode) |
13 | : IFSelect_Signature ("Level Number") , |
14 | thecountmode (countmode) { } |
15 | |
16 | Standard_CString IGESSelect_SignLevelNumber::Value |
17 | (const Handle(Standard_Transient)& ent, |
18 | const Handle(Interface_InterfaceModel)& /* model */) const |
19 | { |
20 | char carlev[20]; |
21 | DeclareAndCast(IGESData_IGESEntity,igesent,ent); |
22 | //JR/Hp |
23 | if (igesent.IsNull()) { |
24 | Standard_CString astr ; |
25 | astr = (Standard_CString ) (thecountmode ? " NO LEVEL" : "/0/"); |
26 | return astr ; |
27 | } |
28 | // if (igesent.IsNull()) return (thecountmode ? " NO LEVEL" : "/0/"); |
29 | DeclareAndCast(IGESGraph_DefinitionLevel,levelist,igesent->LevelList()); |
30 | Standard_Integer level = igesent->Level(); |
31 | |
32 | if (levelist.IsNull()) { |
33 | //JR/Hp |
34 | if (level < 0) { |
35 | Standard_CString astr ; |
36 | astr = (Standard_CString ) (thecountmode ? " NO LEVEL" : "/0/") ; |
37 | return astr ; |
38 | } |
39 | // if (level < 0) return (thecountmode ? " NO LEVEL" : "/0/"); |
40 | laval.Clear(); |
41 | if (thecountmode) sprintf (carlev,"%7d",level); |
42 | else sprintf (carlev,"/%d/",level); |
43 | laval.AssignCat (carlev); |
44 | } |
45 | else if (thecountmode) return "LEVEL LIST"; |
46 | else { |
47 | Standard_Integer i, nblev = levelist->NbLevelNumbers(); |
48 | laval.Clear(); |
49 | laval.AssignCat("LIST:/"); |
50 | for (i = 1; i <= nblev; i ++) { |
51 | sprintf(carlev,"%d/",levelist->LevelNumber(i)); |
52 | laval.AssignCat(carlev); |
53 | } |
54 | } |
55 | return laval.ToCString(); |
56 | } |