Esempio n. 1
0
        /// <summary>
        /// Constructor for the renderer accepting all parameters necessary for its operation
        /// </summary>
        public RebuildSiteModelComputeFuncExecutor(RebuildSiteModelRequestArgument arg)
        {
            Response = new RebuildSiteModelRequestResponse(arg.ProjectID)
            {
                RebuildResult = RebuildSiteModelResult.OK
            };

            _rebuildSiteModelRequestArgument = arg;
            if (arg != null)
            {
                _siteModel = DIContext.Obtain <ISiteModels>().GetSiteModelRaw(arg.ProjectID);
            }

            if (_siteModel == null)
            {
                Response.RebuildResult = RebuildSiteModelResult.UnableToLocateSiteModel;
                return;
            }

            _siteModel.SetStorageRepresentationToSupply(StorageMutability.Mutable);

            // Rebuilding is only supported in the context of the mutable grid for coordination
            if (_siteModel.PrimaryStorageProxy.Mutability != StorageMutability.Mutable ||
                _siteModel.PrimaryStorageProxy.ImmutableProxy == null)
            {
                throw new TRexException("Rebulding is only supported in the context of the mutable grid for coordination");
            }
        }
Esempio n. 2
0
        public static ISiteModel NewEmptyModel()
        {
            ISiteModel siteModel = DIContext.Obtain <ISiteModels>().GetSiteModel(DITagFileFixture.NewSiteModelGuid, true);

            // Switch to mutable storage representation to allow creation of content in the site model
            siteModel.SetStorageRepresentationToSupply(StorageMutability.Mutable);

            _ = siteModel.Machines.CreateNew("Bulldozer", "", MachineType.Dozer, DeviceTypeEnum.SNM940, false, Guid.NewGuid());
            _ = siteModel.Machines.CreateNew("Excavator", "", MachineType.Excavator, DeviceTypeEnum.SNM940, false, Guid.NewGuid());

            return(siteModel);
        }
Esempio n. 3
0
 /// <summary>
 /// Takes a site model and modifies its internal representation to be the immutable form
 /// </summary>
 public static void ConvertSiteModelToImmutable(ISiteModel siteModel)
 {
     siteModel.SetStorageRepresentationToSupply(StorageMutability.Immutable);
 }