Ejemplo n.º 1
0
        public TerrainProject(string existingProjectPath)
        {
            Path = existingProjectPath;

            string infoFileContent = FileInterface.ReadString(Path + System.IO.Path.DirectorySeparatorChar + PROJECT_INFO_FILE);
            object obj             = ObjectSerializer.DeSerialize(infoFileContent, typeof(TerrainProjectInfo));

            Info = (TerrainProjectInfo)obj;
        }
Ejemplo n.º 2
0
        private void loadWorkflowData()
        {
            workflowData = new Dictionary <LayerType, WorkflowData>();

            foreach (LayerType layerType in (LayerType[])Enum.GetValues(typeof(LayerType)))
            {
                string filename  = Path + System.IO.Path.DirectorySeparatorChar + "workflow_" + layerType + ".twd";
                string inputData = FileInterface.ReadString(filename);
                if (inputData != null)
                {
                    List <WorkflowData> workflowData_ = (List <WorkflowData>)ObjectSerializer.DeSerialize(inputData, typeof(List <WorkflowData>));
                    workflowData.Add(layerType, workflowData_[0]);
                }
            }
        }
Ejemplo n.º 3
0
        private static Configurations loadConfigurations(String path)
        {
            currentPath = path;

            string fileContent = FileInterface.ReadString(path + Path.DirectorySeparatorChar + CONFIGURATIONS_FILE);

            Configurations configurations = null;

            if (fileContent != null)
            {
                Object obj = ObjectSerializer.DeSerialize(fileContent, typeof(Configurations));
                if (obj != null)
                {
                    Console.WriteLine("Object is not null. Path: " + currentPath);
                    configurations = (Configurations)obj;
                }
            }
            else
            {
                Console.WriteLine("File content null");
                if (!currentPath.Equals(CONFIGURATIONS_DEFAULT_PATH))
                {
                    return(LoadConfigurations());
                }
            }


            if (configurations == null)
            {
                Console.WriteLine("Finally configurations are null");
                configurations = new Configurations(true);
            }

            configurations.protectData = true;
            return(configurations);
        }
Ejemplo n.º 4
0
        private void loadTerrainOutputs()
        {
            terrainOutputs = new Dictionary <TerrainPipelineLayer, List <TerrainOutput> >(new TerrainPipelineLayerComparator());
            foreach (TerrainPlugin terrainPlugin in TerrainPipeline)
            {
                if (terrainPlugin != null)
                {
                    TerrainPipelineLayer pipelineLayer = new TerrainPipelineLayer();
                    TerrainPluginInfo    pluginInfo    = new TerrainPluginInfo(terrainPlugin);
                    pipelineLayer.PluginId  = pluginInfo.Id;
                    pipelineLayer.LayerCode = TerrainPipelineLayer.ToPipelineLayerCode(terrainPlugin.Out, terrainPlugin.In, terrainPlugin.Not);

                    string filename = Path + OUTPUT_SUBDIRECTORY + pipelineLayer.LayerCode + "_" + pipelineLayer.PluginId + ".tou";

                    string inputData = FileInterface.ReadString(filename);
                    if (inputData != null)
                    {
                        List <TerrainOutput> terrainOutputsList = (List <TerrainOutput>)ObjectSerializer.DeSerialize(inputData, typeof(List <TerrainOutput>));
                        if (terrainOutputsList != null)
                        {
                            terrainOutputs.Add(pipelineLayer, terrainOutputsList);
                        }
                    }
                }
            }

            cleanUnusedOutputs();
        }
Ejemplo n.º 5
0
        private List <TerrainInput> loadTerrainInputs(TerrainPipelineLayer terrainPipelineLayer, List <TerrainInput> terrainInputs)
        {
            string inputData = FileInterface.ReadString(Path + INPUT_SUBDIRECTORY + terrainPipelineLayer.LayerCode + "_" + terrainPipelineLayer.PluginId + ".tin");

            if (inputData != null)
            {
                try
                {
                    List <TerrainInput> allTerrainInputs = new List <TerrainInput>();
                    mergeInnerTerrainInputs(allTerrainInputs, terrainInputs);
                    List <TerrainInputValue> terrainInputValues = (List <TerrainInputValue>)ObjectSerializer.DeSerialize(inputData, typeof(List <TerrainInputValue>));

                    int i = 0;
                    foreach (TerrainInput terrainInput in allTerrainInputs)
                    {
                        switch (terrainInput.Type)
                        {
                        case InputType.Form:
                        case InputType.Sketch:
                            terrainInputValues[i].FillValue(terrainInput);
                            i++;
                            break;
                        }
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Saved input data does not match: " + ex.Message);
                }
            }

            return(terrainInputs);
        }