|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
& A: _! @3 d7 ~: B: @* S# x1 Z5 N6 ^/ ]6 b0 C. Q
4 s+ B# b% L z; ?
一种自定义颜色条的方法,直接可以用,可以作为CAE后处理
' P0 |2 q& U7 u- O A3 C/ ^+ Z4 {1 z" e& b0 |; y% U
4 F" i. f4 y- ]$ m1 s' u. `
# W6 x1 \5 b* V6 l! z8 C
- $ W1 h, [# Q- k$ w
- * b# r) A: f. f7 B1 Q7 ~8 [3 K4 s
1 {* s4 J3 v2 j8 [, H& S
/ ]3 b* G5 U7 U: a2 D6 u- void UI_ColorRangeUDB::UI_ShowColorMapBlocks()
( x( r2 r! j1 v9 {/ `8 u9 L" v - {7 T+ f1 C0 E1 t% {
- int colorNum = integerColorNum->Value();; B# d) C" P" N, h/ }
- vector<BlockStyler::UIBlock*> hiddenGroup;" l! J" U# l* H4 {# Q" J
- hiddenGroup.clear();
$ J% D# o' \; d: r4 Y - vector<BlockStyler::UIBlock*> shownGroup;4 h* k0 c- v4 K/ h5 N @/ Z. i+ j
- shownGroup.clear();7 k) i5 T- P8 K2 T# \
- string groupPreStr = "groupColorRange";
6 b( I2 c8 Z9 j1 U. [/ l3 ^: w - string doubleUPreStr = "doubleU";- Q4 V; H* g1 @1 |7 Y' k) Q5 r
- string doubleLPreStr = "doubleL";
* L" W: V. c [$ {: { - //get all the groups with the name str //groupColorRange6
/ `* @7 h- b5 V8 ]& e* A - vector<BlockStyler::UIBlock*> allBlocks = theUserDefinedUIBlock->TopBlock()->GetBlocks();
B4 q$ K: O* G) t - //type: Group name : groupColorRange" L1 s5 c+ I2 n
- //type : Group name : groupColorRange1: C0 ^& m) R6 ~
- //type : Group name : groupColorRange10$ J* w+ t3 Q0 \
- //type : Group name : groupColorRange11
. @; d( a7 n) m& [ - //type : Group name : groupColorRange12: o* F( _* h2 X% S. f5 H
- //type : Group name : groupColorRange2
8 X% W3 [+ s O% H% Y - //type : Group name : groupColorRange32 v, ~+ a2 [1 U3 i8 W. o6 B8 s
- //type : Group name : groupColorRange4
% S' X7 [+ v; _% v. z2 V/ C - //type : Group name : groupColorRange5. R* g" }1 X2 A) s5 k
- //type : Group name : groupColorRange6- Q2 @1 ?' w3 n, f- w; v1 t6 Y
- //type : Group name : groupColorRange7
) H0 t( L- [# Z% G - //type : Group name : groupColorRange8. Y' X8 K$ \: ~) f! F7 k* ~8 v7 z3 e2 }8 d
- //type : Group name : groupColorRange9* H" Q. c- S# W" w+ p
2 a* S% R, f- r% B1 Q- for (int i = 0; i < allBlocks.size(); i++)
0 Y. f. m+ N( j, q$ x - {
5 z. W+ y0 ?' r' }3 j - BlockStyler::UIBlock* tempBlock = allBlocks[i];# Z X- X* B/ X. m- s
- if (isSameNXString("Group", tempBlock->Type().GetText()))6 ?4 D% o# c# A2 T: ~/ Z3 C2 S
- {
" z* n% z8 f$ p* |8 }* S { - string blockNameStr = tempBlock->Name().GetLocaleText();5 c- n9 d# x5 A# B
- size_t findIndex = blockNameStr.find("groupColorRange");! j. I5 x N9 i4 ?6 V. e
- if (findIndex != string::npos)+ ~; K* m6 o0 R# S& x4 v
- {' |* I+ p. I0 W
- string subStr = blockNameStr.substr(groupPreStr.length());
8 w J, ~, O+ ? - // Echo("%s", subStr.c_str());* O1 L0 ~1 ~1 U* E- m0 N& J* b# y
- //Echo("%d -- %d", atoi(subStr.c_str()), colorNum);7 z7 P, e8 I% O8 W" q
- if (colorNum >= atoi(subStr.c_str()))
( Z5 p6 ]8 p2 @! L& z, M& ~ f - {2 ^6 i+ J+ H6 _( N
- shownGroup.push_back(tempBlock);
8 }6 k2 j$ y: c, v9 {% d - }
" \; J7 }& Z# Q& `) o2 E, t& j - else
( v3 i: x# f9 U - {9 V6 r4 p$ h" h4 O" G T2 r
- hiddenGroup.push_back(tempBlock);, @# w j3 t% i
- }+ }$ _' r7 Y& z! L
- }# Q/ t/ M- y [, O% m6 |
- }
. T$ P% y& b5 N: @' r% W - }
\! t; p8 ^# G9 m/ s& F4 R - if (!shownGroup.empty())0 j5 a/ o: \/ t
- {" z9 \- R- D' E2 z/ O/ ^
- for (auto a : shownGroup)
- S2 O7 B, s* [4 ~# o7 a - {: A& t& i9 w# ?2 A
- a->SetShow(true);
* O9 C7 p1 k2 {' U- g
! S7 Y1 A- k. z) C3 G- }0 m8 X6 J% f! @. _9 D( r
- }
, O+ Y" P* w) S" r' b7 y7 P - if (!hiddenGroup.empty())
# G% S! Q- G: m' p+ c - {
+ B+ E/ O3 ~: ~( d - for (auto a : hiddenGroup)
4 i" V' t; a T- O- s3 W& O6 r - {
0 ?! _" L; P% K8 \ - a->SetShow(false); ~7 c3 N% n `: q/ o2 N! L
- }
$ k) c" U7 j% y! E0 U' @ - }
( H1 ^7 s% ^1 W: ]
$ `6 y3 }! @1 l9 u# r) p- //实时更新显示
/ b+ ~! o, V* a- J0 q8 z( p! Z! Z - 6 A4 ^# J! N' A, O6 _' z8 Y
- UI_UpdateDoubleRangeValue();( r( Z3 h$ g( V0 s, a' v; c# [
- }
复制代码 5 S, L- e$ j7 C# v( `
* Y% b' F* g$ ^# `$ T
! `& O' ?8 M! U/ z
|
|