示例#1
0
        protected override bool Execute(CodeActivityContext context)
        {
            IWorkflowContext workflowContext = context.GetExtension <IWorkflowContext>();
            ParameterStack   pstack          = context.GetValue <ParameterStack>(this.Parameter);

            var target    = pstack.GetValue <FileMappingInfo>(ActivityParameterStack.TARGET);
            var workspace = pstack.GetValue <Workspace>(ActivityParameterStack.WORKSPACE);

            // Guard
            Ensure.That(target).IsNotNull();
            Ensure.That(workspace).IsNotNull();

            var aclfilepath = Path.Combine(workspace.WorkspacePath, target.MappingFilePath);

            aclfilepath += ".aclgene";

            // ACLファイルの作成を行います。
            //
            var data = new AclFileStructure();

            data.Version    = AclFileStructure.CURRENT_VERSION;
            data.LastUpdate = DateTime.Now;
            data.Data       = new KeyValuePair <string, string>[] {
                new KeyValuePair <string, string>("ACLHASH", target.AclHash)
            };

            using (var file = File.Create(aclfilepath))
            {
                Serializer.Serialize(file, data);
            }

            return(true);
        }
示例#2
0
        // アクティビティが値を返す場合は、CodeActivity<TResult> から派生して、 Execute メソッドから値を返します。
        protected override IEntity <long> Execute(CodeActivityContext context)
        {
            IWorkflowContext workflowContext = context.GetExtension <IWorkflowContext>();

            var entity = this.Entity.Get(context);

            if (entity == null)
            {
                ParameterStack pstack = context.GetValue <ParameterStack>(this.Parameter);
                string         key    = this.ParameterKey.Get(context);
                entity = pstack.GetValue <IEntity <long> >(key);
            }

            // Guard
            Ensure.That(entity).IsNotNull();

            var dbset = workflowContext.DbContext.Set(entity.GetType());

            if (entity.Id == 0)
            {
                dbset.Add(entity);
            }
            else
            {
                workflowContext.DbContext.Entry(entity).State = System.Data.Entity.EntityState.Modified;
            }

            return(entity);
        }
 // Parameters -> IdentifierToken ParametersTail |
 //               NumberToken ParametersTail |
 //               e
 private bool ProcessParameters()
 {
     if (LexicalAnaylzer.Token == Token.IdentifierToken)
     {
         if (!CheckDeclaredVariable())
         {
             return(false);
         }
         ParameterStack.Push(LexicalAnaylzer.Lexeme);
         LexicalAnaylzer.GetNextToken();
         if (!ProcessParametersTail())
         {
             return(false);
         }
     }
     else if (LexicalAnaylzer.Token == Token.NumberToken)
     {
         ParameterStack.Push(LexicalAnaylzer.Lexeme);
         LexicalAnaylzer.GetNextToken();
         if (!ProcessParametersTail())
         {
             return(false);
         }
     }
     return(true);
 }
 // ParametersTail -> CommaToken IdentifierToken ParametersTail |
 //                   CommaToken NumberToken ParametersTail |
 //                   e
 private bool ProcessParametersTail()
 {
     if (LexicalAnaylzer.Token == Token.CommaToken && LexicalAnaylzer.IsFirstWordCharacter(LexicalAnaylzer.LookNextCharacter()))
     { // TODO: This isn't good - will work for this grammar but shouldn't be checking just next character like so
         LexicalAnaylzer.GetNextToken();
         if (!CheckDeclaredVariable())
         {
             return(false);
         }
         ParameterStack.Push(LexicalAnaylzer.Lexeme);
         if (!MatchToken(Token.IdentifierToken))
         {
             return(false);
         }
         if (!ProcessParametersTail())
         {
             return(false);
         }
     }
     else if (LexicalAnaylzer.Token == Token.CommaToken && LexicalAnaylzer.IsDigitCharacter(LexicalAnaylzer.LookNextCharacter()))
     { // TODO: This isn't good - will work for this grammar but shouldn't be checking just next character like so
         LexicalAnaylzer.GetNextToken();
         ParameterStack.Push(LexicalAnaylzer.Lexeme);
         if (!MatchToken(Token.NumberToken))
         {
             return(false);
         }
         if (!ProcessParametersTail())
         {
             return(false);
         }
     }
     return(true);
 }
示例#5
0
        public GetProperties(Component comp)
        {
            ParameterStack pStack = new ParameterStack();

            pStack  = comp.BuildParameterStack(pStack);
            _pStack = pStack;
        }
示例#6
0
    IEnumerable <LazyString> Impl_Call_CustomMethod(MethodInfo method, Instruction instruction, MethodDefinition targetMethod)
    {
        // pop the parameters off the variable stack and onto the parameter stack
        var paramsVal = ArraySlice(
            GetGlobal(Variables.VariableStack),
            () => "0",
            () => targetMethod.Parameters.Count.ToString());

        foreach (var action in ParameterStack.Push(paramsVal))
        {
            yield return(action);
        }
        foreach (var action in VariableStack.Pop(targetMethod.Parameters.Count))
        {
            yield return(action);
        }

        foreach (var action in JumpOffsetStack.Push(GetJumpId(method, instruction.Next)))
        {
            yield return(action);
        }
        foreach (var action in JumpOffsetStack.Push(() => "0"))
        {
            yield return(action);
        }

        foreach (var action in Impl_Call_CustomMethod_Direct(targetMethod))
        {
            yield return(action);
        }

        yield return(() => "Loop;");
    }
示例#7
0
    static IEnumerable <LazyString> Impl_Starg_S(MethodInfo method, Instruction instruction)
    {
        var parameters = method.Definition.Parameters;
        var paramCount = parameters.Count;

        yield return(SetGlobal(Variables.Temporary, ArraySlice(
                                   GetGlobal(Variables.ParameterStack),
                                   () => "0",
                                   () => paramCount.ToString())));

        foreach (var action in ParameterStack.Pop(paramCount))
        {
            yield return(action);
        }

        foreach (var i in Enumerable.Range(0, paramCount))
        {
            var push = ParameterStack.Push(
                instruction.Operand == parameters[i] ?
                VariableStack.GetLastElement(0) :
                ArraySubscript(GetGlobal(Variables.Temporary), i));
            foreach (var action in push)
            {
                yield return(action);
            }
        }

        foreach (var action in VariableStack.Pop(1))
        {
            yield return(action);
        }
    }
示例#8
0
        protected override void Execute(CodeActivityContext context)
        {
            IWorkflowContext workflowContext = context.GetExtension <IWorkflowContext>();
            ParameterStack   pstack          = context.GetValue <ParameterStack>(this.Parameter);

            var aclhash    = context.GetValue <string>(Aclhash);
            var outputname = context.GetValue <string>(OutputName);

            var workspace = pstack.GetValue <Workspace>(ActivityParameterStack.WORKSPACE);
            var fileinfo  = pstack.GetValue <FileSystemInfo>(ActivityParameterStack.WORKSPACE_FILEINFO);

            // Guard
            Ensure.That(workspace).IsNotNull();
            Ensure.That(fileinfo).IsNotNull();

            var entity = new FileMappingInfo
            {
                AclHash         = aclhash,
                Workspace       = workspace,
                Mimetype        = "image/png",          // 未実装(テスト実装)
                MappingFilePath = workspace.TrimWorekspacePath(fileinfo.FullName, false),
            };

            pstack.SetValue(outputname, entity);
        }
