@@ -10,16 +10,23 @@ import sinon from 'sinon';
1010import Fetcher from 'Provider/Fetcher' ;
1111import Renderer from './bootstrap' ;
1212
13- import ept from '../data/entwine/ept.json' ;
14- import eptHierarchy from '../data/entwine/ept-hierarchy/0-0-0-0.json' ;
13+ import eptFile from '../data/entwine/ept.json' ;
14+ import eptHierarchyFile from '../data/entwine/ept-hierarchy/0-0-0-0.json' ;
1515
16- const baseurl = 'https://raw.githubusercontent.com/iTowns/iTowns2-sample-data/master/pointclouds' ;
17- const urlEpt = `${ baseurl } /entwine/ept.json` ;
18- const urlEptHierarchy = `${ baseurl } /entwine/ept-hierarchy/0-0-0-0.json` ;
16+ // LASParser need to be mocked instead of calling it
17+ LASParser . enableLazPerf ( './examples/libs/laz-perf' ) ;
18+
19+ const baseurl = 'https://raw.githubusercontent.com/iTowns/iTowns2-sample-data/master/pointclouds/entwine' ;
20+
21+ const eptSsAuthority = JSON . parse ( eptFile ) ;
22+ eptSsAuthority . srs = {
23+ wkt : 'PROJCS["RGF93 v1 / Lambert-93",GEOGCS["RGF93 v1",DATUM["Reseau_Geodesique_Francais_1993_v1",SPHEROID["GRS 1980",6378137,298.257222101],TOWGS84[0,0,0,0,0,0,0]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4171"]],PROJECTION["Lambert_Conformal_Conic_2SP"],PARAMETER["latitude_of_origin",46.5],PARAMETER["central_meridian",3],PARAMETER["standard_parallel_1",49],PARAMETER["standard_parallel_2",44],PARAMETER["false_easting",700000],PARAMETER["false_northing",6600000],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["Easting",EAST],AXIS["Northing",NORTH],AUTHORITY["EPSG","2154"]]' ,
24+ } ;
1925
2026const resources = {
21- [ urlEpt ] : ept ,
22- [ urlEptHierarchy ] : eptHierarchy ,
27+ [ `${ baseurl } /ept.json` ] : JSON . parse ( eptFile ) ,
28+ 'withoutAutority/ept.json' : eptSsAuthority ,
29+ [ `${ baseurl } /ept-hierarchy/0-0-0-0.json` ] : JSON . parse ( eptHierarchyFile ) ,
2330} ;
2431
2532describe ( 'Entwine Point Tile' , function ( ) {
@@ -29,15 +36,12 @@ describe('Entwine Point Tile', function () {
2936
3037 before ( function ( ) {
3138 stubFetcherJson = sinon . stub ( Fetcher , 'json' )
32- . callsFake ( url => Promise . resolve ( JSON . parse ( resources [ url ] ) ) ) ;
39+ . callsFake ( url => Promise . resolve ( resources [ url ] ) ) ;
3340 stubFetcherArrayBuf = sinon . stub ( Fetcher , 'arrayBuffer' )
3441 . callsFake ( ( ) => Promise . resolve ( new ArrayBuffer ( ) ) ) ;
3542 // currently no test on data fetched...
3643
3744 LASParser . enableLazPerf ( './examples/libs/laz-perf' ) ;
38- source = new EntwinePointTileSource ( {
39- url : 'https://raw.githubusercontent.com/iTowns/iTowns2-sample-data/master/pointclouds/entwine' ,
40- } ) ;
4145 } ) ;
4246
4347 after ( async function ( ) {
@@ -46,11 +50,32 @@ describe('Entwine Point Tile', function () {
4650 await LASParser . terminate ( ) ;
4751 } ) ;
4852
49- it ( 'loads the EPT structure' , ( done ) => {
50- source . whenReady
51- . then ( ( ) => {
52- done ( ) ;
53- } ) . catch ( done ) ;
53+ describe ( 'Entwine Point Tile Source' , function ( ) {
54+ describe ( 'data type' , function ( ) {
55+ // TO DO dataType in [laszip, binary, zstandard]
56+ } ) ;
57+ describe ( 'retrieving crs from srs information' , function ( ) {
58+ it ( 'No srs authority' , ( done ) => {
59+ source = new EntwinePointTileSource ( {
60+ url : 'withoutAutority' ,
61+ } ) ;
62+ source . whenReady
63+ . then ( ( ) => {
64+ assert . equal ( source . crs , 'RGF93 v1 / Lambert-93' ) ;
65+ done ( ) ;
66+ } ) . catch ( done ) ;
67+ } ) ;
68+ it ( 'With srs authority' , ( done ) => {
69+ source = new EntwinePointTileSource ( {
70+ url : 'https://raw.githubusercontent.com/iTowns/iTowns2-sample-data/master/pointclouds/entwine' ,
71+ } ) ;
72+ source . whenReady
73+ . then ( ( ) => {
74+ assert . equal ( source . crs , 'EPSG:3857' ) ;
75+ done ( ) ;
76+ } ) . catch ( done ) ;
77+ } ) ;
78+ } ) ;
5479 } ) ;
5580
5681 describe ( 'Layer' , function ( ) {
0 commit comments