在海燕,是有可能复制并粘贴使用的海洋中输入树中的项目? 我需要有一个特定的井或战略某处的复印件; 我怎样才能做到这一点?
例如,如果我想有这口井(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):
SimulationRoot simroot = SimulationRoot.Get(PetrelProject.PrimaryProject);
DevelopmentStrategyCollection strategycol=simroot.DevelopmentStrategyCollection;
那些在海燕的复制/粘贴功能的许多领域对象实现所谓的接口ICopyable
。 不过,我不相信这是所有域对象是一致的。 副本/ A更可靠的方式粘贴域对象是通过使用的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
)。