예제 #1
0
QString MultiLayer::saveToString(const QString &geometry) {
  QString s = "<multiLayer>\n";
  s += QString(name()) + "\t";
  s += QString::number(cols) + "\t";
  s += QString::number(rows) + "\t";
  s += birthDate() + "\n";
  s += geometry;
  s += "WindowLabel\t" + windowLabel() + "\t" +
       QString::number(captionPolicy()) + "\n";
  s += "Margins\t" + QString::number(left_margin) + "\t" +
       QString::number(right_margin) + "\t" + QString::number(top_margin) +
       "\t" + QString::number(bottom_margin) + "\n";
  s += "Spacing\t" + QString::number(rowsSpace) + "\t" +
       QString::number(colsSpace) + "\n";
  s += "LayerCanvasSize\t" + QString::number(l_canvas_width) + "\t" +
       QString::number(l_canvas_height) + "\n";
  s += "Alignement\t" + QString::number(hor_align) + "\t" +
       QString::number(vert_align) + "\n";

  for (int i = 0; i < (int)graphsList.count(); i++) {
    Graph *ag = (Graph *)graphsList.at(i);
    s += ag->saveToString();
  }
  return s + "</multiLayer>\n";
}
예제 #2
0
QString Note::saveToString(const QString &info)
{
QString s= "<note>\n";
s+= QString(name()) + "\t" + birthDate() + "\n";
s+= info;
s+= "WindowLabel\t" + windowLabel() + "\t" + QString::number(captionPolicy()) + "\n";
s+= "AutoExec\t" + QString(autoExec ? "1" : "0") + "\n";
s+= "<content>\n"+te->text().trimmed()+"\n</content>";
s+="\n</note>\n";
return s;
}
void Matrix::save(const QString &fn, const QString &info, bool saveAsTemplate)
{
	QFile f(fn);
	if (!f.isOpen()){
		if (!f.open(QIODevice::Append))
			return;
	}
	bool notTemplate = !saveAsTemplate;

	QTextStream t( &f );
	t.setEncoding(QTextStream::UnicodeUTF8);
	t << "<matrix>\n";
	if (notTemplate)
        t << QString(objectName()) + "\t";
	t << QString::number(numRows())+"\t";
	t << QString::number(numCols())+"\t";
	if (notTemplate)
        t << birthDate() + "\n";
	t << info;
	t << "ColWidth\t" + QString::number(d_column_width)+"\n";
	t << "<formula>\n" + formula_str + "\n</formula>\n";
	t << "TextFormat\t" + QString(txt_format) + "\t" + QString::number(num_precision) + "\n";
	if (notTemplate)
        t << "WindowLabel\t" + windowLabel() + "\t" + QString::number(captionPolicy()) + "\n";
	t << "Coordinates\t" + QString::number(x_start,'g',15) + "\t" +QString::number(x_end,'g',15) + "\t";
	t << QString::number(y_start,'g',15) + "\t" + QString::number(y_end,'g',15) + "\n";
	t << "ViewType\t" + QString::number((int)d_view_type) + "\n";
    t << "HeaderViewType\t" + QString::number((int)d_header_view_type) + "\n";

	if (d_color_map_type != Custom)
		t << "ColorPolicy\t" + QString::number(d_color_map_type) + "\n";
	else {
		t << "<ColorMap>\n";
		t << "\t<Mode>" + QString::number(d_color_map.mode()) + "</Mode>\n";
		t << "\t<MinColor>" + d_color_map.color1().name() + "</MinColor>\n";
		t << "\t<MaxColor>" + d_color_map.color2().name() + "</MaxColor>\n";
		QwtArray <double> colors = d_color_map.colorStops();
		int stops = (int)colors.size();
		t << "\t<ColorStops>" + QString::number(stops - 2) + "</ColorStops>\n";
		for (int i = 1; i < stops - 1; i++){
			t << "\t<Stop>" + QString::number(colors[i]) + "\t";
			t << QColor(d_color_map.rgb(QwtDoubleInterval(0,1), colors[i])).name();
			t << "</Stop>\n";
		}
		t << "</ColorMap>\n";
	}

    if (notTemplate)
        t << d_matrix_model->saveToString();
    t <<"</matrix>\n";
}
예제 #4
0
void Note::save(const QString &fn, const QString &info, bool)
{
	QFile f(fn);
	if (!f.isOpen()){
		if (!f.open(QIODevice::Append))
			return;
	}	
	QTextStream t( &f );
	t.setEncoding(QTextStream::UnicodeUTF8);
	t << "<note>\n";
	t << QString(name()) + "\t" + birthDate() + "\n";
	t << info;
	t << "WindowLabel\t" + windowLabel() + "\t" + QString::number(captionPolicy()) + "\n";
	t << "AutoExec\t" + QString(autoExec ? "1" : "0") + "\n";
	t << "<LineNumbers>" + QString::number(d_line_number->isVisible()) + "</LineNumbers>\n";
	t << "<content>\n" + te->text().stripWhiteSpace() + "\n</content>";
	t << "\n</note>\n";
}
예제 #5
0
QString Matrix::saveToString(const QString &info)
{
QString s= "<matrix>\n";
s+= QString(name()) + "\t";
s+= QString::number(d_table->numRows())+"\t";
s+= QString::number(d_table->numCols())+"\t";
s+= birthDate() + "\n";
s+= info;
s+= "ColWidth\t" + QString::number(d_table->columnWidth(0))+"\n";
s+= "<formula>\n" + formula_str + "\n</formula>\n";
s+= "TextFormat\t" + QString(txt_format) + "\t" + QString::number(num_precision) + "\n";
s+= "WindowLabel\t" + windowLabel() + "\t" + QString::number(captionPolicy()) + "\n";
s+= "Coordinates\t" + QString::number(x_start,'g',15) + "\t" +QString::number(x_end,'g',15) + "\t";
s+= QString::number(y_start,'g',15) + "\t" + QString::number(y_end,'g',15) + "\n";
s+= saveText();
s+="</matrix>\n";
return s;
}
예제 #6
0
QString Matrix::saveToString(const QString &info, bool saveAsTemplate)
{
    bool notTemplate = !saveAsTemplate;
	QString s = "<matrix>\n";
	if (notTemplate)
        s += QString(objectName()) + "\t";
	s += QString::number(numRows())+"\t";
	s += QString::number(numCols())+"\t";
	if (notTemplate)
        s += birthDate() + "\n";
	s += info;
	s += "ColWidth\t" + QString::number(d_column_width)+"\n";
	s += "<formula>\n" + formula_str + "\n</formula>\n";
	s += "TextFormat\t" + QString(txt_format) + "\t" + QString::number(num_precision) + "\n";
	if (notTemplate)
        s += "WindowLabel\t" + windowLabel() + "\t" + QString::number(captionPolicy()) + "\n";
	s += "Coordinates\t" + QString::number(x_start,'g',15) + "\t" +QString::number(x_end,'g',15) + "\t";
	s += QString::number(y_start,'g',15) + "\t" + QString::number(y_end,'g',15) + "\n";
	s += "ViewType\t" + QString::number((int)d_view_type) + "\n";
    s += "HeaderViewType\t" + QString::number((int)d_header_view_type) + "\n";

	if (d_color_map_type != Custom)
		s += "ColorPolicy\t" + QString::number(d_color_map_type) + "\n";
	else {
		s += "<ColorMap>\n";
		s += "\t<Mode>" + QString::number(d_color_map.mode()) + "</Mode>\n";
		s += "\t<MinColor>" + d_color_map.color1().name() + "</MinColor>\n";
		s += "\t<MaxColor>" + d_color_map.color2().name() + "</MaxColor>\n";
		QwtArray <double> colors = d_color_map.colorStops();
		int stops = (int)colors.size();
		s += "\t<ColorStops>" + QString::number(stops - 2) + "</ColorStops>\n";
		for (int i = 1; i < stops - 1; i++){
			s += "\t<Stop>" + QString::number(colors[i]) + "\t";
			s += QColor(d_color_map.rgb(QwtDoubleInterval(0,1), colors[i])).name();
			s += "</Stop>\n";
		}
		s += "</ColorMap>\n";
	}

    if (notTemplate)
        s += d_matrix_model->saveToString();
    s +="</matrix>\n";
	return s;
}
QString TableStatistics::saveToString(const QString &geometry)
{
  QString s = "<TableStatistics>\n";
  s += QString(name())+"\t";
  s += QString(d_base->name())+"\t";
  s += QString(d_type == row ? "row" : "col") + "\t";
  s += birthDate()+"\n";
  s += "Targets";
  for (QValueList<int>::iterator i=d_targets.begin(); i!=d_targets.end(); ++i)
    s += "\t" + QString::number(*i);
  s += "\n";
  s += geometry;
  s += saveHeader();
  s += saveColumnWidths();
  s += saveCommandes();
  s += saveColumnTypes();
  s += saveComments();
  s += "WindowLabel\t" + windowLabel() + "\t" + QString::number(captionPolicy()) + "\n";
  return s + "</TableStatistics>\n";
}
예제 #8
0
void Matrix::save(const QString &fn, const QString &info, bool saveAsTemplate)
{
	QFile f(fn);
	if (!f.isOpen()){
		if (!f.open(QIODevice::Append))
			return;
	}
	bool notTemplate = !saveAsTemplate;

	QTextStream t( &f );
	t.setEncoding(QTextStream::UnicodeUTF8);
	t << "<matrix>\n";
	if (notTemplate)
        t << QString(objectName()) + "\t";
	t << QString::number(numRows())+"\t";
	t << QString::number(numCols())+"\t";
	if (notTemplate)
        t << birthDate() + "\n";
	t << info;
	t << "ColWidth\t" + QString::number(d_column_width)+"\n";
	t << "<formula>\n" + formula_str + "\n</formula>\n";
	t << "TextFormat\t" + QString(txt_format) + "\t" + QString::number(num_precision) + "\n";
	if (notTemplate)
        t << "WindowLabel\t" + windowLabel() + "\t" + QString::number(captionPolicy()) + "\n";
	t << "Coordinates\t" + QString::number(x_start,'g',15) + "\t" +QString::number(x_end,'g',15) + "\t";
	t << QString::number(y_start,'g',15) + "\t" + QString::number(y_end,'g',15) + "\n";
	t << "ViewType\t" + QString::number((int)d_view_type) + "\n";
    t << "HeaderViewType\t" + QString::number((int)d_header_view_type) + "\n";

	if (d_color_map_type != Custom)
		t << "ColorPolicy\t" + QString::number(d_color_map_type) + "\n";
	else
		t << ColorMapEditor::saveToXmlString(d_color_map);

    if (notTemplate){//save data
		t << "<data>\n";
		double* d_data = d_matrix_model->dataVector();
		int d_rows = numRows();
		int d_cols = numCols();
		int cols = d_cols - 1;

		for(int i = 0; i < d_rows; i++){
			int aux = d_cols*i;
			bool emptyRow = true;
			for(int j = 0; j < d_cols; j++){
				if (gsl_finite(d_data[aux + j])){
					emptyRow = false;
					break;
				}
			}
			if (emptyRow)
				continue;

			t << QString::number(i) + "\t";

			for(int j = 0; j < cols; j++){
				double val = d_data[aux + j];
				if (gsl_finite(val))
					t << QString::number(val, 'e', 16);
				t << "\t";
			}
			double val = d_data[aux + cols];
			if (gsl_finite(val))
				t << QString::number(val, 'e', 16);
			t << "\n";
		}
		t << "</data>\n";
    }
    t << "</matrix>\n";
}