|
我的思路: 选定直线后 取出线的2个端点,根据取出的端点再给定偏置距离得到新的点。
2 \0 O3 h6 ?5 E( p$ ]5 N$ Q8 z \0 j, |) e
如图:
9 l: p, N9 o9 l8 W! H, s" @
8 T3 R; z0 j' u! T3 @! n+ x看我代码:7 n% u8 W) m0 c; O6 f
int CHANGE_action_9_act_cb ( int dialog_id,, D' J1 o( T0 A! q u
void * client_data,
) W. h% m& ^% x/ {" I UF_STYLER_item_value_type_p_t callback_data)2 _; v/ ?( C' ~5 }& O' _8 y' f
{
( d% t5 ^. ]" m! J/ ] /* Make sure User Function is available. */
/ h3 @' j6 u2 X3 w+ w; z' {. ~. P if ( UF_initialize() != 0)
( R6 `- F& m7 e# k9 z return ( UF_UI_CB_CONTINUE_DIALOG );
( b# C' C9 A) U; o/ Y8 O% G5 I/ q" x /* ---- Enter your callback code here ----- */
6 I* g2 I8 f# F int err = 0;
) J! T# c3 V. F a char *message = "Select point";* E* {& X& h, T! g- G
double point_coords[3];1 {" B; s7 [, b
UF_UI_selection_options_t opts;1 _; S F8 E; y$ I+ Z8 ?
UF_UI_mask_t mask[1] = {{UF_line_type, 0, 0}};+ m6 P$ ?% S" [2 D2 Z
$ c. a9 c4 F, R+ c
int response;
# ]4 o' e5 |# b+ m2 G( e/ F! F double cursor[3];
! g3 s4 j. I1 K3 A double A[3],B[3];
" N" A8 n3 V8 H& i q4 @ tag_t object, view;! D; U6 Q4 U/ K
int unhighlight = 0;7 r2 v& t1 J o
UF_CURVE_line_p_t line_coords;2 `5 l) G& T3 v9 f U+ y' q
tag_t line_tag;
9 o% _ N7 l2 h9 v opts.other_options = 0;0 c* s7 l7 w. T0 Y) ^1 ]& {
opts.reserved = NULL;3 n; _' E" k/ a1 l
opts.num_mask_triples = 1;
( b/ y5 d) U5 [/ a$ H opts.mask_triples = mask;5 {: ~4 R' T7 e; Y( Y. W. z- z
opts.scope = UF_UI_SEL_SCOPE_WORK_PART_AND_OCC; // 定义选择范围) o1 ^# T0 L1 E& S, \: a6 H- Y
err = UF_UI_select_single(message, &opts, &response, &object, cursor, &view);0 o# v2 a3 X1 _( h4 k* z4 ?
if(err == 0 && response == 4 || response == 5)5 Z# d+ e7 ~9 n$ ^' b, K
{
* ]) ^/ E: C- X9 U1 I/ B) k$ R' W if(object != NULL_TAG)
9 Z& x F- ~4 M. X' y, |6 u { 4 T! p6 P2 ?! l4 X
/*extern UFUNEXPORT int UF_CURVE_ask_line_data(tag_t line ,UF_CURVE_line_p_t line_coords)*/
: Q6 S2 e# u( t UF_CURVE_ask_line_data (object, line_coords); // 获取点位置
; G( E; l. u3 j0 G u6 { //---下面要取出端点 再把端点偏置 但是代码不知道怎么实现了 ------请高人进来!!!!!
" C' b# ]7 Y% |2 N& D A[0]= line_coords->start_point[0];8 U* v |$ y" n# o! G. G
A[1]= line_coords->start_point[1];
; T( P* y3 @: l5 g- l A[2]= line_coords->start_point[2];3 b5 R- `! W( F0 t
//uc1601(info,1); 8 e( a: s' D8 N4 D1 H
}
4 i% `3 N/ g. I O" O2 [ // UF_CURVE_create_line(&line_coords,&line_tag);/ w+ h6 F8 a* p- t
}
6 b# D, c, G A( R' R/ v* T UF_terminate ();
x4 w; L( D3 R7 ]( _0 M1 J0 E /* Callback acknowledged, do not terminate dialog */
- b9 L: ~4 h# X0 i3 o return (UF_UI_CB_CONTINUE_DIALOG); 3 a6 ?! Z' R8 W
} |
|