Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds an info button to GSV window in Explore, Validate, and Gallery #3050

Merged
merged 34 commits into from
Oct 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
64bfa54
created and formatted popover in audit page with limited info and no …
davphan Sep 2, 2022
3eb55af
popover formatted and clipboard + GSV links added
davphan Sep 7, 2022
b7927d2
popover is dismissable by click, all functionality and styling comple…
davphan Sep 7, 2022
11adf6d
fixed info button
davphan Sep 7, 2022
3171540
Finalized GSVIinfoPopover js class and completed region id addition f…
davphan Sep 21, 2022
2f5ef33
Audit and Validate front end complete
davphan Sep 22, 2022
d617ef7
front end for Gallery complete
davphan Sep 22, 2022
a32fcf8
Completed front end except LabelMap bootstrap issues, all remaining t…
davphan Sep 25, 2022
012755a
Merge branch 'develop' of https://github.com/ProjectSidewalk/Sidewalk…
misaugstad Oct 11, 2022
bcd80e2
reduces number of digits shown in lat/lng
misaugstad Oct 11, 2022
d653880
removes info popover from LabelMap
misaugstad Oct 12, 2022
6ef52c6
lat/lng and link to GSV to LabelMap modals
misaugstad Oct 12, 2022
888dce5
adds street_edge_id and region_id to LabelMap modal
misaugstad Oct 12, 2022
895dab3
adds region_id and street_edge_id to Validate and Gallery popovers
misaugstad Oct 12, 2022
a6f9b99
cleans up info button popover code a bit
misaugstad Oct 12, 2022
67dc706
Gallery info button now refreshes data on new images
misaugstad Oct 13, 2022
6e70ef0
fixes Gallery info popover not closing when clicking next button
misaugstad Oct 13, 2022
10e82ba
info button on gallery no longer covered by validation border
misaugstad Oct 13, 2022
f6ac85d
info button vertically centered in Gallery
misaugstad Oct 13, 2022
1ba477b
adds label ID to info button on Validate and Gallery
misaugstad Oct 13, 2022
6bd60c5
Explore and Validate info buttons are now white
misaugstad Oct 13, 2022
769469f
moves location of info button images
misaugstad Oct 13, 2022
c615967
simplifies Validate code for keeping track of Label objects
misaugstad Oct 13, 2022
f92277f
fixes gsv info button copy to clipboard popover
misaugstad Oct 13, 2022
519efa7
removes unused code
misaugstad Oct 13, 2022
9af8cee
gsv info button switched to pointer cursor
misaugstad Oct 13, 2022
22edb66
fixes styling of info button and clipboard popovers
misaugstad Oct 13, 2022
9cde4d3
renames GSVInfoPopOver.js to GSVInfoPopover.js
misaugstad Oct 14, 2022
61038f3
info button and footer text now selectable on audit page
misaugstad Oct 14, 2022
db3e944
adds logging to clicks on the GSV info buttons
misaugstad Oct 14, 2022
99d7298
adds translations to GSV info button popover
misaugstad Oct 14, 2022
e9e491a
fixes look of accuracy tooltip on Explore
misaugstad Oct 14, 2022
dd500f8
code style updates
misaugstad Oct 15, 2022
7ede752
adds a few more translations to LabelMap
misaugstad Oct 15, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ module.exports = function(grunt) {
'public/javascripts/common/UtilitiesMath.js',
'public/javascripts/common/UtilitiesPanomarker.js',
'public/javascripts/common/UtilitiesShape.js',
'public/javascripts/common/UtilitiesSidewalk.js'
'public/javascripts/common/UtilitiesSidewalk.js',
'public/javascripts/common/GSVInfoPopover.js'
],
dest: 'public/javascripts/SVLabel/build/SVLabel.js'
},
Expand Down Expand Up @@ -70,7 +71,8 @@ module.exports = function(grunt) {
'public/javascripts/SVValidate/src/util/*.js',
'public/javascripts/SVValidate/src/zoom/*.js',
'public/javascripts/common/Panomarker.js',
'public/javascripts/common/UtilitiesSidewalk.js'
'public/javascripts/common/UtilitiesSidewalk.js',
'public/javascripts/common/GSVInfoPopover.js'
],
dest: 'public/javascripts/SVValidate/build/SVValidate.js'
},
Expand All @@ -83,7 +85,8 @@ module.exports = function(grunt) {
'public/javascripts/Gallery/src/displays/*.js',
'public/javascripts/Gallery/src/modal/*.js',
'public/javascripts/Gallery/src/*.js',
'public/javascripts/common/Panomarker.js'
'public/javascripts/common/Panomarker.js',
'public/javascripts/common/GSVInfoPopover.js'
],
dest: 'public/javascripts/Gallery/build/Gallery.js'
}
Expand Down
26 changes: 16 additions & 10 deletions app/formats/json/LabelFormat.scala
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ object LabelFormat {
"severity" -> labelMetadata.severity,
"temporary" -> labelMetadata.temporary,
"description" -> labelMetadata.description,
"street_edge_id" -> labelMetadata.streetEdgeId,
"region_id" -> labelMetadata.regionId,
"user_validation" -> labelMetadata.userValidation.map(LabelValidationTable.validationOptions.get),
"tags" -> labelMetadata.tags
)
Expand All @@ -82,14 +84,16 @@ object LabelFormat {
"gsv_panorama_id" -> labelMetadata.gsvPanoramaId,
"tutorial" -> labelMetadata.tutorial,
"image_date" -> labelMetadata.imageDate,
"heading" -> labelMetadata.heading,
"pitch" -> labelMetadata.pitch,
"zoom" -> labelMetadata.zoom,
"heading" -> labelMetadata.headingPitchZoom._1,
"pitch" -> labelMetadata.headingPitchZoom._2,
"zoom" -> labelMetadata.headingPitchZoom._3,
"canvas_x" -> labelMetadata.canvasXY._1,
"canvas_y" -> labelMetadata.canvasXY._2,
"canvas_width" -> labelMetadata.canvasWidth,
"canvas_height" -> labelMetadata.canvasHeight,
"canvas_width" -> labelMetadata.canvasWidthHeight._1,
"canvas_height" -> labelMetadata.canvasWidthHeight._2,
"audit_task_id" -> labelMetadata.auditTaskId,
"street_edge_id" -> labelMetadata.streetEdgeId,
"region_id" -> labelMetadata.regionId,
"user_id" -> labelMetadata.userId,
"username" -> labelMetadata.username,
"timestamp" -> labelMetadata.timestamp,
Expand All @@ -113,13 +117,15 @@ object LabelFormat {
"gsv_panorama_id" -> labelMetadata.gsvPanoramaId,
"tutorial" -> labelMetadata.tutorial,
"image_date" -> labelMetadata.imageDate,
"heading" -> labelMetadata.heading,
"pitch" -> labelMetadata.pitch,
"zoom" -> labelMetadata.zoom,
"heading" -> labelMetadata.headingPitchZoom._1,
"pitch" -> labelMetadata.headingPitchZoom._2,
"zoom" -> labelMetadata.headingPitchZoom._3,
"canvas_x" -> labelMetadata.canvasXY._1,
"canvas_y" -> labelMetadata.canvasXY._2,
"canvas_width" -> labelMetadata.canvasWidth,
"canvas_height" -> labelMetadata.canvasHeight,
"canvas_width" -> labelMetadata.canvasWidthHeight._1,
"canvas_height" -> labelMetadata.canvasWidthHeight._2,
"street_edge_id" -> labelMetadata.streetEdgeId,
"region_id" -> labelMetadata.regionId,
"timestamp" -> labelMetadata.timestamp,
"label_type_key" -> labelMetadata.labelTypeKey,
"label_type_value" -> labelMetadata.labelTypeValue,
Expand Down
27 changes: 18 additions & 9 deletions app/models/audit/AuditTaskTable.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import models.utils.MyPostgresDriver.simple._
import models.daos.slick.DBTableDefinitions.{DBUser, UserTable}
import models.label.{LabelTable, LabelTypeTable}
import models.street.StreetEdgePriorityTable
import models.region.RegionTable
import models.user.{UserRoleTable, UserStatTable}
import play.api.libs.json._
import play.api.Play.current
Expand All @@ -18,7 +19,7 @@ import scala.slick.lifted.ForeignKeyQuery
import scala.slick.jdbc.{GetResult, StaticQuery => Q}

case class AuditTask(auditTaskId: Int, amtAssignmentId: Option[Int], userId: String, streetEdgeId: Int, taskStart: Timestamp, taskEnd: Option[Timestamp], completed: Boolean, currentLat: Float, currentLng: Float, startPointReversed: Boolean)
case class NewTask(edgeId: Int, geom: LineString,
case class NewTask(edgeId: Int, geom: LineString, regionId: Int,
currentLng: Float, currentLat: Float, x1: Float, y1: Float, x2: Float, y2: Float,
startPointReversed: Boolean, // Did we start at x1,y1 instead of x2,y2?
taskStart: Timestamp,
Expand All @@ -35,6 +36,7 @@ case class NewTask(edgeId: Int, geom: LineString,
val linestring: geojson.LineString[geojson.LatLng] = geojson.LineString(latlngs)
val properties = Json.obj(
"street_edge_id" -> edgeId,
"region_id" -> regionId,
"current_lng" -> currentLng,
"current_lat" -> currentLat,
"x1" -> x1,
Expand Down Expand Up @@ -108,6 +110,7 @@ object AuditTaskTable {
implicit val newTaskConverter = GetResult[NewTask](r => {
val edgeId = r.nextInt
val geom = r.nextGeometry[LineString]
val regionId = r.nextInt
val currentLng = r.nextFloat
val currentLat = r.nextFloat
val x1 = r.nextFloat
Expand All @@ -119,7 +122,7 @@ object AuditTaskTable {
val completedByAnyUser = r.nextBoolean
val priority = r.nextDouble
val completed = r.nextBooleanOption.getOrElse(false)
NewTask(edgeId, geom, currentLng, currentLat, x1, y1, x2, y2, startPointReversed, taskStart, completedByAnyUser, priority, completed)
NewTask(edgeId, geom, regionId, currentLng, currentLat, x1, y1, x2, y2, startPointReversed, taskStart, completedByAnyUser, priority, completed)
})

val db = play.api.db.slick.DB
Expand All @@ -128,6 +131,7 @@ object AuditTaskTable {
val streetEdges = TableQuery[StreetEdgeTable]
val streetEdgePriorities = TableQuery[StreetEdgePriorityTable]
val users = TableQuery[UserTable]
val regions = TableQuery[StreetEdgeRegionTable]

val completedTasks = auditTasks.filter(_.completed)
val streetEdgesWithoutDeleted = streetEdges.filterNot(_.deleted)
Expand Down Expand Up @@ -370,9 +374,10 @@ object AuditTaskTable {
// Join with other queries to get completion count and priority for each of the street edges.
val edges = for {
se <- streetEdgesWithoutDeleted if se.streetEdgeId === streetEdgeId
re <- regions if se.streetEdgeId === re.streetEdgeId
scau <- streetCompletedByAnyUser if se.streetEdgeId === scau._1
sep <- streetEdgePriorities if scau._1 === sep.streetEdgeId
} yield (se.streetEdgeId, se.geom, se.x2, se.y2, se.x1, se.y1, se.x2, se.y2, false, timestamp, scau._2, sep.priority, userCompleted)
} yield (se.streetEdgeId, se.geom, re.regionId, se.x2, se.y2, se.x1, se.y1, se.x2, se.y2, false, timestamp, scau._2, sep.priority, userCompleted)

NewTask.tupled(edges.first)
}
Expand All @@ -390,15 +395,16 @@ object AuditTaskTable {
val possibleTasks = for {
sp <- streetEdgePriorities
se <- edgesInRegion if sp.streetEdgeId === se.streetEdgeId
re <- regions if se.streetEdgeId === re.streetEdgeId
sc <- streetCompletedByAnyUser if se.streetEdgeId === sc._1
} yield (se.streetEdgeId, se.geom, se.x2, se.y2, se.x1, se.y1, se.x2, se.y2, false, timestamp, sc._2, sp.priority, false)
} yield (se.streetEdgeId, se.geom, re.regionId, se.x2, se.y2, se.x1, se.y1, se.x2, se.y2, false, timestamp, sc._2, sp.priority, false)

// Get the priority of the highest priority task.
val highestPriority: Option[Double] = possibleTasks.map(_._12).max.run
val highestPriority: Option[Double] = possibleTasks.map(_._13).max.run

// Get list of tasks that have this priority.
val highestPriorityTasks: Option[List[NewTask]] = highestPriority.map { highPriority =>
possibleTasks.filter(_._12 === highPriority).list.map(NewTask.tupled)
possibleTasks.filter(_._13 === highPriority).list.map(NewTask.tupled)
}

// Choose one of the highest priority tasks at random.
Expand All @@ -414,9 +420,10 @@ object AuditTaskTable {
val newTask = for {
at <- auditTasks if at.auditTaskId === taskId
se <- streetEdges if at.streetEdgeId === se.streetEdgeId
re <- regions if se.streetEdgeId === re.streetEdgeId
sp <- streetEdgePriorities if se.streetEdgeId === sp.streetEdgeId
sc <- streetCompletedByAnyUser if sp.streetEdgeId === sc._1
} yield (se.streetEdgeId, se.geom, at.currentLng, at.currentLat, se.x1, se.y1, se.x2, se.y2, at.startPointReversed, timestamp, sc._2, sp.priority, false)
} yield (se.streetEdgeId, se.geom, re.regionId, at.currentLng, at.currentLat, se.x1, se.y1, se.x2, se.y2, at.startPointReversed, timestamp, sc._2, sp.priority, false)

newTask.list.map(NewTask.tupled).headOption
}
Expand All @@ -430,9 +437,10 @@ object AuditTaskTable {
val tasks = for {
ser <- nonDeletedStreetEdgeRegions if ser.regionId === regionId
se <- streetEdges if ser.streetEdgeId === se.streetEdgeId
re <- regions if se.streetEdgeId === re.streetEdgeId
sep <- streetEdgePriorities if se.streetEdgeId === sep.streetEdgeId
scau <- streetCompletedByAnyUser if sep.streetEdgeId === scau._1
} yield (se.streetEdgeId, se.geom, se.x2, se.y2, se.x1, se.y1, se.x2, se.y2, false, timestamp, scau._2, sep.priority, false)
} yield (se.streetEdgeId, se.geom, re.regionId, se.x2, se.y2, se.x1, se.y1, se.x2, se.y2, false, timestamp, scau._2, sep.priority, false)

tasks.list.map(NewTask.tupled(_))
}
Expand All @@ -450,10 +458,11 @@ object AuditTaskTable {
val tasks = for {
(ser, ucs) <- edgesInRegion.leftJoin(userCompletedStreets).on(_.streetEdgeId === _._1)
se <- streetEdges if ser.streetEdgeId === se.streetEdgeId
re <- regions if se.streetEdgeId === re.streetEdgeId
sep <- streetEdgePriorities if se.streetEdgeId === sep.streetEdgeId
scau <- streetCompletedByAnyUser if sep.streetEdgeId === scau._1
} yield (
se.streetEdgeId, se.geom, se.x2, se.y2, se.x1, se.y1, se.x2, se.y2, false, timestamp, scau._2, sep.priority, ucs._2.?.getOrElse(false))
se.streetEdgeId, se.geom, re.regionId, se.x2, se.y2, se.x1, se.y1, se.x2, se.y2, false, timestamp, scau._2, sep.priority, ucs._2.?.getOrElse(false))

tasks.list.map(NewTask.tupled(_))
}
Expand Down
Loading