Skip to content
Snippets Groups Projects
Commit f815b04d authored by Lucas Philippe's avatar Lucas Philippe
Browse files

ajout readme et clean

parent 61d3b9fb
Branches main
No related tags found
No related merge requests found
...@@ -8,4 +8,6 @@ Le dossier `TP1` comprend le TP1 et le TP2 (expérience contrôlée). ...@@ -8,4 +8,6 @@ Le dossier `TP1` comprend le TP1 et le TP2 (expérience contrôlée).
Le dossier `TP3` comprend l'analyse des résultats. Le dossier `TP3` comprend l'analyse des résultats.
Le dossier `TP4` comprend le TP "Technique d'entrée de texte". Le dossier `TP4` comprend le TP "Technique d'entrée de texte".
\ No newline at end of file
Le dossier `TP5` comprend le TP "Visualisation".
\ No newline at end of file
# Visualisation processing # Visualisation processing
## TP1 ## Première paartie
**Enoncé du tp : http://malacria.com/teachings/RVA/visualisation/tpvisu1.html** **Enoncé du tp : http://malacria.com/teachings/RVA/visualisation/tpvisu1.html**
## TP2 ## Deuxième partie
**Enoncé du tp : http://malacria.com/teachings/RVA/visualisation/tpvisu2.html** **Enoncé du tp : http://malacria.com/teachings/RVA/visualisation/tpvisu2.html**
### Définir les marques ### Définir les marques
Nous choisisons les attributs "population" et "altiteude" pour encoder visuellement les villes. Voici comment nous pourrions associer une variable rétinienne à chaque attribut : Nous choisisons les attributs "population" et "altitude" pour encoder visuellement les villes. Voici comment nous pourrions associer une variable rétinienne à chaque attribut :
- Population : la variable rétinienne associée à la population sera la taille du marqueur. Ainsi, une ville avec une population plus élevée aurait une marque plus grande qu'une ville avec une population plus faible. - Population : la variable rétinienne associée à la population sera la taille du marqueur. Ainsi, une ville avec une population plus élevée aurait une marque plus grande qu'une ville avec une population plus faible.
- Altitude : la variable rétinienne associée à l'altitude sera la couleur du marqueur. Par exemple, les villes ayant une altitude plus élevée seront représentées par des marqueurs jaunes à rouge, tandis que les villes ayant une altitude plus basse seront représentées par des marqueurs bleus. - Altitude : la variable rétinienne associée à l'altitude sera la couleur du marqueur. Par exemple, les villes ayant une altitude plus élevée seront représentées par des marqueurs jaunes à rouge, tandis que les villes ayant une altitude plus basse seront représentées par des marqueurs bleus.
On met en place aussi un histogramme des valeurs de population, c'est-à-dire le nombre de valeurs appartenant à chaque intervalle de l'axe afin d'améliorer la visualisation des données. On met en place aussi un histogramme des valeurs de population, c'est-à-dire le nombre de valeurs appartenant à chaque intervalle de l'axe afin d'améliorer la visualisation des données.
\ No newline at end of file
## Troisième partie
**Enoncé du tp : http://malacria.com/teachings/RVA/visualisation/tpvisu3.html**
Je me suis arrêté juste avant la 10eme partie.
\ No newline at end of file
class City { class City {
int postalcode; int postalcode;
String name; String name;
float x; float x;
...@@ -10,7 +10,6 @@ class City { ...@@ -10,7 +10,6 @@ class City {
boolean isHighlighted=false; boolean isHighlighted=false;
boolean isClicked=false; boolean isClicked=false;
// put a drawing function in here and call from main drawing loop }
public City(String postalcode, String name, float x, float y, float population, float surface, float altitude) { public City(String postalcode, String name, float x, float y, float population, float surface, float altitude) {
this.postalcode = Integer.parseInt(postalcode); this.postalcode = Integer.parseInt(postalcode);
this.name = name; this.name = name;
...@@ -22,22 +21,16 @@ class City { ...@@ -22,22 +21,16 @@ class City {
} }
void draw() { void draw() {
//map the altitude to the color in porcentage
float porcentageAlt = map(this.altitude, minAltitude, maxAltitude, 0, 100); float porcentageAlt = map(this.altitude, minAltitude, maxAltitude, 0, 100);
float hue = getColorForAltitude(porcentageAlt); float hue = getColorForAltitude(porcentageAlt);
// Set marker size based on populationxxxx
radius=map(this.population, minPopulation, maxPopulation, 3, 100); radius=map(this.population, minPopulation, maxPopulation, 3, 100);
// Draw marker
float alpha = 80; float alpha = 80;
if(isHighlighted){ if(isHighlighted){
alpha=255; alpha=255;
} }
fill(hue, 100, 100, alpha); fill(hue, 100, 100, alpha);
ellipse(x, y, radius, radius); ellipse(x, y, radius, radius);
// Draw city name
if (isHighlighted) { if (isHighlighted) {
textSize(16); textSize(16);
textAlign(LEFT, CENTER); textAlign(LEFT, CENTER);
......
...@@ -32,7 +32,6 @@ void drawAltitudeLegend(float minVal, float maxVal, float x, float y, float w, f ...@@ -32,7 +32,6 @@ void drawAltitudeLegend(float minVal, float maxVal, float x, float y, float w, f
} }
void drawDistributionPopulationLegend(int minPopulation, int maxPopulation, float x, float y, float width, float height, int numberOfDiv, float[] populationValues) { void drawDistributionPopulationLegend(int minPopulation, int maxPopulation, float x, float y, float width, float height, int numberOfDiv, float[] populationValues) {
// Calcul de l'histogramme
int[] histogram = new int[numberOfDiv]; int[] histogram = new int[numberOfDiv];
for (int i = 0; i < populationValues.length; i++) { for (int i = 0; i < populationValues.length; i++) {
int val = (int) map(populationValues[i], minPopulation, maxPopulation, 0, numberOfDiv); int val = (int) map(populationValues[i], minPopulation, maxPopulation, 0, numberOfDiv);
...@@ -61,8 +60,6 @@ void drawDistributionPopulationLegend(int minPopulation, int maxPopulation, floa ...@@ -61,8 +60,6 @@ void drawDistributionPopulationLegend(int minPopulation, int maxPopulation, floa
float barHeight = map(histogram[i], 0, maxHistogram, 0, height); float barHeight = map(histogram[i], 0, maxHistogram, 0, height);
rect(currentX, y - barHeight, binWidth, barHeight); rect(currentX, y - barHeight, binWidth, barHeight);
} }
// Dessin de la légende
// Draw title // Draw title
fill(0); fill(0);
......
//globally //globally
//declare the min and max variables that you need in parseInfo
float minX, maxX; float minX, maxX;
float minY, maxY; float minY, maxY;
int totalCount; // total number of places int totalCount;
int minPopulation, maxPopulation; int minPopulation, maxPopulation;
int minSurface, maxSurface; int minSurface, maxSurface;
int minAltitude, maxAltitude; int minAltitude, maxAltitude;
//declare the variables corresponding to the column ids for x and y
int x = 1; int x = 1;
int y = 2; int y = 2;
...@@ -50,7 +48,6 @@ void draw() { ...@@ -50,7 +48,6 @@ void draw() {
drawSlider(); drawSlider();
// Vérifiez que l'indice est valide
for (int i = 0; i < Math.min(totalCount, cities.length); ++i) { for (int i = 0; i < Math.min(totalCount, cities.length); ++i) {
cities[i].draw(); cities[i].draw();
} }
...@@ -122,7 +119,6 @@ void drawLegend() { ...@@ -122,7 +119,6 @@ void drawLegend() {
float distributionY = height - legendsHeight; float distributionY = height - legendsHeight;
float distributionWidth = width - 100; float distributionWidth = width - 100;
float distributionHeight = 50; float distributionHeight = 50;
// get list of population values from the cities
float[] populationValues = new float[cities.length]; float[] populationValues = new float[cities.length];
for (int i = 0; i < cities.length - 2; i++) { for (int i = 0; i < cities.length - 2; i++) {
populationValues[i] = cities[i].population; populationValues[i] = cities[i].population;
...@@ -205,15 +201,15 @@ void mouseDragged() { ...@@ -205,15 +201,15 @@ void mouseDragged() {
} }
} }
if (updateData) { if (updateData) {
readData(); // Modifier pour ne lire les données que si nécessaire readData();
redraw(); // Limitez le redessin aux moments nécessaires redraw();
} }
} }
} }
void mouseReleased() { void mouseReleased() {
draggingSlider = false; draggingSlider = false;
redraw(); // Assurez-vous de redessiner une dernière fois à la fin du déplacement redraw();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment