src/ldtypes.h

changeset 542
46a33bdc0b36
parent 541
0e38beeb050a
child 551
0efe5dbcef07
equal deleted inserted replaced
541:0e38beeb050a 542:46a33bdc0b36
178 // In 0.1-alpha, there was a separate 'radial' type which had a position and 178 // In 0.1-alpha, there was a separate 'radial' type which had a position and
179 // matrix as well. Even though right now only LDSubfile uses this, I'm keeping 179 // matrix as well. Even though right now only LDSubfile uses this, I'm keeping
180 // this class distinct in case I get new extension ideas. :) 180 // this class distinct in case I get new extension ideas. :)
181 // ============================================================================= 181 // =============================================================================
182 class LDMatrixObject 182 class LDMatrixObject
183 { PROPERTY (public, LDObject*, LinkPointer, NO_OPS, STOCK_WRITE) 183 { PROPERTY (public, LDObject*, LinkPointer, NO_OPS, STOCK_WRITE)
184 PROPERTY (public, vertex, Position, NO_OPS, CUSTOM_WRITE) 184 PROPERTY (public, matrix, Transform, NO_OPS, CUSTOM_WRITE)
185 PROPERTY (public, matrix, Transform, NO_OPS, CUSTOM_WRITE)
186 185
187 public: 186 public:
188 LDMatrixObject() {} 187 LDMatrixObject() {}
189 LDMatrixObject (const matrix& transform, const vertex& pos) : 188 LDMatrixObject (const matrix& transform, const vertex& pos) :
190 m_Transform (transform), 189 m_Transform (transform),
191 m_position (LDSharedVertex::getSharedVertex (pos)) {} 190 m_Position (LDSharedVertex::getSharedVertex (pos)) {}
192 191
193 const double& setCoordinate (const Axis ax, double value) 192 inline const vertex& getPosition() const
193 { return m_Position->data();
194 }
195
196 void setCoordinate (const Axis ax, double value)
194 { vertex v = getPosition(); 197 { vertex v = getPosition();
195 v[ax] = value; 198 v[ax] = value;
196 setPosition (v); 199 setPosition (v);
197 200 }
198 return getPosition()[ax]; 201
199 } 202 void setPosition (const vertex& a);
200 203
201 private: 204 private:
202 LDSharedVertex* m_position; 205 LDSharedVertex* m_Position;
203 }; 206 };
204 207
205 // ============================================================================= 208 // =============================================================================
206 // LDError 209 // LDError
207 // 210 //

mercurial