The ShapeCollectionSave class is a "save" class. Save classes are classes which allow you to load XML files to runtime objects as well as to save data contained in runtime objects to XML files. For more information on Save files, check this article.
You do not need to use the ShapeCollectionSave class in most cases since the FlatRedBallServices' Load method can load ShapeCollections. If you are simply looking to load a ShapeCollection, see this page.
You can use ShapeCollectionSave if you are making a tool that works with the .shcx file format.
You can load load a ShapeCollectionSave as follows:
Sha'eCollectionSaves can be saved through the Save method. Therefore, the process of saving an existing ShapeCollectionSave is very simple:
The more complicated process is to construct the ShapeCollectionSave. You can construct a ShapeCollectionSave by creating a ShapeCollectionSave from an existing ShapeCollection or manually (by instantiating and adding instances to it).
The following code saves a .shcxfile named MyShapeCollection.shcx. It assumes that shapeCollection is a valid .
Add the following using statements:
Assumes shapeCollection is a valid ShapeCollection:
The steps for creating a ShapeCollectionSave manually are:
Instantiate a ShapeCollectionSave
Add "save" instances to the ShapeCollectionSave (such as PolygonSave and CircleSave)
Save using the Save method.
You can convert ShapeCollectionSaves into runtime ShapeCollections: Add the following using statements:
Assumes "save" is a valid ShapeCollectionSave:
Did this article leave any questions unanswered? Post any question in our forums for a rapid response.