62 lines
1.2 KiB
C++
62 lines
1.2 KiB
C++
//#
|
|
|
|
//# main.c
|
|
|
|
//#
|
|
|
|
//# =======================================================
|
|
|
|
//# Lab i Avacerad C++
|
|
|
|
//# 4. Figures
|
|
|
|
//#
|
|
|
|
//#
|
|
|
|
//# Christian Ohlsson
|
|
|
|
//# Daniel Alfredsson
|
|
|
|
//# Karlstads universitet
|
|
|
|
//# 991013
|
|
|
|
//# =======================================================
|
|
|
|
|
|
|
|
|
|
|
|
#include <iostream.h>
|
|
|
|
#include "Graphic\Graphics.h"
|
|
|
|
#include "line.h"
|
|
|
|
#include "rectngle.h"
|
|
|
|
#include "circle.h"
|
|
|
|
#include "flist.h"
|
|
|
|
#include "CmplxFgr.h"
|
|
|
|
|
|
|
|
void main(void) {
|
|
|
|
ComplexFigure cf;
|
|
|
|
FList myList;
|
|
|
|
Graphics g;
|
|
|
|
|
|
|
|
Line l(0,0,0,10, 9);
|
|
|
|
l.add(20,20);
|
|
|
|
|
|
|
|
Rectangle r(5,5,25,25,8);
|
|
|
|
Circle c(100, 100, 50, 14);
|
|
|
|
|
|
|
|
cf.add(FigureHolder(c));
|
|
|
|
cf.add(FigureHolder(l));
|
|
|
|
|
|
|
|
myList.add(0,FigureHolder(l));
|
|
|
|
myList.add(1,FigureHolder(r));
|
|
|
|
myList.add(2,FigureHolder(c));
|
|
|
|
myList.add(3,FigureHolder(cf));
|
|
|
|
|
|
|
|
cout <<"\n1";
|
|
|
|
for(int i = 0; i < myList.getSize(); i++) {
|
|
|
|
FigureHolder fh = myList.getItem(i);
|
|
|
|
Figure* f = fh.getFigure();
|
|
|
|
f->draw(g);
|
|
|
|
}
|
|
|
|
l.erase(g);
|
|
|
|
r.erase(g);
|
|
|
|
c.erase(g);
|
|
|
|
|
|
|
|
cout <<"\n2";
|
|
|
|
for(i = 0; i < myList.getSize(); i++) {
|
|
|
|
FigureHolder fh = myList.getItem(i);
|
|
|
|
Figure* f = fh.getFigure();
|
|
|
|
f->draw(g);
|
|
|
|
}
|
|
|
|
char x;
|
|
|
|
cin >> x;
|
|
|
|
}
|
|
|