blob: c48ec9c2d67ceb1eb400a1c73e22a0436eb01787 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
#include <IFSelect_SelectRange.ixx>
#include <stdio.h>
IFSelect_SelectRange::IFSelect_SelectRange () { }
void IFSelect_SelectRange::SetRange
(const Handle(IFSelect_IntParam)& rankfrom,
const Handle(IFSelect_IntParam)& rankto)
{ thelower = rankfrom; theupper = rankto; }
void IFSelect_SelectRange::SetOne (const Handle(IFSelect_IntParam)& rank)
{ thelower = theupper = rank; }
void IFSelect_SelectRange::SetFrom
(const Handle(IFSelect_IntParam)& rankfrom)
{ thelower = rankfrom; theupper.Nullify(); }
void IFSelect_SelectRange::SetUntil
(const Handle(IFSelect_IntParam)& rankto)
{ thelower.Nullify(); theupper = rankto; }
Standard_Boolean IFSelect_SelectRange::HasLower () const
{ return (!thelower.IsNull()); }
Handle(IFSelect_IntParam) IFSelect_SelectRange::Lower () const
{ return thelower; }
Standard_Integer IFSelect_SelectRange::LowerValue () const
{
if (thelower.IsNull()) return 0;
return thelower->Value();
}
Standard_Boolean IFSelect_SelectRange::HasUpper () const
{ return (!theupper.IsNull()); }
Handle(IFSelect_IntParam) IFSelect_SelectRange::Upper () const
{ return theupper; }
Standard_Integer IFSelect_SelectRange::UpperValue () const
{
if (theupper.IsNull()) return 0;
return theupper->Value();
}
Standard_Boolean IFSelect_SelectRange::Sort
(const Standard_Integer rank, const Handle(Standard_Transient)& ,
const Handle(Interface_InterfaceModel)& ) const
{
Standard_Integer rankfrom = 0;
if (!thelower.IsNull()) rankfrom = thelower->Value();
Standard_Integer rankto = 0;
if (!theupper.IsNull()) rankto = theupper->Value();
return (rank >= rankfrom && (rankto == 0 || rankto >= rank));
}
TCollection_AsciiString IFSelect_SelectRange::ExtractLabel () const
{
char lab[30];
Standard_Integer rankfrom = 0;
if (!thelower.IsNull()) rankfrom = thelower->Value();
Standard_Integer rankto = 0;
if (!theupper.IsNull()) rankto = theupper->Value();
if (rankfrom == rankto) sprintf(lab,"Rank no %d",rankfrom);
else if (rankfrom == 0) sprintf(lab,"Until no %d",rankto);
else if (rankto == 0) sprintf(lab,"From no %d",rankto);
else sprintf(lab,"From %d Until %d",rankfrom,rankto);
return TCollection_AsciiString(lab);
}
|