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
6e708748
Commit
6e708748
authored
1 year ago
by
Lucas Philippe
Browse files
Options
Downloads
Patches
Plain Diff
ajout etape 5
parent
bf2ab336
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
TP5/sketch_240321a/City.pde
+6
-1
6 additions, 1 deletion
TP5/sketch_240321a/City.pde
TP5/sketch_240321a/sketch_240321a.pde
+12
-1
12 additions, 1 deletion
TP5/sketch_240321a/sketch_240321a.pde
with
18 additions
and
2 deletions
TP5/sketch_240321a/City.pde
+
6
−
1
View file @
6e708748
...
@@ -7,6 +7,7 @@ class City {
...
@@ -7,6 +7,7 @@ class City {
float
density
;
float
density
;
float
altitude
;
float
altitude
;
float
radius
=
0
;
float
radius
=
0
;
boolean
isHighlighted
=
false
;
// put a drawing function in here and call from main drawing loop }
// 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
)
{
...
@@ -28,7 +29,11 @@ class City {
...
@@ -28,7 +29,11 @@ class City {
radius
=
map
(
this
.
population
,
minPopulation
,
maxPopulation
,
3
,
100
);
radius
=
map
(
this
.
population
,
minPopulation
,
maxPopulation
,
3
,
100
);
// Draw marker
// Draw marker
fill
(
hue
,
100
,
100
);
float
alpha
=
80
;
if
(
isHighlighted
){
alpha
=
255
;
}
fill
(
hue
,
100
,
100
,
alpha
);
ellipse
(
x
,
y
,
radius
,
radius
);
ellipse
(
x
,
y
,
radius
,
radius
);
}
}
...
...
This diff is collapsed.
Click to expand it.
TP5/sketch_240321a/sketch_240321a.pde
+
12
−
1
View file @
6e708748
...
@@ -146,16 +146,27 @@ void keyPressed() {
...
@@ -146,16 +146,27 @@ void keyPressed() {
}
}
void
mouseMoved
()
{
void
mouseMoved
()
{
//println("(x: " + mouseX + ", y: " + mouseY + ")");
City
city
=
pick
(
mouseX
,
mouseY
);
City
city
=
pick
(
mouseX
,
mouseY
);
if
(
city
!=
null
)
{
if
(
city
!=
null
)
{
if
(
lastCitySelected
!=
city
)
{
if
(
lastCitySelected
!=
city
)
{
if
(
lastCitySelected
!=
null
)
{
lastCitySelected
.
isHighlighted
=
false
;
}
lastCitySelected
=
city
;
lastCitySelected
=
city
;
println
(
city
.
name
);
println
(
city
.
name
);
lastCitySelected
.
isHighlighted
=
true
;
redraw
();
}
}
else
{
if
(
lastCitySelected
!=
null
)
{
lastCitySelected
.
isHighlighted
=
false
;
lastCitySelected
=
null
;
redraw
();
}
}
}
}
}
}
City
pick
(
int
px
,
int
py
)
{
City
pick
(
int
px
,
int
py
)
{
for
(
int
i
=
totalCount
-
1
;
i
>=
0
;
--
i
)
{
for
(
int
i
=
totalCount
-
1
;
i
>=
0
;
--
i
)
{
if
(
cities
[
i
].
contains
(
px
,
py
))
{
if
(
cities
[
i
].
contains
(
px
,
py
))
{
...
...
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