示例#9
0
        /// <summary>
        /// ファイルの移動(転送)を行います
        /// </summary>
        /// <param name="context"></param>
        void MoveVirtualFile(CodeActivityContext context)
        {
            ParameterStack pstack    = context.GetValue <ParameterStack>(this.Parameter);
            var            workspace = pstack.GetValue <Workspace>(ActivityParameterStack.WORKSPACE);
            var            target    = pstack.GetValue <FileMappingInfo>(ActivityParameterStack.TARGET);

            // Guard
            Ensure.That(target).IsNotNull();
            Ensure.That(workspace).IsNotNull();

            var fromFilePath = new FileInfo(Path.Combine(workspace.WorkspacePath, target.MappingFilePath));
            var toFilePath   = Path.Combine(workspace.PhysicalPath, target.MappingFilePath + ".tmp");

            if (!File.Exists(fromFilePath.FullName))
            {
                new ApplicationException(fromFilePath.FullName + "が見つかりません");
            }

            // 移動先のディレクトリがサブディレクトリを含む場合、
            // 存在しないサブディレクトリを作成します。
            var newFileInfo = new FileInfo(Path.Combine(workspace.PhysicalPath, target.MappingFilePath));

            Directory.CreateDirectory(newFileInfo.Directory.FullName);

            File.Move(fromFilePath.FullName, toFilePath);
        }
示例#10
0
        /// <summary>
        /// Artifactから画像ファイルパスを取得し、サムネイルを生成します。
        /// </summary>
        /// <param name="workflowContext"></param>
        /// <param name="pstack"></param>
        private void GenerateArtifact(IWorkflowContext workflowContext, ParameterStack pstack)
        {
            var artifact = pstack.GetValue <ImageArtifact>(ActivityParameterStack.TARGET);

            if (artifact == null)
            {
                throw new ArgumentNullException();
            }

            var imageArtifactRepository = new ImageArtifactRepository(workflowContext.DbContext);

            if (artifact.Id != 0L)
            {
                artifact = imageArtifactRepository.Load(artifact.Id);
            }

            var fullpath         = System.IO.Path.Combine(artifact.FileMappingInfo.Workspace.PhysicalPath, artifact.FileMappingInfo.MappingFilePath);
            var thumbnailManager = workflowContext.ThumbnailManager;

            if (string.IsNullOrEmpty(artifact.ThumbnailKey))
            {
                var thumbnailKey = thumbnailManager.BuildThumbnail(null, fullpath);
                artifact.ThumbnailKey = thumbnailKey;
            }
            else
            {
                var thumbnailKey = thumbnailManager.BuildThumbnail(artifact.ThumbnailKey, fullpath);
            }
        }
示例#11
0
        protected override AclFileStructure Execute(CodeActivityContext context)
        {
            IWorkflowContext workflowContext = context.GetExtension <IWorkflowContext>();
            ParameterStack   pstack          = context.GetValue <ParameterStack>(this.Parameter);

            var workspace = pstack.GetValue <Workspace>(ActivityParameterStack.WORKSPACE);
            var relative  = pstack.GetValue <string>(ActivityParameterStack.WORKSPACE_FILEPATH);

            var virtualFileFullPath = Path.Combine(workspace.WorkspacePath, relative);

            var fileInfo = new FileInfo(virtualFileFullPath);

            if (!fileInfo.Exists)
            {
                LOG.Warn("対象ファイルが、見つかりませんでした。");
                return(null);
            }
            if (fileInfo.Extension != ".aclgene")
            {
                LOG.Warn("対象ファイルが、ACLファイルではありません。");
                return(null);
            }

            pstack.SetValue(ActivityParameterStack.WORKSPACE_FILEINFO, fileInfo);

            using (var file = File.OpenRead(virtualFileFullPath))
            {
                return(Serializer.Deserialize <AclFileStructure>(file));
            }
        }
示例#12
0
        protected override void Execute(CodeActivityContext context)
        {
            ParameterStack pstack = context.GetValue <ParameterStack>(this.Parameter);
            object         value  = context.GetValue <object>(this.Value);
            string         key    = context.GetValue <string>(this.Key);

            pstack.SetValue(key, value);
        }
示例#13
0
        protected override void Execute(CodeActivityContext context)
        {
            IWorkflowContext workflowContext = context.GetExtension <IWorkflowContext>();
            ParameterStack   pstack          = context.GetValue <ParameterStack>(this.Parameter);
            string           aliasName       = context.GetValue <string>(this.AliasName);
            string           key             = context.GetValue <string>(this.Key);

            pstack.SetAlias(key, aliasName);
        }
示例#14
0
        private void DeleteMisc(IWorkflowContext workflowContext, ParameterStack pstack)
        {
            var key = pstack.GetValue <string>(ActivityParameterStack.GENERATETHUMBNAIL_KEY);

            // Guard
            Ensure.That(key).IsNotNullOrEmpty();

            var thumbnailManager = workflowContext.ThumbnailManager;

            thumbnailManager.RemoveThumbnail(key);
        }
示例#15
0
        public bool GetReferencePointAndThickness(ref Vector2D v, ref double thickness)
        {
            if (!Component.IsSupportingAutomaticFolding)
            {
                return(false);
            }
            ParameterStack stack = CurrentParameterStack;

            thickness = stack.GetDoubleParameterValue("th1");
            v         = Component.ReferencePoint(stack);
            return(true);
        }
示例#16
0
        private void DeleteeArtifact(IWorkflowContext workflowContext, ParameterStack pstack)
        {
            var artifact         = pstack.GetValue <ImageArtifact>(ActivityParameterStack.TARGET);
            var thumbnailManager = workflowContext.ThumbnailManager;

            if (artifact == null)
            {
                throw new ArgumentNullException();
            }

            thumbnailManager.RemoveThumbnail(artifact.ThumbnailKey);
        }
示例#17
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="workflowContext"></param>
        /// <param name="pstack"></param>
        private void GenerateMisc(IWorkflowContext workflowContext, ParameterStack pstack)
        {
            var key  = pstack.GetValue <string>(ActivityParameterStack.GENERATETHUMBNAIL_KEY);
            var path = pstack.GetValue <string>(ActivityParameterStack.GENERATETHUMBNAIL_IMAGEPATH);

            // Guard
            Ensure.That(key).IsNotNullOrEmpty();
            Ensure.That(path).IsNotNullOrEmpty();

            var thumbnailManager = workflowContext.ThumbnailManager;

            thumbnailManager.BuildThumbnail(key, path);
        }
示例#18
0
        protected override void Execute(CodeActivityContext context)
        {
            IWorkflowContext workflowContext = context.GetExtension <IWorkflowContext>();
            ParameterStack   pstack          = context.GetValue <ParameterStack>(this.Parameter);
            string           distKey         = context.GetValue <string>(this.DistKey);
            string           srcKey          = context.GetValue <string>(this.SrcKey);

            var obj = pstack.GetValue(srcKey, false);

            pstack.SetValue(distKey, obj);

            pstack.ClearKey(srcKey);
        }
