0022048: Visualization, AIS_InteractiveContext - single object selection should alway...
[occt.git] / src / IGESSelect / IGESSelect_IGESTypeForm.cxx
1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
2 //
3 // This file is part of Open CASCADE Technology software library.
4 //
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
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.
10 //
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
13
14
15 #include <IGESData_IGESEntity.hxx>
16 #include <IGESData_UndefinedEntity.hxx>
17 #include <IGESSelect_IGESTypeForm.hxx>
18 #include <Interface_InterfaceModel.hxx>
19 #include <Interface_Macros.hxx>
20 #include <Standard_Transient.hxx>
21 #include <Standard_Type.hxx>
22
23 #include <stdio.h>
24 IMPLEMENT_STANDARD_RTTIEXT(IGESSelect_IGESTypeForm,IFSelect_Signature)
25
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,
47    const Handle(Interface_InterfaceModel)& /*model*/) const
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 }