|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- l7 d% `$ W: Q: y# W/ L6 _
5 e' O9 u$ S3 F5 I! [; |3 [8 ~+ {8 T) p
一种自定义颜色条的方法,直接可以用,可以作为CAE后处理* ^ H7 c1 b4 w. k
5 i: t; H& n9 O/ B) U1 V' O
- _/ V: f% @5 o4 f7 I5 w. C% J9 [' U1 D
- / A1 }& t |" }. L6 j0 N8 R# Y
- ( @9 n* b; n4 Y6 P1 e/ u! J
|8 i- t- |' A8 h2 S5 Y- # ?8 ^0 p' r; U& q4 u. ]
- void UI_ColorRangeUDB::UI_ShowColorMapBlocks()& J; d: C1 z! ~6 \' t; |8 E
- {
- F, _0 H. t x' M - int colorNum = integerColorNum->Value();0 {5 j, E9 g: E3 _/ O
- vector<BlockStyler::UIBlock*> hiddenGroup;) C# i! H" H+ u% E0 H+ ?) _
- hiddenGroup.clear();+ D* n+ Q: u: _, P9 h7 J$ }
- vector<BlockStyler::UIBlock*> shownGroup;
: y0 X9 I! U0 R - shownGroup.clear();1 y" x$ ?! X! z4 x9 K1 d
- string groupPreStr = "groupColorRange";* c6 s6 r# |1 P5 X1 Y8 z
- string doubleUPreStr = "doubleU";6 |9 m/ A/ ?; i6 r" s6 C) n: o# A
- string doubleLPreStr = "doubleL";$ w* |- h. w( d
- //get all the groups with the name str //groupColorRange6
c* P2 ~6 l3 ^, _2 _8 P/ M - vector<BlockStyler::UIBlock*> allBlocks = theUserDefinedUIBlock->TopBlock()->GetBlocks();
- j* N, v6 v: K - //type: Group name : groupColorRange
4 O3 r, _3 A2 J/ S$ t - //type : Group name : groupColorRange1% [6 ]4 ~6 P' L3 B
- //type : Group name : groupColorRange10; o" |* ^( h& z& j* w0 Y; W7 n' ?' d% C
- //type : Group name : groupColorRange11/ l7 u* Z- j0 n, c: Y
- //type : Group name : groupColorRange12& X8 x1 U3 J% v4 }
- //type : Group name : groupColorRange2; k9 L3 N7 ~$ ~) U9 [
- //type : Group name : groupColorRange3
, [" h2 P+ `( H" w& C2 s L - //type : Group name : groupColorRange4
1 ?; B# U6 v& J9 e" a8 b - //type : Group name : groupColorRange5
) J" T* w7 f$ X" Z - //type : Group name : groupColorRange6: m- ]% `1 K$ _. z
- //type : Group name : groupColorRange7
. {9 `" r% S& O5 }- E7 v7 r9 \ - //type : Group name : groupColorRange8
/ J% N# \3 x0 f3 {# D$ A, F - //type : Group name : groupColorRange9
3 a9 A$ G9 X& N- ]+ o$ V - $ R1 N! k( [9 Z& o3 p
- for (int i = 0; i < allBlocks.size(); i++)
0 ?# Y& f, I R& g - { P# F$ x& j5 X, v
- BlockStyler::UIBlock* tempBlock = allBlocks[i]; a3 o" s' c' w, w( ]
- if (isSameNXString("Group", tempBlock->Type().GetText()))
+ E0 c/ N6 F! B" x: l/ I" i - {
$ \5 ?5 [) n9 u8 I+ |4 @/ a - string blockNameStr = tempBlock->Name().GetLocaleText();, [3 t' M1 E' C* }* A! T! q
- size_t findIndex = blockNameStr.find("groupColorRange");. t2 J* v) w( U' k0 i- @
- if (findIndex != string::npos)
- |* D/ h K" e+ j9 M - {
- T7 F9 B6 [0 a, A - string subStr = blockNameStr.substr(groupPreStr.length());
3 E3 t1 E; r& u - // Echo("%s", subStr.c_str());
: B; R: ~1 g: Z3 v) r0 ~ - //Echo("%d -- %d", atoi(subStr.c_str()), colorNum);. Q5 O# \ R! Z. Z+ t
- if (colorNum >= atoi(subStr.c_str()))
% W: t6 g) k5 J2 `1 ? - {
6 i1 N. Z# b8 S - shownGroup.push_back(tempBlock);
5 D9 k1 ~3 V0 E2 { - }# k4 P7 ]. }$ y+ q* X# C4 O
- else
) ?7 {* `7 ~0 a" y. o! |* n2 Z! f - { s# s$ x, V {/ f1 ?
- hiddenGroup.push_back(tempBlock);9 z- p, E8 D7 k4 b, ~
- }
* c2 q+ U% Q! V W0 m6 O - }8 n2 z/ M" f+ w6 T
- }( t- @' J5 N, L; q7 _, v5 v2 E0 N% @
- }
+ r4 l& |6 w. P3 o& I2 e5 ^ - if (!shownGroup.empty())
" k3 R* Y, t0 ]4 ? - {
- I8 ^8 s. f n5 P" c* m4 \3 C - for (auto a : shownGroup)4 c2 e/ Q& H* |# U4 q2 t
- {5 q9 `* u' N5 s/ I4 _. l; C+ @
- a->SetShow(true);
# \) n7 |0 {# _# t - ! g# D( v- G& N# k
- }
9 S" H& I- A6 J$ |: P; q0 | - }
0 m5 j" }" @* j: P8 f N7 w: E - if (!hiddenGroup.empty())
( b: H& ~/ U& E; a# w ~- Q - {* ]6 H& d5 j6 P2 f. D0 F. T: O' E
- for (auto a : hiddenGroup)7 _+ e+ }7 j7 c4 d
- {) h( N5 X/ j2 z" A9 k t% X- P
- a->SetShow(false);$ a' J& u- E) E) | f7 D+ t: d0 c
- }
# v/ D/ W* {$ m( H- [5 o8 H, X# x - }
2 Z- T2 m) L: }: Y+ a7 ?7 q8 D/ T - & k( F8 i' Q+ \$ J; S4 l4 p# J* W) q
- //实时更新显示: c" B+ G% H# k
- + d1 N0 g8 E/ z$ q( u% q( r
- UI_UpdateDoubleRangeValue();" z1 |+ d, T* b' Z8 t# h
- }
复制代码
+ ~: `$ L& Q" e+ B
; {& S _1 H6 V/ w0 {6 P6 Q3 |
# }, h; [% f. E$ J |
|