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

feat(3dtiles): add support for binary batch table #1834

Merged
merged 2 commits into from
Oct 26, 2022

Conversation

jailln
Copy link
Contributor

@jailln jailln commented Apr 5, 2022

Description

Motivation and Context

Note: BinaryPropertyAccessor.js may also be used for parsing the binary content of the 3D Tiles feature table (not supported by itowns yet).

@jailln jailln force-pushed the feat/binary-batch-table branch 2 times, most recently from 00157c4 to 06661a3 Compare April 6, 2022 12:30
@gchoqueux
Copy link
Contributor

Hello Vincent,
Thanks for your contribution.
Your PR is ready for review?

@jailln
Copy link
Contributor Author

jailln commented Apr 6, 2022

Yes it is 🙂
I will just add more tests to pass the coverage check but it won't change the code already pushed.

@jailln jailln force-pushed the feat/binary-batch-table branch from 06661a3 to 99fb432 Compare April 6, 2022 12:59
@jailln
Copy link
Contributor Author

jailln commented Apr 13, 2022

Hello @gchoqueux
It's ready to be reviewed.

@gchoqueux
Copy link
Contributor

I am currently busy
I'll look at it as soon as I have some time

@jailln jailln force-pushed the feat/binary-batch-table branch from a8e9f99 to fcc83ac Compare June 20, 2022 10:09
@jailln jailln force-pushed the feat/binary-batch-table branch from fcc83ac to 00f67a6 Compare September 13, 2022 12:25
src/Core/3DTiles/C3DTBatchTable.js Show resolved Hide resolved
src/Core/3DTiles/C3DTBatchTable.js Outdated Show resolved Hide resolved
Comment on lines 27 to 40
constructor(buffer, jsonLength, binaryLength, batchLength, registeredExtensions) {
this.type = C3DTilesTypes.batchtable;
this.batchLength = batchLength;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The constructor signature change is a breaking change. I think we could add a depreciation warning like so :

if (jsonLength + binaryLength !== buffer.byteLength) {
    // The constructor was called with its deprecated signature
    console.warn('some deprecation error message');
    registeredExtensions = batchLength;
    batchLength = binaryLength;
    binaryLength = jsonLength;
    jsonLength = buffer.byteLength - binaryLength;
}

WDYT ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's a good idea to add this test to check if the provided arguments seem correct but not to check if the constructor was called with the former signature since the test can pass if the constructor is called with the former signature and if the batch length equals the binary length.

However, since there is no optional argument in this function, we can test if the number of arguments is correc and add a deprecation warning and compute the values as suggested if not. WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, I didn't think of simply counting the number of arguments but it is a safer test 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After some more thinking, I think we should not add a deprecation test based on arguments length either since it may happen for other reasons than because the previous constructor was used. In addition, batch tables are not meant to be constructed directly by users of itowns but by our 3D tiles parsers so there is little chance that a user calls this constructor anyway. Therefore, I think we should keep it this way and only add BREAKING CHANGE in the commit title (and therefore in the release). WDYT ?

src/Core/3DTiles/utils/BinaryPropertyAccessor.js Outdated Show resolved Hide resolved
@jailln jailln force-pushed the feat/binary-batch-table branch 2 times, most recently from c879321 to 3fab1e5 Compare October 7, 2022 09:05
jailln added 2 commits October 7, 2022 11:12
BREAKING CHANGE:
`C3DTBatchTable` constructor signature has changed from
C3DTBatchTable(buffer, binaryLength, batchLength, registeredExtensions) to
C3DTBatchTable(buffer, jsonLength, binaryLength, batchLength, registeredExtensions)
@jailln jailln force-pushed the feat/binary-batch-table branch from 3fab1e5 to bdf67f9 Compare October 7, 2022 09:13
@jailln
Copy link
Contributor Author

jailln commented Oct 7, 2022

I added the deprecation warning, added the breaking change message in the commit and rebased.

@jailln jailln merged commit f3bd6c7 into master Oct 26, 2022
@mgermerie mgermerie deleted the feat/binary-batch-table branch November 7, 2022 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants