Skip to content
This repository has been archived by the owner on Dec 17, 2024. It is now read-only.

Commit

Permalink
removed All from names, made getObject return a list instead of a gen…
Browse files Browse the repository at this point in the history
…erator
  • Loading branch information
vim-sroberge committed Nov 14, 2023
1 parent 21b755d commit f273b06
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/vim-loader/elementMapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export class ElementNoMapping {
return false
}

getAllElements () {
getElements () {
return []
}

Expand Down Expand Up @@ -96,7 +96,7 @@ export class ElementMapping {
/**
* Returns all element indices of the vim
*/
getAllElements () {
getElements () {
return this._elementIds.keys()
}

Expand Down Expand Up @@ -211,7 +211,7 @@ export class ElementMapping2 {
/**
* Returns all element indices of the vim
*/
getAllElements () {
getElements () {
return this._elementToInstances.keys()
}

Expand Down
1 change: 1 addition & 0 deletions src/vim-loader/progressive/g3dSubset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ export class G3dSubset {
)
return new G3dSubset(this._source, instances)
}

if (mode === 'tag' || mode === 'group') {
throw new Error('Filter Mode Not implemented')
}
Expand Down
14 changes: 8 additions & 6 deletions src/vim-loader/vim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export class Vim {
*/
getObjectFromInstance (instance: number) {
const element = this.map?.getElementFromInstance(instance)
if (!element) return
if (element === undefined) return
return this.getObjectFromElement(element)
}

Expand Down Expand Up @@ -118,7 +118,7 @@ export class Vim {
getObjectsInBox (box: THREE.Box3) {
const result: Object[] = []

for (const obj of this.getAllObjects()) {
for (const obj of this.getObjects()) {
const b = obj.getBoundingBox()
if (!b) continue
if (box.containsBox(b)) {
Expand All @@ -131,17 +131,19 @@ export class Vim {
/**
* Enumerates all objects of the vim
*/
* getAllObjects () {
for (const e of this.map.getAllElements()) {
getObjects () {
const result = new Array<Object>()
for (const e of this.map.getElements()) {
const obj = this.getObjectFromElement(e)
if (obj) yield obj
result.push(obj)
}
return result
}

/**
* Enumerates all objects of the vim
*/
getSubsetObjects (subset: G3dSubset) {
getObjectsInSubset (subset: G3dSubset) {
const set = new Set<Object>()
const result = new Array<Object>()
const count = subset.getInstanceCount()
Expand Down

0 comments on commit f273b06

Please sign in to comment.