Opened 16 years ago
Closed 16 years ago
#803 closed enhancement (fixed)
Maestro API: Default settings for resource classes
Reported by: | jng | Owned by: | ksgeograf |
---|---|---|---|
Priority: | low | Milestone: | |
Component: | Maestro | Version: | |
Severity: | trivial | Keywords: | |
Cc: | External ID: |
Description
It would be nice if resource types are initialized with default settings.
Since these classes are generated off the xsd schemas (correct?), there is a lot of boilerplate code required to explicitly set all the required elements for a given resource.
For example:
Layer Definition:
- Create a default line/point/polygon style
Web Layout:
- Create a default command list.
- Create a default toolbar/context menu/task pane bar configuration.
Change History (6)
comment:1 by , 16 years ago
Status: | new → assigned |
---|---|
Version: | 2.0.1 |
comment:2 by , 16 years ago
comment:3 by , 16 years ago
Or some kind of ResourceFactory class that has
CreateLineLayer() CreateAreaLayer() CreatePointLayer() ... CreateXXX()
would also work
comment:4 by , 16 years ago
In r3535, I have added a method called CreateResourceObject to the connection interface. You can now do:
MaestroAPI.HttpServerConnection con = new OSGeo.MapGuide.MaestroAPI.HttpServerConnection(new Uri("http://localhost/mapguide"), "Administrator", "admin", "da", true); MaestroAPI.LayerDefinition ldef = con.CreateResourceObject<MaestroAPI.LayerDefinition>();
And get a layer with many default properties set. Is this close enough to meet your requirements, or do you have a special use case in mind?
comment:6 by , 16 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
The easiest way to accomplish this is to use the "DeserializeObject" method, and give it a file stream as input. There are some templates in the "Templates" folder.
A simple solution would be to embed these in the MaestroAPI.dll, and create methods to generate objects from them. Does that seem like a resonable solution?