src/ldtypes.cpp

changeset 551
0efe5dbcef07
parent 542
46a33bdc0b36
child 553
2418d5955421
equal deleted inserted replaced
550:d97594e3fc54 551:0efe5dbcef07
144 return val; 144 return val;
145 } 145 }
146 146
147 // ============================================================================= 147 // =============================================================================
148 // ----------------------------------------------------------------------------- 148 // -----------------------------------------------------------------------------
149 str LDCndLine::raw() 149 str LDCondLine::raw()
150 { str val = fmt ("5 %1", getColor()); 150 { str val = fmt ("5 %1", getColor());
151 151
152 // Add the coordinates 152 // Add the coordinates
153 for (int i = 0; i < 4; ++i) 153 for (int i = 0; i < 4; ++i)
154 val += fmt (" %1", getVertex (i)); 154 val += fmt (" %1", getVertex (i));
282 // ============================================================================= 282 // =============================================================================
283 // ----------------------------------------------------------------------------- 283 // -----------------------------------------------------------------------------
284 static void transformObject (LDObject* obj, matrix transform, vertex pos, int 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::CondLine:
288 case LDObject::Triangle: 288 case LDObject::Triangle:
289 case LDObject::Quad: 289 case LDObject::Quad:
290 290
291 for (int 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);
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 LDCondLine::move (vertex vect)
527 { for (int 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 // =============================================================================
536 536
537 LDObject* LDObject::getDefault (const LDObject::Type type) 537 LDObject* LDObject::getDefault (const LDObject::Type type)
538 { CHECK_FOR_OBJ (Comment) 538 { CHECK_FOR_OBJ (Comment)
539 CHECK_FOR_OBJ (BFC) 539 CHECK_FOR_OBJ (BFC)
540 CHECK_FOR_OBJ (Line) 540 CHECK_FOR_OBJ (Line)
541 CHECK_FOR_OBJ (CndLine) 541 CHECK_FOR_OBJ (CondLine)
542 CHECK_FOR_OBJ (Subfile) 542 CHECK_FOR_OBJ (Subfile)
543 CHECK_FOR_OBJ (Triangle) 543 CHECK_FOR_OBJ (Triangle)
544 CHECK_FOR_OBJ (Quad) 544 CHECK_FOR_OBJ (Quad)
545 CHECK_FOR_OBJ (Empty) 545 CHECK_FOR_OBJ (Empty)
546 CHECK_FOR_OBJ (BFC) 546 CHECK_FOR_OBJ (BFC)
620 620
621 void LDLine::invert() 621 void LDLine::invert()
622 { invertLine (this); 622 { invertLine (this);
623 } 623 }
624 624
625 void LDCndLine::invert() 625 void LDCondLine::invert()
626 { invertLine (this); 626 { invertLine (this);
627 } 627 }
628 628
629 void LDVertex::invert() {} 629 void LDVertex::invert() {}
630 630
631 // ============================================================================= 631 // =============================================================================
632 // ----------------------------------------------------------------------------- 632 // -----------------------------------------------------------------------------
633 LDLine* LDCndLine::demote() 633 LDLine* LDCondLine::demote()
634 { LDLine* repl = new LDLine; 634 { LDLine* repl = new LDLine;
635 635
636 for (int i = 0; i < repl->vertices(); ++i) 636 for (int i = 0; i < repl->vertices(); ++i)
637 repl->setVertex (i, getVertex (i)); 637 repl->setVertex (i, getVertex (i));
638 638

mercurial