feat(simulation): integrate infrastructure jobs and semantic scene editing
Integrate infrastructure preparation and qualified map delivery with local scenes. Add semantic editing, object provenance, survey caching and operator scene tools.
This commit is contained in:
@@ -3,10 +3,12 @@ import {readFileSync} from 'node:fs';
|
||||
import {test} from 'node:test';
|
||||
import ts from 'typescript';
|
||||
import {PerspectiveCamera,Vector3} from 'three';
|
||||
async function source(name){
|
||||
const code=ts.transpileModule(readFileSync(new URL(`../src/core/simulation/${name}.ts`,import.meta.url),'utf8'),{compilerOptions:{module:ts.ModuleKind.ESNext}}).outputText.replace('from "three"',`from "${import.meta.resolve('three')}"`);
|
||||
return import(`data:text/javascript;base64,${Buffer.from(code).toString('base64')}`);
|
||||
function moduleUrl(url){
|
||||
const code=ts.transpileModule(readFileSync(url,'utf8'),{compilerOptions:{module:ts.ModuleKind.ESNext}}).outputText
|
||||
.replace(/from "([^"]+)"/g,(_,name)=>`from "${name.startsWith('.')?moduleUrl(new URL(name+'.ts',url)):import.meta.resolve(name)}"`);
|
||||
return `data:text/javascript;base64,${Buffer.from(code).toString('base64')}`;
|
||||
}
|
||||
async function source(name){return import(moduleUrl(new URL(`../src/core/simulation/${name}.ts`,import.meta.url)));}
|
||||
const {panCamera,orbitCamera,navigationDepth}=await source('editorNavigation');
|
||||
const {editWaypoints,waypointEditing,waypointShortcut}=await source('waypointEditing');
|
||||
const {streamRecovery}=await source('streamRecovery');
|
||||
@@ -82,3 +84,11 @@ test('catalog discovery of a run cannot claim an idle or historical viewer',()=>
|
||||
assert.equal(viewedAiRun(catalog,'forest','new'),live);
|
||||
assert.equal(viewedAiRun(catalog,'bamboo','new'),undefined);
|
||||
});
|
||||
|
||||
test('cube preferences migrate without changing older settings and validate saved presentation',()=>{
|
||||
const p=normalizePlannerPreferences({pivot:{pixels:125},cube:{size:500,face:'red',opacity:-1,edgeOpacity:-2,text:'#123456'}});
|
||||
assert.equal(p.pivot.pixels,125);assert.equal(p.cube.size,160);assert.equal(p.cube.face,'#292929');assert.equal(p.cube.opacity,.2);assert.equal(p.cube.text,'#123456');
|
||||
assert.equal(normalizePlannerPreferences({}).cube.size,66);
|
||||
assert.equal(p.cube.edgeOpacity,0);assert.equal(normalizePlannerPreferences({}).cube.edgeOpacity,1);
|
||||
assert.deepEqual(normalizePlannerPreferences(JSON.parse(JSON.stringify(p))),p);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user