| 1 |
diff --git a/src/ImportOPJ.cc b/src/ImportOPJ.cc
|
| 2 |
index 2b625d4..c49752f 100644
|
| 3 |
--- a/src/ImportOPJ.cc
|
| 4 |
+++ b/src/ImportOPJ.cc
|
| 5 |
@@ -12,6 +12,44 @@
|
| 6 |
|
| 7 |
#include <liborigin/OPJFile.h>
|
| 8 |
|
| 9 |
+// The declaration of liborigin's OPJFile::colType() changed from
|
| 10 |
+// const char *OPJFile::colType(int, int) const;
|
| 11 |
+// in version 20071119 to
|
| 12 |
+// ColumnType OPJFile::colType(int, int) const;
|
| 13 |
+// in version 20080225. This function can be used to get the string
|
| 14 |
+// that colType() returned in liborigin/20071119 from the ColumnType
|
| 15 |
+// that colType() returns in liborigin/20080225. The use of this
|
| 16 |
+// function requires a build-dependency on liborigin (>= 20080225).
|
| 17 |
+QString colTypeToString(const ColumnType type) {
|
| 18 |
+ QString type_str = "";
|
| 19 |
+
|
| 20 |
+ switch (type) {
|
| 21 |
+ case X:
|
| 22 |
+ type_str = "X";
|
| 23 |
+ break;
|
| 24 |
+ case Y:
|
| 25 |
+ type_str = "Y";
|
| 26 |
+ break;
|
| 27 |
+ case Z:
|
| 28 |
+ type_str = "Z";
|
| 29 |
+ break;
|
| 30 |
+ case XErr:
|
| 31 |
+ type_str = "DX";
|
| 32 |
+ break;
|
| 33 |
+ case YErr:
|
| 34 |
+ type_str = "DY";
|
| 35 |
+ break;
|
| 36 |
+ case Label:
|
| 37 |
+ type_str = "LABEL";
|
| 38 |
+ break;
|
| 39 |
+ case NONE:
|
| 40 |
+ type_str = "NONE";
|
| 41 |
+ break;
|
| 42 |
+ }
|
| 43 |
+
|
| 44 |
+ return type_str;
|
| 45 |
+}
|
| 46 |
+
|
| 47 |
ImportOPJ::ImportOPJ(MainWin *mw, QString filename)
|
| 48 |
: mw(mw),filename(filename)
|
| 49 |
{}
|
| 50 |
@@ -44,13 +82,13 @@ int ImportOPJ::import() {
|
| 51 |
for (int j=0;j<nr_cols;j++) {
|
| 52 |
QString name(opj.colName(s,j));
|
| 53 |
spread->setColumnTitle(j,name.replace(QRegExp(".*_"),""));
|
| 54 |
- spread->setColumnType(j,opj.colType(s,j));
|
| 55 |
+ spread->setColumnType(j,colTypeToString(opj.colType(s,j)));
|
| 56 |
|
| 57 |
for (int i=0;i<opj.numRows(s,j);i++) {
|
| 58 |
double *v = (double *) opj.oData(s,j,i,true);
|
| 59 |
|
| 60 |
LTableItem *item;
|
| 61 |
- if(strcmp(opj.colType(s,j),"LABEL")) { // number
|
| 62 |
+ if(strcmp(colTypeToString(opj.colType(s,j)),"LABEL")) { // number
|
| 63 |
if(fabs(*v)>0 && fabs(*v)<2.0e-300) // empty entry
|
| 64 |
continue;
|
| 65 |
item = new LTableItem( table, QTableItem::OnTyping,QString::number(*v));
|
| 66 |
@@ -62,7 +100,7 @@ int ImportOPJ::import() {
|
| 67 |
}
|
| 68 |
}
|
| 69 |
for (int s=0;s<opj.numMatrices();s++) {
|
| 70 |
- kdDebug()<<" Matrix "<<s+1<<" : "<<opj.matrixName(s)<<" (ParentFolder : "<<opj.matrixParentFolder(s)<<")"<<endl;
|
| 71 |
+ kdDebug()<<" Matrix "<<s+1<<" : "<<opj.matrixName(s)<<endl; //" (ParentFolder : "<<opj.matrixParentFolder(s)<<")"<<endl;
|
| 72 |
kdDebug()<<" Label : "<<opj.matrixLabel(s)<<" Cols/Rows : "<<opj.numMatrixCols(s)<<'/'<<opj.numMatrixRows(s)<<endl;
|
| 73 |
kdDebug()<<" Formula : "<<opj.matrixFormula(s)<<" DisplayType : "<<opj.matrixNumDisplayType(s)<<endl;
|
| 74 |
|
| 75 |
@@ -99,7 +137,7 @@ int ImportOPJ::import() {
|
| 76 |
|
| 77 |
QString notes = mw->getProject()->Notes();
|
| 78 |
for (int s=0;s<opj.numNotes();s++) {
|
| 79 |
- kdDebug()<<" Note "<<s+1<<" : "<<opj.noteName(s)<<" (ParentFolder : "<<opj.noteParentFolder(s)<<")"<<endl;
|
| 80 |
+ kdDebug()<<" Note "<<s+1<<" : "<<opj.noteName(s)<<endl; //" (ParentFolder : "<<opj.noteParentFolder(s)<<")"<<endl;
|
| 81 |
kdDebug()<<" Label : "<<opj.noteLabel(s)<<" Text : "<<opj.noteText(s)<<endl;
|
| 82 |
notes.append(QString(opj.noteLabel(s))+":\n");
|
| 83 |
notes.append(opj.noteText(s));
|
| 84 |
@@ -115,7 +153,7 @@ int ImportOPJ::import() {
|
| 85 |
}
|
| 86 |
|
| 87 |
for (int s=0;s<opj.numGraphs();s++) {
|
| 88 |
- kdDebug()<<" Graph "<<s+1<<" : "<<opj.graphName(s)<<" (ParentFolder : "<<opj.graphParentFolder(s)<<")"<<endl;
|
| 89 |
+ kdDebug()<<" Graph "<<s+1<<" : "<<opj.graphName(s)<<endl; //" (ParentFolder : "<<opj.graphParentFolder(s)<<")"<<endl;
|
| 90 |
kdDebug()<<" Label : "<<opj.graphLabel(s)<<" Layers : "<<opj.numLayers(s)<<endl;
|
| 91 |
|
| 92 |
Worksheet *work = mw->newWorksheet();
|
| 93 |
@@ -139,8 +177,10 @@ int ImportOPJ::import() {
|
| 94 |
#else
|
| 95 |
kdDebug()<<"Layer x axis : "<<opj.layerXAxisTitle(s,l).txt<<endl;
|
| 96 |
kdDebug()<<"Layer y axis : "<<opj.layerYAxisTitle(s,l).txt<<endl;
|
| 97 |
- Label *xlabel = new Label(parseOriginText(opj.layerXAxisTitle(s,l).txt));
|
| 98 |
- Label *ylabel = new Label(parseOriginText(opj.layerYAxisTitle(s,l).txt));
|
| 99 |
+
|
| 100 |
+ // The name Label is ambiguous, therefore use LPLabel here.
|
| 101 |
+ LPLabel *xlabel = new LPLabel(parseOriginText(opj.layerXAxisTitle(s,l).txt));
|
| 102 |
+ LPLabel *ylabel = new LPLabel(parseOriginText(opj.layerYAxisTitle(s,l).txt));
|
| 103 |
kdDebug()<<"Layer legend : "<<opj.layerLegend(s,l).txt<<endl;
|
| 104 |
#endif
|
| 105 |
plot->getAxis(0)->setLabel(xlabel);
|
| 106 |
@@ -342,11 +382,11 @@ int ImportOPJ::import() {
|
| 107 |
}
|
| 108 |
|
| 109 |
// axis range
|
| 110 |
- vector<double> xrange=opj.layerXRange(s,l);
|
| 111 |
- vector<double> yrange=opj.layerYRange(s,l);
|
| 112 |
+ graphLayerRange xrange=opj.layerXRange(s,l);
|
| 113 |
+ graphLayerRange yrange=opj.layerYRange(s,l);
|
| 114 |
LRange range[2];
|
| 115 |
- range[0] = LRange(xrange[0],xrange[1]);
|
| 116 |
- range[1] = LRange(yrange[0],yrange[1]);
|
| 117 |
+ range[0] = LRange(xrange.min,xrange.max);
|
| 118 |
+ range[1] = LRange(yrange.min,yrange.max);
|
| 119 |
plot->setActRanges(range);
|
| 120 |
|
| 121 |
// axis scale
|
| 122 |
diff --git a/src/Label.h b/src/Label.h
|
| 123 |
index b61c55b..5aa7097 100644
|
| 124 |
--- a/src/Label.h
|
| 125 |
+++ b/src/Label.h
|
| 126 |
@@ -66,4 +66,10 @@ private:
|
| 127 |
bool is_texlabel; // if it is a tex label
|
| 128 |
};
|
| 129 |
|
| 130 |
+// <liborigin/OPJFile.h> defines an enumerator of the type ColumnType with
|
| 131 |
+// the name Label in the global namespace. Since the class Label defined in
|
| 132 |
+// this file ("Label.h") collides with the aforementioned enumerator in
|
| 133 |
+// "ImportOPJ.cc" we define a synonym for Label here to avoid the ambiguity.
|
| 134 |
+typedef Label LPLabel;
|
| 135 |
+
|
| 136 |
#endif //LABEL_H
|