Beispiel #1
0
 public MultiFileComputer(IArgumentProvider argumentProvider, string defaultDirPath,
                          IContextMessage contextMessage, string identify, ComputeArgument arg)
 {
     _argumentProvider  = argumentProvider;
     _orbitFilesDirPath = defaultDirPath;
     _contextMessage    = contextMessage;
     _identify          = identify;
     _arg = arg;
 }
        public override IExtractResult Make(Action <int, string> progressTracker, IContextMessage contextMessage)
        {
            _contextMessage = contextMessage;
            if (_argumentProvider == null || _argumentProvider.DataProvider == null)
            {
                return(null);
            }

            if (_argumentProvider.GetArg("AlgorithmName") == null)
            {
                PrintInfo("参数\"AlgorithmName\"为空。");
                return(null);
            }
            string algorith = _argumentProvider.GetArg("AlgorithmName").ToString();

            if (algorith != "0RVI")
            {
                PrintInfo("指定的算法\"" + algorith + "\"没有实现。");
                return(null);
            }

            ComputeArgument               arg      = GetComputeArguments(contextMessage);
            MultiFileComputer             computer = new MultiFileComputer(_argumentProvider, _orbitFilesDirPath, contextMessage, "0RVI", arg);
            Dictionary <string, string[]> pathDic  = _argumentProvider.GetArg("OrbitFileSelectType") as Dictionary <string, string[]>;

            if (pathDic == null)
            {
                return(computer.ComputeByCurrentRaster(progressTracker));
            }
            if (pathDic.Keys.Contains("CurrentRaster")) //选择当前影像
            {
                return(computer.ComputeByCurrentRaster(progressTracker));
            }
            if (pathDic.Keys.Contains("DirectoryPath")) //选择局地文件夹路径
            {
                return(computer.ComputeByDirPath(pathDic["DirectoryPath"][0]));
            }
            if (pathDic.Keys.Contains("FileNames")) //选择多个文件进行计算
            {
                return(computer.ComputeByFiles(pathDic["FileNames"]));
            }
            return(null);
        }