diff options
| author | Maximilian Albert <maximilian.albert@gmail.com> | 2007-08-06 06:25:56 +0000 |
|---|---|---|
| committer | cilix42 <cilix42@users.sourceforge.net> | 2007-08-06 06:25:56 +0000 |
| commit | c72ae0d4195889e19861f0e814cb237d7a623097 (patch) | |
| tree | 8ec5f4c752623bb5dd2ecaf83c7af7012d6abaa9 /src/perspective3d.cpp | |
| parent | updated translation into Russian (diff) | |
| download | inkscape-c72ae0d4195889e19861f0e814cb237d7a623097.tar.gz inkscape-c72ae0d4195889e19861f0e814cb237d7a623097.zip | |
Preparatory stuff to combine VPs in draggers
(bzr r3387)
Diffstat (limited to 'src/perspective3d.cpp')
| -rw-r--r-- | src/perspective3d.cpp | 41 |
1 files changed, 31 insertions, 10 deletions
diff --git a/src/perspective3d.cpp b/src/perspective3d.cpp index 1ad910bfa..27366e564 100644 --- a/src/perspective3d.cpp +++ b/src/perspective3d.cpp @@ -61,18 +61,32 @@ perspective_line_snap (NR::Point line_pt, Box3D::Axis dir, NR::Point ext_pt, Per Perspective3D::Perspective3D (VanishingPoint const &pt_x, VanishingPoint const &pt_y, VanishingPoint const &pt_z) : desktop (NULL), - vp_x (pt_x), - vp_y (pt_y), - vp_z (pt_z), boxes (NULL) { + vp_x = new VanishingPoint (pt_x); + vp_y = new VanishingPoint (pt_y); + vp_z = new VanishingPoint (pt_z); } +Perspective3D::Perspective3D (Perspective3D &other) + : desktop (other.desktop), + boxes (NULL) // FIXME: Should we add an option to copy the list of boxes? +{ + vp_x = new VanishingPoint (*other.vp_x); + vp_y = new VanishingPoint (*other.vp_y); + vp_z = new VanishingPoint (*other.vp_z); +} + + Perspective3D::~Perspective3D () { g_assert (desktop != NULL); desktop->remove_perspective (this); + delete vp_x; + delete vp_y; + delete vp_z; + g_slist_free (boxes); } @@ -80,16 +94,23 @@ Perspective3D::~Perspective3D () VanishingPoint * Perspective3D::get_vanishing_point (Box3D::Axis const dir) { - // FIXME: Also handle value 'NONE' in switch switch (dir) { case X: - return &vp_x; + return vp_x; break; case Y: - return &vp_y; + return vp_y; break; case Z: - return &vp_z; + return vp_z; + break; + case NONE: + g_warning ("Axis direction must be specified. As a workaround we return the VP in X direction.\n"); + return vp_x; + break; + default: + g_warning ("Single axis direction needed to determine corresponding vanishing point.\n"); + return get_vanishing_point (extract_first_axis_direction(dir)); break; } } @@ -99,13 +120,13 @@ Perspective3D::set_vanishing_point (Box3D::Axis const dir, VanishingPoint const { switch (dir) { case X: - vp_x = pt; + (*vp_x) = pt; break; case Y: - vp_y = pt; + (*vp_y) = pt; break; case Z: - vp_z = pt; + (*vp_z) = pt; break; case NONE: // no vanishing point to set |
