X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fbox3d.h;h=95327567960affc690885061ee79b1fb3d1949f1;hb=5209a05743e62584a7ec6afe050ffb0223f899f8;hp=33284810392fcf0d525746d4e40bdd1fbcab30dd;hpb=1e94aadbf9f0afdee8ea93a408911629badd07bd;p=inkscape.git diff --git a/src/box3d.h b/src/box3d.h index 332848103..953275679 100644 --- a/src/box3d.h +++ b/src/box3d.h @@ -1,5 +1,5 @@ -#ifndef __SP_3DBOX_H__ -#define __SP_3DBOX_H__ +#ifndef __SP_BOX3D_H__ +#define __SP_BOX3D_H__ /* * SVG implementation @@ -15,35 +15,82 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include "inkscape.h" -#include "perspective-line.h" - #include "sp-item-group.h" -#include "sp-path.h" -#include "xml/document.h" -#include "xml/repr.h" -#include "line-geometry.h" -#include "box3d-face.h" +#include "proj_pt.h" +#include "axis-manip.h" + +#define SP_TYPE_BOX3D (box3d_get_type ()) +#define SP_BOX3D(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_BOX3D, SPBox3D)) +#define SP_BOX3D_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SP_TYPE_BOX3D, Box3DClass)) +#define SP_IS_BOX3D(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_BOX3D)) +#define SP_IS_BOX3D_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SP_TYPE_BOX3D)) + +class Box3DSide; +class Persp3D; +class Persp3DReference; + +struct SPBox3D : public SPGroup { + gint z_orders[6]; // z_orders[i] holds the ID of the face at position #i in the group (from top to bottom) + gchar *persp_href; + Persp3DReference *persp_ref; -#define SP_TYPE_3DBOX (sp_3dbox_get_type ()) -#define SP_3DBOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_3DBOX, SP3DBox)) -#define SP_3DBOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SP_TYPE_3DBOX, SP3DBoxClass)) -#define SP_IS_3DBOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_3DBOX)) -#define SP_IS_3DBOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SP_TYPE_3DBOX)) + Proj::Pt3 orig_corner0; + Proj::Pt3 orig_corner7; + Proj::Pt3 save_corner0; + Proj::Pt3 save_corner7; -struct SP3DBox : public SPGroup { - Box3DFace faces[6]; + Box3D::Axis swapped; // to indicate which coordinates are swapped during dragging + + gint my_counter; // for debugging only }; -struct SP3DBoxClass { - SPGroupClass parent_class; +struct SPBox3DClass { + SPGroupClass parent_class; }; -GType sp_3dbox_get_type (void); +GType box3d_get_type (void); + +void box3d_position_set (SPBox3D *box); +Proj::Pt3 box3d_get_proj_corner (SPBox3D const *box, guint id); +NR::Point box3d_get_corner_screen (SPBox3D const *box, guint id, bool item_coords = true); +Proj::Pt3 box3d_get_proj_center (SPBox3D *box); +NR::Point box3d_get_center_screen (SPBox3D *box); + +void box3d_set_corner (SPBox3D *box, guint id, NR::Point const &new_pos, Box3D::Axis movement, bool constrained); +void box3d_set_center (SPBox3D *box, NR::Point const &new_pos, NR::Point const &old_pos, Box3D::Axis movement, bool constrained); +void box3d_corners_for_PLs (const SPBox3D * box, Proj::Axis axis, NR::Point &corner1, NR::Point &corner2, NR::Point &corner3, NR::Point &corner4); +bool box3d_recompute_z_orders (SPBox3D *box); +void box3d_set_z_orders (SPBox3D *box); + +int box3d_pt_lies_in_PL_sector (SPBox3D const *box, NR::Point const &pt, int id1, int id2, Box3D::Axis axis); +int box3d_VP_lies_in_PL_sector (SPBox3D const *box, Proj::Axis vpdir, int id1, int id2, Box3D::Axis axis); -void sp_3dbox_position_set (SP3DBoxContext &bc); -void sp_3dbox_compute_specific_corners (SP3DBoxContext *box3d_context, NR::Point &corner1, NR::Point &corner2, NR::Point &corner3, NR::Point &corner4); +void box3d_relabel_corners(SPBox3D *box); +void box3d_check_for_swapped_coords(SPBox3D *box); -#endif +void box3d_add_to_selection(SPBox3D *box); +void box3d_remove_from_selection(SPBox3D *box); +void box3d_mark_transformed(SPBox3D *box); + +std::list box3d_extract_boxes(SPObject *obj); + +Persp3D *box3d_get_perspective(SPBox3D const *box); +void box3d_switch_perspectives(SPBox3D *box, Persp3D *old_persp, Persp3D *new_persp, bool recompute_corners = false); + +SPGroup *box3d_convert_to_group(SPBox3D *box); + + +#endif /* __SP_BOX3D_H__ */ + +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :