Code

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