Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
lam-station-visualization
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Insights
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
data-analysis-and-ai
lam-station-visualization
Commits
1e3647cd
Commit
1e3647cd
authored
6 years ago
by
Janne Alatalo
Browse files
Options
Downloads
Patches
Plain Diff
Add simple station status card when station is clicked
parent
2b7f8648
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#4043
failed
6 years ago
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/PointMap.js
+76
-1
76 additions, 1 deletion
src/PointMap.js
with
76 additions
and
1 deletion
src/PointMap.js
+
76
−
1
View file @
1e3647cd
import
React
,
{
Component
}
from
'
react
'
;
import
DeckGL
,
{
PolygonLayer
,
MapController
}
from
'
deck.gl
'
;
import
{
StaticMap
}
from
'
react-map-gl
'
;
import
Card
from
'
@material-ui/core/Card
'
;
import
CardContent
from
'
@material-ui/core/CardContent
'
;
import
CardActionArea
from
'
@material-ui/core/CardActionArea
'
;
import
CardActions
from
'
@material-ui/core/CardActions
'
;
import
Button
from
'
@material-ui/core/Button
'
;
import
Typography
from
'
@material-ui/core/Typography
'
;
import
Tooltip
from
'
./Tooltip.js
'
;
...
...
@@ -70,6 +76,72 @@ class PointMap extends Component {
}
}
getCard
(
clicked
)
{
const
station
=
this
.
props
.
points
.
get
(
clicked
);
if
(
!
station
)
{
return
null
;
}
const
name
=
station
.
get_name
();
const
avg_speed_dir1
=
station
.
get_avg_speed_dir1
();
const
avg_speed_dir2
=
station
.
get_avg_speed_dir2
();
const
norm_flow_dir1
=
station
.
get_free_flow_speed_dir1
();
const
norm_flow_dir2
=
station
.
get_free_flow_speed_dir2
();
const
traffic_vol_dir1
=
station
.
get_traffic_vol_dir1
();
const
traffic_vol_dir2
=
station
.
get_traffic_vol_dir2
();
const
styles
=
{
card
:
{
position
:
"
absolute
"
,
marginTop
:
10
,
marginLeft
:
10
,
maxWidth
:
345
,
zIndex
:
10
,
left
:
0
,
top
:
0
,
}
}
const
close_card
=
(
prevState
)
=>
{
clicked
=
null
;
return
{
...
prevState
,
clicked
};
};
return
(
<
Card
style
=
{
styles
.
card
}
>
<
CardContent
>
<
Typography
gutterBottom
variant
=
"
headline
"
component
=
"
h3
"
>
{
name
}
<
/Typography
>
<
Typography
component
=
"
p
"
>
{
`Average speed direction 1:
${
avg_speed_dir1
}
km/h`
}
<
/Typography
>
<
Typography
component
=
"
p
"
>
{
`Average speed direction 2:
${
avg_speed_dir2
}
km/h`
}
<
/Typography
>
<
Typography
component
=
"
p
"
>
{
`Normal traffic flow direction 1:
${
norm_flow_dir1
}
km/h`
}
<
/Typography
>
<
Typography
component
=
"
p
"
>
{
`Normal traffic flow direction 2:
${
norm_flow_dir2
}
km/h`
}
<
/Typography
>
<
Typography
component
=
"
p
"
>
{
`Traffic volume direction 1:
${
traffic_vol_dir1
}
/5min`
}
<
/Typography
>
<
Typography
component
=
"
p
"
>
{
`Traffic volume direction 2:
${
traffic_vol_dir2
}
/5min`
}
<
/Typography
>
<
/CardContent
>
<
CardActions
>
<
Button
size
=
"
small
"
color
=
"
primary
"
onClick
=
{()
=>
this
.
setState
(
close_card
)}
>
Close
<
/Button
>
<
/CardActions
>
<
/Card
>
);
}
render
()
{
const
point_coords
=
this
.
props
.
points
.
toArray
();
const
layers
=
[
...
...
@@ -120,7 +192,10 @@ class PointMap extends Component {
viewState
=
{
this
.
state
.
viewport
}
/
>
<
/DeckGL
>
{
this
.
state
.
tooltipVisible
&&
<
Tooltip
{...
this
.
state
.
tooltip
}
/>
}
{
this
.
state
.
tooltipVisible
&&
<
Tooltip
{...
this
.
state
.
tooltip
}
/>
}
{
this
.
state
.
clicked
&&
this
.
getCard
(
this
.
state
.
clicked
)
}
<
/div
>
);
}
...
...
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