ArcObjects编程方法(三):单例对象的使用

版本:ArcGIS 10   

单例对象就是只能有一个实例的对象。在ArcObjects中,单例对象只能通过Activator类实例化,并通过ComReleaser类释放。另外要注意的是,同一个线程中的ArcObjects引用只能访问同一个线程中的对象。

通过Activator类创建单例对象:

[C#]

Type t = Type.GetTypeFromProgID("esriFramework.StyleGallery");
System.Object obj = Activator.CreateInstance(t);
IStyleGallery sg = obj as IStyleGallery;

 

ArcObjects中的单例类:

AccessWorkspaceFactory
ActionEnvironment*
AGAnimationUtils
AGSServerConnectionFactory
AMSWorkspaceFactory
AnimationControlsDialog
AnimationCreateKeyframeDialog
AnimationFromPathDialog
AnimationLayerGroupDialog
AnimationManagerDialog
AnimationTypeCamera
AnimationTypeGlobeCamera
AnimationTypeGlobeLayer
AnimationTypeLayer
AnimationTypeMapLayer
AnimationTypeMapView
AnimationTypeScene
AnimationTypeTimeLayer
AppRef*
ArcInfoWorkspaceFactory
CadWorkspaceFactory
CieLabConversion
CommandsEnvironment
DddEnvironment
DddServerEnvironment
DDDToolbarEnvironment
DEGdbUtilities
DEUtilities
DummyGraduatedMarkerLayer
DummyLayer
EngineEditor
EngineNetworkAnalystEnvironment
EnvironmentManager
ErrorDialog
ErrorMessage
ExcelWorkspaceFactory
ExtensionManager
FileGDBWorkspaceFactory
FindDialog
FormatList
GeoDatabaseHelper
GMxEffectsToolbarEnvironment
GPGlobeFunctionFactory
GPHolder
GPSAUtil
GPServerFunctionFactory
GpsPositionDialog
GPUtilities
GxCatalogROT
GxDatabaseExtensions
IdentifyDialog
IMSWorkspaceFactory
InMemoryWorkspaceFactory
LabelEnvironment
LayerEffectsEnvironment
LocatorManager
MemoryRelationshipClassFactory
MessageLogger
MetadataSynchronizer
MonitorSettings
MyPlaceCollection
NADirectionsWindowManager
NetCDFWorkspaceFactory
NetworkIdentifyDialog
OLEDBWorkspaceFactory
PCCoverageWorkspaceFactory
RasterAnalysisToolbarEnvironment
RasterAttributeTableManager
RasterDefaultsEnv
RasterSettings
RasterStatus
RasterWorkspaceFactory
RelQueryTableFactory
SAExtension
SchematicProjectMgr
SchematicWorkspaceFactory
ScratchWorkspaceFactory
SDCWorkspaceFactory
SdeWorkspaceFactory
SelectionEnvironment
ServerStyleGallery
ShapefileWorkspaceFactory
SpatialReferenceEnvironment
StreetMapWorkspaceFactory
StyleGallery
SxAnimationEnvironment
SxEffectsToolbarEnvironment
SymbologyEnvironment
SystemHelper
TAExtension
TextFileWorkspaceFactory
TexturePersistenceProperties
TinWorkspaceFactory
TMS_MarshalHelper
ToolboxWorkspaceFactory
TrackingEnvironment
VpfWorkspaceFactory
WMSConnectionFactory
WorkspaceFactory
XMLTypeMapper

 

参考:

http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#/Interacting_with_singleton_objects/00010000043p000000/

posted @ 2011-09-23 16:48  xmwang  阅读(629)  评论(0编辑  收藏  举报