1 #ifndef __SP_BOX3D_H__
2 #define __SP_BOX3D_H__
4 /*
5 * SVG <box3d> implementation
6 *
7 * Authors:
8 * Lauris Kaplinski <lauris@kaplinski.com>
9 * Maximilian Albert <Anhalter42@gmx.de>
10 *
11 * Copyright (C) 2007 Authors
12 * Copyright (C) 1999-2002 Lauris Kaplinski
13 * Copyright (C) 2000-2001 Ximian, Inc.
14 *
15 * Released under GNU GPL, read the file 'COPYING' for more information
16 */
18 #include "sp-item-group.h"
19 #include "proj_pt.h"
20 #include "axis-manip.h"
22 #define SP_TYPE_BOX3D (box3d_get_type ())
23 #define SP_BOX3D(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_BOX3D, SPBox3D))
24 #define SP_BOX3D_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SP_TYPE_BOX3D, Box3DClass))
25 #define SP_IS_BOX3D(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_BOX3D))
26 #define SP_IS_BOX3D_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SP_TYPE_BOX3D))
28 class Box3DSide;
29 class Persp3D;
30 class Persp3DReference;
32 class SPBox3D : public SPGroup {
33 public:
34 gint z_orders[6]; // z_orders[i] holds the ID of the face at position #i in the group (from top to bottom)
36 gchar *persp_href;
37 Persp3DReference *persp_ref;
39 Proj::Pt3 orig_corner0;
40 Proj::Pt3 orig_corner7;
42 Proj::Pt3 save_corner0;
43 Proj::Pt3 save_corner7;
45 Box3D::Axis swapped; // to indicate which coordinates are swapped during dragging
47 gint my_counter; // for debugging only
48 static SPBox3D * createBox3D(SPItem * parent);
49 };
51 class SPBox3DClass {
52 public:
53 SPGroupClass parent_class;
54 };
56 GType box3d_get_type (void);
58 void box3d_position_set (SPBox3D *box);
59 Proj::Pt3 box3d_get_proj_corner (SPBox3D const *box, guint id);
60 Geom::Point box3d_get_corner_screen (SPBox3D const *box, guint id, bool item_coords = true);
61 Proj::Pt3 box3d_get_proj_center (SPBox3D *box);
62 Geom::Point box3d_get_center_screen (SPBox3D *box);
64 void box3d_set_corner (SPBox3D *box, guint id, Geom::Point const &new_pos, Box3D::Axis movement, bool constrained);
65 void box3d_set_center (SPBox3D *box, Geom::Point const &new_pos, Geom::Point const &old_pos, Box3D::Axis movement, bool constrained);
66 void box3d_corners_for_PLs (const SPBox3D * box, Proj::Axis axis, Geom::Point &corner1, Geom::Point &corner2, Geom::Point &corner3, Geom::Point &corner4);
67 bool box3d_recompute_z_orders (SPBox3D *box);
68 void box3d_set_z_orders (SPBox3D *box);
70 int box3d_pt_lies_in_PL_sector (SPBox3D const *box, Geom::Point const &pt, int id1, int id2, Box3D::Axis axis);
71 int box3d_VP_lies_in_PL_sector (SPBox3D const *box, Proj::Axis vpdir, int id1, int id2, Box3D::Axis axis);
73 void box3d_relabel_corners(SPBox3D *box);
74 void box3d_check_for_swapped_coords(SPBox3D *box);
76 std::list<SPBox3D *> box3d_extract_boxes(SPObject *obj);
78 Persp3D *box3d_get_perspective(SPBox3D const *box);
79 void box3d_switch_perspectives(SPBox3D *box, Persp3D *old_persp, Persp3D *new_persp, bool recompute_corners = false);
81 SPGroup *box3d_convert_to_group(SPBox3D *box);
84 #endif /* __SP_BOX3D_H__ */
86 /*
87 Local Variables:
88 mode:c++
89 c-file-style:"stroustrup"
90 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
91 indent-tabs-mode:nil
92 fill-column:99
93 End:
94 */
95 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :