Merge pull request #963 from pierotofy/langup

Support for reading coords.txt
pull/966/head
Piero Toffanin 2021-02-25 14:03:23 -05:00 zatwierdzone przez GitHub
commit 1c6912a30e
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 32 dodań i 15 usunięć

Wyświetl plik

@ -121,24 +121,41 @@ class ModelView extends React.Component {
}
loadGeoreferencingOffset = (cb) => {
$.ajax({
url: `${this.assetsPath()}/odm_georeferencing/odm_georeferencing_model_geo.txt`,
type: 'GET',
error: () => {
console.warn("Cannot find odm_georeferencing_model_geo.txt (not georeferenced?)")
cb({x: 0, y: 0});
},
success: (data) => {
const lines = data.split("\n");
if (lines.length >= 2){
const [ x, y ] = lines[1].split(" ").map(parseFloat);
cb({x, y});
}else{
console.warn(`Malformed odm_georeferencing_model_geo.txt: ${data}`);
const geoFile = `${this.assetsPath()}/odm_georeferencing/coords.txt`;
const legacyGeoFile = `${this.assetsPath()}/odm_georeferencing/odm_georeferencing_model_geo.txt`;
const getGeoOffsetFromUrl = (url) => {
$.ajax({
url: url,
type: 'GET',
error: () => {
console.warn(`Cannot find ${url} (not georeferenced?)`);
cb({x: 0, y: 0});
},
success: (data) => {
const lines = data.split("\n");
if (lines.length >= 2){
const [ x, y ] = lines[1].split(" ").map(parseFloat);
cb({x, y});
}else{
console.warn(`Malformed georeferencing file: ${data}`);
cb({x: 0, y: 0});
}
}
}
});
};
$.ajax({
type: "HEAD",
url: legacyGeoFile
}).done(() => {
// If a legacy georeferencing file is present
// we'll use that
getGeoOffsetFromUrl(legacyGeoFile);
}).fail(() => {
getGeoOffsetFromUrl(geoFile);
});
}
pointCloudFilePath = (cb) => {