Esempio n. 1
0
        private void LoadGeophysiscsTextDataForPreview(string inputFilename)
        {
            IOResults ares = new IOResults();

            List<ColumnMetaInfo> dbFields = GetGeophysicsFieldsFromXODB();
            // talk to the database to get the column names 

            ImportDataPreview.SetMandatoryMappingColumns(dbFields);
            ImportDataPreview.SetPreviewType("GEOPHYISCS");

            bool firstLineIsHeader = true;
            
            if (inputFilename.ToLower().EndsWith("las"))
            {
                LASFileReader lfr = new LASFileReader();
                int errCode = 0;
                LASFile fl = lfr.ReadLASFile(inputFilename, 0, out errCode);

                List<RawDataRow> dt = new List<RawDataRow>();
                RawDataRow rdh = new RawDataRow();
                rdh.dataItems = new List<string>();
                rdh.dataItems.Add("Depth");
                foreach (string ss in fl.columnHeaders) {
                    rdh.dataItems.Add(ss);
                }

                dt.Add(rdh);
                foreach (LASDataRow ldr in fl.dataRows) {
                    RawDataRow rd = new RawDataRow();
                    rd.dataItems.Add(""+ldr.depth);
                    foreach (double d in ldr.rowData) {
                        rd.dataItems.Add("" + d); 
                    }
                    dt.Add(rd);
                }

                ImportDataPreview.ResetTable(dt, true);
                
            }
            else
            {
                List<RawDataRow> dt = blockRawFileReader.LoadRawDataForPreview(inputFilename, ares);
                ImportDataPreview.ResetTable(dt, firstLineIsHeader);
                
            }
        }
Esempio n. 2
0
        public LASFile GetLASFile(string inputFilename,ModelImportStatus mis ) {
            LASFile lf = null;
            try
            {
                LASFileReader lfr = new LASFileReader();
                int columnOffset = 0;
                int errorCode = 0;
                 lf = lfr.ReadLASFile(inputFilename, columnOffset, out errorCode);
                
                if (errorCode == 0)
                {
                    mis.finalErrorCode = ModelImportStatus.OK;
                    string res = "";
                    foreach (string nc in lf.columnHeaders)
                    {
                        res += nc + ", ";
                    }
                    mis.linesReadFromSource = lf.dataRows.Count;
  
                    // Display error mesasges if required
                    if (lf.errorDetails != null && lf.errorDetails.Count > 0)
                    {
                        string messageBoxText = "The file (" + inputFilename + ") was loaded, but issues were noted as follows:";
                        mis.AddWarningMessage(messageBoxText);
                        foreach (string ed in lf.errorDetails)
                        {
                            string ss = "\n" + ed;
                            mis.AddWarningMessage(ss);
                        }
                        
                        
                       

                    }

                }
                else
                {

                    string messageBoxText = "The file (" + inputFilename + ") could not be loaded.  Please check that the file is " +
                                            "accessible, is not open in another application and is in the correct format.";
                    mis.AddErrorMessage(messageBoxText);
                    string errorCodeDetails = LASErrorCodes.LookupCode(errorCode);
                    if (lf != null && lf.errorDetails != null)
                    {
                        foreach (string ed in lf.errorDetails)
                        {
                            string ss = "\n" + ed;
                            mis.AddErrorMessage(ss);
                        }
                    }
                    
                    mis.finalErrorCode = ModelImportStatus.ERROR_LOADING_FILE;
                    string caption = "Error loading file " + inputFilename;
                    
                }

            }
            catch (Exception ex)
            {

            }
            return lf;
        }