97 lines
2.4 KiB
C++
97 lines
2.4 KiB
C++
//## begin module.cm preserve=no
|
|
|
|
// %X% %Q% %Z% %W%
|
|
|
|
//## end module.cm
|
|
|
|
|
|
|
|
//## begin module.cp preserve=no
|
|
|
|
//## end module.cp
|
|
|
|
|
|
|
|
//## Module: Prectangle; Pseudo Package body
|
|
|
|
//## Subsystem: Figures
|
|
|
|
//## Source file: Prctngle.cpp
|
|
|
|
|
|
|
|
//## begin module.additionalIncludes preserve=no
|
|
|
|
//## end module.additionalIncludes
|
|
|
|
|
|
|
|
//## begin module.includes preserve=yes
|
|
|
|
//## end module.includes
|
|
|
|
|
|
|
|
// Prectangle
|
|
|
|
#include "Prctngle.h"
|
|
|
|
//## begin module.additionalDeclarations preserve=yes
|
|
|
|
|
|
|
|
Persistent* Prectangle::_pobj = Persistent::addType("Prectangle", new Prectangle);
|
|
|
|
//## end module.additionalDeclarations
|
|
|
|
|
|
|
|
|
|
|
|
// Class Prectangle
|
|
|
|
|
|
|
|
Prectangle::Prectangle()
|
|
|
|
//## begin Prectangle::Prectangle%.hasinit preserve=no
|
|
|
|
//## end Prectangle::Prectangle%.hasinit
|
|
|
|
//## begin Prectangle::Prectangle%.initialization preserve=yes
|
|
|
|
//## end Prectangle::Prectangle%.initialization
|
|
|
|
{
|
|
|
|
//## begin Prectangle::Prectangle%.body preserve=yes
|
|
|
|
//## end Prectangle::Prectangle%.body
|
|
|
|
}
|
|
|
|
Prectangle::Prectangle(int x1, int y1, int x2, int y2, Color c)
|
|
|
|
{
|
|
|
|
_pobj=Persistent::addType("Prectangle", new Prectangle);
|
|
|
|
setColor(c);
|
|
|
|
setLT(x1, y1);
|
|
|
|
setRB(x2, y2);
|
|
|
|
}
|
|
|
|
Prectangle::Prectangle(const Prectangle& src)
|
|
|
|
{
|
|
|
|
Point *lt, *rb;
|
|
|
|
lt=(Point*)&src.getLT();
|
|
|
|
setLT(lt->getx(), lt->gety());
|
|
|
|
rb=(Point*)&src.getRB();
|
|
|
|
setRB(rb->getx(), rb->gety());
|
|
|
|
setColor(Figure::getColor());
|
|
|
|
}
|
|
|
|
|
|
|
|
Prectangle::~Prectangle()
|
|
|
|
{
|
|
|
|
//## begin Prectangle::~Prectangle%.body preserve=yes
|
|
|
|
//## end Prectangle::~Prectangle%.body
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//## Other Operations (implementation)
|
|
|
|
void Prectangle::archive (PStream& ps)
|
|
|
|
{
|
|
|
|
//## begin Prectangle::archive%940866981.body preserve=yes
|
|
|
|
if(ps.isSaving()){
|
|
|
|
Point LT = getLT();
|
|
|
|
Point RB = getRB();
|
|
|
|
|
|
|
|
::archive(LT,ps);
|
|
|
|
::archive(RB,ps);
|
|
|
|
int i = getColor();
|
|
|
|
::archive(i,ps);
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
Point LT, RB;
|
|
|
|
int i;
|
|
|
|
::archive(LT,ps);
|
|
|
|
setLT(LT.getx(), LT.gety());
|
|
|
|
::archive(LT,ps);
|
|
|
|
setRB(RB.getx(), RB.gety());
|
|
|
|
::archive(i,ps);
|
|
|
|
setColor(i);
|
|
|
|
}
|
|
|
|
|
|
|
|
//## end Prectangle::archive%940866981.body
|
|
|
|
}
|
|
|
|
|
|
|
|
// Additional Declarations
|
|
|
|
//## begin Prectangle.declarations preserve=yes
|
|
|
|
//## end Prectangle.declarations
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//## begin module.epilog preserve=yes
|
|
|
|
//## end module.epilog
|
|
|