15
15
"inspector" : None ,
16
16
"color_scheme" : None ,
17
17
"z_scale" : None ,
18
- "topo_offset" : None ,
19
- "classes" : {"numbers" : [], "names" : []},
20
- "time_offset" : None ,
21
- "point_shift" : [None , None , None ],
22
18
"rgb_max" : None ,
23
19
"bbox" : None ,
24
20
"name_space" : None ,
25
21
"group_name" : None ,
26
22
"array_name" : None ,
27
23
"token" : None ,
28
24
"tiledb_env" : None ,
29
- "mbtoken" : None ,
30
- "mbstyle" : None ,
31
25
"crs" : None ,
32
26
"buffer_size" : None ,
33
27
"streaming" : None ,
46
40
"worker_pool_size" : None ,
47
41
}
48
42
43
+ IMAGE_ARGS_DEFAULTS = {
44
+ "width" : None ,
45
+ "height" : None ,
46
+ "wheel_precision" : None , # used? in base class?
47
+ "move_speed" : None , # used?
48
+ "name_space" : None ,
49
+ "array_name" : None ,
50
+ "group_name" : None ,
51
+ "geometry_array_name" : None ,
52
+ "base_group" : None ,
53
+ "token" : None ,
54
+ "tiledb_env" : None ,
55
+ "default_channels" : None ,
56
+ }
49
57
50
- def check_point_cloud_args (source , mode , point_cloud_args_in ):
51
- if mode == "time" :
52
- raise ValueError ("This mode will be implemented soon" )
53
- if mode == "classes" :
54
- raise ValueError ("This mode will be implemented soon" )
55
- if not "classes" in point_cloud_args_in :
56
- raise ValueError (
57
- "The classes containing numbers and names is not specified"
58
- )
59
- elif mode == "topo" :
60
- raise ValueError ("This mode will be implemented soon" )
61
- if not "mbtoken" in point_cloud_args_in :
62
- raise ValueError ("The Mapbox token is not specified" )
63
- if not "crs" in point_cloud_args_in :
64
- raise ValueError (
65
- "The crs (coordinate reference system) of the data is not specified"
66
- )
67
- if not "bbox" in point_cloud_args_in :
68
- raise ValueError ("The bbox is not specified" )
69
58
59
+ def in_pixels (h , default ):
60
+ if h is None :
61
+ return default
62
+ if isinstance (h , str ):
63
+ if "px" in h :
64
+ return h
65
+ return h + "px"
66
+ if isinstance (h , int ):
67
+ return str (h ) + "px"
68
+ if isinstance (h , float ):
69
+ return str (int (h )) + "px"
70
+
71
+
72
+ def check_image_args (image_args_in ):
73
+ image_args = {}
74
+ for key in IMAGE_ARGS_DEFAULTS .keys ():
75
+ if key in image_args_in :
76
+ if key is not None :
77
+ image_args [key ] = image_args_in .pop (key )
78
+
79
+ image_args ["height" ] = in_pixels (image_args .get ("height" ), "500px" )
80
+ image_args ["width" ] = in_pixels (image_args .get ("width" ), "700px" )
81
+
82
+ if not "token" in image_args :
83
+ try :
84
+ token = os .getenv ("TILEDB_REST_TOKEN" )
85
+ except :
86
+ if token == None :
87
+ raise ValueError (
88
+ "The TileDB Cloud token needed to access the array is not specified or cannot be accessed"
89
+ )
90
+ image_args = {** image_args , "token" : token }
91
+
92
+ return image_args
93
+
94
+
95
+ def check_point_cloud_args (source , streaming , point_cloud_args_in ):
70
96
point_cloud_args = {}
71
97
for key in POINT_CLOUD_ARGS_DEFAULTS .keys ():
72
98
if key in point_cloud_args_in :
73
99
if key is not None :
74
100
point_cloud_args [key ] = point_cloud_args_in .pop (key )
75
101
76
- def in_pixels (h , default ):
77
- if h is None :
78
- return default
79
- if isinstance (h , str ):
80
- if "px" in h :
81
- return h
82
- return h + "px"
83
- if isinstance (h , int ):
84
- return str (h ) + "px"
85
- if isinstance (h , float ):
86
- return str (int (h )) + "px"
87
-
88
102
point_cloud_args ["height" ] = in_pixels (point_cloud_args .get ("height" ), "500px" )
89
103
point_cloud_args ["width" ] = in_pixels (point_cloud_args .get ("width" ), "700px" )
90
104
@@ -101,7 +115,7 @@ def in_pixels(h, default):
101
115
return point_cloud_args
102
116
103
117
104
- def check_point_cloud_data_dict (mode , data ):
118
+ def check_point_cloud_data_dict (data ):
105
119
for var in ["X" , "Y" , "Z" , "Red" , "Green" , "Blue" ]:
106
120
if not var in data :
107
121
raise ValueError ("Data dictionary does not contain " + var )
@@ -115,28 +129,16 @@ def check_point_cloud_data_dict(mode, data):
115
129
):
116
130
raise ValueError ("Attributes in data dictionary do not have the same length." )
117
131
118
- if mode == "time" :
119
- if not "GpsTime" in data :
120
- raise ValueError ("Data dictionary does not contain 'GpsTime'" )
121
-
122
- i = np .argsort (data ["GpsTime" ])
123
- for key in ["Red" , "Green" , "Blue" , "GpsTime" , "X" , "Y" , "Z" ]:
124
- data [key ] = data [key ][i ]
125
-
126
- elif mode == "classes" :
127
- if not "Classification" in data :
128
- raise ValueError ("Data dictionary does not contain 'Classification'" )
129
-
130
132
return data
131
133
132
134
133
- def check_point_cloud_data_local (mode , uri , point_cloud_args ):
135
+ def check_point_cloud_data_local (uri , point_cloud_args ):
134
136
if os .path .isdir (uri ) == False :
135
137
raise ValueError ("uri: " + uri + " does not exist." )
136
138
if not "bbox" in point_cloud_args :
137
139
raise ValueError ("The bbox for slicing data from the array is not specified" )
138
140
139
- data = create_point_cloud (mode , uri , point_cloud_args ["bbox" ])
141
+ data = create_point_cloud (uri , point_cloud_args ["bbox" ])
140
142
141
143
return data
142
144
0 commit comments