108 lines
2.8 KiB
C++
108 lines
2.8 KiB
C++
//## begin module.cm preserve=no
|
|
|
|
// %X% %Q% %Z% %W%
|
|
|
|
//## end module.cm
|
|
|
|
|
|
|
|
//## begin module.cp preserve=no
|
|
|
|
//## end module.cp
|
|
|
|
|
|
|
|
//## Module: Rectangle; Pseudo Package body
|
|
|
|
//## Subsystem: Figures
|
|
|
|
//## Source file: Rectngle.cpp
|
|
|
|
|
|
|
|
//## begin module.additionalIncludes preserve=no
|
|
|
|
//## end module.additionalIncludes
|
|
|
|
|
|
|
|
//## begin module.includes preserve=yes
|
|
|
|
//## end module.includes
|
|
|
|
|
|
|
|
// Rectangle
|
|
|
|
#include "Rectngle.h"
|
|
|
|
//## begin module.additionalDeclarations preserve=yes
|
|
|
|
#include <iostream.h>
|
|
|
|
//## end module.additionalDeclarations
|
|
|
|
|
|
|
|
|
|
|
|
// Class Rectangle
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Rectangle::Rectangle()
|
|
|
|
//## begin Rectangle::Rectangle%.hasinit preserve=no
|
|
|
|
//## end Rectangle::Rectangle%.hasinit
|
|
|
|
//## begin Rectangle::Rectangle%.initialization preserve=yes
|
|
|
|
//## end Rectangle::Rectangle%.initialization
|
|
|
|
{
|
|
|
|
//## begin Rectangle::Rectangle%.body preserve=yes
|
|
|
|
//## end Rectangle::Rectangle%.body
|
|
|
|
}
|
|
|
|
|
|
|
|
Rectangle::Rectangle (int x1, int y1, int x2, int y2, Color color)
|
|
|
|
//## begin Rectangle::Rectangle%939623932.hasinit preserve=no
|
|
|
|
//## end Rectangle::Rectangle%939623932.hasinit
|
|
|
|
//## begin Rectangle::Rectangle%939623932.initialization preserve=yes
|
|
|
|
//## end Rectangle::Rectangle%939623932.initialization
|
|
|
|
{
|
|
|
|
//## begin Rectangle::Rectangle%939623932.body preserve=yes
|
|
|
|
setColor(color);
|
|
|
|
leftTop.setx(x1);
|
|
|
|
leftTop.sety(y1);
|
|
|
|
rightBottom.setx(x2);
|
|
|
|
rightBottom.sety(y2);
|
|
|
|
//## end Rectangle::Rectangle%939623932.body
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Rectangle::~Rectangle()
|
|
|
|
{
|
|
|
|
//## begin Rectangle::~Rectangle%.body preserve=yes
|
|
|
|
//## end Rectangle::~Rectangle%.body
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//## Other Operations (implementation)
|
|
|
|
void Rectangle::draw (Graphics &g)
|
|
|
|
{
|
|
|
|
//## begin Rectangle::draw%937398672.body preserve=yes
|
|
|
|
g.drawRectangle(leftTop, rightBottom, getColor());
|
|
|
|
//## end Rectangle::draw%937398672.body
|
|
|
|
}
|
|
|
|
|
|
|
|
void Rectangle::erase (Graphics &g)
|
|
|
|
{
|
|
|
|
//## begin Rectangle::erase%937398673.body preserve=yes
|
|
|
|
setColor(g.getBGColor());
|
|
|
|
draw(g);
|
|
|
|
//## end Rectangle::erase%937398673.body
|
|
|
|
}
|
|
|
|
|
|
|
|
Figure * Rectangle::clone ()
|
|
|
|
{
|
|
|
|
//## begin Rectangle::clone%937398684.body preserve=yes
|
|
|
|
return new Rectangle(*this);
|
|
|
|
//## end Rectangle::clone%937398684.body
|
|
|
|
}
|
|
|
|
|
|
|
|
// Additional Declarations
|
|
|
|
//## begin Rectangle.declarations preserve=yes
|
|
|
|
//## end Rectangle.declarations
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//## begin module.epilog preserve=yes
|
|
|
|
//## end module.epilog
|
|
|
|
|
|
|
|
|
|
|
|
// Detached code regions:
|
|
|
|
// WARNING: this code will be lost if code is regenerated.
|
|
|
|
#if 0
|
|
|
|
//## begin Rectangle::setColor%939797855.body preserve=no
|
|
|
|
color=src;
|
|
|
|
//## end Rectangle::setColor%939797855.body
|
|
|
|
|
|
|
|
//## begin Rectangle::getColor%939797856.body preserve=no
|
|
|
|
return color;
|
|
|
|
//## end Rectangle::getColor%939797856.body
|
|
|
|
|
|
|
|
#endif
|
|
|