|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
$ R) U4 ^; A7 M4 M$ W) k' c
" d! ?, Y* R2 K1 }3 T" m
0 {- X! {' T$ a! Z5 O6 y一种自定义颜色条的方法,直接可以用,可以作为CAE后处理( r% R. I6 U- u- Y) K4 U! s
8 f0 O. G$ g6 j1 o( s- r! w, V
1 A1 d" O+ W6 b5 h" Y
1 P# d) X0 \) H$ {1 u
1 l' S1 K0 C {6 c5 ^
8 M9 m: ~9 M l) p& q7 {! u4 {' x, B- 0 r8 [* j4 V5 m* A
- / Q y' i: J# u0 m2 v
- void UI_ColorRangeUDB::UI_ShowColorMapBlocks()
" a- W; w/ Y* W" @. o6 t - {
+ p+ z7 j* m. L O) i - int colorNum = integerColorNum->Value();
" A6 ~) m1 Q/ O- D - vector<BlockStyler::UIBlock*> hiddenGroup;
/ r0 s9 c9 j8 T) m) d4 K3 x - hiddenGroup.clear();: z) B% d5 a" o$ O
- vector<BlockStyler::UIBlock*> shownGroup;
5 \) a$ b5 l; `; x/ R. q' K; L - shownGroup.clear();& q9 K1 [5 `0 a7 `8 |
- string groupPreStr = "groupColorRange";
2 q7 h* `2 b+ |3 I4 j7 A( s. n4 j2 m - string doubleUPreStr = "doubleU";
# |% E8 J0 T! r2 L0 i8 g3 g - string doubleLPreStr = "doubleL";
$ g+ Q; P# b; ^) }9 f' `) @ - //get all the groups with the name str //groupColorRange6
4 |$ p; |- O; l2 t i7 K" X1 Z - vector<BlockStyler::UIBlock*> allBlocks = theUserDefinedUIBlock->TopBlock()->GetBlocks();
8 {! e* V0 R1 @# _( q" {: k* m - //type: Group name : groupColorRange" @$ _+ r9 c# q
- //type : Group name : groupColorRange1
3 C" f! |& D5 l$ o& q# b - //type : Group name : groupColorRange10
! p/ i+ C9 L. E' P - //type : Group name : groupColorRange11
3 G- o" B; e9 g! x8 M! P - //type : Group name : groupColorRange12; m5 U5 t' V2 F9 B3 U
- //type : Group name : groupColorRange2
7 |& p. B5 |& g/ F - //type : Group name : groupColorRange3
- e6 K6 F% G0 [! S+ @ - //type : Group name : groupColorRange4
) e2 \4 b. v0 e9 r7 U: H% ?: S0 ^ - //type : Group name : groupColorRange5
; g! W. G3 E3 e) ` - //type : Group name : groupColorRange6; R$ `3 K2 a# F. b( s
- //type : Group name : groupColorRange7- x* Z6 t* S- P, z; H3 f |
- //type : Group name : groupColorRange8
8 a: M4 C5 F: ~: ^' [4 I5 R - //type : Group name : groupColorRange9
, U& D" ^# U+ V+ u3 G1 A
3 c. ?/ T( Y% ^% E- for (int i = 0; i < allBlocks.size(); i++)% x; x2 q: _# r( c( h4 W' ^
- {( b! o$ j% ~ I4 G [7 Z: h$ e
- BlockStyler::UIBlock* tempBlock = allBlocks[i];
# U; j9 w; W( `3 N - if (isSameNXString("Group", tempBlock->Type().GetText()))
- ]. y9 s: Y, I2 q( M& ` - {
1 A# E0 q, |0 j# E0 Z% A- P - string blockNameStr = tempBlock->Name().GetLocaleText();
2 X7 l( @' l+ p6 L& c& a - size_t findIndex = blockNameStr.find("groupColorRange");
0 _4 n7 s. b' t6 [! p - if (findIndex != string::npos)0 K6 m/ k+ \8 s6 q; H- P5 O5 T
- {7 y, @& t' j; y; e/ e2 b
- string subStr = blockNameStr.substr(groupPreStr.length());2 @9 @* T: m% n4 P5 Q# C
- // Echo("%s", subStr.c_str());
6 H8 t; b8 A$ I z; |9 m3 p: T1 |4 } - //Echo("%d -- %d", atoi(subStr.c_str()), colorNum);
0 g( Y. l& e& }$ |" q0 q, e - if (colorNum >= atoi(subStr.c_str()))
2 }, J) [& ?, N! g- \$ Q, H; }9 ^ - {5 s3 h9 R) ~% f* e4 a6 o: v/ ?$ ~
- shownGroup.push_back(tempBlock);
; \1 P7 |7 I2 q; t - }& f; S9 d# r7 a$ l3 W1 X, U+ l' v+ U
- else/ @9 c: |6 d% ?. B G% `0 `
- {; T) ~1 a" X% J
- hiddenGroup.push_back(tempBlock);
* N" m: C. a3 A* o - }! _, K5 Q) s/ P5 P: `2 g
- }
0 X" [- Y" Z% ^0 s - }
7 C6 j M5 r9 z. q0 n& g3 B' K% o - }
" o# y' |$ {0 O& N" G - if (!shownGroup.empty())+ U5 k7 R6 Q2 P! S5 z- g) N3 m
- {
' ~4 X" D# n# o1 I6 E0 W - for (auto a : shownGroup)
1 O2 |3 M( i* E+ B7 x2 O! z - {% Q( B E$ n/ ^, R
- a->SetShow(true);
9 J% I' v* x( [9 W. _9 V; n - ( c2 g. L; W5 W- c/ T
- }5 i& ]. s+ @- e4 v( U- k
- }. b0 O2 v6 I0 a9 z- l$ E* c
- if (!hiddenGroup.empty())
\+ }/ {' l) s - {! M( {1 j v5 L# f' f! m
- for (auto a : hiddenGroup)
2 L1 d, K% c3 U2 ^) \# C% W - {
5 K2 [2 X( w D" X Z. h* A - a->SetShow(false);8 k6 B& o: @/ R+ R7 d7 h! |2 b
- }
, G5 {) X/ K+ N9 A! X - }
3 Z7 _6 {* W: h# L/ ^' c
* v9 X% q6 _7 s6 t# ]- O1 ]- //实时更新显示# h L9 b$ {) E4 v/ P
% h; S" f2 l4 n8 `5 T8 I- UI_UpdateDoubleRangeValue();
* ~5 B6 N4 I, Z0 P9 w) x- R* k - }
复制代码
2 ]+ {& v8 m# M: _; o) C) f( l6 V& J7 c8 m5 p( U, k
) q# y8 N2 I9 n8 t8 |$ u |
|