Fri, 13 Dec 2013 00:39:49 +0200
- LDObject::move is no longer virtual
src/ldtypes.cpp | file | annotate | diff | comparison | revisions | |
src/ldtypes.h | file | annotate | diff | comparison | revisions |
--- a/src/ldtypes.cpp Fri Dec 13 00:31:16 2013 +0200 +++ b/src/ldtypes.cpp Fri Dec 13 00:39:49 2013 +0200 @@ -473,59 +473,18 @@ // ============================================================================= // ----------------------------------------------------------------------------- void LDObject::move (vertex vect) -{ (void) vect; -} -void LDEmpty::move (vertex vect) -{ (void) vect; -} -void LDBFC::move (vertex vect) -{ (void) vect; -} -void LDComment::move (vertex vect) -{ (void) vect; -} -void LDError::move (vertex vect) -{ (void) vect; -} - -// ============================================================================= -// ----------------------------------------------------------------------------- -void LDVertex::move (vertex vect) -{ pos += vect; -} - -// ============================================================================= -// ----------------------------------------------------------------------------- -void LDSubfile::move (vertex vect) -{ setPosition (getPosition() + vect); -} - -// ============================================================================= -// ----------------------------------------------------------------------------- -void LDLine::move (vertex vect) -{ for (int i = 0; i < 2; ++i) - setVertex (i, getVertex (i) + vect); -} - -// ============================================================================= -// ----------------------------------------------------------------------------- -void LDTriangle::move (vertex vect) -{ for (int i = 0; i < 3; ++i) - setVertex (i, getVertex (i) + vect); -} - -// ============================================================================= -// ----------------------------------------------------------------------------- -void LDQuad::move (vertex vect) -{ for (int i = 0; i < 4; ++i) - setVertex (i, getVertex (i) + vect); -} - -// ============================================================================= -// ----------------------------------------------------------------------------- -void LDCondLine::move (vertex vect) -{ for (int i = 0; i < 4; ++i) - setVertex (i, getVertex (i) + vect); +{ if (hasMatrix()) + { LDMatrixObject* mo = dynamic_cast<LDMatrixObject*> (this); + mo->setPosition (mo->getPosition() + vect); + } + elif (getType() == LDObject::Vertex) + { // ugh + static_cast<LDVertex*> (this)->pos += vect; + } + else + { for (int i = 0; i < vertices(); ++i) + setVertex (i, getVertex (i) + vect); + } } // ============================================================================= @@ -659,10 +618,6 @@ getFileName(), getCamera(), getX(), getY(), getWidth(), getHeight()); } -void LDOverlay::move (vertex vect) -{ Q_UNUSED (vect) -} - void LDOverlay::invert() {} // =============================================================================
--- a/src/ldtypes.h Fri Dec 13 00:31:16 2013 +0200 +++ b/src/ldtypes.h Fri Dec 13 00:39:49 2013 +0200 @@ -32,7 +32,6 @@ virtual LD##T* clone() { \ return new LD##T (*this); \ } \ - virtual void move (vertex where); \ virtual void invert(); #define LDOBJ_NAME(N) virtual str getTypeName() const override { return #N; } @@ -102,7 +101,7 @@ virtual void invert(); // Inverts this object (winding is reversed) virtual bool isColored() const; // Is this object colored? virtual bool isScemantic() const; // Does this object have meaning in the part model? - virtual void move (vertex vect); // Moves this object using the given vertex as a movement List + void move (vertex vect); // Moves this object using the given vertex as a movement List LDObject* next() const; // Object after this in the current file LDObject* prev() const; // Object prior to this in the current file virtual str raw() { return ""; } // This object as LDraw code @@ -185,7 +184,7 @@ public: LDMatrixObject() : - m_Position (LDSharedVertex::getSharedVertex ({0, 0, 0})) {} + m_Position (LDSharedVertex::getSharedVertex (g_origin)) {} LDMatrixObject (const matrix& transform, const vertex& pos) : m_Transform (transform),