Home > functions > gui > bm_editor > bm_edit_app_view > bm_edit_app_view3d > bm_edit_app_view3d_callback.m

bm_edit_app_view3d_callback

PURPOSE ^

processing callback of bm_edit_app_view3d.

SYNOPSIS ^

function bm_edit_app_view3d_callback(obj, hObj)

DESCRIPTION ^

 processing callback of bm_edit_app_view3d.
 [IN]
     obj : bm_edit_app_view3d object
    hObj : action component handle
 [OUT]
    none

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function bm_edit_app_view3d_callback(obj, hObj)
0002 % processing callback of bm_edit_app_view3d.
0003 % [IN]
0004 %     obj : bm_edit_app_view3d object
0005 %    hObj : action component handle
0006 % [OUT]
0007 %    none
0008 %
0009 % Copyright (C) 2011, ATR All Rights Reserved.
0010 % License : New BSD License(see VBMEG_LICENSE.txt)
0011 
0012 %
0013 % --- Previous check
0014 %
0015 if ~exist('obj', 'var'), error('obj is a required parameter.'); end
0016 if ~exist('hObj', 'var'), error('hObj is a required parameter.'); end
0017 
0018 %
0019 % --- Main Procedure
0020 %
0021 H = guihandles(obj.h);
0022 
0023 switch(hObj)
0024     case H.model_listbox
0025         % set current axes to selected axes
0026         set(gcf, 'CurrentAxes', H.selected_axes);
0027         cla(H.selected_axes);
0028         % get patch handle
0029         if length(obj.patch_handles) <= 0, return; end
0030         selected = get(H.model_listbox, 'Value');
0031         patch_h = obj.patch_handles(selected);
0032         % copy patch from main axes to selected axes
0033         new_patch_h = copyobj(patch_h, H.selected_axes);
0034         % view setting
0035         alpha(new_patch_h, 1);
0036         lighting phong;
0037         material dull;
0038         axis equal;
0039         axis off;
0040         camlight(-60,0);
0041         camlight(60,0);
0042         camlight(180,0);
0043         set(H.selected_axes, 'View', get(H.model_axes, 'View'));
0044         xlim(H.selected_axes, xlim(H.model_axes));
0045         ylim(H.selected_axes, ylim(H.model_axes));
0046         zlim(H.selected_axes, zlim(H.model_axes));
0047         % show current alpha popup
0048         alpha_val = get(patch_h, 'FaceAlpha');
0049         contents = get(H.tranceparent_popup, 'String');
0050         alpha_val_list = zeros(length(contents), 1);
0051         for k=1:length(contents)
0052             alpha_val_list(k) = str2num(contents{k});
0053         end
0054         ix = find(alpha_val_list == alpha_val);
0055         set(H.tranceparent_popup, 'Value', ix);
0056     case H.color_push
0057         % get change object
0058         selected = get(H.model_listbox, 'Value');
0059         patch_h = obj.patch_handles(selected);
0060         % select new color
0061         C = get(patch_h, 'FaceColor');
0062         C = uisetcolor(C);
0063         % change color
0064         if length(C) == 1 && C == 0
0065         else
0066             set(patch_h, 'FaceColor', C);
0067             bm_edit_app_view3d_callback(obj, H.model_listbox);
0068         end
0069     case H.tranceparent_popup
0070         % get change object
0071         selected = get(H.model_listbox, 'Value');
0072         patch_h = obj.patch_handles(selected);
0073         % select new transparent
0074         contents = get(H.tranceparent_popup, 'String');
0075         Value = get(H.tranceparent_popup, 'Value');
0076         tranceparent = sscanf(contents{Value}, '%f');
0077         % change tranceparent
0078         alpha(patch_h, tranceparent);
0079 end
0080 
0081 rotate3d(H.model_axes, 'on');
0082 
0083 guidata(obj.h, obj);

Generated on Tue 27-Aug-2013 11:46:04 by m2html © 2005