Пример #1
0
/** Save data scalar information */
void VScalar::save(QXmlStreamWriter &s) {
  if (dataSource()) {
    s.writeStartElement("vscalar");
    saveFilename(s);

    s.writeAttribute("field", _field);
    s.writeAttribute("f0", QString::number(_f0));

    saveNameInfo(s, SCALARNUM);
    s.writeEndElement();
  }
}
void ImageExporterOutputWidget::updateUiFileName()
{
    QString oldUiFilename{ m_ui->fileNameTextEdit->toPlainText() };
    int positionOfEnumNumIndex{ oldUiFilename.indexOf(m_supportedTags["enum_num"]) + m_supportedTags["enum_num"].length() };
    std::string startIndex{ extractEnumNumStartIndex(oldUiFilename.toStdString(), positionOfEnumNumIndex) };
    QString newUiFilename{ oldUiFilename.replace(positionOfEnumNumIndex, static_cast<int>(startIndex.length()), QString::number(atoi(startIndex.c_str()) + 1)) };

    bool oldSignalStatus = m_ui->fileNameTextEdit->blockSignals(true);
    m_ui->fileNameTextEdit->setPlainText(newUiFilename);
    emit filenameChanged();
    saveFilename();
    m_ui->fileNameTextEdit->blockSignals(oldSignalStatus);
}
Пример #3
0
    void DownloadManager::startDownloadImpl( QString const & url, QString const & path )
    {
        bool fileExist = false;
        bool tempExist = false;
        QString fileName = "";
        QString filePath = saveFilename( path == "" ? url : path, fileExist, fileName, tempExist, path == "" );

        if ( fileExist && m_existDownloadPolicy == CancelDownloadFile) {
            emit status( url, "Cancel", "File already exist", filePath );
            return;
        }

        Downloads item;
        item.m_url = url;
        item.m_key = fileName;
        item.m_destFile = filePath;
        item.m_tempFile = filePath + ".part";
        item.m_tempExists = tempExist;

        m_downloadQueue.enqueue(item);
        startNextDownload();
    }
void DataMatrix::save(QXmlStreamWriter &xml) {
  if (file()) {
    xml.writeStartElement(staticTypeTag);

    saveFilename(xml);

    xml.writeAttribute("field", _field);
    xml.writeAttribute("reqxstart", QString::number(_reqXStart));
    xml.writeAttribute("reqystart", QString::number(_reqYStart));
    xml.writeAttribute("reqnx", QString::number(_reqNX));
    xml.writeAttribute("reqny", QString::number(_reqNY));
    xml.writeAttribute("doave", QVariant(_doAve).toString());
    xml.writeAttribute("doskip", QVariant(_doSkip).toString());
    xml.writeAttribute("skip", QString::number(_skip));
    xml.writeAttribute("xmin", QString::number(minX()));
    xml.writeAttribute("ymin", QString::number(minY()));
    xml.writeAttribute("xstep", QString::number(xStepSize()));
    xml.writeAttribute("ystep", QString::number(yStepSize()));
    saveNameInfo(xml, VNUM|MNUM|XNUM);

    xml.writeEndElement();
  }
}
void mexFunction( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] ) {

	if (nlhs != 1 || nrhs != 7) {
		mexErrMsgTxt("Usage: [Error] = fndllSolidWorks(XY (2xN), Tilt (1xN), Rotation (1xN), Rad (1xN), strTemplate, strOutputFile, bShutdown)");
		return;
	} 

	const int *dim1 = mxGetDimensions(prhs[0]);
	int NumHoles = dim1[1];
	const int *dim2 = mxGetDimensions(prhs[1]);
	const int *dim3 = mxGetDimensions(prhs[2]);

	if (dim1[0] != 2 || dim2[0] != 1 || dim1[1] != dim2[1] || dim3[1] != NumHoles) {
		mexErrMsgTxt("Usage: [Error] = fndllSolidWorks(XY (2xN), Tilt (1xN), Rotation (1xN), Rad (1xN), strTemplate, strOutputFile, bShutdown)");
		return;
	}

	//static const double HOLE_RADIUS_M = .375*MM_TO_M;


	double *P = (double *)mxGetData(prhs[0]);
	double *Tilt = (double *)mxGetData(prhs[1]);
	double *Rot = (double *)mxGetData(prhs[2]);

	double *Rad = (double *)mxGetData(prhs[3]);

	char TemplateFile[1000], OutputFile[1000];
	
	mxGetString(prhs[4], TemplateFile, 999);
	mxGetString(prhs[5], OutputFile, 999);

	bool bShutdown = (*(char *)mxGetData(prhs[6])) > 0;

        std::string saveFilename(OutputFile);
		std::string templateFileName(TemplateFile);

        vector<double> x_mm_list;
        vector<double> y_mm_list;
		vector<double> r_mm_list;

        vector<double > tilt_degrees_list;
        vector<double> rotation_degrees_list;

		for(int i = 0; i< NumHoles;i++) {

                        double tilt_degrees = Tilt[i];
                        double rotation_degrees = Rot[i];

                        double x = P[2*i+0];
                        double y = P[2*i+1];
						double r = Rad[i] ;

                        x_mm_list.push_back(x);
                        y_mm_list.push_back(y);
						r_mm_list.push_back(r);
                        tilt_degrees_list.push_back(tilt_degrees);
                        rotation_degrees_list.push_back(rotation_degrees);
        }

        int Err = createRecordingChamber(x_mm_list,
                               y_mm_list,
							   tilt_degrees_list,
							   rotation_degrees_list,
							   r_mm_list,
							   saveFilename, templateFileName,bShutdown);

		int output_dim_array[2] = {1,1};
	plhs[0] = mxCreateNumericArray(2, output_dim_array, mxDOUBLE_CLASS, mxREAL);
	double *Out = (double*) mxGetPr(plhs[0]);
	*Out = Err;

}