forked from OpenDroneMap/OpenSfM
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: upgrade opensfm viewer to mapillary-js v4.0.0-beta.4 (mapillary…
…#740) Summary: Pull Request resolved: mapillary#740 ## Contributions - Upgrade viewer to MapillaryJS v4.0.0-beta.4 - Fix loading using reconstruction path - Invent image buffer on client if server returns error (e.g. when no images exist for a dataset). This means the viewer will always work, even when images are missing. Errors will be logged to the browser. - Increased cell grid depth for more fine grained load - Do not hide bearing indicator in non street camera control mode - Add ENU axes visualization - Add three.js orbit controls as default camera control option using MJS custom camera control API - Earth surface hover indicator for simplified earth navigation - Add image and point count stats control - Improved spatial viz perf in MJS. Logarithmic ray tracing/camera frame intersection. Improved linear rendering logic. Should work with ~10,000 camera frames without considerable lag. Reviewed By: paulinus Differential Revision: D28031955 fbshipit-source-id: 1e44c9c5ac83df0115b9a811f118c4560007917e
- Loading branch information
1 parent
18801cc
commit f76cb16
Showing
18 changed files
with
888 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
/** | ||
* @format | ||
*/ | ||
|
||
export class StatsControl { | ||
constructor(options) { | ||
const container = this._createContainer(); | ||
this._container = container; | ||
this._provider = options.provider; | ||
this._shotCount = 0; | ||
this._pointCount = 0; | ||
this._total = this._createText( | ||
this._makeContent('Total', this._shotCount, this._pointCount), | ||
); | ||
this._container.appendChild(this._total); | ||
this._visible = false; | ||
if (options.visible) { | ||
this.show(); | ||
} | ||
} | ||
|
||
get container() { | ||
return this._container; | ||
} | ||
|
||
addRawData(rawData) { | ||
for (const data of Object.values(rawData)) { | ||
const id = data.id; | ||
const url = data.url; | ||
const cluster = data.cluster; | ||
const shotCount = Object.keys(cluster.shots).length; | ||
const pointCount = Object.keys(cluster.points).length; | ||
const content = this._makeContent(id, shotCount, pointCount, url); | ||
this.addStatRow(content); | ||
|
||
this._shotCount += shotCount; | ||
this._pointCount += pointCount; | ||
} | ||
|
||
this._total.textContent = this._makeContent( | ||
'Total', | ||
this._shotCount, | ||
this._pointCount, | ||
); | ||
} | ||
|
||
addStatRow(content) { | ||
const stat = this._createText(content); | ||
stat.classList.add('opensfm-info-text-stat'); | ||
this._container.appendChild(stat); | ||
} | ||
|
||
hide() { | ||
if (!this._visible) { | ||
return; | ||
} | ||
this._container.classList.add('opensfm-hidden'); | ||
this._visible = false; | ||
} | ||
|
||
show() { | ||
if (this._visible) { | ||
return; | ||
} | ||
this._container.classList.remove('opensfm-hidden'); | ||
this._visible = true; | ||
} | ||
|
||
_createContainer() { | ||
const header = document.createElement('span'); | ||
header.classList.add('opensfm-info-text', 'opensfm-info-text-header'); | ||
header.textContent = 'Stats'; | ||
|
||
const container = document.createElement('div'); | ||
container.classList.add('opensfm-control-container', 'opensfm-hidden'); | ||
container.appendChild(header); | ||
return container; | ||
} | ||
|
||
_createText(content) { | ||
const document = window.document; | ||
const element = document.createElement('span'); | ||
element.classList.add('opensfm-info-text'); | ||
element.textContent = content; | ||
return element; | ||
} | ||
|
||
_makeContent(prefix, shotCount, pointCount, suffix) { | ||
const append = suffix ? ` (${suffix})` : ''; | ||
return `${prefix}: ${shotCount} images, ${pointCount} points${append}`; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.