Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PHILIPPE-iihm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lucas Philippe
PHILIPPE-iihm
Commits
dd480a20
Commit
dd480a20
authored
1 year ago
by
Lucas Philippe
Browse files
Options
Downloads
Patches
Plain Diff
Debut 3eme partie du TP5, Etape 1
parent
bc95bbe6
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.DS_Store
+0
-0
0 additions, 0 deletions
.DS_Store
TP5/sketch_240321a/Legends.pde
+2
-0
2 additions, 0 deletions
TP5/sketch_240321a/Legends.pde
TP5/sketch_240321a/sketch_240321a.pde
+22
-6
22 additions, 6 deletions
TP5/sketch_240321a/sketch_240321a.pde
with
24 additions
and
6 deletions
.DS_Store
+
0
−
0
View file @
dd480a20
No preview for this file type
This diff is collapsed.
Click to expand it.
TP5/sketch_240321a/Legends.pde
+
2
−
0
View file @
dd480a20
...
@@ -49,6 +49,8 @@ void drawDistributionPopulationLegend(int minPopulation, int maxPopulation, floa
...
@@ -49,6 +49,8 @@ void drawDistributionPopulationLegend(int minPopulation, int maxPopulation, floa
}
}
}
}
fill
(
220
,
100
,
100
);
// Dessin de l'axe et des barres de l'histogramme
// Dessin de l'axe et des barres de l'histogramme
float
binWidth
=
width
/
numberOfDiv
;
float
binWidth
=
width
/
numberOfDiv
;
...
...
This diff is collapsed.
Click to expand it.
TP5/sketch_240321a/sketch_240321a.pde
+
22
−
6
View file @
dd480a20
...
@@ -13,6 +13,7 @@ int y = 2;
...
@@ -13,6 +13,7 @@ int y = 2;
City
cities
[];
City
cities
[];
int
legendsHeight
=
100
;
int
legendsHeight
=
100
;
int
minPopulationToDisplay
=
10000
;
void
setup
()
{
void
setup
()
{
size
(
900
,
900
);
size
(
900
,
900
);
...
@@ -21,7 +22,15 @@ void setup() {
...
@@ -21,7 +22,15 @@ void setup() {
void
draw
(){
void
draw
(){
background
(
255
);
background
(
255
);
for
(
int
i
=
0
;
i
<
totalCount
-
2
;
++
i
)
{
// Draw title
fill
(
0
);
textSize
(
20
);
textAlign
(
CENTER
,
CENTER
);
text
(
"Afficher les populations supérieures à "
+
minPopulationToDisplay
,
width
/
2
,
20
);
textSize
(
12
);
for
(
int
i
=
0
;
i
<
totalCount
;
++
i
)
{
// draw a point at the coordinates of the city
// draw a point at the coordinates of the city
cities
[
i
].
draw
();
cities
[
i
].
draw
();
}
}
...
@@ -30,7 +39,7 @@ void draw(){
...
@@ -30,7 +39,7 @@ void draw(){
// Draw the distribution of the altitude values
// Draw the distribution of the altitude values
float
[]
altitudeValues
=
new
float
[
cities
.
length
];
float
[]
altitudeValues
=
new
float
[
cities
.
length
];
for
(
int
i
=
0
;
i
<
cities
.
length
-
2
;
i
++
)
{
for
(
int
i
=
0
;
i
<
totalCount
;
i
++
)
{
altitudeValues
[
i
]
=
cities
[
i
].
altitude
;
altitudeValues
[
i
]
=
cities
[
i
].
altitude
;
}
}
...
@@ -54,15 +63,22 @@ void readData() {
...
@@ -54,15 +63,22 @@ void readData() {
parseInfo
(
lines
[
0
]);
// read the header line
parseInfo
(
lines
[
0
]);
// read the header line
cities
=
new
City
[
totalCount
]
;
ArrayList
<
City
>
filteredCities
=
new
ArrayList
<
City
>
()
;
for
(
int
i
=
2
;
i
<
totalCount
;
++
i
)
{
for
(
int
i
=
2
;
i
<
totalCount
;
++
i
)
{
String
[]
columns
=
split
(
lines
[
i
],
TAB
);
String
[]
columns
=
split
(
lines
[
i
],
TAB
);
float
pointX
=
float
(
columns
[
x
]);
float
pointX
=
float
(
columns
[
x
]);
float
pointY
=
float
(
columns
[
y
]);
float
pointY
=
float
(
columns
[
y
]);
cities
[
i
-
2
]
=
new
City
(
columns
[
0
],
columns
[
4
],
mapX
(
pointX
),
mapY
(
pointY
),
float
(
columns
[
5
]),
float
(
columns
[
6
]),
float
(
columns
[
7
]));
// filter the cities
if
(
float
(
columns
[
5
])
>
minPopulationToDisplay
)
{
filteredCities
.
add
(
new
City
(
columns
[
0
],
columns
[
4
],
mapX
(
pointX
),
mapY
(
pointY
),
float
(
columns
[
5
]),
float
(
columns
[
6
]),
float
(
columns
[
7
])));
}
}
}
println
(
"City list created: "
+
cities
.
length
+
" cities"
);
totalCount
=
filteredCities
.
size
();
cities
=
filteredCities
.
toArray
(
new
City
[
0
]);
println
(
"City list created: "
+
totalCount
+
" cities"
);
}
}
...
@@ -95,7 +111,6 @@ void drawLegend() {
...
@@ -95,7 +111,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
;
drawAltitudeLegend
(
minAltitude
,
maxAltitude
,
distributionX
,
distributionY
,
distributionWidth
,
distributionHeight
);
// get list of population values from the cities
// 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
++
)
{
...
@@ -104,5 +119,6 @@ void drawLegend() {
...
@@ -104,5 +119,6 @@ void drawLegend() {
int
numberOfDiv
=
30
;
int
numberOfDiv
=
30
;
// draw the population distribution
// draw the population distribution
//drawAltitudeLegend(minAltitude, maxAltitude, distributionX, distributionY, distributionWidth, distributionHeight);
drawDistributionPopulationLegend
(
minPopulation
,
maxPopulation
,
distributionX
,
distributionY
,
distributionWidth
,
distributionHeight
,
numberOfDiv
,
populationValues
);
drawDistributionPopulationLegend
(
minPopulation
,
maxPopulation
,
distributionX
,
distributionY
,
distributionWidth
,
distributionHeight
,
numberOfDiv
,
populationValues
);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment