Class ObjectFactory
Factory class to create MapGuide resource objects with either pre-defined or sensible default values. This is recommended over creating the objects directly as this ensures that there are no null child properties where the XML schema forbids it.
By default this class will only create known versions of any top-level resource (as of writing, up to MapGuide Open Source 2.6 / AIMS 2015). In order to be able to create newer versions where support has not yet been added to this library, you will need to register the appropriate methods that can create resources of this version:
- RegisterLayerFactoryMethod(Version, Func<LayerType, ILayerDefinition>) for Layer Definitions
This registration needs to be done as part of your application's startup/initialization phase.
Inheritance
Inherited Members
Namespace: OSGeo.MapGuide.ObjectModels
Assembly: OSGeo.MapGuide.ObjectModels.dll
Syntax
public static class ObjectFactory
Methods
| Improve this Doc View SourceCreateAttributeRelation()
Creates the attribute relation.
Declaration
public static IAttributeRelation CreateAttributeRelation()
Returns
Type | Description |
---|---|
IAttributeRelation |
CreateCalculatedProperty()
Creates the calculated property.
Declaration
public static ICalculatedProperty CreateCalculatedProperty()
Returns
Type | Description |
---|---|
ICalculatedProperty |
CreateCalculatedProperty(String, String)
Creates the calculated property.
Declaration
public static ICalculatedProperty CreateCalculatedProperty(string name, string expression)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the calculated property |
System.String | expression | The FDO Expression |
Returns
Type | Description |
---|---|
ICalculatedProperty |
CreateCompoundSymbol(Version, String, String)
Creates the compound symbol.
Declaration
public static ICompoundSymbolDefinition CreateCompoundSymbol(Version version, string name, string description)
Parameters
Type | Name | Description |
---|---|---|
System.Version | version | The version. |
System.String | name | The name. |
System.String | description | The description. |
Returns
Type | Description |
---|---|
ICompoundSymbolDefinition |
CreateDefaultLayer(LayerType, Version)
Creates the default layer.
Declaration
public static ILayerDefinition CreateDefaultLayer(LayerType type, Version version)
Parameters
Type | Name | Description |
---|---|---|
LayerType | type | The type. |
System.Version | version | The version. |
Returns
Type | Description |
---|---|
ILayerDefinition |
CreateDrawingSource()
Creates the drawing source.
Declaration
public static IDrawingSource CreateDrawingSource()
Returns
Type | Description |
---|---|
IDrawingSource |
CreateEnvelope(Double, Double, Double, Double)
Creates an envelope (bounding box)
Declaration
public static IEnvelope CreateEnvelope(double minx, double miny, double maxx, double maxy)
Parameters
Type | Name | Description |
---|---|---|
System.Double | minx | |
System.Double | miny | |
System.Double | maxx | |
System.Double | maxy |
Returns
Type | Description |
---|---|
IEnvelope |
CreateFeatureSource(String)
Creates the feature source.
Declaration
public static IFeatureSource CreateFeatureSource(string provider)
Parameters
Type | Name | Description |
---|---|---|
System.String | provider | The provider. |
Returns
Type | Description |
---|---|
IFeatureSource |
CreateFeatureSource(String, NameValueCollection)
Creates the feature source.
Declaration
public static IFeatureSource CreateFeatureSource(string provider, NameValueCollection values)
Parameters
Type | Name | Description |
---|---|---|
System.String | provider | The provider. |
System.Collections.Specialized.NameValueCollection | values | The connection properties. |
Returns
Type | Description |
---|---|
IFeatureSource |
CreateFeatureSourceExtension()
Creates the feature source extension.
Declaration
public static IFeatureSourceExtension CreateFeatureSourceExtension()
Returns
Type | Description |
---|---|
IFeatureSourceExtension |
CreateFeatureSourceExtension(String, String)
Creates the feature source extension.
Declaration
public static IFeatureSourceExtension CreateFeatureSourceExtension(string name, string featureClass)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | |
System.String | featureClass |
Returns
Type | Description |
---|---|
IFeatureSourceExtension |
CreateFlexibleLayout(Version, IApplicationDefinitionTemplateInfoSet, IApplicationDefinitionWidgetInfoSet, IApplicationDefinitionContainerInfoSet, String, Boolean)
Creates a fusion flexible layout
Declaration
public static IApplicationDefinition CreateFlexibleLayout(Version siteVersion, IApplicationDefinitionTemplateInfoSet templates, IApplicationDefinitionWidgetInfoSet widgets, IApplicationDefinitionContainerInfoSet containers, string templateName, bool statelessMode = false)
Parameters
Type | Name | Description |
---|---|---|
System.Version | siteVersion | The site version |
IApplicationDefinitionTemplateInfoSet | templates | The set of available templates |
IApplicationDefinitionWidgetInfoSet | widgets | The set of available widgets |
IApplicationDefinitionContainerInfoSet | containers | The set of available containers |
System.String | templateName | The name of the template. See FusionTemplateNames for the common pre-defined names |
System.Boolean | statelessMode | If true, the widget set will only be populated with widgets that can work without a running MapGuide Server |
Returns
Type | Description |
---|---|
IApplicationDefinition |
CreateLoadProcedure(LoadType)
Creates the load procedure.
Declaration
public static ILoadProcedure CreateLoadProcedure(LoadType type)
Parameters
Type | Name | Description |
---|---|---|
LoadType | type | The type. |
Returns
Type | Description |
---|---|
ILoadProcedure |
CreateLoadProcedure(LoadType, IEnumerable<String>)
Creates the load procedure.
Declaration
public static ILoadProcedure CreateLoadProcedure(LoadType type, IEnumerable<string> fileNames)
Parameters
Type | Name | Description |
---|---|---|
LoadType | type | The type. |
System.Collections.Generic.IEnumerable<System.String> | fileNames | The file names. |
Returns
Type | Description |
---|---|
ILoadProcedure |
CreateMapDefinition(Version, String)
Creates the map definition.
Declaration
public static IMapDefinition CreateMapDefinition(Version version, string name)
Parameters
Type | Name | Description |
---|---|---|
System.Version | version | |
System.String | name |
Returns
Type | Description |
---|---|
IMapDefinition |
CreateMapDefinition(Version, String, String)
Creates the map definition.
Declaration
public static IMapDefinition CreateMapDefinition(Version ver, string name, string coordinateSystemWkt)
Parameters
Type | Name | Description |
---|---|---|
System.Version | ver | |
System.String | name | |
System.String | coordinateSystemWkt |
Returns
Type | Description |
---|---|
IMapDefinition |
CreateMapDefinition(Version, String, String, IEnvelope)
Creates the map definition.
Declaration
public static IMapDefinition CreateMapDefinition(Version ver, string name, string coordinateSystemWkt, IEnvelope env)
Parameters
Type | Name | Description |
---|---|---|
System.Version | ver | |
System.String | name | |
System.String | coordinateSystemWkt | |
IEnvelope | env |
Returns
Type | Description |
---|---|
IMapDefinition |
CreateMetadata()
Creates an empty resource document header metadata object
Declaration
public static ResourceDocumentHeaderTypeMetadata CreateMetadata()
Returns
Type | Description |
---|---|
ResourceDocumentHeaderTypeMetadata |
CreatePoint2D(Double, Double)
Creates a 2d point
Declaration
public static IPoint2D CreatePoint2D(double x, double y)
Parameters
Type | Name | Description |
---|---|---|
System.Double | x | |
System.Double | y |
Returns
Type | Description |
---|---|
IPoint2D |
CreatePoint3D(Double, Double, Double)
Creates a 3d point
Declaration
public static IPoint3D CreatePoint3D(double x, double y, double z)
Parameters
Type | Name | Description |
---|---|---|
System.Double | x | |
System.Double | y | |
System.Double | z |
Returns
Type | Description |
---|---|
IPoint3D |
CreatePrintLayout()
Creates the print layout.
Declaration
public static IPrintLayout CreatePrintLayout()
Returns
Type | Description |
---|---|
IPrintLayout |
CreateSecurityGroup()
Creates an empty group security object
Declaration
public static ResourceSecurityTypeGroups CreateSecurityGroup()
Returns
Type | Description |
---|---|
ResourceSecurityTypeGroups |
CreateSecurityUser()
Creates an empty user security object
Declaration
public static ResourceSecurityTypeUsers CreateSecurityUser()
Returns
Type | Description |
---|---|
ResourceSecurityTypeUsers |
CreateSimpleLabel(Version, GeometryContextType)
Creates a simple label symbol
Declaration
public static ISimpleSymbolDefinition CreateSimpleLabel(Version version, GeometryContextType type)
Parameters
Type | Name | Description |
---|---|---|
System.Version | version | |
GeometryContextType | type |
Returns
Type | Description |
---|---|
ISimpleSymbolDefinition |
CreateSimplePoint(Version)
Declaration
public static ISimpleSymbolDefinition CreateSimplePoint(Version version)
Parameters
Type | Name | Description |
---|---|---|
System.Version | version |
Returns
Type | Description |
---|---|
ISimpleSymbolDefinition |
CreateSimpleSolidFill(Version)
Creates a simple solid fill symbol
Declaration
public static ISimpleSymbolDefinition CreateSimpleSolidFill(Version version)
Parameters
Type | Name | Description |
---|---|---|
System.Version | version |
Returns
Type | Description |
---|---|
ISimpleSymbolDefinition |
CreateSimpleSolidLine(Version)
Creates a simple solid line symbol
Declaration
public static ISimpleSymbolDefinition CreateSimpleSolidLine(Version version)
Parameters
Type | Name | Description |
---|---|---|
System.Version | version |
Returns
Type | Description |
---|---|
ISimpleSymbolDefinition |
CreateSimpleSymbol(Version, String, String)
Creates a simple symbol definition.
Declaration
public static ISimpleSymbolDefinition CreateSimpleSymbol(Version version, string name, string description)
Parameters
Type | Name | Description |
---|---|---|
System.Version | version | The version. |
System.String | name | The name. |
System.String | description | The description. |
Returns
Type | Description |
---|---|
ISimpleSymbolDefinition |
CreateSymbolLibrary()
Creates a new symbol library
Declaration
public static ISymbolLibrary CreateSymbolLibrary()
Returns
Type | Description |
---|---|
ISymbolLibrary |
CreateTileSetDefinition(Version)
Creates the tile set definition
Declaration
public static ITileSetDefinition CreateTileSetDefinition(Version version)
Parameters
Type | Name | Description |
---|---|---|
System.Version | version |
Returns
Type | Description |
---|---|
ITileSetDefinition |
CreateTileSetDefinition(Version, IEnvelope)
Creates the tile set definition using the default provider
Declaration
public static ITileSetDefinition CreateTileSetDefinition(Version version, IEnvelope extents)
Parameters
Type | Name | Description |
---|---|---|
System.Version | version | |
IEnvelope | extents |
Returns
Type | Description |
---|---|
ITileSetDefinition |
CreateWatermark(SymbolDefinitionType, Version)
Creates a Watermark Definition
Declaration
public static IWatermarkDefinition CreateWatermark(SymbolDefinitionType type, Version version)
Parameters
Type | Name | Description |
---|---|---|
SymbolDefinitionType | type | |
System.Version | version |
Returns
Type | Description |
---|---|
IWatermarkDefinition |
CreateWebLayout(Version, String)
Creates the web layout.
Declaration
public static IWebLayout CreateWebLayout(Version version, string mapDefinitionId)
Parameters
Type | Name | Description |
---|---|---|
System.Version | version | The version. |
System.String | mapDefinitionId | The map definition id. |
Returns
Type | Description |
---|---|
IWebLayout |
Deserialize(String, Stream)
Deserializes the specified stream for the specified resource type.
Declaration
public static IResource Deserialize(string resourceType, Stream stream)
Parameters
Type | Name | Description |
---|---|---|
System.String | resourceType | Type of the resource. |
System.IO.Stream | stream | The stream. |
Returns
Type | Description |
---|---|
IResource |
DeserializeEmbeddedFlexLayout(Version)
Returns a deserialized copy of an embedded Flexible Layout
Declaration
public static IApplicationDefinition DeserializeEmbeddedFlexLayout(Version siteVersion)
Parameters
Type | Name | Description |
---|---|---|
System.Version | siteVersion |
Returns
Type | Description |
---|---|
IApplicationDefinition |
DeserializeXml(String)
Deserializes the specified XML.
Declaration
public static IResource DeserializeXml(string xml)
Parameters
Type | Name | Description |
---|---|---|
System.String | xml | The XML. |
Returns
Type | Description |
---|---|
IResource |
RegisterCompoundSymbolFactoryMethod(Version, Func<ICompoundSymbolDefinition>)
Registers the compound symbol factory method
Declaration
public static void RegisterCompoundSymbolFactoryMethod(Version version, Func<ICompoundSymbolDefinition> func)
Parameters
Type | Name | Description |
---|---|---|
System.Version | version | |
System.Func<ICompoundSymbolDefinition> | func |
RegisterLayerFactoryMethod(Version, Func<LayerType, ILayerDefinition>)
Registers the layer factory method.
Declaration
public static void RegisterLayerFactoryMethod(Version version, Func<LayerType, ILayerDefinition> method)
Parameters
Type | Name | Description |
---|---|---|
System.Version | version | The ver. |
System.Func<LayerType, ILayerDefinition> | method | The method. |
RegisterLoadProcedureFactoryMethod(LoadType, Func<ILoadProcedure>)
Registers the load procedure factory method.
Declaration
public static void RegisterLoadProcedureFactoryMethod(LoadType type, Func<ILoadProcedure> method)
Parameters
Type | Name | Description |
---|---|---|
LoadType | type | The type. |
System.Func<ILoadProcedure> | method | The method. |
RegisterMapDefinitionFactoryMethod(Version, Func<IMapDefinition>)
Register the map definition factory method
Declaration
public static void RegisterMapDefinitionFactoryMethod(Version version, Func<IMapDefinition> method)
Parameters
Type | Name | Description |
---|---|---|
System.Version | version | |
System.Func<IMapDefinition> | method |
RegisterResource(ResourceTypeDescriptor, ResourceSerializer)
Registers a resource serializer
Declaration
public static void RegisterResource(ResourceTypeDescriptor desc, ResourceSerializer serializer)
Parameters
Type | Name | Description |
---|---|---|
ResourceTypeDescriptor | desc | The desc. |
ResourceSerializer | serializer | The serializer. |
RegisterResourceSerializer(ResourceTypeDescriptor, Func<IResource, Stream>, Func<String, IResource>)
Registers a resource serializer
Declaration
public static void RegisterResourceSerializer(ResourceTypeDescriptor resourceType, Func<IResource, Stream> serializer, Func<string, IResource> deserializer)
Parameters
Type | Name | Description |
---|---|---|
ResourceTypeDescriptor | resourceType | The resource type descriptor. |
System.Func<IResource, System.IO.Stream> | serializer | The serialize method. |
System.Func<System.String, IResource> | deserializer | The deserialize method. |
RegisterSimpleSymbolFactoryMethod(Version, Func<ISimpleSymbolDefinition>)
Regsiters the simple symbol factory method
Declaration
public static void RegisterSimpleSymbolFactoryMethod(Version version, Func<ISimpleSymbolDefinition> func)
Parameters
Type | Name | Description |
---|---|---|
System.Version | version | |
System.Func<ISimpleSymbolDefinition> | func |
RegisterTileSetDefinitionFactoryMethod(Version, Func<ITileSetDefinition>)
Registers the Tile Set Definition factory method
Declaration
public static void RegisterTileSetDefinitionFactoryMethod(Version version, Func<ITileSetDefinition> func)
Parameters
Type | Name | Description |
---|---|---|
System.Version | version | |
System.Func<ITileSetDefinition> | func |
RegisterWatermarkDefinitionFactoryMethod(Version, Func<SymbolDefinitionType, IWatermarkDefinition>)
Registers the Watermark Definition factory method
Declaration
public static void RegisterWatermarkDefinitionFactoryMethod(Version version, Func<SymbolDefinitionType, IWatermarkDefinition> method)
Parameters
Type | Name | Description |
---|---|---|
System.Version | version | |
System.Func<SymbolDefinitionType, IWatermarkDefinition> | method |
RegisterWebLayoutFactoryMethod(Version, Func<String, IWebLayout>)
Registers the web layout factory method.
Declaration
public static void RegisterWebLayoutFactoryMethod(Version version, Func<string, IWebLayout> method)
Parameters
Type | Name | Description |
---|---|---|
System.Version | version | The version. |
System.Func<System.String, IWebLayout> | method | The method. |
Reset()
Resets the object factory by clearing all registered factories
Declaration
public static void Reset()
Serialize(IResource)
Serializes the specified resource.
Declaration
public static Stream Serialize(IResource resource)
Parameters
Type | Name | Description |
---|---|---|
IResource | resource | The resource. |
Returns
Type | Description |
---|---|
System.IO.Stream |
SerializeAsString(IResource)
Serializes the specified resource.
Declaration
public static string SerializeAsString(IResource resource)
Parameters
Type | Name | Description |
---|---|---|
IResource | resource |
Returns
Type | Description |
---|---|
System.String |