PySimultan 0.4.22__py3-none-any.whl → 0.5.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- PySimultan2/__about__.py +1 -1
- PySimultan2/__init__.py +1 -0
- PySimultan2/data_model.py +185 -80
- PySimultan2/default_types.py +127 -21
- PySimultan2/files.py +55 -5
- PySimultan2/object_mapper.py +58 -7
- PySimultan2/resources/ComponentBuilder.dll +0 -0
- PySimultan2/resources/ComponentBuilder.runtimeconfig.json +2 -1
- PySimultan2/resources/ComponentBuilder.xml +47 -1
- PySimultan2/resources/SIMULTAN.AutoUpdate.Client.dll +0 -0
- PySimultan2/resources/SIMULTAN.AutoUpdate.DataTransferLibrary.dll +0 -0
- PySimultan2/resources/SIMULTAN.Lang.dll +0 -0
- PySimultan2/resources/SIMULTAN.Lang.xml +94 -7
- PySimultan2/resources/SIMULTAN.Plugins.dll +0 -0
- PySimultan2/resources/SIMULTAN.UI.dll +0 -0
- PySimultan2/resources/SIMULTAN.UI.xml +136 -43
- PySimultan2/resources/SIMULTAN.dll +0 -0
- PySimultan2/resources/SIMULTAN.xml +364 -97
- PySimultan2/resources/System.Collections.Immutable.dll +0 -0
- PySimultan2/resources/System.Reflection.Metadata.dll +0 -0
- PySimultan2/resources/System.Reflection.MetadataLoadContext.dll +0 -0
- PySimultan2/resources/componentmanager.user +0 -0
- PySimultan2/simultan_object.py +64 -15
- PySimultan2/taxonomy_maps.py +20 -12
- PySimultan2/type_setter_lookup.py +46 -33
- PySimultan2/utils.py +49 -14
- {pysimultan-0.4.22.dist-info → pysimultan-0.5.0.dist-info}/METADATA +2 -3
- {pysimultan-0.4.22.dist-info → pysimultan-0.5.0.dist-info}/RECORD +30 -32
- {pysimultan-0.4.22.dist-info → pysimultan-0.5.0.dist-info}/WHEEL +1 -1
- PySimultan2/resources/GeometryViewer.dll +0 -0
- PySimultan2/resources/GeometryViewer.dll.config +0 -42
- PySimultan2/resources/GeometryViewer.xml +0 -6425
- PySimultan2/resources/SitePlanner.dll +0 -0
- PySimultan2/resources/SitePlanner.dll.config +0 -11
- PySimultan2/resources/SitePlanner.xml +0 -2736
- {pysimultan-0.4.22.dist-info → pysimultan-0.5.0.dist-info}/licenses/LICENSE.txt +0 -0
PySimultan2/default_types.py
CHANGED
@@ -7,6 +7,8 @@ import pandas as pd
|
|
7
7
|
import colorlog
|
8
8
|
from typing import Union, List, Type, Set, Tuple, Any, Optional
|
9
9
|
|
10
|
+
from reactivex import return_value
|
11
|
+
|
10
12
|
from .utils import (sort_slots, create_simultan_component_for_taxonomy, create_mapped_python_object,
|
11
13
|
set_property_to_sim_component, set_property_to_parameter, set_property_to_file_info,
|
12
14
|
set_property_to_list, set_property_to_value_field, set_property_to_unknown_type,
|
@@ -139,11 +141,19 @@ class ComponentList(SimultanObject):
|
|
139
141
|
|
140
142
|
def append(self, values: Union[SimultanObject, List]):
|
141
143
|
|
144
|
+
return_val = []
|
145
|
+
|
146
|
+
as_list = True
|
142
147
|
if not isinstance(values, Iterable):
|
148
|
+
as_list = False
|
143
149
|
values = [values]
|
144
150
|
|
145
151
|
for i, value in enumerate(values, start=len(self.data)):
|
146
|
-
self._set_value(value, i)
|
152
|
+
return_val.append(self._set_value(value, i))
|
153
|
+
|
154
|
+
if not as_list:
|
155
|
+
return return_val[0]
|
156
|
+
return return_val
|
147
157
|
|
148
158
|
def _update_slot_extensions(self, index: int):
|
149
159
|
|
@@ -160,6 +170,9 @@ class ComponentList(SimultanObject):
|
|
160
170
|
|
161
171
|
def _set_value(self, value, i):
|
162
172
|
|
173
|
+
if isinstance(value, FileInfo):
|
174
|
+
raise ValueError(f'FileInfos cannot be added to ComponentLists')
|
175
|
+
|
163
176
|
if isinstance(value, SimultanObject):
|
164
177
|
slot = value._wrapped_obj.Slots.Items[0]
|
165
178
|
|
@@ -171,6 +184,9 @@ class ComponentList(SimultanObject):
|
|
171
184
|
self.add_referenced_component(value._wrapped_obj,
|
172
185
|
slot_extension=str(i),
|
173
186
|
slot=slot)
|
187
|
+
|
188
|
+
return value
|
189
|
+
|
174
190
|
else:
|
175
191
|
new_val = create_mapped_python_object(value,
|
176
192
|
data_model=self._data_model,
|
@@ -193,6 +209,8 @@ class ComponentList(SimultanObject):
|
|
193
209
|
slot_extension=str(i),
|
194
210
|
slot=taxonomy_entry)
|
195
211
|
|
212
|
+
return new_val
|
213
|
+
|
196
214
|
def __setitem__(self, i, value):
|
197
215
|
if isinstance(i, slice):
|
198
216
|
for j, val in enumerate(value):
|
@@ -210,7 +228,7 @@ class ComponentList(SimultanObject):
|
|
210
228
|
self._set_value(value, i)
|
211
229
|
|
212
230
|
def extend(self, values: List):
|
213
|
-
self.append(values)
|
231
|
+
return self.append(values)
|
214
232
|
|
215
233
|
def remove(self, value: SimultanObject):
|
216
234
|
self.discard(value)
|
@@ -292,6 +310,41 @@ class ComponentList(SimultanObject):
|
|
292
310
|
self._wrapped_obj.Components.Clear()
|
293
311
|
self._wrapped_obj.ReferencedComponents.Clear()
|
294
312
|
|
313
|
+
def to_json(self) -> dict[Any: Any]:
|
314
|
+
|
315
|
+
return_val = [None] * len(self.data)
|
316
|
+
|
317
|
+
for i, val in enumerate(self.data):
|
318
|
+
|
319
|
+
if hasattr(val, 'json_ref'):
|
320
|
+
return_val[i] = val.json_ref()
|
321
|
+
elif isinstance(val, list):
|
322
|
+
return_val[i] = [v.json_ref() if hasattr(v, 'json_ref') else v for v in val]
|
323
|
+
elif isinstance(val, dict):
|
324
|
+
return_val[i] = {k: v.json_ref() if hasattr(v, 'json_ref') else v for k, v in val.items()}
|
325
|
+
elif isinstance(val, np.ndarray):
|
326
|
+
return_val[i] = val.tolist()
|
327
|
+
else:
|
328
|
+
return_val[i] = val
|
329
|
+
|
330
|
+
return {
|
331
|
+
str(self.id): {
|
332
|
+
'name': self.name,
|
333
|
+
'taxonomies': self.taxonomy_keys,
|
334
|
+
'items': return_val
|
335
|
+
}
|
336
|
+
}
|
337
|
+
|
338
|
+
def json_ref(self):
|
339
|
+
return {"$ref": {
|
340
|
+
"$type": 'ComponentList',
|
341
|
+
"$taxonomies": self.taxonomy_keys,
|
342
|
+
"$id": {'local_id': self.id.LocalId,
|
343
|
+
'global_id': str(self.id.GlobalId)
|
344
|
+
},
|
345
|
+
"length": len(self)
|
346
|
+
}
|
347
|
+
}
|
295
348
|
|
296
349
|
component_list_map = TaxonomyMap(taxonomy_name='PySimultan',
|
297
350
|
taxonomy_key='PySimultan',
|
@@ -319,9 +372,11 @@ class ComponentDictionary(SimultanObject):
|
|
319
372
|
self._dict = {}
|
320
373
|
super().__init__(*args, **kwargs)
|
321
374
|
self.component_policy = kwargs.get('component_policy', 'subcomponent') # component add policy of the content/parameter/property, 'reference' or 'subcomponent'
|
375
|
+
self._generate_internal_dict()
|
322
376
|
|
323
377
|
def __load_init__(self, *args, **kwargs):
|
324
378
|
self._dict = {}
|
379
|
+
self._generate_internal_dict()
|
325
380
|
|
326
381
|
@classmethod
|
327
382
|
def create_from_values(cls,
|
@@ -348,15 +403,20 @@ class ComponentDictionary(SimultanObject):
|
|
348
403
|
for key, value in values.items():
|
349
404
|
new_component_dict[key] = value
|
350
405
|
|
406
|
+
new_component_dict._generate_internal_dict()
|
407
|
+
|
351
408
|
return new_component_dict
|
352
409
|
|
353
410
|
def __getitem__(self, key, *args, **kwargs):
|
354
411
|
|
355
412
|
comp_dict = object.__getattribute__(self, '_dict')
|
356
413
|
|
357
|
-
if kwargs.get('check_dict',
|
358
|
-
|
359
|
-
|
414
|
+
if (kwargs.get('check_dict', False) and comp_dict is not None and
|
415
|
+
(key in comp_dict.keys() or '__dict_key__' + key in comp_dict.keys())):
|
416
|
+
if key in comp_dict.keys():
|
417
|
+
return comp_dict.get(key, None)
|
418
|
+
else:
|
419
|
+
return comp_dict.get('__dict_key__' + key, None)
|
360
420
|
else:
|
361
421
|
# data_model = config.default_data_model
|
362
422
|
# obj = get_component_taxonomy_entry(self._wrapped_obj, key)
|
@@ -406,6 +466,8 @@ class ComponentDictionary(SimultanObject):
|
|
406
466
|
object_mapper=object_mapper)
|
407
467
|
|
408
468
|
if val is not None:
|
469
|
+
if key.startswith('__dict_key__'):
|
470
|
+
key = key.replace('__dict_key__', '')
|
409
471
|
self._dict[key] = val
|
410
472
|
|
411
473
|
return self._dict.get(key, None)
|
@@ -454,27 +516,32 @@ class ComponentDictionary(SimultanObject):
|
|
454
516
|
return
|
455
517
|
|
456
518
|
from .type_setter_lookup import type_setter_fcn_lookup_dict
|
457
|
-
setter_fcn = type_setter_fcn_lookup_dict.get(
|
519
|
+
setter_fcn = type_setter_fcn_lookup_dict.get(value, set_property_to_unknown_type)
|
458
520
|
|
459
521
|
setter_fcn(*fcn_arg_list)
|
460
522
|
item = self.__getitem__(key, check_dict=False)
|
461
523
|
|
462
|
-
|
524
|
+
if key.startswith('__dict_key__'):
|
525
|
+
self._dict[key.replace('__dict_key__', '')] = item
|
526
|
+
else:
|
527
|
+
self._dict[key] = item
|
463
528
|
|
464
529
|
def __delitem__(self, key):
|
465
530
|
self[key] = None
|
466
531
|
del self._dict[key]
|
467
532
|
|
468
533
|
def items(self):
|
534
|
+
if self._dict is None or not self._dict:
|
535
|
+
self._generate_internal_dict()
|
469
536
|
return self._dict.items()
|
470
537
|
|
471
538
|
def keys(self):
|
472
|
-
if not self._dict:
|
539
|
+
if not self._dict or not self._dict:
|
473
540
|
self._generate_internal_dict()
|
474
541
|
return self._dict.keys()
|
475
542
|
|
476
543
|
def values(self):
|
477
|
-
if not self._dict:
|
544
|
+
if not self._dict or not self._dict:
|
478
545
|
self._generate_internal_dict()
|
479
546
|
return self._dict.values()
|
480
547
|
|
@@ -482,22 +549,26 @@ class ComponentDictionary(SimultanObject):
|
|
482
549
|
comp_dict = {}
|
483
550
|
|
484
551
|
for parameter in self._wrapped_obj.Parameters.Items:
|
485
|
-
|
486
|
-
|
487
|
-
|
552
|
+
key = parameter.NameTaxonomyEntry.TextOrKey.replace('__dict_key__', '')
|
553
|
+
comp_dict[key] = get_obj_value(parameter,
|
554
|
+
data_model=self._data_model,
|
555
|
+
object_mapper=self._object_mapper)
|
488
556
|
for component in self._wrapped_obj.Components.Items:
|
489
|
-
|
490
|
-
|
491
|
-
|
557
|
+
key = component.Slot.SlotBase.Target.Key.replace('__dict_key__', '')
|
558
|
+
comp_dict[key] = get_obj_value(component.Component,
|
559
|
+
data_model=self._data_model,
|
560
|
+
object_mapper=self._object_mapper)
|
492
561
|
for ref_component in self._wrapped_obj.ReferencedComponents.Items:
|
493
|
-
|
494
|
-
|
495
|
-
|
562
|
+
key = ref_component.Slot.SlotBase.Target.Key.replace('__dict_key__', '')
|
563
|
+
comp_dict[key] = get_obj_value(ref_component.Target,
|
564
|
+
data_model=self._data_model,
|
565
|
+
object_mapper=self._object_mapper)
|
496
566
|
for ref_asset in self._wrapped_obj.ReferencedAssets.Items:
|
497
567
|
for tag in ref_asset.Resource.Tags:
|
498
|
-
|
499
|
-
|
500
|
-
|
568
|
+
key = tag.Target.Key.replace('__dict_key__', '')
|
569
|
+
comp_dict[key] = get_obj_value(ref_asset.Target,
|
570
|
+
data_model=self._data_model,
|
571
|
+
object_mapper=self._object_mapper)
|
501
572
|
|
502
573
|
object.__setattr__(self, '_dict', comp_dict)
|
503
574
|
|
@@ -529,5 +600,40 @@ class ComponentDictionary(SimultanObject):
|
|
529
600
|
for key, value in other.items():
|
530
601
|
self[key] = value
|
531
602
|
|
603
|
+
def to_json(self) -> dict:
|
604
|
+
|
605
|
+
return_value = {}
|
606
|
+
|
607
|
+
for key, value in self.items():
|
608
|
+
if isinstance(value, SimultanObject):
|
609
|
+
return_value[key] = value.to_json()
|
610
|
+
elif isinstance(value, list):
|
611
|
+
return_value[key] = [v.json_ref() if hasattr(v, 'json_ref') else v for v in value]
|
612
|
+
elif isinstance(value, dict):
|
613
|
+
return_value[key] = {k: v.json_ref() if hasattr(v, 'json_ref') else v for k, v in value.items()}
|
614
|
+
elif isinstance(value, np.ndarray):
|
615
|
+
return_value[key] = value.tolist()
|
616
|
+
else:
|
617
|
+
return_value[key] = value
|
618
|
+
|
619
|
+
return {
|
620
|
+
str(self.id): {
|
621
|
+
'name': self.name,
|
622
|
+
'taxonomies': self.taxonomy_keys,
|
623
|
+
'items': return_value
|
624
|
+
}
|
625
|
+
}
|
626
|
+
|
627
|
+
def json_ref(self):
|
628
|
+
return {"$ref": {
|
629
|
+
"$type": 'ComponentDictionary',
|
630
|
+
"$taxonomies": self.taxonomy_keys,
|
631
|
+
"$id": {'local_id': self.id.LocalId,
|
632
|
+
'global_id': str(self.id.GlobalId)
|
633
|
+
},
|
634
|
+
"length": len(self)
|
635
|
+
}
|
636
|
+
}
|
637
|
+
|
532
638
|
|
533
639
|
component_dict_map = ComponentDictionary._taxonomy_map
|
PySimultan2/files.py
CHANGED
@@ -81,9 +81,17 @@ def add_asset_to_component(comp: [SimComponent, SimultanObject],
|
|
81
81
|
wrapped_obj = comp if isinstance(comp, SimComponent) else comp._wrapped_obj
|
82
82
|
|
83
83
|
if tag is not None:
|
84
|
-
|
84
|
+
try:
|
85
|
+
add_tag_to_resource(asset, tag)
|
86
|
+
except Exception as e:
|
87
|
+
logger.error(f'Error adding tag to asset {asset}: {e} ')
|
88
|
+
raise e
|
85
89
|
|
86
|
-
|
90
|
+
try:
|
91
|
+
return ComponentMapping.AddAsset(wrapped_obj, asset, content_id)
|
92
|
+
except Exception as e:
|
93
|
+
logger.error(f'Error adding asset {asset} to component: {e}')
|
94
|
+
raise e
|
87
95
|
|
88
96
|
|
89
97
|
def remove_asset_from_component(comp: Union[SimComponent, SimultanObject],
|
@@ -187,7 +195,9 @@ class FileInfo(object, metaclass=MetaMock):
|
|
187
195
|
_cls_instances = {}
|
188
196
|
|
189
197
|
@classmethod
|
190
|
-
def from_string(cls,
|
198
|
+
def from_string(cls,
|
199
|
+
filename: str,
|
200
|
+
content: str, *args, **kwargs) -> FileInfo:
|
191
201
|
"""
|
192
202
|
Create a file info object from a string.
|
193
203
|
:param filename: Name of the file to be created. E.g. 'new_file.txt'
|
@@ -237,6 +247,13 @@ class FileInfo(object, metaclass=MetaMock):
|
|
237
247
|
self.args = args
|
238
248
|
self.kwargs = kwargs
|
239
249
|
|
250
|
+
@property
|
251
|
+
def key(self) -> int:
|
252
|
+
try:
|
253
|
+
return self.resource_entry.Key
|
254
|
+
except Exception as e:
|
255
|
+
return None
|
256
|
+
|
240
257
|
@property
|
241
258
|
def resource_entry(self) -> Union[ResourceFileEntry, ContainedResourceFileEntry, None]:
|
242
259
|
if self._resource_entry is None:
|
@@ -258,8 +275,13 @@ class FileInfo(object, metaclass=MetaMock):
|
|
258
275
|
self._resource_entry = value
|
259
276
|
|
260
277
|
@property
|
261
|
-
def file_size(self) -> int:
|
262
|
-
|
278
|
+
def file_size(self) -> Optional[int]:
|
279
|
+
try:
|
280
|
+
return os.path.getsize(self.file_path)
|
281
|
+
except FileNotFoundError:
|
282
|
+
raise FileNotFoundError(f'File not found: {self.file_path}')
|
283
|
+
except Exception as e:
|
284
|
+
raise e
|
263
285
|
|
264
286
|
@property
|
265
287
|
def last_modified(self) -> datetime:
|
@@ -269,6 +291,10 @@ class FileInfo(object, metaclass=MetaMock):
|
|
269
291
|
def resource_entry(self, value):
|
270
292
|
self._resource_entry = value
|
271
293
|
|
294
|
+
@property
|
295
|
+
def filename(self) -> str:
|
296
|
+
return self.resource_entry.File.Name
|
297
|
+
|
272
298
|
@property
|
273
299
|
def name(self) -> str:
|
274
300
|
return os.path.basename(self.file_path)
|
@@ -317,6 +343,9 @@ class FileInfo(object, metaclass=MetaMock):
|
|
317
343
|
def __exit__(self, *args):
|
318
344
|
self.file_obj.close()
|
319
345
|
|
346
|
+
def __repr__(self):
|
347
|
+
return f'FileInfo({self.file_path})'
|
348
|
+
|
320
349
|
def get_content(self, encoding='utf-8') -> Optional[Union[str, dict[str, str]]]:
|
321
350
|
"""
|
322
351
|
Get the content of the file.
|
@@ -373,3 +402,24 @@ class FileInfo(object, metaclass=MetaMock):
|
|
373
402
|
if self.resource_entry is not None:
|
374
403
|
self.data_model.delete_resource(self.resource_entry)
|
375
404
|
os.remove(self.file_path)
|
405
|
+
|
406
|
+
def to_json(self) -> dict:
|
407
|
+
|
408
|
+
obj_dict = {
|
409
|
+
'key': self.key,
|
410
|
+
'name': self.name,
|
411
|
+
'file_path': self.file_path,
|
412
|
+
'file_size': self.file_size,
|
413
|
+
'last_modified': self.last_modified,
|
414
|
+
'encoding': self.encoding,
|
415
|
+
'is_zip': self.is_zip,
|
416
|
+
}
|
417
|
+
|
418
|
+
return obj_dict
|
419
|
+
|
420
|
+
def json_ref(self):
|
421
|
+
return {"$ref": {
|
422
|
+
"$type": 'FileInfo',
|
423
|
+
"$key": str(self.key)
|
424
|
+
}
|
425
|
+
}
|
PySimultan2/object_mapper.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
from typing import Optional, Type, TYPE_CHECKING, Union
|
1
|
+
from typing import Optional, Type, TYPE_CHECKING, Union, Any
|
2
2
|
from copy import copy
|
3
3
|
from collections import UserList
|
4
4
|
from colorlog import getLogger
|
@@ -72,10 +72,20 @@ class PythonMapper(object):
|
|
72
72
|
def mapped_classes(self, value):
|
73
73
|
self._mapped_classes = value
|
74
74
|
|
75
|
-
def register(self,
|
76
|
-
|
75
|
+
def register(self,
|
76
|
+
taxonomy,
|
77
|
+
cls,
|
78
|
+
re_register=False,
|
79
|
+
taxonomy_map=None):
|
80
|
+
if not (self.re_register or re_register) and taxonomy in self.registered_classes.keys():
|
77
81
|
return
|
78
82
|
|
83
|
+
if taxonomy in self.mapped_classes.keys():
|
84
|
+
try:
|
85
|
+
del self.mapped_classes[taxonomy]
|
86
|
+
except KeyError:
|
87
|
+
pass
|
88
|
+
|
79
89
|
if taxonomy_map is None:
|
80
90
|
taxonomy_map = TaxonomyMap(taxonomy_name='PySimultan',
|
81
91
|
taxonomy_key='PySimultan',
|
@@ -171,7 +181,11 @@ class PythonMapper(object):
|
|
171
181
|
typed_data.append(typed_object)
|
172
182
|
return typed_data
|
173
183
|
|
174
|
-
def create_python_geometry_object(self,
|
184
|
+
def create_python_geometry_object(self,
|
185
|
+
component: Union[Layer, Vertex, Edge, PEdge, Face, Volume, EdgeLoop],
|
186
|
+
data_model: 'DataModel' = None,
|
187
|
+
*args,
|
188
|
+
**kwargs):
|
175
189
|
|
176
190
|
if component is None:
|
177
191
|
return None
|
@@ -191,7 +205,7 @@ class PythonMapper(object):
|
|
191
205
|
self.create_python_object(component, data_model, *args, **kwargs)
|
192
206
|
|
193
207
|
def get_mapped_class_from_component(self,
|
194
|
-
component,
|
208
|
+
component: Union[SimComponent, Layer, Vertex, Edge, PEdge, Face, Volume, EdgeLoop],
|
195
209
|
data_model: Optional['DataModel'] = None,
|
196
210
|
*args,
|
197
211
|
**kwargs) -> Optional[Type[SimultanObject]]:
|
@@ -205,7 +219,10 @@ class PythonMapper(object):
|
|
205
219
|
if isinstance(component,
|
206
220
|
(Layer, Vertex, Edge, PEdge, Face, Volume, EdgeLoop)
|
207
221
|
):
|
208
|
-
self.create_python_geometry_object(component,
|
222
|
+
self.create_python_geometry_object(component,
|
223
|
+
data_model,
|
224
|
+
*args,
|
225
|
+
**kwargs)
|
209
226
|
|
210
227
|
c_slots = [x.Target.Key for x in component.Slots.Items]
|
211
228
|
c_slot = list(set(c_slots) & set(self.registered_classes.keys()))
|
@@ -266,6 +283,21 @@ class PythonMapper(object):
|
|
266
283
|
*args,
|
267
284
|
**kwargs)
|
268
285
|
|
286
|
+
def create_mapped_python_object(self,
|
287
|
+
obj: Any,
|
288
|
+
data_model=None,
|
289
|
+
add_to_data_model=True,
|
290
|
+
*args,
|
291
|
+
**kwargs) -> Optional[SimultanObject]:
|
292
|
+
|
293
|
+
from .utils import create_mapped_python_object
|
294
|
+
return create_mapped_python_object(obj,
|
295
|
+
object_mapper=self,
|
296
|
+
data_model=data_model,
|
297
|
+
add_to_data_model=add_to_data_model,
|
298
|
+
*args,
|
299
|
+
**kwargs)
|
300
|
+
|
269
301
|
def get_typed_data_with_taxonomy(self, taxonomy: str, data_model=None, first=False):
|
270
302
|
|
271
303
|
tax_components = data_model.find_components_with_taxonomy(taxonomy=taxonomy, first=first)
|
@@ -307,7 +339,9 @@ class PythonMapper(object):
|
|
307
339
|
new_val = create_mapped_python_object(obj, self, data_model)
|
308
340
|
return new_val
|
309
341
|
|
310
|
-
def copy(self
|
342
|
+
def copy(self,
|
343
|
+
*args,
|
344
|
+
**kwargs) -> 'PythonMapper':
|
311
345
|
new_mapper = PythonMapper()
|
312
346
|
new_mapper.registered_classes = self.registered_classes
|
313
347
|
new_mapper.taxonomy_maps = self.taxonomy_maps
|
@@ -315,6 +349,23 @@ class PythonMapper(object):
|
|
315
349
|
new_mapper.load_undefined = self.load_undefined
|
316
350
|
return new_mapper
|
317
351
|
|
352
|
+
def __add__(self, other: 'PythonMapper') -> 'PythonMapper':
|
353
|
+
new_mapper = self.copy()
|
354
|
+
new_mapper.registered_classes.update(other.registered_classes)
|
355
|
+
new_mapper.taxonomy_maps.update(other.taxonomy_maps)
|
356
|
+
new_mapper.registered_geometry_classes.update(other.registered_geometry_classes)
|
357
|
+
return new_mapper
|
358
|
+
|
359
|
+
def get_mapped_class_for_python_type(self, python_type: type) -> Optional[Type[SimultanObject]]:
|
360
|
+
try:
|
361
|
+
key = list(filter(lambda x: self.registered_classes[x] == python_type,
|
362
|
+
self.registered_classes)
|
363
|
+
)[0]
|
364
|
+
mapped_cls = self.get_mapped_class(key)
|
365
|
+
return mapped_cls
|
366
|
+
except IndexError:
|
367
|
+
return None
|
368
|
+
|
318
369
|
|
319
370
|
if config.get_default_mapper() is None:
|
320
371
|
config.set_default_mapper(PythonMapper())
|
Binary file
|
@@ -12,7 +12,8 @@
|
|
12
12
|
}
|
13
13
|
],
|
14
14
|
"configProperties": {
|
15
|
-
"System.Reflection.Metadata.MetadataUpdater.IsSupported": false
|
15
|
+
"System.Reflection.Metadata.MetadataUpdater.IsSupported": false,
|
16
|
+
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": true
|
16
17
|
}
|
17
18
|
}
|
18
19
|
}
|
@@ -2875,6 +2875,12 @@
|
|
2875
2875
|
Invoked when the selection in this list has changed
|
2876
2876
|
</summary>
|
2877
2877
|
</member>
|
2878
|
+
<member name="E:ComponentBuilder.ViewNEW.Components.ComponentListVM.TreeViewContextMenuOpening">
|
2879
|
+
<summary>
|
2880
|
+
Context menu opening event on all the elements in the component list.
|
2881
|
+
Useful to inject custom menu items in plugins.
|
2882
|
+
</summary>
|
2883
|
+
</member>
|
2878
2884
|
<member name="P:ComponentBuilder.ViewNEW.Components.ComponentListVM.SuperviseCommand">
|
2879
2885
|
<summary>
|
2880
2886
|
Command for supervising a component (only available when user has supervise privilege)
|
@@ -10206,11 +10212,21 @@
|
|
10206
10212
|
Command for exporting the project as JSON
|
10207
10213
|
</summary>
|
10208
10214
|
</member>
|
10209
|
-
<member name="P:ComponentBuilder.ViewNEW.JSONExportRibbon.JSONExportRibbonVM.
|
10215
|
+
<member name="P:ComponentBuilder.ViewNEW.JSONExportRibbon.JSONExportRibbonVM.ExportJSONSelectedNetworksCommand">
|
10210
10216
|
<summary>
|
10211
10217
|
Command for selection networks to export
|
10212
10218
|
</summary>
|
10213
10219
|
</member>
|
10220
|
+
<member name="P:ComponentBuilder.ViewNEW.JSONExportRibbon.JSONExportRibbonVM.ExportXMICommand">
|
10221
|
+
<summary>
|
10222
|
+
Command for exporting the whole project in XMI format
|
10223
|
+
</summary>
|
10224
|
+
</member>
|
10225
|
+
<member name="P:ComponentBuilder.ViewNEW.JSONExportRibbon.JSONExportRibbonVM.ExportXMISelectedNetworksCommand">
|
10226
|
+
<summary>
|
10227
|
+
Command for selecting a network and exporting it to XMI
|
10228
|
+
</summary>
|
10229
|
+
</member>
|
10214
10230
|
<member name="M:ComponentBuilder.ViewNEW.JSONExportRibbon.JSONExportRibbonVM.#ctor(ComponentBuilder.ViewNEW.MainWindowContent.MainWindowVM,SIMULTAN.Utils.IServicesProvider)">
|
10215
10231
|
<summary>
|
10216
10232
|
Initializes a new instance of the ExcelToolsRibbonVM class
|
@@ -19163,5 +19179,35 @@
|
|
19163
19179
|
<member name="P:ComponentBuilder.WinUtils.WinSynchronizationContext.InvokeRequired">
|
19164
19180
|
<inheritdoc/>
|
19165
19181
|
</member>
|
19182
|
+
<member name="T:XamlGeneratedNamespace.GeneratedInternalTypeHelper">
|
19183
|
+
<summary>
|
19184
|
+
GeneratedInternalTypeHelper
|
19185
|
+
</summary>
|
19186
|
+
</member>
|
19187
|
+
<member name="M:XamlGeneratedNamespace.GeneratedInternalTypeHelper.CreateInstance(System.Type,System.Globalization.CultureInfo)">
|
19188
|
+
<summary>
|
19189
|
+
CreateInstance
|
19190
|
+
</summary>
|
19191
|
+
</member>
|
19192
|
+
<member name="M:XamlGeneratedNamespace.GeneratedInternalTypeHelper.GetPropertyValue(System.Reflection.PropertyInfo,System.Object,System.Globalization.CultureInfo)">
|
19193
|
+
<summary>
|
19194
|
+
GetPropertyValue
|
19195
|
+
</summary>
|
19196
|
+
</member>
|
19197
|
+
<member name="M:XamlGeneratedNamespace.GeneratedInternalTypeHelper.SetPropertyValue(System.Reflection.PropertyInfo,System.Object,System.Object,System.Globalization.CultureInfo)">
|
19198
|
+
<summary>
|
19199
|
+
SetPropertyValue
|
19200
|
+
</summary>
|
19201
|
+
</member>
|
19202
|
+
<member name="M:XamlGeneratedNamespace.GeneratedInternalTypeHelper.CreateDelegate(System.Type,System.Object,System.String)">
|
19203
|
+
<summary>
|
19204
|
+
CreateDelegate
|
19205
|
+
</summary>
|
19206
|
+
</member>
|
19207
|
+
<member name="M:XamlGeneratedNamespace.GeneratedInternalTypeHelper.AddEventHandler(System.Reflection.EventInfo,System.Object,System.Delegate)">
|
19208
|
+
<summary>
|
19209
|
+
AddEventHandler
|
19210
|
+
</summary>
|
19211
|
+
</member>
|
19166
19212
|
</members>
|
19167
19213
|
</doc>
|
Binary file
|
Binary file
|
Binary file
|