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
2b045011
Commit
2b045011
authored
1 year ago
by
Lucas Philippe
Browse files
Options
Downloads
Patches
Plain Diff
Ajout etape 2
parent
dd480a20
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
TP5/sketch_240321a/sketch_240321a.pde
+25
-4
25 additions, 4 deletions
TP5/sketch_240321a/sketch_240321a.pde
with
25 additions
and
4 deletions
TP5/sketch_240321a/sketch_240321a.pde
+
25
−
4
View file @
2b045011
...
...
@@ -14,10 +14,13 @@ City cities[];
int
legendsHeight
=
100
;
int
minPopulationToDisplay
=
10000
;
boolean
redrawInProgress
=
false
;
void
setup
()
{
size
(
900
,
900
);
colorMode
(
HSB
,
360
,
100
,
100
);
readData
();
noLoop
();
}
void
draw
(){
...
...
@@ -46,11 +49,11 @@ void draw(){
if
(
legendsHeight
>
0
)
{
drawLegend
();
}
redrawInProgress
=
false
;
}
void
readData
()
{
redrawInProgress
=
true
;
String
[]
lines
=
loadStrings
(
"./villes.tsv"
);
// check that the file has been loaded
...
...
@@ -99,11 +102,11 @@ void parseInfo(String line) {
}
float
mapX
(
float
x
)
{
return
map
(
x
,
minX
,
maxX
,
0
,
800
);
return
map
(
x
,
minX
,
maxX
,
5
0
,
800
);
}
float
mapY
(
float
y
)
{
return
map
(
y
,
maxY
,
minY
,
0
,
800
);
return
map
(
y
,
maxY
,
minY
,
5
0
,
800
);
}
void
drawLegend
()
{
...
...
@@ -122,3 +125,21 @@ void drawLegend() {
//drawAltitudeLegend(minAltitude, maxAltitude, distributionX, distributionY, distributionWidth, distributionHeight);
drawDistributionPopulationLegend
(
minPopulation
,
maxPopulation
,
distributionX
,
distributionY
,
distributionWidth
,
distributionHeight
,
numberOfDiv
,
populationValues
);
}
void
keyPressed
()
{
if
(
redrawInProgress
)
{
return
;
}
int
gap
=
2
;
if
(
key
==
'+'
)
{
if
(
minPopulationToDisplay
==
0
)
{
minPopulationToDisplay
=
1
;
}
minPopulationToDisplay
=
minPopulationToDisplay
*
gap
;
readData
();
}
else
if
(
key
==
'-'
)
{
minPopulationToDisplay
=
minPopulationToDisplay
/
gap
;
readData
();
}
redraw
();
}
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