|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
* ~# t6 K! P* G" m5 G, k
4 B% _. O9 Y; g2 B. R. H2 N
! a8 X7 S- B9 X% T e$ d
一种自定义颜色条的方法,直接可以用,可以作为CAE后处理
( f& Y1 N a; o8 H6 s, Q% {
I V {3 z1 N
8 Y( F0 J5 ^$ L! [; q3 q. G: l" }0 e! F
- 3 B( o4 A( i& `9 b
- ' o3 ?- Q' m- |& r# V
- % F o; Z+ p! K& p/ H, Q, M7 c
) N7 I) v. u- L& Q2 ^: F% Y) Y- void UI_ColorRangeUDB::UI_ShowColorMapBlocks()/ a1 n* V+ a( k5 Q( p5 p
- {. ^: g- L: e. B+ v
- int colorNum = integerColorNum->Value();
4 c$ B, b2 O3 H- M7 k - vector<BlockStyler::UIBlock*> hiddenGroup;! d$ l" e7 E2 H% |) o) i
- hiddenGroup.clear();; V6 ]$ P( d* I$ m, f( k7 `$ ]
- vector<BlockStyler::UIBlock*> shownGroup;
( g% B$ ^8 d A# V - shownGroup.clear();
: ^4 Z9 c T O$ O' w; ~ - string groupPreStr = "groupColorRange";. x( c, t$ N& G9 J
- string doubleUPreStr = "doubleU";
4 R- w7 O$ ]( r0 ^/ p6 A" m - string doubleLPreStr = "doubleL";
+ _: h5 D0 v& t, z8 _, x - //get all the groups with the name str //groupColorRange6: R% C E- Y; W' \
- vector<BlockStyler::UIBlock*> allBlocks = theUserDefinedUIBlock->TopBlock()->GetBlocks();
/ w* ] U( G+ V1 T - //type: Group name : groupColorRange
1 g; q( F/ ~1 _, x* ? - //type : Group name : groupColorRange19 A" j6 G3 v1 K0 d/ W+ d4 {
- //type : Group name : groupColorRange10$ _) l. p4 w0 ~5 \' z: {
- //type : Group name : groupColorRange11
# [) r5 l c6 y; C* o - //type : Group name : groupColorRange12, o+ _4 F- d7 ~2 [
- //type : Group name : groupColorRange2# I/ S: d) d" b* F
- //type : Group name : groupColorRange3
5 U, y ?% Y0 H - //type : Group name : groupColorRange4. |8 ?: y" g8 d* A, K$ D, R* Z% z
- //type : Group name : groupColorRange5' C: w' V" c: f3 J+ t
- //type : Group name : groupColorRange6
# X& l* R" a5 p - //type : Group name : groupColorRange79 D2 {' Y2 Z* C( Q0 n3 Q+ B
- //type : Group name : groupColorRange8' s. d7 Y; a$ t0 E: w+ p- }0 z) m
- //type : Group name : groupColorRange9
# C# e" C, H! i, |- n3 e3 C
) f4 L5 j; R4 Z: Q" S) ^& B y1 a- for (int i = 0; i < allBlocks.size(); i++)
) q3 ?- I( S0 x, L5 y! @( s) J/ o - {
: q% W! Q8 U" x& l' X4 e9 B - BlockStyler::UIBlock* tempBlock = allBlocks[i];
* Z4 d2 b! T0 m+ J - if (isSameNXString("Group", tempBlock->Type().GetText()))
) C5 z6 z8 S7 `; q% D# t2 s - {# {. t/ k* c* r# h( M# [
- string blockNameStr = tempBlock->Name().GetLocaleText();- x. Z( j8 Q' p x" G/ E% n
- size_t findIndex = blockNameStr.find("groupColorRange");; E7 G( ]' V- S S* K
- if (findIndex != string::npos)+ d) ^# Z: _* v2 \% H# D
- {
% d6 y7 b' C) {0 x# N2 |" z: @ - string subStr = blockNameStr.substr(groupPreStr.length());
4 v* I5 C5 x$ H) m0 X; e- G - // Echo("%s", subStr.c_str());
/ j; C; E, C) L9 f0 _ V% y - //Echo("%d -- %d", atoi(subStr.c_str()), colorNum);+ U* h' p! @) @. [! f r3 c3 d; g% b
- if (colorNum >= atoi(subStr.c_str()))" v& F/ o( E8 m5 a1 U" Q& u* z+ Y
- {. a9 H3 k" d/ r/ V" Y7 Q( L
- shownGroup.push_back(tempBlock);1 P) D4 J7 }1 c! L: N( ?' {
- }
1 f( B+ l X4 N k3 { - else
3 Y* l, Y/ D$ L" \+ Z5 z - {
$ t) b; P8 y0 I. W( r1 V - hiddenGroup.push_back(tempBlock);
& u7 G2 Z7 C2 V" H5 _3 |8 U. S - }4 N! y: b; n$ y1 X3 w
- }
# ]$ r$ N' |/ A, }4 W! M - }
9 j9 r4 k) O( V6 { - }# n. s2 J6 }3 ~, a! u0 O
- if (!shownGroup.empty())
& V, y7 e8 {, h( u- N! t% l - {
5 z3 W' Q6 D C - for (auto a : shownGroup)) m ^! O. c$ o6 v
- {
$ Z5 {5 d8 A0 d% [; ] - a->SetShow(true);6 p) W# A; w4 V' l2 ^% j6 g
- * c% [/ h- b( M x# b
- }& l2 w, c6 ^& {8 F9 `4 y4 ]' [
- }/ _" Z4 h5 W2 ]; t: D6 E
- if (!hiddenGroup.empty())* a9 a' u2 Y4 w t5 V% o+ J
- {
' q3 F+ R; C0 l' v3 [4 g {2 l - for (auto a : hiddenGroup), l( u0 y6 k1 ^7 i! X
- {
, T/ P P3 r) n. ^ - a->SetShow(false);
3 l1 _: V- q' B/ @ - }
6 d( s1 M5 m! `. w9 _+ F - }
8 x1 R6 P, Y9 I) W - 9 x, \2 x$ k S6 |& q/ i$ }* ]1 l
- //实时更新显示
6 F6 L* M0 C7 Y" I7 \% d - 6 \9 I, b2 M0 W& E! {. n% ]
- UI_UpdateDoubleRangeValue();
' E& I0 i K8 ?6 @0 { - }
复制代码
* U; v# f9 e+ l3 q% Q' O7 G
5 C8 c; w* T; ~ ?; z) B0 L2 y$ w, F8 I. U
|
|