|
GLG Toolkit, C# Class Library
Version 4.6
|
This group contains methods for saving and serializing either drawings or individual objects. More...
This group contains methods for saving and serializing either drawings or individual objects.
Functions | |
| bool | SaveObject (Object medium, GlgMediumType medium_type) |
| Saves the object into a stream using a default encoding. More... | |
| bool | SaveObject (Object medium, GlgMediumType medium_type, Encoding encoding) |
| Saves the object into a stream using the specified charset. More... | |
| bool | SaveObject (String filename) |
| Saves the object to a file using a default encoding. More... | |
| bool | SaveObject (String filename, Encoding encoding) |
| Saves the object to a file using the specified encoding. More... | |
| bool SaveObject | ( | Object | medium, |
| GlgMediumType | medium_type | ||
| ) |
Saves the object into a stream using a default encoding.
This method serializes the object and all its subsidiary objects into a stream using the GLG ASCII save format that provides maximum portability between different deployment environments.
| medium | The destination stream to save to. |
| medium_type | Destination type, must be STREAM. |
| bool SaveObject | ( | Object | medium, |
| GlgMediumType | medium_type, | ||
| Encoding | encoding | ||
| ) |
Saves the object into a stream using the specified charset.
This method serializes the object and all its subsidiary objects into a stream using the GLG ASCII save format that provides maximum portability between different deployment environments.
| medium | The destination stream to save to. |
| medium_type | Destination type, must be STREAM. |
| encoding | Encoding for string encoding. |
| bool SaveObject | ( | String | filename | ) |
Saves the object to a file using a default encoding.
This method can be used to save either a viewport, or any GlgObject object.
| filename | The file to save the object to. |
This method saves the specified object and all its subsidiary objects to a file. A GLG object of any type may be saved in this fashion and later loaded using LoadObject. The method uses the GLG ASCII save format that provides maximum portability between different deployment environments.
For applications that load a drawing, modify it and save if back to a file, the drawing should be loaded using LoadObject instead of LoadWidget. LoadWidget extracts the $Widget viewport from the loaded drawing, discarding the rest of the drawing, while LoadObject returns an object that represents the whole drawing.
Using SaveObject to save a viewport loaded with LoadWidget will result in a loss of information contained in the discarded part of the drawing, such as the type of the coordinate system used to display the viewport, which will make it difficult to load and edit the drawing in the Graphics Builder. The following example demonstrates the proper technique:
| bool SaveObject | ( | String | filename, |
| Encoding | encoding | ||
| ) |
Saves the object to a file using the specified encoding.
This method is similar to the SaveObject method described above, but allows to save using the specified encoding.
| filename | The file to save the object to. |
| encoding | Encoding for string encoding. |