103 lines
2.6 KiB
C++
103 lines
2.6 KiB
C++
//## begin module.cm preserve=no
|
|
|
|
// %X% %Q% %Z% %W%
|
|
|
|
//## end module.cm
|
|
|
|
|
|
|
|
//## begin module.cp preserve=no
|
|
|
|
//## end module.cp
|
|
|
|
|
|
|
|
//## Module: Pcircle; Pseudo Package body
|
|
|
|
//## Subsystem: Figures
|
|
|
|
//## Source file: Pcircle.cpp
|
|
|
|
|
|
|
|
//## begin module.additionalIncludes preserve=no
|
|
|
|
//## end module.additionalIncludes
|
|
|
|
|
|
|
|
//## begin module.includes preserve=yes
|
|
|
|
//## end module.includes
|
|
|
|
|
|
|
|
// Pcircle
|
|
|
|
#include "Pcircle.h"
|
|
|
|
#include "PStream.h"
|
|
|
|
#include "Point.h"
|
|
|
|
//## begin module.additionalDeclarations preserve=yes
|
|
|
|
void archive(int &i, PStream &ps);
|
|
|
|
void archive(Point& i, PStream &ps);
|
|
|
|
|
|
|
|
|
|
|
|
Persistent* Pcircle::_pobj = Persistent::addType("Pcircle", new Pcircle);
|
|
|
|
// ************** GAMMAL ******************
|
|
|
|
//IMPLEMENT_PERSISTENT(Pcircle);
|
|
|
|
//## end module.additionalDeclarations
|
|
|
|
|
|
|
|
|
|
|
|
// Class Pcircle
|
|
|
|
|
|
|
|
Pcircle::~Pcircle()
|
|
|
|
{
|
|
|
|
//## begin Pcircle::~Pcircle%.body preserve=yes
|
|
|
|
//## end Pcircle::~Pcircle%.body
|
|
|
|
}
|
|
|
|
Pcircle::Pcircle(int xPos, int yPos, int _radius, Color _color)
|
|
|
|
//## begin Pcircle::Pcircle%.hasinit preserve=no
|
|
|
|
//## end Pcircle::Pcircle%.hasinit
|
|
|
|
//## begin Pcircle::Pcircle%.initialization preserve=yes
|
|
|
|
//## end Pcircle::Pcircle%.initialization
|
|
|
|
{
|
|
|
|
//## begin Pcircle::Pcircle%.body preserve=yes
|
|
|
|
// Circle::Circle(xPos, yPos, _radius, _color);
|
|
|
|
|
|
|
|
_pobj = Persistent::addType("Pcircle", new Pcircle);
|
|
|
|
setCenter(xPos, yPos);
|
|
|
|
setRad(_radius);
|
|
|
|
setColor(_color);
|
|
|
|
//## end Pcircle::Pcircle%.body
|
|
|
|
}
|
|
|
|
|
|
|
|
Pcircle::Pcircle(const Pcircle &src)
|
|
|
|
{
|
|
|
|
Point *tmp;
|
|
|
|
tmp=(Point*)&src.getCenter();
|
|
|
|
setCenter(tmp->getx(), tmp->gety());
|
|
|
|
setRad(src.getRad());
|
|
|
|
setColor(Figure::getColor());
|
|
|
|
}
|
|
|
|
//## Other Operations (implementation)
|
|
|
|
void Pcircle::archive (PStream& ps)
|
|
|
|
{
|
|
|
|
//## begin Pcircle::archive%940866975.body preserve=yes
|
|
|
|
if(ps.isSaving()){
|
|
|
|
Point c = getCenter();
|
|
|
|
if(ps.is_open())
|
|
|
|
cout << "File open... archiving " <<endl;
|
|
|
|
else
|
|
|
|
cout << "File NOT open... archiving " <<endl;
|
|
|
|
|
|
|
|
::archive(c,ps);
|
|
|
|
int i = getRad();
|
|
|
|
::archive(i,ps);
|
|
|
|
i = getColor();
|
|
|
|
::archive(i,ps);
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
Point c;
|
|
|
|
int i;
|
|
|
|
::archive(c,ps);
|
|
|
|
setCenter(c.getx(), c.gety());
|
|
|
|
::archive(i,ps);
|
|
|
|
setRad(i);
|
|
|
|
::archive(i,ps);
|
|
|
|
setColor(i);
|
|
|
|
}
|
|
|
|
//## end Pcircle::archive%940866975.body
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Additional Declarations
|
|
|
|
//## begin Pcircle.declarations preserve=yes
|
|
|
|
//## end Pcircle.declarations
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//## begin module.epilog preserve=yes
|
|
|
|
//## end module.epilog
|
|
|