2014-06-16 48 views
1

在Petrel中,是否可以使用海洋在輸入樹中複製粘貼項目?我需要在某個地方有一個特定的油井或戰略副本;我怎樣才能做到這一點?使用海洋在Petrel中複製粘貼項目...?

例如,如果我想有這口井的副本(myWell):

Tubing = e.Data.GetData(typeof(TubingString)) as TubingString; 
    Borehole myWell=Tubing.Borehole; 

到我boreholecollection(Borhol):

WellRoot Welrot = Slb.Ocean.Petrel.DomainObject.Well.WellRoot.Get(PetrelProject.PrimaryProject); 
    BoreholeCollection Borhol = Welrot.BoreholeCollection; 

還是有DevelopmentStrategy副本(oldStrategy):

EclipseFormatSimulator.Arguments args=WellKnownSimulators.ECLIPSE100.GetEclipseFormatSimulatorArguments(theCase); 
    DevelopmentStrategy oldStrategy=args.Strategies.DevelopmentStrategies.First(); 

到DevelopmentStrategyCollection(strategycol):

那些在海燕的複製/粘貼功能,實現所謂的 ICopyable接口
SimulationRoot simroot = SimulationRoot.Get(PetrelProject.PrimaryProject); 
    DevelopmentStrategyCollection strategycol=simroot.DevelopmentStrategyCollection; 

回答

1

許多領域對象。不過,我不相信這對所有域對象都是一致的。複製/粘貼域對象的更可靠的方法是通過使用ICopyableFactory服務。

Borehole borehole = ...; 

ICopyable copyable = borehole as ICopyable; 

if (copyable == null) 
{ 
    ICopyableFactory factory = CoreSystem.GetService<ICopyableFactory>(borehole); 
    copyable = factory.GetCopyable(borehole); 
} 

if (copyable != null) 
{ 
    IDataSourceManager sourceMgr = ...; 
    IDataSourceManager targetMgr = ...; 
    IProjectInfo sourceProjectInfo = ...; 
    IProjectInfo targetProjectInfo = ...; 
    ICoordinateReferenceSystem sourceCrs = ...; 
    ICoordinateReferenceSystem targetCrs = ...; 
    ICoordinateOperation coordinateOperation = ...; 
    CopyContext.Element ignoreElements = ...; 
    CopyContext.Identify identity = ...; 
    object targetCollection = ...; 
    object snapshot = copyable.GetSnapshot(); 

    CopyContext context = new CopyContext(sourceMgr, targetMgr, 
     sourceProjectInfo, targetProjectInfo, sourceCrs, targetCrs 
     coordinateOperation, ignoreElements, identity, targetCollection, 
     snapshot); 

    Borehole copy = copyable.Copy(context) as Borehole; 
} 

ICopyable.Copy需要大量的參數,因爲這種方法也用於參考項目工具(用於複製項目之間的域對象)。如果您在同一個項目中複製域對象,則所有關聯的源/目標屬性將相同(即targetMgr = sourceMgr)。