|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
: L, a, f6 I* p) U3 }2 ?) B1 X
! ~0 ]$ z8 k+ w6 w6 s/ M' D- F9 }' C5 v+ s: l
一种自定义颜色条的方法,直接可以用,可以作为CAE后处理
+ i" h, X' s% T' I; J
( o7 e4 M; l9 p
0 L5 `$ r8 F& l. G, `8 S& R
4 W! g. c" t7 |3 o
% N) ^5 ?; }* J/ N$ u7 ~/ x- 1 ^0 P6 L' |9 ?1 ?
- 8 V. ^1 i3 K( ^$ O
- $ ^. I7 r& x/ F. n% d3 m8 f
- void UI_ColorRangeUDB::UI_ShowColorMapBlocks()
0 |- D4 t2 E* \" } - {" D9 J' n2 ~" ^- x4 m; w0 k& O0 y, \) T
- int colorNum = integerColorNum->Value();
- P, ]/ d; Y4 Y9 Q0 j - vector<BlockStyler::UIBlock*> hiddenGroup;
( J- m: T, `' z! J* v' T - hiddenGroup.clear();
6 x) E5 b3 L3 n% f, C - vector<BlockStyler::UIBlock*> shownGroup;
W! ^1 n+ E6 K) X - shownGroup.clear();. z$ U6 S$ _9 Z7 j0 t
- string groupPreStr = "groupColorRange"; U# _" e/ h- D7 _. c
- string doubleUPreStr = "doubleU";
2 n/ i1 @( t" p( o0 p* y' G. } - string doubleLPreStr = "doubleL";3 {% d6 [' D; z; q Z2 G
- //get all the groups with the name str //groupColorRange62 [) S( ?& m. I( w0 }, Z) ^
- vector<BlockStyler::UIBlock*> allBlocks = theUserDefinedUIBlock->TopBlock()->GetBlocks();" n9 h# L6 W& o1 X: `' w1 x
- //type: Group name : groupColorRange
A5 T. e7 V R# v - //type : Group name : groupColorRange1
5 M- C+ G b9 {7 X# [4 s - //type : Group name : groupColorRange10: {, Z; S3 ?9 m( B* C! _
- //type : Group name : groupColorRange11* ^$ T+ S. R- B& ]9 d2 c( W: e
- //type : Group name : groupColorRange12
8 n8 n! B9 Q- D8 T/ D% d; r - //type : Group name : groupColorRange27 i @, ^3 h6 M6 m8 A' }! {- `
- //type : Group name : groupColorRange32 p4 D& c6 V% T
- //type : Group name : groupColorRange4
) J8 m( Z; }/ g - //type : Group name : groupColorRange5
4 P, ]5 \2 Y+ p" T, C - //type : Group name : groupColorRange67 _7 j5 x. \5 n4 G8 i7 b3 X
- //type : Group name : groupColorRange7
' f& b- Q( r/ S% Q. Q' ^ - //type : Group name : groupColorRange8
/ }' A6 i. S5 @8 Y9 L/ {5 Y- E - //type : Group name : groupColorRange9
. d9 r5 }$ H4 o" _# |& I+ u - 1 _ ^5 ~5 N: N8 K R. V
- for (int i = 0; i < allBlocks.size(); i++)0 a% Z1 z1 A9 O6 x0 l# y
- {* \$ }8 @2 w3 m( Q% g. }
- BlockStyler::UIBlock* tempBlock = allBlocks[i];
' l" k9 D4 ~4 V5 f7 r& b - if (isSameNXString("Group", tempBlock->Type().GetText()))
( B5 h& B- R S7 C) Q- r2 I6 I - { c4 P' c8 Z+ k6 f! g0 u4 u
- string blockNameStr = tempBlock->Name().GetLocaleText();4 Z, W: p) U. C+ S( [9 G7 Q
- size_t findIndex = blockNameStr.find("groupColorRange");4 A: f4 g4 x! Q7 n
- if (findIndex != string::npos)
; E4 _7 K7 p0 ?( t7 J - {
) w* s! ~# F8 t# t% T, F - string subStr = blockNameStr.substr(groupPreStr.length());
4 P8 l% G- P3 i) b; j) _( a" v7 g - // Echo("%s", subStr.c_str());0 m: B7 {; O" f
- //Echo("%d -- %d", atoi(subStr.c_str()), colorNum);9 O# N' f9 d/ u9 }8 D g' g
- if (colorNum >= atoi(subStr.c_str()))
, b+ ~- w: J6 w$ _6 m: d u) E - {9 p8 y p$ Q' e: k5 s
- shownGroup.push_back(tempBlock);( K5 i8 {9 P8 U, E
- }
. ~' u( E2 o0 \) ? - else
' U$ A+ t" j! O, o+ R - {
" {. T4 D D4 X& \ - hiddenGroup.push_back(tempBlock);
6 f. Y1 w/ ^* r" n8 U$ V - }. u5 k' m1 p& D5 j# m2 A% e
- }
7 Y u d& Q8 x, W e ]$ }: t - }
% v4 \2 i6 Y7 t. w: g5 ` - }
1 x; `0 t/ J( \9 z" ?. V4 W6 U3 q - if (!shownGroup.empty())
# [. G2 {3 L2 @! b$ [, s - {
; {7 U z1 s4 x8 j8 t; N - for (auto a : shownGroup)2 c6 \( {1 K$ N) d5 ]: `9 u b
- {
& Z( I7 _6 E- W$ S" t5 A - a->SetShow(true);
* I- V* e; v8 i# a" m& |, S+ n - # ]7 l% n9 I( @$ n2 o6 J
- }7 }& ~' a4 k+ I* @7 w& \
- }
G8 q4 W4 q' A! `9 ^5 X, k) T - if (!hiddenGroup.empty())
% {- | W' I! C( y. F& l - {0 p& U9 L; d% D0 g) _# ^' k
- for (auto a : hiddenGroup)
( o, q" u3 c. w3 b3 |$ @( s' \ - {
l2 B6 c! n- A. [ - a->SetShow(false);( a5 F2 h" d3 P3 f$ ?: h/ u, R
- }* e; |( X+ l1 g3 y) i- O
- }9 G3 S% I3 n3 L8 N. o3 h3 i- M
- : L# z, T0 _. N& B/ w3 S
- //实时更新显示
8 r; ?4 t$ V0 }: z. R' U e - & T' t- U/ t( I
- UI_UpdateDoubleRangeValue();/ V* l* m+ C# c; Q+ T. v
- }
复制代码
' V# i) B, X/ x3 }
7 @: H2 i. u+ C! g! m4 |2 h( [( A; s2 r# l$ t3 a8 I$ T
|
|