first commit
This commit is contained in:
120
Lab6/line.cpp
Normal file
120
Lab6/line.cpp
Normal file
@@ -0,0 +1,120 @@
|
||||
//## begin module.cm preserve=no
|
||||
|
||||
// %X% %Q% %Z% %W%
|
||||
|
||||
//## end module.cm
|
||||
|
||||
|
||||
|
||||
//## begin module.cp preserve=no
|
||||
|
||||
//## end module.cp
|
||||
|
||||
|
||||
|
||||
//## Module: Line; Pseudo Package body
|
||||
|
||||
//## Subsystem: Figures
|
||||
|
||||
//## Source file: Line.cpp
|
||||
|
||||
|
||||
|
||||
//## begin module.additionalIncludes preserve=no
|
||||
|
||||
//## end module.additionalIncludes
|
||||
|
||||
|
||||
|
||||
//## begin module.includes preserve=yes
|
||||
|
||||
//## end module.includes
|
||||
|
||||
|
||||
|
||||
// Line
|
||||
|
||||
#include "Line.h"
|
||||
|
||||
//## begin module.additionalDeclarations preserve=yes
|
||||
|
||||
#include <iostream.h>
|
||||
|
||||
//## end module.additionalDeclarations
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Class Line
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Line::Line (int x1, int y1, int x2, int y2, Color color)
|
||||
|
||||
//## begin Line::Line%939623930.hasinit preserve=no
|
||||
|
||||
//## end Line::Line%939623930.hasinit
|
||||
|
||||
//## begin Line::Line%939623930.initialization preserve=yes
|
||||
|
||||
//## end Line::Line%939623930.initialization
|
||||
|
||||
{
|
||||
|
||||
//## begin Line::Line%939623930.body preserve=yes
|
||||
|
||||
setColor(color);
|
||||
|
||||
|
||||
|
||||
Point start, end;
|
||||
|
||||
start.setx(x1);
|
||||
|
||||
start.sety(y1);
|
||||
|
||||
end.setx(x2);
|
||||
|
||||
end.sety(y2);
|
||||
|
||||
myPoints.add(myPoints.getSize(), start);
|
||||
|
||||
myPoints.add(myPoints.getSize(), end);
|
||||
|
||||
//## end Line::Line%939623930.body
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Line::~Line()
|
||||
|
||||
{
|
||||
|
||||
//## begin Line::~Line%.body preserve=yes
|
||||
|
||||
//## end Line::~Line%.body
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//## Other Operations (implementation)
|
||||
|
||||
void Line::draw (Graphics &g)
|
||||
|
||||
{
|
||||
|
||||
//## begin Line::draw%937398668.body preserve=yes
|
||||
|
||||
Point start,end;
|
||||
|
||||
Reference in New Issue
Block a user