Skip to content

editorGlobalsModelElementSerializer

Class: ModelElementSerializer ‹ModelElement, Serialized

Type parameters

ModelElement: IModelElement

Serialized: object

Hierarchy

ModelElementSerializer

ImportedModelSerializer

CellDescriptorSerializer

MeshSerializer

OrnamentDescriptorSerializer

ParametricHoleDescriptorSerializer

PlaceholderDescriptorSerializer

RoundEdgeDescriptorSerializer

SvgSurfaceDescriptorSerializer

TessellationDescriptorSerializer

LocalOrnamentDescriptorSerializer

PolygonOrnamentDescriptorSerializer

RoundCornerDescriptorSerializer

Index

Methods

Methods

Protected _deserializePlane

_deserializePlane(plane: ISerializedPlane): Plane

Inherited from BaseSerializer._deserializePlane

Defined in src/history/serialization/BaseSerializer.ts:155

Convenience method to serialize a Plane without invoking an extra serializer.

Parameters:

Name Type Description
plane ISerializedPlane -

Returns: Plane


Protected _deserializeQuaternion

_deserializeQuaternion(quaternion: ISerializedQuaternion): Quaternion

Inherited from BaseSerializer._deserializeQuaternion

Defined in src/history/serialization/BaseSerializer.ts:136

Convenience method to deserialize a Vector3 without invoking an extra serializer.

Parameters:

Name Type Description
quaternion ISerializedQuaternion -

Returns: Quaternion


Protected _deserializeVector3

_deserializeVector3(vector: ISerializedVector3): Vector3

Inherited from BaseSerializer._deserializeVector3

Defined in src/history/serialization/BaseSerializer.ts:115

Convenience method to deserialize a Vector3 without invoking an extra serializer.

Parameters:

Name Type
vector ISerializedVector3

Returns: Vector3


Protected _serializePlane

_serializePlane(plane: Plane): ISerializedPlane

Inherited from BaseSerializer._serializePlane

Defined in src/history/serialization/BaseSerializer.ts:144

Convenience method to serialize a Plane without invoking an extra serializer.

Parameters:

Name Type Description
plane Plane -

Returns: ISerializedPlane


Protected _serializeQuaternion

_serializeQuaternion(quaternion: Quaternion): ISerializedQuaternion

Inherited from BaseSerializer._serializeQuaternion

Defined in src/history/serialization/BaseSerializer.ts:123

Convenience method to serialize a Quaternion without invoking an extra serializer.

Parameters:

Name Type Description
quaternion Quaternion -

Returns: ISerializedQuaternion


Protected _serializeVector3

_serializeVector3(vector: ReadonlyVector3): ISerializedVector3

Inherited from BaseSerializer._serializeVector3

Defined in src/history/serialization/BaseSerializer.ts:104

Convenience method to serialize a Vector3 without invoking an extra serializer.

Parameters:

Name Type
vector ReadonlyVector3

Returns: ISerializedVector3


Abstract deserialize

deserialize(serialized: LatestSerializedObjectVersion): ModelElement

Inherited from BaseSerializer.deserialize

Defined in src/history/serialization/BaseSerializer.ts:80

This method should instantiate the deserialized object and fill it with the information that can be retrieved from the serialized object serialized. Any references to other objects, that depend on another Serializer (i.e. that used enqueueObjectToSerialize in the serialize method) must be resolved in linkDependencies.

remarks Classes might have to be adapted to allow for this separation between instantiation and initialization.

Parameters:

Name Type Description
serialized LatestSerializedObjectVersion the serialized object in POJO form, not as a string

Returns: ModelElement


linkDependencies

linkDependencies(deserialized: ModelElement, serialized: Serialized, resolve: function): void

Inherited from BaseSerializer.linkDependencies

Defined in src/history/serialization/BaseSerializer.ts:93

This is invoked in a second pass when all objects have been instantiated. The passed resolve function does the reverse of the enqueueObjectToSerialize function: It takes a name (e.g. Mesh1) and returns an object.

remarks This object may not be fully populated yet. Some classes need to be adapted to allow instantiation in an incomplete state (which sadly prevents immutability in some places).

Parameters:

deserialized: ModelElement

-

serialized: Serialized

-

resolve: function

-

▸ (name: string): any

Parameters:

Name Type
name string

Returns: void


Abstract serialize

serialize(target: ModelElement, enqueueObjectToSerialize: function): Serialized

Inherited from BaseSerializer.serialize

Defined in src/history/serialization/BaseSerializer.ts:65

This method is invoked with the object to serialize and an enqueueObjectToSerialize function. This function accepts an object to be serialized and returns the name of that serialized object (e.g. "Mesh1"). This allows expressing dependencies between objects.

Parameters:

target: ModelElement

the object to be serialized

enqueueObjectToSerialize: function

function to reference an object by the returned name in the serialization

▸ (o: any): string

Parameters:

Name Type
o any

Returns: Serialized

the serialized object


Static getSerializedClass

getSerializedClass(): object

Inherited from BaseSerializer.getSerializedClass

Defined in src/history/serialization/BaseSerializer.ts:52

Return a reference to the class that is serialized by this Serializer.

Returns: object


Static getSerializedClassName

getSerializedClassName(): string

Inherited from BaseSerializer.getSerializedClassName

Defined in src/history/serialization/BaseSerializer.ts:45

Overwrite in subclass. Warning: Do not use getSerializedClass().name because the name is minified in production.

Returns: string

the (unique) name of the class that is serialized