356:08398f57aba3 | 357:9c954c222996 |
---|---|
32 return new LD##T (*this); \ | 32 return new LD##T (*this); \ |
33 } \ | 33 } \ |
34 virtual void move (vertex vVector); \ | 34 virtual void move (vertex vVector); \ |
35 virtual void invert (); | 35 virtual void invert (); |
36 | 36 |
37 #define LDOBJ_VERTICES(V) virtual short vertices () const { return V; } | 37 #define LDOBJ_NAME( N ) virtual str typeName() const { return #N; } |
38 #define LDOBJ_SETCOLORED(V) virtual bool isColored () const { return V; } | 38 #define LDOBJ_VERTICES( V ) virtual short vertices() const { return V; } |
39 #define LDOBJ_COLORED LDOBJ_SETCOLORED (true) | 39 #define LDOBJ_SETCOLORED( V ) virtual bool isColored() const { return V; } |
40 #define LDOBJ_UNCOLORED LDOBJ_SETCOLORED (false) | 40 #define LDOBJ_COLORED LDOBJ_SETCOLORED( true ) |
41 | 41 #define LDOBJ_UNCOLORED LDOBJ_SETCOLORED( false ) |
42 #define LDOBJ_CUSTOM_SCEMANTIC virtual bool isScemantic () const | 42 |
43 #define LDOBJ_SCEMANTIC LDOBJ_CUSTOM_SCEMANTIC { return true; } | 43 #define LDOBJ_CUSTOM_SCEMANTIC virtual bool isScemantic() const |
44 #define LDOBJ_NON_SCEMANTIC LDOBJ_CUSTOM_SCEMANTIC { return false; } | 44 #define LDOBJ_SCEMANTIC LDOBJ_CUSTOM_SCEMANTIC { return true; } |
45 | 45 #define LDOBJ_NON_SCEMANTIC LDOBJ_CUSTOM_SCEMANTIC { return false; } |
46 #define LDOBJ_SETMATRIX(V) virtual bool hasMatrix () const { return V; } | 46 |
47 #define LDOBJ_HAS_MATRIX LDOBJ_SETMATRIX (true) | 47 #define LDOBJ_SETMATRIX(V) virtual bool hasMatrix() const { return V; } |
48 #define LDOBJ_NO_MATRIX LDOBJ_SETMATRIX (false) | 48 #define LDOBJ_HAS_MATRIX LDOBJ_SETMATRIX( true ) |
49 #define LDOBJ_NO_MATRIX LDOBJ_SETMATRIX( false ) | |
49 | 50 |
50 class QListWidgetItem; | 51 class QListWidgetItem; |
51 class LDSubfile; | 52 class LDSubfile; |
52 | 53 |
53 // ============================================================================= | 54 // ============================================================================= |
151 virtual bool isColored () const { return false; } | 152 virtual bool isColored () const { return false; } |
152 | 153 |
153 // Does this object have meaning in the part model? | 154 // Does this object have meaning in the part model? |
154 virtual bool isScemantic () const { return false; } | 155 virtual bool isScemantic () const { return false; } |
155 | 156 |
157 // Type name of this object | |
158 virtual str typeName() const { return "unknown"; } | |
159 static str typeName( LDObject::Type type ); | |
160 | |
156 // Returns a sample object by the given value | 161 // Returns a sample object by the given value |
157 static LDObject* getDefault (const LDObject::Type type); | 162 static LDObject* getDefault (const LDObject::Type type); |
158 | 163 |
159 static void moveObjects (vector<LDObject*> objs, const bool bUp); | 164 static void moveObjects (vector<LDObject*> objs, const bool bUp); |
160 static str objectListContents (const vector<LDObject*>& objs); | 165 static str objectListContents (const vector<LDObject*>& objs); |
188 // zContent contains the contents of the unparsable line. | 193 // zContent contains the contents of the unparsable line. |
189 // ============================================================================= | 194 // ============================================================================= |
190 class LDGibberish : public LDObject { | 195 class LDGibberish : public LDObject { |
191 public: | 196 public: |
192 LDOBJ (Gibberish) | 197 LDOBJ (Gibberish) |
198 LDOBJ_NAME( error ) | |
193 LDOBJ_VERTICES (0) | 199 LDOBJ_VERTICES (0) |
194 LDOBJ_UNCOLORED | 200 LDOBJ_UNCOLORED |
195 LDOBJ_SCEMANTIC | 201 LDOBJ_SCEMANTIC |
196 LDOBJ_NO_MATRIX | 202 LDOBJ_NO_MATRIX |
197 | 203 |
226 // the text of the comment. | 232 // the text of the comment. |
227 // ============================================================================= | 233 // ============================================================================= |
228 class LDComment : public LDObject { | 234 class LDComment : public LDObject { |
229 public: | 235 public: |
230 LDOBJ (Comment) | 236 LDOBJ (Comment) |
237 LDOBJ_NAME( comment ) | |
231 LDOBJ_VERTICES (0) | 238 LDOBJ_VERTICES (0) |
232 LDOBJ_UNCOLORED | 239 LDOBJ_UNCOLORED |
233 LDOBJ_NON_SCEMANTIC | 240 LDOBJ_NON_SCEMANTIC |
234 LDOBJ_NO_MATRIX | 241 LDOBJ_NO_MATRIX |
235 | 242 |
248 class LDBFC : public LDObject { | 255 class LDBFC : public LDObject { |
249 public: | 256 public: |
250 enum Type { CertifyCCW, CCW, CertifyCW, CW, NoCertify, InvertNext, NumStatements }; | 257 enum Type { CertifyCCW, CCW, CertifyCW, CW, NoCertify, InvertNext, NumStatements }; |
251 | 258 |
252 LDOBJ (BFC) | 259 LDOBJ (BFC) |
260 LDOBJ_NAME( bfc ) | |
253 LDOBJ_VERTICES (0) | 261 LDOBJ_VERTICES (0) |
254 LDOBJ_UNCOLORED | 262 LDOBJ_UNCOLORED |
255 LDOBJ_CUSTOM_SCEMANTIC { return (type == InvertNext); } | 263 LDOBJ_CUSTOM_SCEMANTIC { return (type == InvertNext); } |
256 LDOBJ_NO_MATRIX | 264 LDOBJ_NO_MATRIX |
257 | 265 |
272 class LDSubfile : public LDObject, public LDMatrixObject { | 280 class LDSubfile : public LDObject, public LDMatrixObject { |
273 PROPERTY (LDOpenFile*, fileInfo, setFileInfo) | 281 PROPERTY (LDOpenFile*, fileInfo, setFileInfo) |
274 | 282 |
275 public: | 283 public: |
276 LDOBJ (Subfile) | 284 LDOBJ (Subfile) |
285 LDOBJ_NAME( subfile ) | |
277 LDOBJ_VERTICES (0) | 286 LDOBJ_VERTICES (0) |
278 LDOBJ_COLORED | 287 LDOBJ_COLORED |
279 LDOBJ_SCEMANTIC | 288 LDOBJ_SCEMANTIC |
280 LDOBJ_HAS_MATRIX | 289 LDOBJ_HAS_MATRIX |
281 | 290 |
296 // set. | 305 // set. |
297 // ============================================================================= | 306 // ============================================================================= |
298 class LDLine : public LDObject { | 307 class LDLine : public LDObject { |
299 public: | 308 public: |
300 LDOBJ (Line) | 309 LDOBJ (Line) |
310 LDOBJ_NAME( line ) | |
301 LDOBJ_VERTICES (2) | 311 LDOBJ_VERTICES (2) |
302 LDOBJ_COLORED | 312 LDOBJ_COLORED |
303 LDOBJ_SCEMANTIC | 313 LDOBJ_SCEMANTIC |
304 LDOBJ_NO_MATRIX | 314 LDOBJ_NO_MATRIX |
305 | 315 |
314 // inherited from LDLine, c0 and c1 are the control points of this line. | 324 // inherited from LDLine, c0 and c1 are the control points of this line. |
315 // ============================================================================= | 325 // ============================================================================= |
316 class LDCondLine : public LDLine { | 326 class LDCondLine : public LDLine { |
317 public: | 327 public: |
318 LDOBJ (CondLine) | 328 LDOBJ (CondLine) |
329 LDOBJ_NAME( condline ) | |
319 LDOBJ_VERTICES (4) | 330 LDOBJ_VERTICES (4) |
320 LDOBJ_COLORED | 331 LDOBJ_COLORED |
321 LDOBJ_SCEMANTIC | 332 LDOBJ_SCEMANTIC |
322 LDOBJ_NO_MATRIX | 333 LDOBJ_NO_MATRIX |
323 | 334 |
333 // triangle is colored with. | 344 // triangle is colored with. |
334 // ============================================================================= | 345 // ============================================================================= |
335 class LDTriangle : public LDObject { | 346 class LDTriangle : public LDObject { |
336 public: | 347 public: |
337 LDOBJ (Triangle) | 348 LDOBJ (Triangle) |
349 LDOBJ_NAME( triangle ) | |
338 LDOBJ_VERTICES (3) | 350 LDOBJ_VERTICES (3) |
339 LDOBJ_COLORED | 351 LDOBJ_COLORED |
340 LDOBJ_SCEMANTIC | 352 LDOBJ_SCEMANTIC |
341 LDOBJ_NO_MATRIX | 353 LDOBJ_NO_MATRIX |
342 | 354 |
355 // of the quad, dColor is the color used for the quad. | 367 // of the quad, dColor is the color used for the quad. |
356 // ============================================================================= | 368 // ============================================================================= |
357 class LDQuad : public LDObject { | 369 class LDQuad : public LDObject { |
358 public: | 370 public: |
359 LDOBJ (Quad) | 371 LDOBJ (Quad) |
372 LDOBJ_NAME( quad ) | |
360 LDOBJ_VERTICES (4) | 373 LDOBJ_VERTICES (4) |
361 LDOBJ_COLORED | 374 LDOBJ_COLORED |
362 LDOBJ_SCEMANTIC | 375 LDOBJ_SCEMANTIC |
363 LDOBJ_NO_MATRIX | 376 LDOBJ_NO_MATRIX |
364 | 377 |
377 // finished parts. | 390 // finished parts. |
378 // ============================================================================= | 391 // ============================================================================= |
379 class LDVertex : public LDObject { | 392 class LDVertex : public LDObject { |
380 public: | 393 public: |
381 LDOBJ (Vertex) | 394 LDOBJ (Vertex) |
395 LDOBJ_NAME( vertex ) | |
382 LDOBJ_VERTICES (0) // TODO: move pos to vaCoords[0] | 396 LDOBJ_VERTICES (0) // TODO: move pos to vaCoords[0] |
383 LDOBJ_COLORED | 397 LDOBJ_COLORED |
384 LDOBJ_NON_SCEMANTIC | 398 LDOBJ_NON_SCEMANTIC |
385 LDOBJ_NO_MATRIX | 399 LDOBJ_NO_MATRIX |
386 | 400 |
397 // ============================================================================= | 411 // ============================================================================= |
398 class LDOverlay : public LDObject | 412 class LDOverlay : public LDObject |
399 { | 413 { |
400 public: | 414 public: |
401 LDOBJ( Overlay ) | 415 LDOBJ( Overlay ) |
416 LDOBJ_NAME( overlay ) | |
402 LDOBJ_VERTICES( 0 ) | 417 LDOBJ_VERTICES( 0 ) |
403 LDOBJ_UNCOLORED | 418 LDOBJ_UNCOLORED |
404 LDOBJ_NON_SCEMANTIC | 419 LDOBJ_NON_SCEMANTIC |
405 LDOBJ_NO_MATRIX | 420 LDOBJ_NO_MATRIX |
406 PROPERTY( int, camera, setCamera ) | 421 PROPERTY( int, camera, setCamera ) |
409 PROPERTY( int, width, setWidth ) | 424 PROPERTY( int, width, setWidth ) |
410 PROPERTY( int, height, setHeight ) | 425 PROPERTY( int, height, setHeight ) |
411 PROPERTY( str, filename, setFilename ) | 426 PROPERTY( str, filename, setFilename ) |
412 }; | 427 }; |
413 | 428 |
414 // ============================================================================= | |
415 // Object type names. Pass the return value of getType as the index to get a | |
416 // string representation of the object's type. | |
417 extern const char* g_saObjTypeNames[]; | |
418 | |
419 // Icons for these types | |
420 extern const char* g_saObjTypeIcons[]; | |
421 | |
422 #endif // LDTYPES_H | 429 #endif // LDTYPES_H |