-
Notifications
You must be signed in to change notification settings - Fork 0
/
gisement.cc
76 lines (48 loc) · 1.5 KB
/
gisement.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
//fichier gisement.cc, THEVENOZ Julien et MANEFF Lucas
#include <iostream>
#include <fstream>
#include <vector>
#include "geomod.h"
#include "gisement.h"
#include "constantes.h"
using namespace std;
namespace{
vector<Gisement*> gis_ptr_tab;
}
void initialize_gis_pointers(vector<Gisement>& gisement_tab){
gis_ptr_tab = vector<Gisement*> (gisement_tab.size());
if(gis_ptr_tab.size() == gisement_tab.size())
cout << "YES"<<endl;
for(size_t i(0); i<gisement_tab.size(); i++){
gis_ptr_tab[i] = &(gisement_tab[i]);
cout << gis_ptr_tab[i]->getX()<<" "<< gis_ptr_tab[i]->getY()<<" "
<<gis_ptr_tab[i]->getRad()<<" "<<gis_ptr_tab[i]->getCap()<<endl;
}
}
vector<Gisement*> getGisement_tab_ptr(){
return gis_ptr_tab;
}
double verif_capacity(Point pos){
double capacity(0);
for(auto giz : gis_ptr_tab)
if(inCircle(pos, {giz->getX(), giz->getY(),giz->getRad()}))
capacity = giz->getCap();
return capacity;
}
void extraction(Point pos){
for(auto giz : gis_ptr_tab)
if(inCircle(pos, {giz->getX(), giz->getY(),giz->getRad()}))
giz->extract_deltaR();
}
void Gisement::afficher() const{
displayCircle({center.x, center.y, rad});
double init_cap(1000*(rad/rayon_min)*(rad/rayon_min));
double ratio_actuel(capacity/init_cap);
displayDisque({center.x, center.y, ratio_actuel*rad});
}
void Gisement::save(std::ostream& fichier) const{
fichier<< center.x <<" "<< center.y <<" "<< rad <<" "<< capacity<<endl;
}
void Gisement::extract_deltaR(){
capacity = capacity - deltaR;
}