/// <summary> /// Carry out the block model import /// </summary> /// <param name="SelectedBMFile"></param> /// <param name="SelectedFormatBMFile"></param> /// <param name="importMap"></param> /// <param name="rawFileReader"></param> /// <returns></returns> internal bool DoBMImport(string SelectedBMFile, string SelectedFormatBMFile, ImportDataMap importMap, RawFileReader rawFileReader, string NKDProjectID, string modelAlias) { BaseImportTools bit = new BaseImportTools(); int cxColumnID = importMap.GetColumnIDMappedTo("CentroidX"); int cyColumnID = importMap.GetColumnIDMappedTo("CentroidY"); int czColumnID = importMap.GetColumnIDMappedTo("CentroidZ"); ColumnStats xOrigin = rawFileReader.GetDimensions(cxColumnID); ColumnStats yOrigin = rawFileReader.GetDimensions(cyColumnID); ColumnStats zOrigin = rawFileReader.GetDimensions(czColumnID); int approxNumLines = xOrigin.count; Stream bmFileStream = new FileStream(SelectedBMFile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); // Stream bmFileStream = new FileStream(SelectedBMFile, FileMode.Open); ModelImportStatus mos = new ModelImportStatus(); Guid newModelGuid = Guid.NewGuid(); Guid authorGuid = new Guid(); List<string> status = bit.PerformBMImport(mos, newModelGuid, bmFileStream, null, importMap, xOrigin.min, yOrigin.min, zOrigin.min, backgroundWorker, approxNumLines, NKDProjectID, modelAlias, authorGuid, ConnectionString); return true; }
private void PresetDimensionData(ImportDataMap impMap) { var rawFileReader = new RawFileReader((SelectedFile.ToLower().IndexOf(".csv") > -1) ? ',' : '\t'); int cxColumnID = impMap.GetColumnIDMappedTo("CentroidX"); int cyColumnID = impMap.GetColumnIDMappedTo("CentroidY"); int czColumnID = impMap.GetColumnIDMappedTo("CentroidZ"); int xincColumnID = impMap.GetColumnIDMappedTo("LegthX"); int yincColumnID = impMap.GetColumnIDMappedTo("LengthY"); int zincColumnID = impMap.GetColumnIDMappedTo("LengthZ"); PhysicalDimensions pd = new PhysicalDimensions(); if (cxColumnID > -1) { ColumnStats xOrigin = rawFileReader.GetDimensions(cxColumnID); pd.originX = xOrigin.min; } if (cyColumnID > -1) { ColumnStats yOrigin = rawFileReader.GetDimensions(cyColumnID); pd.originY = yOrigin.min; } if (czColumnID > -1) { ColumnStats zOrigin = rawFileReader.GetDimensions(czColumnID); pd.originZ = zOrigin.min; } if (xincColumnID > -1) { ColumnStats xInc = rawFileReader.GetDimensions(xincColumnID); pd.blockXWidth = xInc.max; } if (yincColumnID > -1) { ColumnStats yInc = rawFileReader.GetDimensions(yincColumnID); pd.blockYWidth = yInc.max; } if (zincColumnID > -1) { ColumnStats zInc = rawFileReader.GetDimensions(zincColumnID); pd.blockZWidth = zInc.max; } BlockDimensionsControl.SetBlockDimensions(pd); }