示例#19
0
        public void CreateFactoryEntities(PicFactory factory, ParameterStack stack, Transform2D transform)
        {
            double L         = stack.GetDoubleParameterValue("L");
            double H         = stack.GetDoubleParameterValue("H");
            double R         = stack.GetDoubleParameterValue("R");
            bool   Rounding0 = stack.GetBoolParameterValue("Rounding0");
            bool   Rounding1 = stack.GetBoolParameterValue("Rounding1");
            bool   Rounding2 = stack.GetBoolParameterValue("Rounding2");
            bool   Rounding3 = stack.GetBoolParameterValue("Rounding3");
            double Ang       = stack.GetDoubleParameterValue("Angle") * Math.PI / 180.0;

            // segments
            PicFactory       fTemp      = new PicFactory();
            List <PicEntity> entityList = new List <PicEntity>();

            entityList.Add(fTemp.AddSegment(
                               PicGraphics.LT.LT_CUT
                               , new Vector2D(0.0, 0.0)
                               , new Vector2D(L * Math.Cos(Ang), L * Math.Sin(Ang))));
            entityList.Add(fTemp.AddSegment(
                               PicGraphics.LT.LT_CUT
                               , new Vector2D(L * Math.Cos(Ang), L * Math.Sin(Ang))
                               , new Vector2D(L * Math.Cos(Ang) - H * Math.Sin(Ang), L * Math.Sin(Ang) + H * Math.Cos(Ang))));
            entityList.Add(fTemp.AddSegment(
                               PicGraphics.LT.LT_CUT
                               , new Vector2D(L * Math.Cos(Ang) - H * Math.Sin(Ang), L * Math.Sin(Ang) + H * Math.Cos(Ang))
                               , new Vector2D(-H * Math.Sin(Ang), H * Math.Cos(Ang))));
            entityList.Add(fTemp.AddSegment(
                               PicGraphics.LT.LT_CUT
                               , new Vector2D(-H * Math.Sin(Ang), H * Math.Cos(Ang))
                               , new Vector2D(0.0, 0.0)));

            if (Rounding0)
            {
                fTemp.ProcessTool(new PicToolRound(entityList[0], entityList[1], R));
            }
            if (Rounding1)
            {
                fTemp.ProcessTool(new PicToolRound(entityList[1], entityList[2], R));
            }
            if (Rounding2)
            {
                fTemp.ProcessTool(new PicToolRound(entityList[2], entityList[3], R));
            }
            if (Rounding3)
            {
                fTemp.ProcessTool(new PicToolRound(entityList[3], entityList[0], R));
            }

            factory.AddEntities(fTemp, transform);
        }
示例#20
0
        // アクティビティが値を返す場合は、CodeActivity<TResult> から派生して、
        // Execute メソッドから値を返します。
        protected override FileMappingInfo Execute(CodeActivityContext context)
        {
            IWorkflowContext workflowContext = context.GetExtension <IWorkflowContext>();
            var repo = new FileMappingInfoRepository(workflowContext.DbContext);

            string keyType  = this.KeyType.Get(context);
            string keyValue = this.KeyValue.Get(context);

            FileMappingInfo returnEntity = null;

            switch (keyType)
            {
            case "Id":
                returnEntity = repo.Load(long.Parse(keyValue));
                if (returnEntity == null)
                {
                    LOG.WarnFormat("FileMappingInfoの読み込みに失敗しました。 Id={0}", long.Parse(keyValue));
                }
                break;

            case "AclHash":
                returnEntity = repo.LoadByAclHash(keyValue);
                if (returnEntity == null)
                {
                    LOG.WarnFormat("FileMappingInfoの読み込みに失敗しました。 AclHash={0}", keyValue);
                }
                break;

            case "MappingFilePath":
                returnEntity = repo.LoadByPath(keyValue);
                if (returnEntity == null)
                {
                    LOG.WarnFormat("FileMappingInfoの読み込みに失敗しました。 MappingFilePath={0}", keyValue);
                }
                break;

            default:
                throw new ApplicationException("キータイプの指定が不正です");
            }

            var resultKey = this.ParameterResultKey.Get(context);

            if (resultKey != null)
            {
                ParameterStack pstack = context.GetValue <ParameterStack>(this.Parameter);
                pstack.SetValue(resultKey, returnEntity);
            }

            return(returnEntity);
        }
