|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
×
: Y. b- i1 f* W- n/ Y$ e: Y2 p
& j+ d! y' ^3 k1 l; N5 e! I
5 W, f" o+ u& l% ?8 |( B! n一种自定义颜色条的方法,直接可以用,可以作为CAE后处理1 V: S% U' }, w( ?
) V5 v; b8 n1 |0 S/ l7 q
; c0 i: k3 b3 J7 ^) ~4 b
9 k! b8 Y6 n) E
E) e2 `/ }. V. X' S& ^- - R; H( h$ Q0 a5 S, e
- 2 l: l, y) @$ k5 k
- % X- b0 d, R3 @
- void UI_ColorRangeUDB::UI_ShowColorMapBlocks()
" |% O; d4 D6 S' B - {. _) t0 I$ Q* @& j1 T& U$ C9 X
- int colorNum = integerColorNum->Value();6 J, T2 T* Q0 r! q- M' h- P8 x1 N
- vector<BlockStyler::UIBlock*> hiddenGroup;) \% ^; R. I% E3 k
- hiddenGroup.clear();! y& g# Q6 ]1 F* Q; U# D5 ~
- vector<BlockStyler::UIBlock*> shownGroup;
- Z0 b% m6 c# L( n7 v - shownGroup.clear();% K6 v0 j9 q8 E3 x+ E; `/ {, y
- string groupPreStr = "groupColorRange";5 t3 B l* p$ F; h0 d A; N
- string doubleUPreStr = "doubleU";' b- O( H- U) C# {( j8 i4 B1 ]
- string doubleLPreStr = "doubleL";
6 s/ ?* V9 K: [* p" u0 j - //get all the groups with the name str //groupColorRange6
# w" r, p7 Z; b2 R3 L! I - vector<BlockStyler::UIBlock*> allBlocks = theUserDefinedUIBlock->TopBlock()->GetBlocks();9 ]' T0 |8 {0 U% n$ Y8 ^3 ^. j4 Z
- //type: Group name : groupColorRange" b; \" f4 Z) i) m( B
- //type : Group name : groupColorRange1) s' J1 H+ M C0 m
- //type : Group name : groupColorRange10/ S& H( r: u$ o: f/ \9 q
- //type : Group name : groupColorRange11
8 \; ^) L$ p4 B$ c4 W9 O - //type : Group name : groupColorRange128 _) L" l. x3 y: d
- //type : Group name : groupColorRange2/ D0 t7 a$ H( b# Q, R8 T' |2 o1 P+ c
- //type : Group name : groupColorRange3; {* e' }4 r3 H8 G# ~$ j
- //type : Group name : groupColorRange4, @/ `" E$ ~# a: I
- //type : Group name : groupColorRange52 f) c. U3 z9 S3 g2 O m c
- //type : Group name : groupColorRange6* _% J. h: w6 i% r0 w& p; h2 r
- //type : Group name : groupColorRange7
/ d& ]% [6 V7 n5 T" M! I! Z - //type : Group name : groupColorRange8/ v4 v5 P/ X1 c6 d" P) c* g/ Z
- //type : Group name : groupColorRange9
6 z, g2 b; f# B4 Q5 G5 Z - & u! W( e: x. K3 v7 q6 c
- for (int i = 0; i < allBlocks.size(); i++)2 v2 ]* Y) ]$ P& c: R3 u
- {
! y4 r; k0 W+ G0 w - BlockStyler::UIBlock* tempBlock = allBlocks[i];- O4 ~4 `; y; p# z
- if (isSameNXString("Group", tempBlock->Type().GetText())). Q/ ~2 D+ P8 A* I! o* D
- {" i* k! K% r' Z" p$ x! S
- string blockNameStr = tempBlock->Name().GetLocaleText();! e5 H$ r9 R2 s. ]0 F1 s" ?9 q7 }
- size_t findIndex = blockNameStr.find("groupColorRange");5 J. x! }- F- d2 Z( Q
- if (findIndex != string::npos)! Z5 x W# g5 i! B5 e
- {
1 t1 c7 | z1 l# D) h - string subStr = blockNameStr.substr(groupPreStr.length());
- K' ?3 i' K( ~* `7 l5 D - // Echo("%s", subStr.c_str());& P; z! R" i; J4 \1 c% _
- //Echo("%d -- %d", atoi(subStr.c_str()), colorNum);
2 i$ C) L3 x2 m1 A# h8 y - if (colorNum >= atoi(subStr.c_str())), n' ~7 t: j) k$ z3 I
- {' q3 o8 r( ~: j) r2 m
- shownGroup.push_back(tempBlock); t0 m! g3 n4 L7 K
- }, c6 A: x+ l2 g8 g
- else2 L& d, \* K; t8 R7 c4 H
- {+ C6 ]0 q# R/ u4 x- R) P
- hiddenGroup.push_back(tempBlock);$ ]) J: |% B5 ^# d* S
- }$ T/ x8 Z( V; d4 g
- }3 ^. p7 b& O$ z0 y z7 G
- }7 e$ a; ~$ J9 ^8 X& _8 D0 H6 u
- }, }; ^$ N; O& K) S
- if (!shownGroup.empty())! b- ?) m' C7 Z0 G$ `; ^% y
- {4 N! R8 {6 i2 ~( U6 Y
- for (auto a : shownGroup)
5 c* C( g; J2 K - {! ?2 I1 T/ Z3 Y0 B
- a->SetShow(true);% g0 e- `; Y* _
- : a" {1 Q# @$ V: L4 U
- }
- z$ O9 a/ ]2 p - }
, X' x) g% X+ H - if (!hiddenGroup.empty())+ A/ p4 q7 s; g
- {( c3 p" K- O+ n9 r& L' ^
- for (auto a : hiddenGroup)
o2 X* [' {' t0 w$ L7 v - {
( {# a9 G2 J& _ H, C8 `6 K) `5 T - a->SetShow(false);
% X: P4 s" B9 U - }
7 C* m/ T) }, O - }
& p* T8 d, T7 I* Y - 3 l8 `' b. M$ M' q* Q9 k
- //实时更新显示
# U+ Y4 b' ~$ E; z/ F
: `# N- ?" ]9 n. n( H- ]- UI_UpdateDoubleRangeValue();
" G+ K) }3 j7 s - }
复制代码 2 h; r* n; f7 e1 v/ f
3 u& U; X# f8 s9 P, d
* Y+ O$ |; ~& w1 l |
|