bool CSVResourceReportElement::generate() { generateHeader(); generateTableHeader(); ResourceList filteredResourceList; if (!filterResourceList(filteredResourceList, 0, hideResource, rollUpResource)) return false; sortResourceList(filteredResourceList); maxDepthResourceList = filteredResourceList.maxDepth(); maxDepthTaskList = 0; int rNo = 1; for (ResourceListIterator rli(filteredResourceList); *rli != 0; ++rli, ++rNo) { TableLineInfo tli1; tli1.ca1 = tli1.resource = *rli; for (uint sc = 0; sc < scenarios.count(); ++sc) { tli1.row = sc; tli1.sc = scenarios[sc]; tli1.idxNo = rNo; generateLine(&tli1, sc == 0 ? 4 : 5); } } generateFooter(); return true; }
bool CSVTaskReportElement::generate() { generateHeader(); generateTableHeader(); TaskList filteredTaskList; if (!filterTaskList(filteredTaskList, 0, getHideTask(), getRollUpTask())) return false; sortTaskList(filteredTaskList); maxDepthTaskList = filteredTaskList.maxDepth(); maxDepthResourceList = 0; int tNo = 1; for (TaskListIterator tli(filteredTaskList); *tli != 0; ++tli, ++tNo) { TableLineInfo tli1; tli1.ca1 = *tli; tli1.task = *tli; for (uint sc = 0; sc < scenarios.count(); ++sc) { tli1.row = sc; tli1.sc = scenarios[sc]; tli1.idxNo = tNo; generateLine(&tli1, sc == 0 ? 2 : 3); } } generateFooter(); return true; }
void EstompageImage::generate() { estompage = new uint8_t[origImage->getWidth() * origImage->getHeight()]; bufferTmp = new float[origImage->getWidth() * 3]; float* lineBuffer[3]; lineBuffer[0]= bufferTmp; lineBuffer[1]= lineBuffer[0]+origImage->getWidth(); lineBuffer[2]= lineBuffer[1]+origImage->getWidth(); int line = 0; int nextBuffer = 0; getOrigLine ( lineBuffer[0], line ); getOrigLine ( lineBuffer[1], line+1 ); getOrigLine ( lineBuffer[2], line+2 ); generateLine ( line++, lineBuffer[0],lineBuffer[0],lineBuffer[1] ); generateLine ( line++, lineBuffer[0],lineBuffer[1],lineBuffer[2] ); while ( line < origImage->getHeight() -1 ) { getOrigLine ( lineBuffer[nextBuffer], line+1 ); generateLine ( line++, lineBuffer[ ( nextBuffer+1 ) %3],lineBuffer[ ( nextBuffer+2 ) %3],lineBuffer[nextBuffer] ); nextBuffer = ( nextBuffer+1 ) %3; } generateLine ( line,lineBuffer[nextBuffer], lineBuffer[ ( nextBuffer+1 ) %3],lineBuffer[ ( nextBuffer+1 ) %3] ); delete[] bufferTmp; }
bool KNMusicCueListParser::writeDetail(const KNMusicAnalysisItem &analysisItem) { //Get the track index. const KNMusicDetailInfo &detailInfo=analysisItem.detailInfo; //Prepare the orignial file data and the temporary file data. QTemporaryFile updatedListFile; QFile listFile(detailInfo.trackFilePath); //Open the list file. if(!listFile.open(QIODevice::ReadOnly)) { return false; } //Open the list file. if(!updatedListFile.open()) { //Close the opened music file. listFile.close(); return false; } //Read the list file. //Initial the list file and temporary file stream as a text file. QTextStream trackStream(&listFile), temporaryStream(&updatedListFile); //Read until the track index comes to the track index. QString rawLine=trackStream.readLine(); //Check the raw line. while(!rawLine.isNull()) { //Simplified the raw line. QString commandRawLine=rawLine.simplified(); //Generate command part and data part cache. QString rawCommand, rawData; //Parse the command. parseCommand(commandRawLine, rawCommand, rawData); //Now we are only taken care about the TRACK. if(rawCommand=="TRACK") { //Use the trackIndex variable find the space temporarily. int trackIndex=rawData.indexOf(' '); //Get the track index. trackIndex= (trackIndex==-1?rawData:rawData.left(trackIndex)).toInt(); //Check the track index. if(trackIndex==detailInfo.trackIndex) { //Hit the track. //First we have to output the raw line data. temporaryStream << rawLine << '\n'; //Then check the detail info data. //We have to write out these informations: // PERFORMER Artist // TITLE Name QString trackData; trackData.append(generateLine( " TITLE ", detailInfo.textLists[Name].toString())); trackData.append(generateLine( " PERFORMER ", detailInfo.textLists[Artist].toString())); //Write the track data to temporary file. temporaryStream << trackData; //Read the original file again until to INDEX, skip all the //other data. rawLine=trackStream.readLine(); //Simplified the raw line. commandRawLine=rawLine.simplified(); //Parse the raw line. parseCommand(commandRawLine, rawCommand, rawData); //Read until we get the INDEX. while(!rawLine.isNull() && rawCommand!="INDEX") { //Continue skip the file. rawLine=trackStream.readLine(); //Simplified the raw line. commandRawLine=rawLine.simplified(); //Parse the raw line. parseCommand(commandRawLine, rawCommand, rawData); } //So now the data should be the first INDEX. //Output the data and continue copy the data. temporaryStream << rawLine << '\n'; } else { //Simply output the data. temporaryStream << rawLine << '\n'; } } else { //Simply output the data. temporaryStream << rawLine << '\n'; } //Read the next line. rawLine=trackStream.readLine(); } //Flush the data. temporaryStream << flush; //Now the data should be all done. //Close the list file. listFile.close(); //Reset the temporary file. updatedListFile.reset(); //Reopen the list file, open as write only mode. if(!listFile.open(QIODevice::WriteOnly)) { return false; } //Write all the data to list file. //Generate the music data cache. char *turboCache=new char[DataCacheSize]; //Now copy all the content from the original file to temporary file. int bytesRead=updatedListFile.read(turboCache, DataCacheSize); while(bytesRead>0) { //Write the cache to the list file. listFile.write(turboCache, bytesRead); //Read new data from the original file to cache. bytesRead=updatedListFile.read(turboCache, DataCacheSize); } //Close the list file and temporary file. listFile.close(); updatedListFile.close(); //Clear up the turbo cache. delete[] turboCache; //Written finished. return true; }
bool HTMLResourceReportElement::generate() { generateHeader(); generateTableHeader(); s() << "<tbody>" << endl; ResourceList filteredResourceList; if (!filterResourceList(filteredResourceList, 0, hideResource, rollUpResource)) return false; sortResourceList(filteredResourceList); maxDepthResourceList = filteredResourceList.maxDepth(); TaskList filteredTaskList; if (!filterTaskList(filteredTaskList, 0, hideTask, rollUpTask)) return false; maxDepthTaskList = filteredTaskList.maxDepth(); int rNo = 1; for (ResourceListIterator rli(filteredResourceList); *rli != 0; ++rli, ++rNo) { TableLineInfo tli1; tli1.ca1 = tli1.resource = *rli; for (uint sc = 0; sc < scenarios.count(); ++sc) { tli1.row = sc; tli1.sc = scenarios[sc]; tli1.idxNo = rNo; tli1.bgCol = colors.getColor("default").dark(100 + sc * 10); generateLine(&tli1, sc == 0 ? 4 : 5); } /* We only want to show the nested task list for leaf resources. Leaf * in this case means "task has no visible childs". */ bool hasVisibleChilds = false; for (ResourceListIterator cli((*rli)->getSubListIterator()); *cli; ++cli) if (filteredResourceList.findRef(*cli) >= 0) { hasVisibleChilds = true; break; } if (hasVisibleChilds) continue; if (!filterTaskList(filteredTaskList, *rli, hideTask, rollUpTask)) return false; sortTaskList(filteredTaskList); int tNo = 1; for (TaskListIterator tli(filteredTaskList); *tli != 0; ++tli, ++tNo) { TableLineInfo tli2; tli2.ca1 = tli2.task = *tli; tli2.ca2 = tli2.resource = *rli; for (uint sc = 0; sc < scenarios.count(); ++sc) { tli2.row = sc; tli2.sc = scenarios[sc]; tli2.idxNo = tNo; tli2.bgCol = colors.getColor("default").light(120). dark(100 + sc * 10); generateLine(&tli2, sc == 0 ? 2 : 3); } } } s() << "</tbody>" << endl; s() << "</table>" << endl; generateFooter(); return true; }
//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- cvf::ref<cvf::DrawableGeo> RivPipeGeometryGenerator::createCenterLine() { return generateLine(m_originalPipeCenterCoords.p()); }