示例#21
0
        protected override void Execute(CodeActivityContext context)
        {
            IWorkflowContext workflowContext = context.GetExtension <IWorkflowContext>();
            ParameterStack   pstack          = context.GetValue <ParameterStack>(this.Parameter);

            string categoryPath = null;

            var target = pstack.GetValue <FileMappingInfo>(ActivityParameterStack.TARGET);

            if (target != null)
            {
                categoryPath = target.MappingFilePath;
            }
            else
            {
                categoryPath = pstack.GetValue <string>(ActivityParameterStack.MAKECATEGORY_CURRENT_CATEGORY);
            }

            if (string.IsNullOrEmpty(categoryPath))
            {
                throw new ApplicationException("有効なカテゴリパス文字列ではありません");
            }

            var catrepo = new CategoryRepository(workflowContext.DbContext);
            var appcat  = catrepo.Load(3L);

            if (appcat == null)
            {
                throw new ApplicationException();
            }
            _IsCreate = false;

            Mogami.Model.Category targetCategory = appcat;
            var tokens   = target.MappingFilePath.Split(new string[] { @"\" }, StringSplitOptions.None);
            var sttokens = new Stack <string>(tokens);
            var title    = sttokens.Pop();
            var qutokens = new Queue <string>(sttokens.Reverse <string>());

            while (qutokens.Count > 0)
            {
                var oneText = qutokens.Dequeue();
                targetCategory = CreateOrSelectCategory(targetCategory, oneText, catrepo);
            }

            workflowContext.DbContext.SaveChanges();

            pstack.SetValue(ActivityParameterStack.CATEGORY, targetCategory);

            this.AlreadyCategoryFlag.Set(context, !_IsCreate);
        }
示例#22
0
        public void Run_UpdateVirtualSpaceAppFlowTest_RenameFileName()
        {
            LOG.Debug("execute method run");

            UpdateVirtualSpaceAppFlowTestSupport.RemoveVirtualFile(1L);
            UpdateVirtualSpaceAppFlowTestSupport.RemovePhysicalFile(1L);
            UpdateVirtualSpaceAppFlowTestSupport.CopyPhysicalSpace_Kinkaku(1L);

            var aclfile = UpdateVirtualSpaceAppFlowTestSupport.CopyVirtualSpace_Kinkaku_aclgene(1L);

            aclfile.MoveTo(Path.Combine(aclfile.DirectoryName, "Kinkaku2.jpg.aclgene"));             //  新しいACLファイル名前にリネームする
            aclfile = new FileInfo(Path.Combine(aclfile.DirectoryName, "Kinkaku2.jpg.aclgene"));

            // ...
            using (var dbc = new AppDbContext())
            {
                var workspace = WorkspaceRepository.Load(dbc, 1L);
                var workflow  = new WorkflowInvoker(new UpdateVirtualSpaceAppFlow());
                workflow.Extensions.Add(new WorkflowExtention(dbc));

                var pstack = new ParameterStack();
                pstack.SetValue("Event", Mogami.Core.Constructions.UpdateVirtualStatusEventType.RENAME);
                pstack.SetValue(ActivityParameterStack.WORKSPACE_FILEPATH, "Kinkaku2.jpg.aclgene");                 // リネーム後のファイル名
                pstack.SetValue(ActivityParameterStack.WORKSPACE, workspace);

                var results = workflow.Invoke(new Dictionary <string, object>
                {
                    { "ParameterStack", pstack }
                });

                dbc.SaveChanges();
            }

            using (var dbc = new AppDbContext())
            {
                var filemapinginfoRepository = new FileMappingInfoRepository(dbc);
                var entity = filemapinginfoRepository.Load(1L);

                var workspace = WorkspaceRepository.Load(dbc, 1L);

                // エンティティの値が変わっていることの確認
                Assert.AreEqual("Kinkaku2.jpg", entity.MappingFilePath);

                // 物理ディレクトリ空間での、ファイル名称が変更していることの確認
                var physicalFileInfo = new FileInfo(Path.Combine(workspace.PhysicalPath, "Kinkaku2.jpg"));
                Assert.IsTrue(physicalFileInfo.Exists);
            }
        }
示例#23
0
        protected override void Execute(CodeActivityContext context)
        {
            IWorkflowContext workflowContext = context.GetExtension <IWorkflowContext>();
            ParameterStack   pstack          = context.GetValue <ParameterStack>(this.Parameter);

            var cleared = pstack.GetValue <Boolean>(ActivityParameterStack.MOVEPHYSICALFILEFROMVIRTUAL_CLEAREDFLAG);


            if (!cleared)
            {
                MoveVirtualFile(context);
            }
            else
            {
                ClearedTemporaryFile(context);
            }
        }
示例#24
0
        public void Run_UpdateVirtualSpaceAppFlowTest_DeleteFileName()
        {
            UpdateVirtualSpaceAppFlowTestSupport.RemoveVirtualFile(1L);
            UpdateVirtualSpaceAppFlowTestSupport.RemovePhysicalFile(1L);
            UpdateVirtualSpaceAppFlowTestSupport.CopyPhysicalSpace_Kinkaku(1L);

            var aclfile = UpdateVirtualSpaceAppFlowTestSupport.CopyVirtualSpace_Kinkaku_aclgene(1L);

            aclfile.Delete();


            using (var dbc = new AppDbContext())
            {
                var workspace = WorkspaceRepository.Load(dbc, 1L);
                var workflow  = new WorkflowInvoker(new UpdateVirtualSpaceAppFlow());
                workflow.Extensions.Add(new WorkflowExtention(dbc));

                var pstack = new ParameterStack();
                pstack.SetValue("Event", Mogami.Core.Constructions.UpdateVirtualStatusEventType.DELETE);
                pstack.SetValue(ActivityParameterStack.WORKSPACE_FILEPATH, "Kinkaku.jpg.aclgene");                 // 削除したファイル
                pstack.SetValue(ActivityParameterStack.WORKSPACE, workspace);
                pstack.SetValue("WF_DeleteAclHash", "Test");

                var results = workflow.Invoke(new Dictionary <string, object>
                {
                    { "ParameterStack", pstack }
                });

                dbc.SaveChanges();
            }

            using (var dbc = new AppDbContext())
            {
                var workspace = WorkspaceRepository.Load(dbc, 1L);

                // 物理ファイルが削除されていることを確認する
                var physicalFileInfo = new FileInfo(Path.Combine(workspace.PhysicalPath, "Kinkaku.jpg"));
                Assert.IsFalse(physicalFileInfo.Exists);

                var entity = FileMappingInfoRepository.Load(dbc, 1L);
                Assert.IsNull(entity);
            }
        }
示例#25
0
        protected override void Execute(CodeActivityContext context)
        {
            IWorkflowContext workflowContext = context.GetExtension <IWorkflowContext>();
            ParameterStack   pstack          = context.GetValue <ParameterStack>(this.Parameter);

            var target    = pstack.GetValue <FileMappingInfo>(ActivityParameterStack.TARGET);
            var filepath  = pstack.GetValue <string>(ActivityParameterStack.WORKSPACE_PHYFILEPATH_OLD);
            var workspace = pstack.GetValue <Workspace>(ActivityParameterStack.WORKSPACE);

            // Guard
            Ensure.That(target).IsNotNull();
            Ensure.That(workspace).IsNotNull();
            Ensure.That(filepath).IsNotNull();

            var srcFileInfo = new FileInfo(Path.Combine(workspace.PhysicalPath, filepath));

            if (!File.Exists(srcFileInfo.FullName))
            {
                throw new ApplicationException(srcFileInfo.FullName + "が見つかりません");
            }

            var oldFileDirectory = new DirectoryInfo(srcFileInfo.DirectoryName);

            // 移動先のディレクトリがサブディレクトリを含む場合、
            // 存在しないサブディレクトリを作成します。
            var newFileInfo = new FileInfo(Path.Combine(workspace.PhysicalPath, target.MappingFilePath));

            Directory.CreateDirectory(newFileInfo.Directory.FullName);

            srcFileInfo.MoveTo(newFileInfo.FullName);

            // 移動元の物理ディレクトリ空間のフォルダが空の場合、フォルダ自体を削除する
            // ※移動元のファイルがあったディレクトリと、その上位階層にむけて空である場合、フォルダを削除します。
            //   このディレクトリにサブディレクトリがある場合は削除しません。(サブディレクトリ内が空であっても、削除は行わない)
            DirectoryInfo deleteTragetDirectory = oldFileDirectory;

            while (deleteTragetDirectory != null &&
                   deleteTragetDirectory.GetFileSystemInfos().Count() == 0)
            {
                deleteTragetDirectory.Delete();
                deleteTragetDirectory = deleteTragetDirectory.Parent;
            }
        }
示例#26
0
        protected override void Execute(CodeActivityContext context)
        {
            IWorkflowContext workflowContext = context.GetExtension <IWorkflowContext>();
            ParameterStack   pstack          = context.GetValue <ParameterStack>(this.Parameter);

            var target    = pstack.GetValue <FileMappingInfo>(ActivityParameterStack.TARGET);
            var workspace = pstack.GetValue <Workspace>(ActivityParameterStack.WORKSPACE);

            // Guard
            Ensure.That(target).IsNotNull();
            Ensure.That(workspace).IsNotNull();

            var file = new FileInfo(Path.Combine(workspace.PhysicalPath, target.MappingFilePath));

            if (!file.Exists)
            {
                throw new ApplicationException();
            }
            file.Delete();
        }
示例#27
0
        protected override void Execute(CodeActivityContext context)
        {
            IWorkflowContext workflowContext = context.GetExtension <IWorkflowContext>();
            ParameterStack   pstack          = context.GetValue <ParameterStack>(this.Parameter);

            var readKey    = this.ReadKey.Get(context);
            var outputname = context.GetValue <string>(OutputName);

            switch (readKey)
            {
            case "FileMappingInfo":
                var target = pstack.GetValue <FileMappingInfo>(ActivityParameterStack.TARGET);
                var a      = ReadByFileMappingInfo(target, workflowContext.DbContext);
                pstack.SetValue(outputname, a);
                break;

            default:
                throw new ApplicationException("不明なReadKeyです。");
            }
        }
示例#28
0
        protected override void Execute(CodeActivityContext context)
        {
            IWorkflowContext workflowContext = context.GetExtension <IWorkflowContext>();
            ParameterStack   pstack          = context.GetValue <ParameterStack>(this.Parameter);
            var readKey = this.ReadKey.Get(context);

            switch (readKey)
            {
            case "Artifact":
                DeleteeArtifact(workflowContext, pstack);
                break;

            case "Misc":
                DeleteMisc(workflowContext, pstack);
                break;

            default:
                throw new ApplicationException();
            }
        }
示例#29
0
        /// <summary>
        /// 物理ディレクトリ空間のファイル名から、「tmp」を除去します
        /// </summary>
        /// <param name="context"></param>
        void ClearedTemporaryFile(CodeActivityContext context)
        {
            ParameterStack pstack    = context.GetValue <ParameterStack>(this.Parameter);
            var            workspace = pstack.GetValue <Workspace>(ActivityParameterStack.WORKSPACE);
            var            target    = pstack.GetValue <FileMappingInfo>(ActivityParameterStack.TARGET);

            // Guard
            Ensure.That(target).IsNotNull();
            Ensure.That(workspace).IsNotNull();


            var clearedFileInfo = new FileInfo(Path.Combine(workspace.PhysicalPath, target.MappingFilePath) + ".tmp");

            if (!File.Exists(clearedFileInfo.FullName))
            {
                throw new ApplicationException(clearedFileInfo.FullName + "が見つかりません");
            }

            var extFileName = Path.GetFileNameWithoutExtension(clearedFileInfo.Name);

            clearedFileInfo.MoveTo(Path.Combine(clearedFileInfo.DirectoryName, extFileName));
        }
示例#30
0
        protected override void Execute(CodeActivityContext context)
        {
            IWorkflowContext workflowContext = context.GetExtension <IWorkflowContext>();
            var repo = new FileMappingInfoRepository(workflowContext.DbContext);

            var entity = this.Entity.Get(context);

            if (entity != null)
            {
                repo.Delete(entity);
            }
            else
            {
                ParameterStack pstack          = context.GetValue <ParameterStack>(this.Parameter);
                var            targetEntityKey = this.ParameterTargetKey.Get(context);
                entity = pstack.GetValue(targetEntityKey, true) as FileMappingInfo;
                if (entity != null)
                {
                    repo.Delete(entity);
                }
            }
        }
示例#31
0
        public void CreateFactoryEntities(PicFactory factory, ParameterStack stack, Transform2D transform)
        {
            PicFactory fTemp = new PicFactory();
            // free variables
            double a0 = stack.GetDoubleParameterValue("a0");
            double a1 = stack.GetDoubleParameterValue("a1");
            bool bbox = stack.GetBoolParameterValue("bbox");
            bool arcDefault = stack.GetBoolParameterValue("Arc default");
            bool arcReflX = stack.GetBoolParameterValue("Arc Refl X");
            bool arcReflY = stack.GetBoolParameterValue("Arc Refl Y");
            bool arcReflXY = stack.GetBoolParameterValue("Arc Refl XY");
            bool arcComplement = stack.GetBoolParameterValue("Complement");

            if (arcDefault)
            {
                PicArc arc0 = fTemp.AddArc(PicGraphics.LT.LT_CUT, new Vector2D(0.0, 0.0), 100.0, a0, a1);
                arc0.Transform(Transform2D.Identity);

                if (bbox)
                {
                    Box2D box = arc0.Box;
                    fTemp.AddSegment(PicGraphics.LT.LT_CUT, 0, 0
                        , box.PtMin.X	// x0
                        , box.PtMin.Y	// y0
                        , box.PtMax.X	// x1
                        , box.PtMin.Y	// y1
                        );
                    fTemp.AddSegment(PicGraphics.LT.LT_CUT, 0, 0
                        , box.PtMax.X	// x0
                        , box.PtMin.Y	// y0
                        , box.PtMax.X	// x1
                        , box.PtMax.Y	// y1
                        );
                    fTemp.AddSegment(PicGraphics.LT.LT_CUT, 0, 0
                        , box.PtMin.X	// x0
                        , box.PtMax.Y	// y0
                        , box.PtMax.X	// x1
                        , box.PtMax.Y	// y1
                        );
                    fTemp.AddSegment(PicGraphics.LT.LT_CUT, 0, 0
                        , box.PtMin.X	// x0
                        , box.PtMin.Y	// y0
                        , box.PtMin.X	// x1
                        , box.PtMax.Y	// y1
                        );
                }
            }
            if (arcReflY)
            {
                PicArc arc1 = fTemp.AddArc(PicGraphics.LT.LT_CUT, new Vector2D(0.0, 0.0), 100.0, a0, a1);
                arc1.Transform(Transform2D.ReflectionY);
            }
            if (arcReflX)
            {
                PicArc arc2 = fTemp.AddArc(PicGraphics.LT.LT_CUT, new Vector2D(0.0, 0.0), 100.0, a0, a1);
                arc2.Transform(Transform2D.ReflectionX);
            }
            if (arcReflXY)
            {
                PicArc arc3 = fTemp.AddArc(PicGraphics.LT.LT_CUT, new Vector2D(0.0, 0.0), 100.0, a0, a1);
                arc3.Transform(Transform2D.ReflectionX * Transform2D.ReflectionY);
            }
            if (arcComplement)
            {
                PicArc arc4 = fTemp.AddArc(PicGraphics.LT.LT_COTATION, new Vector2D(0.0, 0.0), 100.0, a0, a1);
                arc4.Complement();
            }
            
            // end
            factory.AddEntities(fTemp, transform);
        }
示例#32
0
        public void CreateFactoryEntities(PicFactory factory, ParameterStack stack, Transform2D transform)
        {
            double L = stack.GetDoubleParameterValue("L");
            double H = stack.GetDoubleParameterValue("H");
            double R = stack.GetDoubleParameterValue("R");
            bool Rounding0 = stack.GetBoolParameterValue("Rounding0");
            bool Rounding1 = stack.GetBoolParameterValue("Rounding1");
            bool Rounding2 = stack.GetBoolParameterValue("Rounding2");
            bool Rounding3 = stack.GetBoolParameterValue("Rounding3");
            double Ang = stack.GetDoubleParameterValue("Angle") * Math.PI / 180.0;

            // segments
            PicFactory fTemp = new PicFactory();
            List<PicEntity> entityList = new List<PicEntity>();
            entityList.Add(fTemp.AddSegment(
                PicGraphics.LT.LT_CUT
                , new Vector2D(0.0, 0.0)
                , new Vector2D(L * Math.Cos(Ang), L * Math.Sin(Ang))));
            entityList.Add(fTemp.AddSegment(
                PicGraphics.LT.LT_CUT
                , new Vector2D(L * Math.Cos(Ang), L * Math.Sin(Ang))
                , new Vector2D(L * Math.Cos(Ang) - H * Math.Sin(Ang), L * Math.Sin(Ang) + H * Math.Cos(Ang))));
            entityList.Add(fTemp.AddSegment(
                PicGraphics.LT.LT_CUT
                , new Vector2D(L * Math.Cos(Ang) - H * Math.Sin(Ang), L * Math.Sin(Ang) + H * Math.Cos(Ang))
                , new Vector2D(-H * Math.Sin(Ang), H * Math.Cos(Ang))));
            entityList.Add(fTemp.AddSegment(
                PicGraphics.LT.LT_CUT
                , new Vector2D(-H * Math.Sin(Ang), H * Math.Cos(Ang))
                , new Vector2D(0.0, 0.0)));

            if (Rounding0) fTemp.ProcessTool(new PicToolRound(entityList[0], entityList[1], R));
            if (Rounding1) fTemp.ProcessTool(new PicToolRound(entityList[1], entityList[2], R));
            if (Rounding2) fTemp.ProcessTool(new PicToolRound(entityList[2], entityList[3], R));
            if (Rounding3) fTemp.ProcessTool(new PicToolRound(entityList[3], entityList[0], R));

            factory.AddEntities(fTemp, transform);
        }
示例#33
0
        /// <summary>
        /// Build / rebuild parameter stack 
        /// </summary>
        public ParameterStack BuildParameterStack(ParameterStack stackIn)
        {
            ParameterStackUpdater paramUpdater = new ParameterStackUpdater(stackIn);

            paramUpdater.CreateDoubleParameter("a", "A  [ length ]", 100, 0);
            paramUpdater.CreateDoubleParameter("b", "B  [ width ]", 60, 0);
            paramUpdater.CreateDoubleParameter("h", "H  [ height ]", 120, 0);
            paramUpdater.CreateDoubleParameter("e", "thickness", 0.5, 0);
            paramUpdater.CreateDoubleParameter("g", "Glue Flap [ 0=default ]", 0, 0);

            string[] vListTop = { "Sleeve", "Tuck End", "Inversed Tuck End", "Edge Lock", "Seal End" }; //,"Snap Lock","Crash Lock"};
            Parameter paramTopStyle = paramUpdater.CreateMultiParameter("TOP", "TOP Style", vListTop, vListTop, 0);

            if (1 == paramUpdater.GetMultiParameterValue("TOP") || 2 == paramUpdater.GetMultiParameterValue("TOP"))
            {
                string[] vListTuck = { "Simple", "Thumb Hole", "Hanging Tab", "Lock Tongue", "Crash Lock Tongue", "Mailer Lock" };
                Parameter paramTopTuckEnd = paramUpdater.CreateMultiParameter("TUCK", "-- Tuck End", vListTuck, vListTuck, 0);
                paramTopTuckEnd.Parent = paramTopStyle;

                if (2 == paramUpdater.GetMultiParameterValue("TUCK"))
                {
                    string[] vListHole = { "Euro", "Euro Std", "Delta", "Hardware", "Round" };
                    Parameter paramTopHole = paramUpdater.CreateMultiParameter("HOLE", "* Hanging Hole", vListHole, vListHole, 0);
                    paramTopHole.Parent = paramTopTuckEnd;
                }
            }
            else if (3 == paramUpdater.GetMultiParameterValue("TOP"))
            {
                string[] vListEdge = { "Simple Edge Lock", "Crash Edge lock" };
                Parameter paramTopEdgeLock = paramUpdater.CreateMultiParameter("Edge", "-- Edge Lock", vListEdge, vListEdge, 0);
                paramTopEdgeLock.Parent = paramTopStyle;
            }
            else if (4 == paramUpdater.GetMultiParameterValue("TOP"))
            {
                string[] vListSeal = { "Economy", "Full Overlapping", "Reduced Flaps", "Lock Tab" };
                Parameter paramTopSealEnd = paramUpdater.CreateMultiParameter("Seal", "-- Seal End", vListSeal, vListSeal, 0);
                paramTopSealEnd.Parent = paramTopStyle;
            }

            string[] vListBot = { "Sleeve", "Tuck End", "Inversed Tuck End", "Crash-Lock Automatic", "Snap-Lock Semi-Auto", "Edge Lock", "Seal End" };
            Parameter paramBottom = paramUpdater.CreateMultiParameter("BOTTOM", "BOTTOM Style", vListBot, vListBot, 0);

            if (1 == paramUpdater.GetMultiParameterValue("BOTTOM") || 2 == paramUpdater.GetMultiParameterValue("BOTTOM"))
            {
                string[] vListBTuck = { "Simple", "Thumb Hole", "---", "Lock Tongue", "Crash Lock Tongue", "Mailer Lock" };
                Parameter paramBottomTuckEnd = paramUpdater.CreateMultiParameter("BTUCK", "-- Tuck End", vListBTuck, vListBTuck, 0);
                paramBottomTuckEnd.Parent = paramBottom;
            }
            else if (5 == paramUpdater.GetMultiParameterValue("BOTTOM"))
            {
                string[] vListBEdge = { "Simple Edge Lock", "Crash Edge lock" };
                Parameter paramBottomEdgeLock = paramUpdater.CreateMultiParameter("BEdge", "-- Edge Lock", vListBEdge, vListBEdge, 0);
                paramBottomEdgeLock.Parent = paramBottom;
            }
            else if (6 == paramUpdater.GetMultiParameterValue("BOTTOM"))
            {
                string[] vListBSeal = { "Economy", "Full Overlapping", "Reduced Flaps", "Lock Tab" };
                Parameter paramBottomSealEnd = paramUpdater.CreateMultiParameter("BSeal", "-- Seal End", vListBSeal, vListBSeal, 0);
                paramBottomSealEnd.Parent = paramBottom;
            }
            return paramUpdater.UpdatedStack;
        }
示例#34
0
 /// <summary>
 /// Outer dimensions
 /// Method should only be called if component supports palletization
 /// </summary>
 public void OuterDimensions(ParameterStack stack, out double[] dimensions)
 {
     dimensions = new double[3];
 }
示例#35
0
 /// <summary>
 /// Reference point that defines anchored face
 /// </summary>
 public List<Vector2D> ReferencePoints(ParameterStack stack)
 {
     List<Vector2D> ltPoints = new List<Vector2D>();
     return ltPoints;
 }
示例#36
0
        public void CreateFactoryEntities(PicFactory factory, ParameterStack stack, Transform2D transform)
        {
            PicFactory fTemp = new PicFactory();

            // free variables
            double a = stack.GetDoubleParameterValue("a");
            double b = stack.GetDoubleParameterValue("b");
            double h = stack.GetDoubleParameterValue("h");
            double e = stack.GetDoubleParameterValue("e");
            double g = stack.GetDoubleParameterValue("g");

            int iTop = stack.GetMultiParameterValue("TOP");
            int iBot = stack.GetMultiParameterValue("BOTTOM");

            double gg = 15.0;

            // formulas
            SortedList<uint, PicEntity> entities = new SortedList<uint, PicEntity>();

            if (g < 5)
            { // Glue_flap
                IPlugin pluginIn = Host.GetPluginByGuid("729625f4-921d-4f72-af43-4248835a59f3");
                ParameterStack stackIn = Host.GetInitializedParameterStack(pluginIn);
                gg = stackIn.GetDoubleParameterValue("g");
            }
            else
                gg = g;
            //---------- TOP Architecture ---------------------
            if (iTop == 0)
            { // Sleeve
                IPlugin pluginIn = Host.GetPluginByGuid("da290efa-83a5-4ccd-808c-9a5eec81f36b");
                ParameterStack stackIn = Host.GetInitializedParameterStack(pluginIn);
                stackIn.SetDoubleParameter("A", a);		// A
                stackIn.SetDoubleParameter("B", b);		// B
                stackIn.SetDoubleParameter("e", e);		// e
                stackIn.SetDoubleParameter("H", h / 2);		// H
                stackIn.SetDoubleParameter("g", gg);		// g
                bool reflectionX = false, reflectionY = false;
                Transform2D transfReflect = (reflectionY ? Transform2D.ReflectionY : Transform2D.Identity) * (reflectionX ? Transform2D.ReflectionX : Transform2D.Identity);
                pluginIn.CreateFactoryEntities(fTemp, stackIn,
                     Transform2D.Translation(new Vector2D(gg, 0.0))
                     * Transform2D.Rotation(0.0)
                     * transfReflect);
            }
            else if (iTop == 1)
            { // Tuck_end
                int iTuck = stack.GetMultiParameterValue("TUCK");

                IPlugin pluginIn = Host.GetPluginByGuid("818567a3-ce01-45f5-b328-04031713c12c");
                ParameterStack stackIn = Host.GetInitializedParameterStack(pluginIn);
                stackIn.SetDoubleParameter("a", a);		// A
                stackIn.SetDoubleParameter("b", b);		// B
                stackIn.SetDoubleParameter("h", h / 2);		// H
                stackIn.SetDoubleParameter("e", e);		// t
                stackIn.SetDoubleParameter("g", g);		// g
                if (2 == iTuck)
                {
                    int iHole = stack.GetMultiParameterValue("HOLE");
                    stackIn.SetMultiParameter("HOLE", iHole);		// Hanging Hole			
                }
                stackIn.SetDoubleParameter("bp", iTuck);
                bool reflectionX = false, reflectionY = false;
                Transform2D transfReflect = (reflectionY ? Transform2D.ReflectionY : Transform2D.Identity) * (reflectionX ? Transform2D.ReflectionX : Transform2D.Identity);
                pluginIn.CreateFactoryEntities(fTemp, stackIn,
                     Transform2D.Translation(new Vector2D(0.0, 0.0))
                     * Transform2D.Rotation(0.0)
                     * transfReflect);
            }
            else if (iTop == 2)
            { // Inverted_Tuck_end
                int iTuck = stack.GetMultiParameterValue("TUCK");

                IPlugin pluginIn = Host.GetPluginByGuid("66e5437d-a8a8-404d-951c-e7bf944d2342");
                ParameterStack stackIn = Host.GetInitializedParameterStack(pluginIn);
                stackIn.SetDoubleParameter("a", a);		// A
                stackIn.SetDoubleParameter("b", b);		// B
                stackIn.SetDoubleParameter("h", h / 2);		// H
                stackIn.SetDoubleParameter("e", e);		// t
                stackIn.SetDoubleParameter("g", g);		// g
                stackIn.SetDoubleParameter("bp", iTuck);
                bool reflectionX = false, reflectionY = false;
                Transform2D transfReflect = (reflectionY ? Transform2D.ReflectionY : Transform2D.Identity) * (reflectionX ? Transform2D.ReflectionX : Transform2D.Identity);
                pluginIn.CreateFactoryEntities(fTemp, stackIn,
                     Transform2D.Translation(new Vector2D(0.0, 0.0))
                     * Transform2D.Rotation(0.0)
                     * transfReflect);
            }
            else if (iTop == 3)
            { // Edge_Lock
                int iEdge = stack.GetMultiParameterValue("Edge");

                IPlugin pluginIn = Host.GetPluginByGuid("827b4625-ccad-41f8-823a-c165852ca8f4");
                ParameterStack stackIn = Host.GetInitializedParameterStack(pluginIn);
                stackIn.SetDoubleParameter("A", a);		// A
                stackIn.SetDoubleParameter("B", b);		// B
                stackIn.SetDoubleParameter("h", h / 2);		// h
                stackIn.SetDoubleParameter("e", e);		// e
                stackIn.SetDoubleParameter("g", gg);		// g
                stackIn.SetMultiParameter("Edge", iEdge);		// Edge Lock
                stackIn.SetDoubleParameter("A1", b);			// A1
                bool reflectionX = false, reflectionY = false;
                Transform2D transfReflect = (reflectionY ? Transform2D.ReflectionY : Transform2D.Identity) * (reflectionX ? Transform2D.ReflectionX : Transform2D.Identity);
                pluginIn.CreateFactoryEntities(fTemp, stackIn,
                     Transform2D.Translation(new Vector2D(gg, 0.0))
                     * Transform2D.Rotation(0.0)
                     * transfReflect);
            }
            else if (iTop == 4)
            { // Seal_End
                int iSeal = stack.GetMultiParameterValue("Seal");

                IPlugin pluginIn = Host.GetPluginByGuid("af7fb901-90de-4034-9a27-c21d51f826d2");
                ParameterStack stackIn = Host.GetInitializedParameterStack(pluginIn);
                stackIn.SetDoubleParameter("A", a);		// A
                stackIn.SetDoubleParameter("B", b);		// B
                stackIn.SetDoubleParameter("h", h / 2);		// h
                stackIn.SetDoubleParameter("g", gg);		// g
                stackIn.SetMultiParameter("Seal", iSeal);		// Seal End
                stackIn.SetDoubleParameter("e", e);		// e
                bool reflectionX = false, reflectionY = false;
                Transform2D transfReflect = (reflectionY ? Transform2D.ReflectionY : Transform2D.Identity) * (reflectionX ? Transform2D.ReflectionX : Transform2D.Identity);
                pluginIn.CreateFactoryEntities(fTemp, stackIn,
                     Transform2D.Translation(new Vector2D(gg, 0.0))
                     * Transform2D.Rotation(0.0)
                     * transfReflect);
            }


            //---------- BOTTOM Architecture ---------------------
            if (iBot == 0)
            { // Sleeve
                IPlugin pluginIn = Host.GetPluginByGuid("da290efa-83a5-4ccd-808c-9a5eec81f36b");
                ParameterStack stackIn = Host.GetInitializedParameterStack(pluginIn);
                stackIn.SetDoubleParameter("A", a);		// A
                stackIn.SetDoubleParameter("B", b);		// B
                stackIn.SetDoubleParameter("e", e);		// e
                stackIn.SetDoubleParameter("H", h / 2);		// H
                stackIn.SetDoubleParameter("g", gg);		// g
                bool reflectionX = true, reflectionY = false;
                Transform2D transfReflect = (reflectionY ? Transform2D.ReflectionY : Transform2D.Identity) * (reflectionX ? Transform2D.ReflectionX : Transform2D.Identity);
                pluginIn.CreateFactoryEntities(fTemp, stackIn,
                     Transform2D.Translation(new Vector2D(gg, 0.0))
                     * Transform2D.Rotation(0.0)
                     * transfReflect);
            }
            else if (iBot == 1)
            { // Tuck_end
                int iBTuck = stack.GetMultiParameterValue("BTUCK");
                IPlugin pluginIn = Host.GetPluginByGuid("818567a3-ce01-45f5-b328-04031713c12c");
                ParameterStack stackIn = Host.GetInitializedParameterStack(pluginIn);
                stackIn.SetDoubleParameter("a", a);		// A
                stackIn.SetDoubleParameter("b", b);		// B
                stackIn.SetDoubleParameter("h", h / 2);		// H
                stackIn.SetDoubleParameter("e", e);		// t
                stackIn.SetDoubleParameter("g", g);		// g
                stackIn.SetDoubleParameter("bp", 0.0);
                if (iBTuck == 2)
                    stackIn.SetDoubleParameter("bp", 0);
                else
                    stackIn.SetDoubleParameter("bp", iBTuck);
                bool reflectionX = true, reflectionY = false;
                Transform2D transfReflect = (reflectionY ? Transform2D.ReflectionY : Transform2D.Identity) * (reflectionX ? Transform2D.ReflectionX : Transform2D.Identity);
                pluginIn.CreateFactoryEntities(fTemp, stackIn,
                     Transform2D.Translation(new Vector2D(0.0, 0.0))
                     * Transform2D.Rotation(0.0)
                     * transfReflect);
            }
            else if (iBot == 2)
            { // Inverted_Tuck_end
                int iBTuck = stack.GetMultiParameterValue("BTUCK");

                IPlugin pluginIn = Host.GetPluginByGuid("66e5437d-a8a8-404d-951c-e7bf944d2342");
                ParameterStack stackIn = Host.GetInitializedParameterStack(pluginIn);
                stackIn.SetDoubleParameter("a", a);		// A
                stackIn.SetDoubleParameter("b", b);		// B
                stackIn.SetDoubleParameter("h", h / 2);		// H
                stackIn.SetDoubleParameter("e", e);		// t
                stackIn.SetDoubleParameter("g", g);		// g
                stackIn.SetDoubleParameter("bp", 0.0);
                if (iBTuck == 2)
                    stackIn.SetDoubleParameter("bp", 0);
                else
                    stackIn.SetDoubleParameter("bp", iBTuck);
                bool reflectionX = true, reflectionY = false;
                Transform2D transfReflect = (reflectionY ? Transform2D.ReflectionY : Transform2D.Identity) * (reflectionX ? Transform2D.ReflectionX : Transform2D.Identity);
                pluginIn.CreateFactoryEntities(fTemp, stackIn,
                     Transform2D.Translation(new Vector2D(0.0, 0.0))
                     * Transform2D.Rotation(0.0)
                     * transfReflect);
            }
            else if (iBot == 3)
            { // Snap_lock_base
                IPlugin pluginIn = Host.GetPluginByGuid("2c366e1f-35d1-4e72-ba2b-7786e699f94c");
                ParameterStack stackIn = Host.GetInitializedParameterStack(pluginIn);
                stackIn.SetDoubleParameter("a", a);		// a
                stackIn.SetDoubleParameter("b", b);		// b
                stackIn.SetDoubleParameter("h", h / 2);		// h
                stackIn.SetDoubleParameter("e", e);		// e
                stackIn.SetDoubleParameter("g", g);		// g
                bool reflectionX = false, reflectionY = false;
                Transform2D transfReflect = (reflectionY ? Transform2D.ReflectionY : Transform2D.Identity) * (reflectionX ? Transform2D.ReflectionX : Transform2D.Identity);
                pluginIn.CreateFactoryEntities(fTemp, stackIn,
                     Transform2D.Translation(new Vector2D(0.0, 0.0))
                     * Transform2D.Rotation(0.0)
                     * transfReflect);
            }
            else if (iBot == 4)
            { // Crash_lock_base
                IPlugin pluginIn = Host.GetPluginByGuid("2015adce-a857-49c8-b051-b6891b90b941");
                ParameterStack stackIn = Host.GetInitializedParameterStack(pluginIn);
                stackIn.SetDoubleParameter("a", a);		// a
                stackIn.SetDoubleParameter("b", b);		// b
                stackIn.SetDoubleParameter("h", h / 2);		// h
                stackIn.SetDoubleParameter("e", e);		// e
                stackIn.SetDoubleParameter("d", e);		// d
                stackIn.SetDoubleParameter("g", g);		// g
                bool reflectionX = false, reflectionY = false;
                Transform2D transfReflect = (reflectionY ? Transform2D.ReflectionY : Transform2D.Identity) * (reflectionX ? Transform2D.ReflectionX : Transform2D.Identity);
                pluginIn.CreateFactoryEntities(fTemp, stackIn,
                     Transform2D.Translation(new Vector2D(0.0, -h / 2))
                     * Transform2D.Rotation(0.0)
                     * transfReflect);
            }
            else if (iBot == 5)
            { // Edge_Lock
                int iBEdge = stack.GetMultiParameterValue("BEdge");

                IPlugin pluginIn = Host.GetPluginByGuid("827b4625-ccad-41f8-823a-c165852ca8f4");
                ParameterStack stackIn = Host.GetInitializedParameterStack(pluginIn);
                stackIn.SetDoubleParameter("A", a);		// A
                stackIn.SetDoubleParameter("B", b);		// B
                stackIn.SetDoubleParameter("h", h / 2);		// h
                stackIn.SetDoubleParameter("e", e);		// e
                stackIn.SetDoubleParameter("g", gg);		// g
                stackIn.SetMultiParameter("Edge", iBEdge);		// Edge Lock
                stackIn.SetDoubleParameter("A1", b);			// A1
                bool reflectionX = true, reflectionY = false;
                Transform2D transfReflect = (reflectionY ? Transform2D.ReflectionY : Transform2D.Identity) * (reflectionX ? Transform2D.ReflectionX : Transform2D.Identity);
                pluginIn.CreateFactoryEntities(fTemp, stackIn,
                     Transform2D.Translation(new Vector2D(gg, 0.0))
                     * Transform2D.Rotation(0.0)
                     * transfReflect);
            }
            else if (iBot == 6)
            { // Seal_End
                int iBSeal = stack.GetMultiParameterValue("BSeal");

                IPlugin pluginIn = Host.GetPluginByGuid("af7fb901-90de-4034-9a27-c21d51f826d2");
                ParameterStack stackIn = Host.GetInitializedParameterStack(pluginIn);
                stackIn.SetDoubleParameter("A", a);		// A
                stackIn.SetDoubleParameter("B", b);		// B
                stackIn.SetDoubleParameter("h", h / 2);		// h
                stackIn.SetDoubleParameter("g", gg);		// g
                stackIn.SetMultiParameter("Seal", iBSeal);		// Seal End
                stackIn.SetDoubleParameter("e", e);		// e
                bool reflectionX = true, reflectionY = false;
                Transform2D transfReflect = (reflectionY ? Transform2D.ReflectionY : Transform2D.Identity) * (reflectionX ? Transform2D.ReflectionX : Transform2D.Identity);
                pluginIn.CreateFactoryEntities(fTemp, stackIn,
                     Transform2D.Translation(new Vector2D(gg, 0.0))
                     * Transform2D.Rotation(0.0)
                     * transfReflect);
            }

            factory.AddEntities(fTemp, transform);
        }
示例#37
0
        public void CreateFactoryEntities(PicFactory factory, ParameterStack stack, Transform2D transform)
        {
            PicFactory fTemp = new PicFactory();
            const PicGraphics.LT ltCut = PicGraphics.LT.LT_CUT;
            const PicGraphics.LT ltFold = PicGraphics.LT.LT_CREASING;

            // get parameter values
            double L = stack.GetDoubleParameterValue("L");
            double H = stack.GetDoubleParameterValue("H");
            double E = stack.GetDoubleParameterValue("E");
            int PoignsurTete = stack.GetMultiParameterValue("PoignsurTete");

            short layer = 1;
            short grp = 1;
            PicGraphics.LT lt = ltCut;
            if (PoignsurTete >= 2)
            {
                lt = ltFold;
                layer = 2;
            }
            double x1 = (L-H)/2.0;
            double y1 = 0.0;
            double x2 = x1 - (L - H);
            double y2 = y1;
            fTemp.AddSegment(lt, grp, layer, x1, y1, x2, y2);

            lt = ltCut;
            double ry = H / 2.0;
            double xc = x2;
            double yc = - H / 2.0;
            fTemp.AddArc(lt, grp, layer, xc, yc, ry, 90.0, 270.0);

            x1 = xc;
            y1 = -H;
            x2 = x1 + (L - H);
            y2 = y1;
            fTemp.AddSegment(lt, grp, layer, x1, y1, x2, y2);

            ry = H / 2.0;
            xc = x2;
            yc = -H / 2.0;
            fTemp.AddArc(lt, grp, layer, xc, yc, ry, -90.0, 90.0);

            if (PoignsurTete == 3)
            {
                lt = ltCut;
                x1 = (L - H) / 2.0;
                y1 = 0.0;
                x2 = x1;
                y2 = y1 + E;
                fTemp.AddSegment(lt, grp, layer, x1, y1, x2, y2);

                x1 = x2;
                y1 = y2;
                x2 = x1 + E;
                y2 = y1;
                fTemp.AddSegment(lt, grp, layer, x1, y1, x2, y2);

                x1 = -(L - H) / 2.0;
                y1 = 0.0;
                x2 = x1;
                y2 = y1 + E;
                fTemp.AddSegment(lt, grp, layer, x1, y1, x2, y2);

                x1 = x2;
                y1 = y2;
                x2 = x1 - E;
                y2 = y1;
                fTemp.AddSegment(lt, grp, layer, x1, y1, x2, y2);

                lt = ltFold;
                x2 = x1 + (L - H);
                y2 = y1;
                fTemp.AddSegment(lt, grp, layer, x1, y1, x2, y2);
            }

            factory.AddEntities(fTemp, transform);
        }
示例#38
0
 public double ImpositionOffsetY(ParameterStack stack) { return 0.0; }