summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b2dfb57)
raw | patch | inline | side by side (parent: b2dfb57)
author | cilix42 <cilix42@users.sourceforge.net> | |
Mon, 6 Aug 2007 07:10:50 +0000 (07:10 +0000) | ||
committer | cilix42 <cilix42@users.sourceforge.net> | |
Mon, 6 Aug 2007 07:10:50 +0000 (07:10 +0000) |
diff --git a/src/box3d-context.cpp b/src/box3d-context.cpp
index c82728c9760131f0f4826609aa96d27baefe3b32..7490875934d780354a9fb959444d096584bf1f24 100644 (file)
--- a/src/box3d-context.cpp
+++ b/src/box3d-context.cpp
@@ -429,6 +429,11 @@ static gint sp_3dbox_context_root_handler(SPEventContext *event_context, GdkEven
ret = TRUE;
break;
+ case GDK_I:
+ Box3D::Perspective3D::print_debugging_info();
+ ret = true;
+ break;
+
case GDK_x:
case GDK_X:
if (MOD__ALT_ONLY) {
diff --git a/src/box3d.cpp b/src/box3d.cpp
index 44b2c9bbef9ab2ec697da06dbee636f83ed3e56d..fbf7fb15d82c169cc1bf7eb59d0c8184eba67af7 100644 (file)
--- a/src/box3d.cpp
+++ b/src/box3d.cpp
static SPGroupClass *parent_class;
+static gint counter = 0;
+
GType
sp_3dbox_get_type(void)
{
SP3DBox *box = SP_3DBOX (object);
+ box->my_counter = counter++;
+
if (repr->attribute ("inkscape:perspective") == NULL) {
// we are creating a new box; link it to the current perspective
Box3D::Perspective3D::current_perspective->add_box (box);
diff --git a/src/box3d.h b/src/box3d.h
index 1b40afa760ea79de7f53296879ee9ca928a17806..d72c6eb9c8900c66dc48aea14bb9bb7f32933fe3 100644 (file)
--- a/src/box3d.h
+++ b/src/box3d.h
double ratio_x;
double ratio_y;
double ratio_z;
+
+ gint my_counter; // for testing only
};
struct SP3DBoxClass {
diff --git a/src/perspective3d.cpp b/src/perspective3d.cpp
index d4990fd397b5b99ad9d8c5b901dfd0b15c2e943e..8188a1ed2f8335f16249b218e11f6aec7f12161d 100644 (file)
--- a/src/perspective3d.cpp
+++ b/src/perspective3d.cpp
namespace Box3D {
+gint Perspective3D::counter = 0;
+
Perspective3D *
get_persp_of_box (const SP3DBox *box)
{
vp_x = new VanishingPoint (pt_x);
vp_y = new VanishingPoint (pt_y);
vp_z = new VanishingPoint (pt_z);
+
+ my_counter = Perspective3D::counter++;
}
Perspective3D::Perspective3D (Perspective3D &other)
vp_x = new VanishingPoint (*other.vp_x);
vp_y = new VanishingPoint (*other.vp_y);
vp_z = new VanishingPoint (*other.vp_z);
+
+ my_counter = Perspective3D::counter++;
}
}
***/
+void
+Perspective3D::print_debugging_info ()
+{
+ g_print ("====================================================\n");
+ SPDesktop *desktop = inkscape_active_desktop();
+ for (GSList *i = desktop->perspectives; i != NULL; i = i->next) {
+ Perspective3D *persp = (Perspective3D *) i->data;
+ g_print ("Perspective %d:\n", persp->my_counter);
+ //g_print ("Perspective:\n");
+
+ VanishingPoint * vp = persp->get_vanishing_point(Box3D::X);
+ g_print (" VP X: (%f,%f) ", (*vp)[NR::X], (*vp)[NR::Y]);
+ g_print ((vp->is_finite()) ? "(finite)\n" : "(infinite)\n");
+
+ vp = persp->get_vanishing_point(Box3D::Y);
+ g_print (" VP Y: (%f,%f) ", (*vp)[NR::X], (*vp)[NR::Y]);
+ g_print ((vp->is_finite()) ? "(finite)\n" : "(infinite)\n");
+
+ vp = persp->get_vanishing_point(Box3D::Z);
+ g_print (" VP Z: (%f,%f) ", (*vp)[NR::X], (*vp)[NR::Y]);
+ g_print ((vp->is_finite()) ? "(finite)\n" : "(infinite)\n");
+
+ g_print ("\nBoxes: ");
+ if (persp->boxes == NULL) {
+ g_print ("none");
+ } else {
+ GSList *j;
+ for (j = persp->boxes; j != NULL; j = j->next) {
+ if (j->next == NULL) break;
+ g_print ("%d, ", SP_3DBOX (j->data)->my_counter);
+ }
+ if (j != NULL) {
+ g_print ("%d", SP_3DBOX (j->data)->my_counter);
+ }
+ }
+ }
+ g_print ("\n====================================================\n");
+}
+
} // namespace Box3D
/*
diff --git a/src/perspective3d.h b/src/perspective3d.h
index 2cffd3419cbd0c20d2295f30a84f0bd353423e6e..4211c7b3b36dd07afc50b3820f555132d2df5ad1 100644 (file)
--- a/src/perspective3d.h
+++ b/src/perspective3d.h
void reshape_boxes (Box3D::Axis axes);
void update_box_reprs ();
+ static gint counter; // for testing only
+ gint my_counter; // for testing only
+
+ static void print_debugging_info();
static Perspective3D * current_perspective; // should current_perspective be moved to desktop.h?
SPDesktop * desktop; // we need to store the perspective's desktop to be able to access it in the destructor