|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
9 K8 Y$ @+ K$ \8 {3 c0 m2 v1 }/ }; j# b" v* W
6 l) T. c4 F, e) j3 x
一种自定义颜色条的方法,直接可以用,可以作为CAE后处理1 Z B+ t: e3 j/ E
2 C0 C% Q8 V6 H
& b# X& Z7 m- l- h6 ` e9 g* N$ @* G# e/ {
* q) ^" S0 r K- 2 j" p- T0 s" H) Y, w& f5 {8 c
0 n" F: Y. A: m$ L, b- ( s# { s) y" T' K
- void UI_ColorRangeUDB::UI_ShowColorMapBlocks()
+ p7 n, t, J/ A: @5 e' q - {
9 M! _! g: _' S5 W6 G3 Z) Q - int colorNum = integerColorNum->Value();
' d g$ j6 r0 R% s6 }6 q' |+ Z4 v - vector<BlockStyler::UIBlock*> hiddenGroup;
7 i4 L" j0 U) p4 O - hiddenGroup.clear();
/ c- Y7 S* y3 l6 y& `" v - vector<BlockStyler::UIBlock*> shownGroup;. A1 j0 Z0 i9 Q% \, f- Y
- shownGroup.clear();
; y. d7 r/ X! L) q. Z - string groupPreStr = "groupColorRange";( R+ q. d% i) D+ z4 \9 n' v+ p0 a5 p
- string doubleUPreStr = "doubleU";1 D1 K3 ~8 s$ [+ ~2 e7 D% b$ C4 b
- string doubleLPreStr = "doubleL";
( P } i1 G& `: c - //get all the groups with the name str //groupColorRange6
/ D2 h. U8 f; f% z5 ^4 _ - vector<BlockStyler::UIBlock*> allBlocks = theUserDefinedUIBlock->TopBlock()->GetBlocks();
8 U5 K/ a7 U9 P9 i - //type: Group name : groupColorRange
8 j, x. q! _! X8 u- }; I - //type : Group name : groupColorRange1
. d- w3 W6 v9 t - //type : Group name : groupColorRange10
4 W* J1 ?+ g0 g& _+ L( J% s - //type : Group name : groupColorRange11
$ G% w9 |+ W8 s+ v# m$ P3 e9 F, R8 M - //type : Group name : groupColorRange12
5 o2 A5 H- {6 S8 k& b3 m. ^ - //type : Group name : groupColorRange2
+ a. s% h: \2 d& D/ L! y$ L8 K - //type : Group name : groupColorRange3
0 ~4 W" j# y. y& V! a - //type : Group name : groupColorRange45 W0 ]1 L7 o- T; r
- //type : Group name : groupColorRange5' J9 G1 S; l3 \% N# h
- //type : Group name : groupColorRange6+ F8 \, q8 r0 T# N3 }8 d
- //type : Group name : groupColorRange7
% ~% |. f( d: M; f( v1 v; O - //type : Group name : groupColorRange8; L( s- I/ v* {' y( W: L1 u
- //type : Group name : groupColorRange9
/ Z; R- e/ a2 Q - ( ]+ `& V' V/ {3 k1 f+ {2 b
- for (int i = 0; i < allBlocks.size(); i++)
" J+ [* z E* e6 G% J - {
# j K5 } X9 L4 ` - BlockStyler::UIBlock* tempBlock = allBlocks[i];
# g# G( M2 p% V$ |: v7 ~+ h - if (isSameNXString("Group", tempBlock->Type().GetText()))+ k3 Z/ \+ \' h0 r( H
- {1 v2 g8 d" a' H
- string blockNameStr = tempBlock->Name().GetLocaleText();
) |. y! q$ `, K5 p# [% ~ - size_t findIndex = blockNameStr.find("groupColorRange");4 B0 D1 g4 m: j5 s/ h( Q4 Q
- if (findIndex != string::npos)2 [" [, I* R) j5 i0 v D
- {
0 V; e( r' S/ `. |0 `5 v - string subStr = blockNameStr.substr(groupPreStr.length());
. A0 |2 R( r6 v$ N, O0 E# ? - // Echo("%s", subStr.c_str());, _+ D# c- Z% I1 Z. A( U' |
- //Echo("%d -- %d", atoi(subStr.c_str()), colorNum);; n2 j0 C3 I# [$ V) |9 F
- if (colorNum >= atoi(subStr.c_str()))
* E1 U8 {* Q1 w - {5 g# I5 m2 z9 d3 u
- shownGroup.push_back(tempBlock);
# O/ v. t& e) J% n! E& ^) Z - }& @, V/ o8 {; R% U3 M
- else
7 J( o$ F9 _8 |; l: d5 c& U - {
9 j) C' `0 ~( V0 U - hiddenGroup.push_back(tempBlock);
. ]6 q: @1 K; _9 C - }" \4 D1 i- H# B9 t# g
- }
, d( s0 N9 D* g0 r% b3 D - }
) {% T" F, g1 E! G - }' `( Z* ?! {: A& J% e1 O) V( U
- if (!shownGroup.empty())
. s2 R9 |4 s% y - {
/ B% A9 c. S: }7 X& T, w2 a, s x/ a - for (auto a : shownGroup)
8 M) V8 ~) K% E5 r& u2 ^! C - {
! @8 G% t0 N! t. i; C w9 G, y1 x - a->SetShow(true);# `6 X- A( Z2 ^' i" q! V
7 q$ K9 d' f* I9 S1 m0 m& ^- }7 N" r$ r2 F. g
- }
; {. F. E% Z& s% w - if (!hiddenGroup.empty())6 N8 E" b g8 r
- {
9 ^' R0 q/ g3 |( M1 c- E u% ?6 K - for (auto a : hiddenGroup)
3 r+ V, @- b+ J$ k4 o: w5 H: J - {
# y( F& G' |9 `! W0 I - a->SetShow(false);
0 H$ S5 w; d9 x/ D y8 S3 v - } }! H+ z& S. E9 i( O( d& ~+ T
- }
- I, W5 P7 w1 o* f - / r0 v5 G1 P8 q7 v/ M1 Y( O' A
- //实时更新显示
* n1 }/ W; B7 d% u$ I" s - 6 q% g. F* J+ Z( @$ j: A8 C! e/ e* @" D
- UI_UpdateDoubleRangeValue();
; c% Z% K1 r. _- _/ [ - }
复制代码 3 W. Y a& @0 R+ A I" y- g; j/ Y
9 p' [5 ?: s, X% E K# N
9 B3 U( Y; G% E8 u5 }. D |
|