Skip to content

Commit

Permalink
fix minor sonarcloud issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Koyaani committed Jul 1, 2022
1 parent 1268c0f commit 7db655a
Show file tree
Hide file tree
Showing 25 changed files with 488 additions and 538 deletions.
2 changes: 0 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
Expand Down
2 changes: 0 additions & 2 deletions py3dtiles/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

from .utils import TileContentReader, convert_to_ecef
from .tile_content import TileContent
from .feature_table import Feature
Expand Down
16 changes: 2 additions & 14 deletions py3dtiles/b3dm.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# coding: utf-8
import struct
import numpy as np

Expand Down Expand Up @@ -74,7 +73,7 @@ class B3dmHeader(TileContentHeader):
BYTELENGTH = 28

def __init__(self):
self.type = TileContentType.BATCHED3DMODEL
self.type = TileContentType.BATCHED_3D_MODEL
self.magic_value = b"b3dm"
self.version = 1
self.tile_byte_length = 0
Expand Down Expand Up @@ -113,14 +112,10 @@ def sync(self, body):

if body.batch_table is not None:
bth_arr = body.batch_table.to_array()
# btb_arr = body.batch_table.body.to_array()

self.tile_byte_length += len(bth_arr)
self.bt_json_byte_length = len(bth_arr)

# fth_arr = body.feature_table.header.to_array()
# ftb_arr = body.feature_table.body.to_array()

@staticmethod
def from_array(array):
"""
Expand All @@ -146,15 +141,14 @@ def from_array(array):
h.bt_json_byte_length = struct.unpack("i", array[20:24])[0]
h.bt_bin_byte_length = struct.unpack("i", array[24:28])[0]

h.type = TileContentType.BATCHED3DMODEL
h.type = TileContentType.BATCHED_3D_MODEL

return h


class B3dmBody(TileContentBody):
def __init__(self):
self.batch_table = BatchTable()
# self.feature_table = FeatureTable()
self.glTF = GlTF()

def to_array(self):
Expand Down Expand Up @@ -200,13 +194,9 @@ def from_array(th, array):

# build feature table
ft_len = th.ft_json_byte_length + th.ft_bin_byte_length
# ft_arr = array[0:ft_len]
# ft = FeatureTable.from_array(th, ft_arr)

# build batch table
bt_len = th.bt_json_byte_length + th.bt_bin_byte_length
# bt_arr = array[ft_len:ft_len + bt_len]
# bt = BatchTable.from_array(th, bt_arr)

# build glTF
glTF_len = (th.tile_byte_length - ft_len - bt_len
Expand All @@ -216,8 +206,6 @@ def from_array(th, array):

# build tile body with feature table
b = B3dmBody()
# b.feature_table = ft
# b.batch_table = bt
b.glTF = glTF

return b
8 changes: 3 additions & 5 deletions py3dtiles/batch_table.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# -*- coding: utf-8 -*-

import numpy as np
import json


class BatchTable(object):
class BatchTable:
"""
Only the JSON header has been implemented for now. According to the batch
table documentation, the binary body is useful for storing long arrays of
Expand All @@ -14,8 +12,8 @@ class BatchTable(object):
def __init__(self):
self.header = {}

def add_property_from_array(self, propertyName, array):
self.header[propertyName] = array
def add_property_from_array(self, property_name, array):
self.header[property_name] = array

# returns batch table as binary
def to_array(self):
Expand Down
7 changes: 4 additions & 3 deletions py3dtiles/command_line.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import argparse
import traceback

import py3dtiles.convert as convert
import py3dtiles.export as export
import py3dtiles.info as info
import py3dtiles.merger as merger
import py3dtiles.export as export
import traceback


# https://stackoverflow.com/a/43357954
Expand All @@ -30,7 +31,7 @@ def main():
convert.init_parser(sub_parsers, str2bool)
info.init_parser(sub_parsers, str2bool)
merger.init_parser(sub_parsers, str2bool)
export.init_parser(sub_parsers, str2bool)
export.init_parser(sub_parsers)

args = parser.parse_args()

Expand Down
3 changes: 0 additions & 3 deletions py3dtiles/constants.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

# for all sort of size calculation, we consider a fake "thikness" of a point
# in most cases this is useless, but sometimes it's useful, for instance when
# calculating box sizes when all the points are coplanar
Expand Down

0 comments on commit 7db655a

Please sign in to comment.