75 |
75 |
76 bool LDObject::isScemantic() const |
76 bool LDObject::isScemantic() const |
77 { return false; |
77 { return false; |
78 } |
78 } |
79 |
79 |
80 str LDObject::typeName() const |
80 str LDObject::getTypeName() const |
81 { return ""; |
81 { return ""; |
82 } |
82 } |
83 |
83 |
84 short LDObject::vertices() const |
84 int LDObject::vertices() const |
85 { return 0; |
85 { return 0; |
86 } |
86 } |
87 |
87 |
88 // ============================================================================= |
88 // ============================================================================= |
89 // ----------------------------------------------------------------------------- |
89 // ----------------------------------------------------------------------------- |
279 g_LDObjects.removeOne (this); |
279 g_LDObjects.removeOne (this); |
280 } |
280 } |
281 |
281 |
282 // ============================================================================= |
282 // ============================================================================= |
283 // ----------------------------------------------------------------------------- |
283 // ----------------------------------------------------------------------------- |
284 static void transformObject (LDObject* obj, matrix transform, vertex pos, short parentcolor) |
284 static void transformObject (LDObject* obj, matrix transform, vertex pos, int parentcolor) |
285 { switch (obj->getType()) |
285 { switch (obj->getType()) |
286 { case LDObject::Line: |
286 { case LDObject::Line: |
287 case LDObject::CndLine: |
287 case LDObject::CndLine: |
288 case LDObject::Triangle: |
288 case LDObject::Triangle: |
289 case LDObject::Quad: |
289 case LDObject::Quad: |
290 |
290 |
291 for (short i = 0; i < obj->vertices(); ++i) |
291 for (int i = 0; i < obj->vertices(); ++i) |
292 { vertex v = obj->getVertex (i); |
292 { vertex v = obj->getVertex (i); |
293 v.transform (transform, pos); |
293 v.transform (transform, pos); |
294 obj->setVertex (i, v); |
294 obj->setVertex (i, v); |
295 } |
295 } |
296 |
296 |
371 assert (i == start); |
371 assert (i == start); |
372 return; |
372 return; |
373 } |
373 } |
374 |
374 |
375 objsToCompile << obj; |
375 objsToCompile << obj; |
376 objsToCompile << file->obj (target); |
376 objsToCompile << file->getObject (target); |
377 |
377 |
378 obj->swap (file->obj (target)); |
378 obj->swap (file->getObject (target)); |
379 } |
379 } |
380 |
380 |
381 removeDuplicates (objsToCompile); |
381 removeDuplicates (objsToCompile); |
382 |
382 |
383 // The objects need to be recompiled, otherwise their pick lists are left with |
383 // The objects need to be recompiled, otherwise their pick lists are left with |
388 |
388 |
389 // ============================================================================= |
389 // ============================================================================= |
390 // ----------------------------------------------------------------------------- |
390 // ----------------------------------------------------------------------------- |
391 str LDObject::typeName (LDObject::Type type) |
391 str LDObject::typeName (LDObject::Type type) |
392 { LDObject* obj = LDObject::getDefault (type); |
392 { LDObject* obj = LDObject::getDefault (type); |
393 str name = obj->typeName(); |
393 str name = obj->getTypeName(); |
394 delete obj; |
394 delete obj; |
395 return name; |
395 return name; |
396 } |
396 } |
397 |
397 |
398 // ============================================================================= |
398 // ============================================================================= |
399 // ----------------------------------------------------------------------------- |
399 // ----------------------------------------------------------------------------- |
400 str LDObject::objectListContents (const QList<LDObject*>& objs) |
400 str LDObject::describeObjects (const QList<LDObject*>& objs) |
401 { bool firstDetails = true; |
401 { bool firstDetails = true; |
402 str text = ""; |
402 str text = ""; |
403 |
403 |
404 if (objs.isEmpty()) |
404 if (objs.isEmpty()) |
405 return "nothing"; // :) |
405 return "nothing"; // :) |
450 // ----------------------------------------------------------------------------- |
450 // ----------------------------------------------------------------------------- |
451 LDObject* LDObject::next() const |
451 LDObject* LDObject::next() const |
452 { long idx = getIndex(); |
452 { long idx = getIndex(); |
453 assert (idx != -1); |
453 assert (idx != -1); |
454 |
454 |
455 if (idx == (long) file()->numObjs() - 1) |
455 if (idx == (long) file()->getObjectCount() - 1) |
456 return null; |
456 return null; |
457 |
457 |
458 return file()->obj (idx + 1); |
458 return file()->getObject (idx + 1); |
459 } |
459 } |
460 |
460 |
461 // ============================================================================= |
461 // ============================================================================= |
462 // ----------------------------------------------------------------------------- |
462 // ----------------------------------------------------------------------------- |
463 LDObject* LDObject::prev() const |
463 LDObject* LDObject::prev() const |
501 } |
501 } |
502 |
502 |
503 // ============================================================================= |
503 // ============================================================================= |
504 // ----------------------------------------------------------------------------- |
504 // ----------------------------------------------------------------------------- |
505 void LDLine::move (vertex vect) |
505 void LDLine::move (vertex vect) |
506 { for (short i = 0; i < 2; ++i) |
506 { for (int i = 0; i < 2; ++i) |
507 setVertex (i, getVertex (i) + vect); |
507 setVertex (i, getVertex (i) + vect); |
508 } |
508 } |
509 |
509 |
510 // ============================================================================= |
510 // ============================================================================= |
511 // ----------------------------------------------------------------------------- |
511 // ----------------------------------------------------------------------------- |
512 void LDTriangle::move (vertex vect) |
512 void LDTriangle::move (vertex vect) |
513 { for (short i = 0; i < 3; ++i) |
513 { for (int i = 0; i < 3; ++i) |
514 setVertex (i, getVertex (i) + vect); |
514 setVertex (i, getVertex (i) + vect); |
515 } |
515 } |
516 |
516 |
517 // ============================================================================= |
517 // ============================================================================= |
518 // ----------------------------------------------------------------------------- |
518 // ----------------------------------------------------------------------------- |
519 void LDQuad::move (vertex vect) |
519 void LDQuad::move (vertex vect) |
520 { for (short i = 0; i < 4; ++i) |
520 { for (int i = 0; i < 4; ++i) |
521 setVertex (i, getVertex (i) + vect); |
521 setVertex (i, getVertex (i) + vect); |
522 } |
522 } |
523 |
523 |
524 // ============================================================================= |
524 // ============================================================================= |
525 // ----------------------------------------------------------------------------- |
525 // ----------------------------------------------------------------------------- |
526 void LDCndLine::move (vertex vect) |
526 void LDCndLine::move (vertex vect) |
527 { for (short i = 0; i < 4; ++i) |
527 { for (int i = 0; i < 4; ++i) |
528 setVertex (i, getVertex (i) + vect); |
528 setVertex (i, getVertex (i) + vect); |
529 } |
529 } |
530 |
530 |
531 // ============================================================================= |
531 // ============================================================================= |
532 // ----------------------------------------------------------------------------- |
532 // ----------------------------------------------------------------------------- |
687 *ptr = val; |
687 *ptr = val; |
688 } |
688 } |
689 |
689 |
690 // ============================================================================= |
690 // ============================================================================= |
691 // ----------------------------------------------------------------------------- |
691 // ----------------------------------------------------------------------------- |
692 READ_ACCESSOR (short, LDObject::color) |
692 READ_ACCESSOR (int, LDObject::color) |
693 { return m_color; |
693 { return m_color; |
694 } |
694 } |
695 |
695 |
696 SET_ACCESSOR (short, LDObject::setColor) |
696 SET_ACCESSOR (int, LDObject::setColor) |
697 { changeProperty (this, &m_color, val); |
697 { changeProperty (this, &m_color, val); |
698 } |
698 } |
699 |
699 |
700 // ============================================================================= |
700 // ============================================================================= |
701 // ----------------------------------------------------------------------------- |
701 // ----------------------------------------------------------------------------- |