Mercurial > octave-nkf
comparison src/graphics.h.in @ 12364:1a24d55b1714 release-3-4-x
Move axes layout from opengl_renderer::draw_axes to axes::properties
author | Konstantinos Poulios <logari81@googlemail.com> |
---|---|
date | Thu, 03 Feb 2011 01:00:32 +0100 |
parents | a950bfb7b8e8 |
children | 63dc132a1000 |
comparison
equal
deleted
inserted
replaced
12363:eb7c0ba7ca87 | 12364:1a24d55b1714 |
---|---|
3051 Matrix xform_inv; | 3051 Matrix xform_inv; |
3052 scaler sx, sy, sz; | 3052 scaler sx, sy, sz; |
3053 Matrix zlim; | 3053 Matrix zlim; |
3054 }; | 3054 }; |
3055 | 3055 |
3056 enum { | |
3057 AXE_ANY_DIR = 0, | |
3058 AXE_DEPTH_DIR = 1, | |
3059 AXE_HORZ_DIR = 2, | |
3060 AXE_VERT_DIR = 3 | |
3061 }; | |
3062 | |
3056 class OCTINTERP_API axes : public base_graphics_object | 3063 class OCTINTERP_API axes : public base_graphics_object |
3057 { | 3064 { |
3058 public: | 3065 public: |
3059 class OCTINTERP_API properties : public base_properties | 3066 class OCTINTERP_API properties : public base_properties |
3060 { | 3067 { |
3077 base_properties::update_boundingbox (); | 3084 base_properties::update_boundingbox (); |
3078 } | 3085 } |
3079 } | 3086 } |
3080 | 3087 |
3081 void update_camera (void); | 3088 void update_camera (void); |
3089 void update_axes_layout (void); | |
3082 void update_aspectratios (void); | 3090 void update_aspectratios (void); |
3083 void update_transform (void) | 3091 void update_transform (void) |
3084 { | 3092 { |
3085 update_aspectratios (); | 3093 update_aspectratios (); |
3086 update_camera (); | 3094 update_camera (); |
3095 update_axes_layout (); | |
3087 } | 3096 } |
3088 | 3097 |
3089 graphics_xform get_transform (void) const | 3098 graphics_xform get_transform (void) const |
3090 { return graphics_xform (x_render, x_render_inv, sx, sy, sz, x_zlim); } | 3099 { return graphics_xform (x_render, x_render_inv, sx, sy, sz, x_zlim); } |
3091 | 3100 |
3092 Matrix get_transform_matrix (void) const { return x_render; } | 3101 Matrix get_transform_matrix (void) const { return x_render; } |
3093 Matrix get_inverse_transform_matrix (void) const { return x_render_inv; } | 3102 Matrix get_inverse_transform_matrix (void) const { return x_render_inv; } |
3094 Matrix get_opengl_matrix_1 (void) const { return x_gl_mat1; } | 3103 Matrix get_opengl_matrix_1 (void) const { return x_gl_mat1; } |
3095 Matrix get_opengl_matrix_2 (void) const { return x_gl_mat2; } | 3104 Matrix get_opengl_matrix_2 (void) const { return x_gl_mat2; } |
3096 Matrix get_transform_zlim (void) const { return x_zlim; } | 3105 Matrix get_transform_zlim (void) const { return x_zlim; } |
3106 | |
3107 int get_xstate (void) const { return xstate; } | |
3108 int get_ystate (void) const { return ystate; } | |
3109 int get_zstate (void) const { return zstate; } | |
3110 double get_xPlane (void) const { return xPlane; } | |
3111 double get_xPlaneN (void) const { return xPlaneN; } | |
3112 double get_yPlane (void) const { return yPlane; } | |
3113 double get_yPlaneN (void) const { return yPlaneN; } | |
3114 double get_zPlane (void) const { return zPlane; } | |
3115 double get_zPlaneN (void) const { return zPlaneN; } | |
3116 double get_xpTick (void) const { return xpTick; } | |
3117 double get_xpTickN (void) const { return xpTickN; } | |
3118 double get_ypTick (void) const { return ypTick; } | |
3119 double get_ypTickN (void) const { return ypTickN; } | |
3120 double get_zpTick (void) const { return zpTick; } | |
3121 double get_zpTickN (void) const { return zpTickN; } | |
3122 double get_x_min (void) const { return std::min (xPlane, xPlaneN); } | |
3123 double get_x_max (void) const { return std::max (xPlane, xPlaneN); } | |
3124 double get_y_min (void) const { return std::min (yPlane, yPlaneN); } | |
3125 double get_y_max (void) const { return std::max (yPlane, yPlaneN); } | |
3126 double get_z_min (void) const { return std::min (zPlane, zPlaneN); } | |
3127 double get_z_max (void) const { return std::max (zPlane, zPlaneN); } | |
3128 double get_fx (void) const { return fx; } | |
3129 double get_fy (void) const { return fy; } | |
3130 double get_fz (void) const { return fz; } | |
3131 double get_xticklen (void) const { return xticklen; } | |
3132 double get_yticklen (void) const { return yticklen; } | |
3133 double get_zticklen (void) const { return zticklen; } | |
3134 double get_xtickoffset (void) const { return xtickoffset; } | |
3135 double get_ytickoffset (void) const { return ytickoffset; } | |
3136 double get_ztickoffset (void) const { return ztickoffset; } | |
3137 bool get_x2Dtop (void) const { return x2Dtop; } | |
3138 bool get_y2Dright (void) const { return y2Dright; } | |
3139 bool get_layer2Dtop (void) const { return layer2Dtop; } | |
3140 bool get_xySym (void) const { return xySym; } | |
3141 bool get_xyzSym (void) const { return xyzSym; } | |
3142 bool get_zSign (void) const { return zSign; } | |
3143 bool get_nearhoriz (void) const { return nearhoriz; } | |
3097 | 3144 |
3098 ColumnVector pixel2coord (double px, double py) const | 3145 ColumnVector pixel2coord (double px, double py) const |
3099 { return get_transform ().untransform (px, py, (x_zlim(0)+x_zlim(1))/2); } | 3146 { return get_transform ().untransform (px, py, (x_zlim(0)+x_zlim(1))/2); } |
3100 | 3147 |
3101 ColumnVector coord2pixel (double x, double y, double z) const | 3148 ColumnVector coord2pixel (double x, double y, double z) const |
3118 Matrix x_render, x_render_inv; | 3165 Matrix x_render, x_render_inv; |
3119 Matrix x_gl_mat1, x_gl_mat2; | 3166 Matrix x_gl_mat1, x_gl_mat2; |
3120 Matrix x_zlim; | 3167 Matrix x_zlim; |
3121 std::list<octave_value> zoom_stack; | 3168 std::list<octave_value> zoom_stack; |
3122 | 3169 |
3170 // Axes layout data | |
3171 int xstate, ystate, zstate; | |
3172 double xPlane, xPlaneN, yPlane, yPlaneN, zPlane, zPlaneN; | |
3173 double xpTick, xpTickN, ypTick, ypTickN, zpTick, zpTickN; | |
3174 double fx, fy, fz; | |
3175 double xticklen, yticklen, zticklen; | |
3176 double xtickoffset, ytickoffset, ztickoffset; | |
3177 bool x2Dtop, y2Dright, layer2Dtop; | |
3178 bool xySym, xyzSym, zSign, nearhoriz; | |
3179 | |
3123 void set_text_child (handle_property& h, const std::string& who, | 3180 void set_text_child (handle_property& h, const std::string& who, |
3124 const octave_value& v); | 3181 const octave_value& v); |
3125 | 3182 |
3126 void delete_text_child (handle_property& h); | 3183 void delete_text_child (handle_property& h); |
3127 | 3184 |
3134 array_property position u , default_axes_position () | 3191 array_property position u , default_axes_position () |
3135 bool_property box , "on" | 3192 bool_property box , "on" |
3136 array_property colororder , default_colororder () | 3193 array_property colororder , default_colororder () |
3137 array_property dataaspectratio mu , Matrix (1, 3, 1.0) | 3194 array_property dataaspectratio mu , Matrix (1, 3, 1.0) |
3138 radio_property dataaspectratiomode u , "{auto}|manual" | 3195 radio_property dataaspectratiomode u , "{auto}|manual" |
3139 radio_property layer , "{bottom}|top" | 3196 radio_property layer u , "{bottom}|top" |
3140 row_vector_property xlim mu , default_lim () | 3197 row_vector_property xlim mu , default_lim () |
3141 row_vector_property ylim mu , default_lim () | 3198 row_vector_property ylim mu , default_lim () |
3142 row_vector_property zlim mu , default_lim () | 3199 row_vector_property zlim mu , default_lim () |
3143 row_vector_property clim m , default_lim () | 3200 row_vector_property clim m , default_lim () |
3144 row_vector_property alim m , default_lim () | 3201 row_vector_property alim m , default_lim () |
3182 radio_property yscale alu , "{linear}|log" | 3239 radio_property yscale alu , "{linear}|log" |
3183 radio_property zscale alu , "{linear}|log" | 3240 radio_property zscale alu , "{linear}|log" |
3184 radio_property xdir u , "{normal}|reverse" | 3241 radio_property xdir u , "{normal}|reverse" |
3185 radio_property ydir u , "{normal}|reverse" | 3242 radio_property ydir u , "{normal}|reverse" |
3186 radio_property zdir u , "{normal}|reverse" | 3243 radio_property zdir u , "{normal}|reverse" |
3187 radio_property yaxislocation , "{left}|right|zero" | 3244 radio_property yaxislocation u , "{left}|right|zero" |
3188 radio_property xaxislocation , "{bottom}|top|zero" | 3245 radio_property xaxislocation u , "{bottom}|top|zero" |
3189 array_property view u , Matrix () | 3246 array_property view u , Matrix () |
3190 bool_property __hold_all__ h , "off" | 3247 bool_property __hold_all__ h , "off" |
3191 radio_property nextplot , "new|add|replacechildren|{replace}" | 3248 radio_property nextplot , "new|add|replacechildren|{replace}" |
3192 array_property outerposition u , default_axes_outerposition () | 3249 array_property outerposition u , default_axes_outerposition () |
3193 radio_property activepositionproperty , "{outerposition}|position" | 3250 radio_property activepositionproperty , "{outerposition}|position" |
3212 double_property linewidth , 0.5 | 3269 double_property linewidth , 0.5 |
3213 radio_property minorgridlinestyle , "-|--|{:}|-.|none" | 3270 radio_property minorgridlinestyle , "-|--|{:}|-.|none" |
3214 array_property plotboxaspectratio mu , Matrix (1, 3, 1.0) | 3271 array_property plotboxaspectratio mu , Matrix (1, 3, 1.0) |
3215 radio_property plotboxaspectratiomode u , "{auto}|manual" | 3272 radio_property plotboxaspectratiomode u , "{auto}|manual" |
3216 radio_property projection , "{orthographic}|perpective" | 3273 radio_property projection , "{orthographic}|perpective" |
3217 radio_property tickdir m , "{in}|out" | 3274 radio_property tickdir mu , "{in}|out" |
3218 radio_property tickdirmode , "{auto}|manual" | 3275 radio_property tickdirmode u , "{auto}|manual" |
3219 array_property ticklength , default_axes_ticklength () | 3276 array_property ticklength , default_axes_ticklength () |
3220 array_property tightinset r , Matrix (1, 4, 0.0) | 3277 array_property tightinset r , Matrix (1, 4, 0.0) |
3221 // FIXME -- uicontextmenu should be moved here. | 3278 // FIXME -- uicontextmenu should be moved here. |
3222 radio_property units SU , "{normalized}|inches|centimeters|points|pixels|characters" | 3279 radio_property units SU , "{normalized}|inches|centimeters|points|pixels|characters" |
3223 // hidden properties for transformation computation | 3280 // hidden properties for transformation computation |
3238 private: | 3295 private: |
3239 void update_xscale (void) { sx = get_xscale (); } | 3296 void update_xscale (void) { sx = get_xscale (); } |
3240 void update_yscale (void) { sy = get_yscale (); } | 3297 void update_yscale (void) { sy = get_yscale (); } |
3241 void update_zscale (void) { sz = get_zscale (); } | 3298 void update_zscale (void) { sz = get_zscale (); } |
3242 | 3299 |
3243 void update_view (void) { update_camera (); } | 3300 void update_view (void) { update_camera (); update_axes_layout (); } |
3244 void update_dataaspectratio (void) { update_transform (); } | 3301 void update_dataaspectratio (void) { update_transform (); } |
3245 void update_dataaspectratiomode (void) { update_transform (); } | 3302 void update_dataaspectratiomode (void) { update_transform (); } |
3246 void update_plotboxaspectratio (void) { update_transform (); } | 3303 void update_plotboxaspectratio (void) { update_transform (); } |
3247 void update_plotboxaspectratiomode (void) { update_transform (); } | 3304 void update_plotboxaspectratiomode (void) { update_transform (); } |
3248 | 3305 |
3249 void update_xdir (void) { update_camera (); } | 3306 void update_layer (void) { update_axes_layout (); } |
3250 void update_ydir (void) { update_camera (); } | 3307 void update_yaxislocation (void) { update_axes_layout (); } |
3251 void update_zdir (void) { update_camera (); } | 3308 void update_xaxislocation (void) { update_axes_layout (); } |
3309 | |
3310 void update_xdir (void) { update_camera (); update_axes_layout (); } | |
3311 void update_ydir (void) { update_camera (); update_axes_layout (); } | |
3312 void update_zdir (void) { update_camera (); update_axes_layout (); } | |
3313 | |
3314 void update_ticklengths (void); | |
3315 void update_tickdir (void) { update_ticklengths (); } | |
3316 void update_tickdirmode (void) { update_ticklengths (); } | |
3252 | 3317 |
3253 void update_xtick (void) | 3318 void update_xtick (void) |
3254 { | 3319 { |
3255 if (xticklabelmode.is ("auto")) | 3320 if (xticklabelmode.is ("auto")) |
3256 calc_ticklabels (xtick, xticklabel, xscale.is ("log")); | 3321 calc_ticklabels (xtick, xticklabel, xscale.is ("log")); |
3347 | 3412 |
3348 fix_limits (xlim); | 3413 fix_limits (xlim); |
3349 | 3414 |
3350 if (do_clr_zoom) | 3415 if (do_clr_zoom) |
3351 zoom_stack.clear (); | 3416 zoom_stack.clear (); |
3417 | |
3418 update_axes_layout (); | |
3352 } | 3419 } |
3353 | 3420 |
3354 void update_ylim (bool do_clr_zoom = true) | 3421 void update_ylim (bool do_clr_zoom = true) |
3355 { | 3422 { |
3356 if (ytickmode.is ("auto")) | 3423 if (ytickmode.is ("auto")) |
3360 | 3427 |
3361 fix_limits (ylim); | 3428 fix_limits (ylim); |
3362 | 3429 |
3363 if (do_clr_zoom) | 3430 if (do_clr_zoom) |
3364 zoom_stack.clear (); | 3431 zoom_stack.clear (); |
3432 | |
3433 update_axes_layout (); | |
3365 } | 3434 } |
3366 | 3435 |
3367 void update_zlim (void) | 3436 void update_zlim (void) |
3368 { | 3437 { |
3369 if (ztickmode.is ("auto")) | 3438 if (ztickmode.is ("auto")) |
3372 calc_ticklabels (ztick, zticklabel, zscale.is ("log")); | 3441 calc_ticklabels (ztick, zticklabel, zscale.is ("log")); |
3373 | 3442 |
3374 fix_limits (zlim); | 3443 fix_limits (zlim); |
3375 | 3444 |
3376 zoom_stack.clear (); | 3445 zoom_stack.clear (); |
3446 | |
3447 update_axes_layout (); | |
3377 } | 3448 } |
3378 | 3449 |
3379 }; | 3450 }; |
3380 | 3451 |
3381 private: | 3452 private: |