specifier = project.create_specifier(object, allow_partial=allow_partial) if project else None specifier_uuid = specifier.item_uuid if specifier else object.uuid d = {"version": 1, "type": "graphic", "uuid": str(specifier_uuid)} if specifier and specifier.context_uuid: d["context_uuid"] = str(specifier.context_uuid) return d elif isinstance(object, DataStructure): project = project or object.project specifier = project.create_specifier(object, allow_partial=allow_partial) if project else None specifier_uuid = specifier.item_uuid if specifier else object.uuid d = {"version": 1, "type": "structure", "uuid": str(specifier_uuid)} if specifier and specifier.context_uuid: d["context_uuid"] = str(specifier.context_uuid) return d elif isinstance(object, DisplayItem.DisplayItem): project = project or object.project specifier = project.create_specifier(object, allow_partial=allow_partial) if project else None specifier_uuid = specifier.item_uuid if specifier else object.uuid d = {"version": 1, "type": "display_item", "uuid": str(specifier_uuid)} if specifier and specifier.context_uuid: d["context_uuid"] = str(specifier.context_uuid) return d return None ElementalMappingEdge = Schema.entity("elemental_mapping_edge", None, None, { "atomic_number": Schema.prop(Schema.INT), "shell_number": Schema.prop(Schema.INT), "subshell_index": Schema.prop(Schema.INT), "fit_interval": Schema.fixed_tuple([Schema.prop(Schema.FLOAT), Schema.prop(Schema.FLOAT)]), "signal_interval": Schema.fixed_tuple([Schema.prop(Schema.FLOAT), Schema.prop(Schema.FLOAT)]), }) DataStructure.register_entity(ElementalMappingEdge, entity_name="Elemental Mapping Edge")
# TODO: notifying, storage, resolving, moving # TODO: are interval descriptors implicit now? # TODO: display_layers could be a record # TODO: display_properties could be a record # TODO: layout could be a record # TODO: closed_items should be a set of references Calibration = Schema.record({ "offset": Schema.prop(Schema.FLOAT), "scale": Schema.prop(Schema.FLOAT), "units": Schema.prop(Schema.STRING), }) Point = Schema.fixed_tuple( [Schema.prop(Schema.FLOAT), Schema.prop(Schema.FLOAT)]) Size = Schema.fixed_tuple( [Schema.prop(Schema.FLOAT), Schema.prop(Schema.FLOAT)]) Rect = Schema.fixed_tuple([Point, Size]) Vector = Schema.fixed_tuple([Point, Point]) Interval = Schema.fixed_tuple( [Schema.prop(Schema.FLOAT), Schema.prop(Schema.FLOAT)]) DataItem = Schema.entity(