├── FORMAT ├── __init__.py ├── .gitignore ├── doc ├── html │ └── images │ │ └── origin_import.png └── Doxyfile.in ├── OriginObj.cpp ├── setup.py ├── CMakeLists.txt ├── config.h ├── config.h.in ├── README.md ├── OriginAnyParser.h ├── OriginFile.h ├── OriginParser.h ├── opj2dat.cpp ├── OriginFile.cpp ├── OriginParser.cpp ├── endianfstream.hh ├── objects.pxd ├── OriginObj.h ├── COPYING └── liborigin.pyx /FORMAT: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Saluev/python-liborigin2/HEAD/FORMAT -------------------------------------------------------------------------------- /__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from liborigin import parseOriginFile 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.a 2 | *.so 3 | *.pyc 4 | *~ 5 | liborigin.c 6 | liborigin.cpp 7 | build/* 8 | -------------------------------------------------------------------------------- /doc/html/images/origin_import.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Saluev/python-liborigin2/HEAD/doc/html/images/origin_import.png -------------------------------------------------------------------------------- /OriginObj.cpp: -------------------------------------------------------------------------------- 1 | #include "OriginObj.h" 2 | 3 | const double *Origin::getDoubleFromVariant(const variant *v) { 4 | return boost::get(v); 5 | } 6 | 7 | const string *Origin::getStringFromVariant(const variant *v) { 8 | return boost::get(v); 9 | } 10 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | import sys 2 | from distutils.core import setup 3 | from distutils.extension import Extension 4 | 5 | # we'd better have Cython installed, or it's a no-go 6 | try: 7 | from Cython.Distutils import build_ext 8 | from Cython.Build import cythonize 9 | except: 10 | print("You don't seem to have Cython installed. Please get a") 11 | print("copy from http://cython.org and install it") 12 | sys.exit(1) 13 | 14 | 15 | src = ["liborigin.pyx", 16 | "OriginObj.cpp", 17 | "OriginAnyParser.cpp", 18 | "OriginFile.cpp", 19 | "OriginParser.cpp"] 20 | surf3d_ext = Extension("liborigin", src, language='c++', extra_compile_args=["-std=c++11"]) 21 | # surf3d_ext = cythonize("liborigin.pyx", sources=src, language="c++") 22 | 23 | # finally, we can pass all this to distutils 24 | extensions = [surf3d_ext] 25 | setup( 26 | name="liborigin", 27 | ext_modules=extensions, 28 | cmdclass={'build_ext': build_ext}, 29 | ) 30 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # CMakeLists.txt for liborigin 2 | cmake_minimum_required(VERSION 2.8) 3 | 4 | # c++11 standard 5 | add_compile_options(-std=c++11) 6 | 7 | # boost library headers 8 | find_package(Boost REQUIRED) 9 | include_directories(${Boost_INCLUDE_DIRS}) 10 | 11 | # library version 12 | set(LIBORIGIN_VERSION_MAJOR 3) 13 | set(LIBORIGIN_VERSION_MINOR 0) 14 | set(LIBORIGIN_VERSION_BUGFIX 0) 15 | 16 | # compile-time configuration variables to be linked in 17 | configure_file(config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h) 18 | include_directories(${CMAKE_CURRENT_BINARY_DIR}) 19 | 20 | # source files 21 | set (sources 22 | OriginFile.cpp 23 | OriginParser.cpp 24 | OriginAnyParser.cpp 25 | ) 26 | 27 | # header files for development 28 | set (devel-headers 29 | ${CMAKE_CURRENT_BINARY_DIR}/config.h 30 | OriginObj.h 31 | OriginFile.h 32 | OriginParser.h 33 | tree.hh 34 | ) 35 | 36 | # dynamic library 37 | add_library (origin SHARED ${sources}) 38 | set_target_properties(origin PROPERTIES 39 | VERSION ${LIBORIGIN_VERSION_MAJOR}.${LIBORIGIN_VERSION_MINOR}.${LIBORIGIN_VERSION_BUGFIX} 40 | SOVERSION ${LIBORIGIN_VERSION_MAJOR} ) 41 | 42 | # static library 43 | add_library (origin-static STATIC ${sources}) 44 | set_target_properties(origin-static PROPERTIES OUTPUT_NAME "origin" POSITION_INDEPENDENT_CODE ON) 45 | 46 | # install libraries 47 | install(TARGETS origin origin-static DESTINATION lib) 48 | 49 | # install headers 50 | install(FILES ${devel-headers} DESTINATION include/liborigin) 51 | 52 | # command line util 53 | add_executable(opj2dat opj2dat.cpp) 54 | target_link_libraries (opj2dat origin-static) 55 | 56 | install(TARGETS opj2dat DESTINATION bin) 57 | 58 | # documentation 59 | install(FILES COPYING FORMAT README DESTINATION share/doc/liborigin) 60 | configure_file(doc/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile) 61 | find_package(Doxygen) 62 | if(DOXYGEN_FOUND) 63 | add_custom_target(doc ALL ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile 64 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) 65 | install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html DESTINATION share/doc/liborigin) 66 | endif(DOXYGEN_FOUND) 67 | -------------------------------------------------------------------------------- /config.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | File : config.h.in 3 | -------------------------------------------------------------------- 4 | Copyright : (C) 2010 Knut Franke 5 | Email (use @ for *) : knut.franke*gmx.de 6 | Description : compile-time configuration defines 7 | 8 | ***************************************************************************/ 9 | 10 | /*************************************************************************** 11 | * * 12 | * This program is free software; you can redistribute it and/or modify * 13 | * it under the terms of the GNU General Public License as published by * 14 | * the Free Software Foundation; either version 2 of the License, or * 15 | * (at your option) any later version. * 16 | * * 17 | * This program is distributed in the hope that it will be useful, * 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 20 | * GNU General Public License for more details. * 21 | * * 22 | * You should have received a copy of the GNU General Public License * 23 | * along with this program; if not, write to the Free Software * 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, * 25 | * Boston, MA 02110-1301 USA * 26 | * * 27 | ***************************************************************************/ 28 | 29 | #ifndef CONFIG_H 30 | #define CONFIG_H 31 | 32 | #define LIBORIGIN_VERSION_MAJOR ${LIBORIGIN_VERSION_MAJOR} 33 | #define LIBORIGIN_VERSION_MINOR ${LIBORIGIN_VERSION_MINOR} 34 | #define LIBORIGIN_VERSION_BUGFIX ${LIBORIGIN_VERSION_BUGFIX} 35 | #define LIBORIGIN_VERSION ((LIBORIGIN_VERSION_MAJOR << 24) | \ 36 | (LIBORIGIN_VERSION_MINOR << 16) | \ 37 | (LIBORIGIN_VERSION_BUGFIX << 8) ) 38 | #define LIBORIGIN_VERSION_STRING "${LIBORIGIN_VERSION_MAJOR}.${LIBORIGIN_VERSION_MINOR}.${LIBORIGIN_VERSION_BUGFIX}" 39 | 40 | #endif // ifndef CONFIG_H 41 | -------------------------------------------------------------------------------- /config.h.in: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | File : config.h.in 3 | -------------------------------------------------------------------- 4 | Copyright : (C) 2010 Knut Franke 5 | Email (use @ for *) : knut.franke*gmx.de 6 | Description : compile-time configuration defines 7 | ***************************************************************************/ 8 | 9 | /*************************************************************************** 10 | * * 11 | * This program is free software; you can redistribute it and/or modify * 12 | * it under the terms of the GNU General Public License as published by * 13 | * the Free Software Foundation; either version 2 of the License, or * 14 | * (at your option) any later version. * 15 | * * 16 | * This program is distributed in the hope that it will be useful, * 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 19 | * GNU General Public License for more details. * 20 | * * 21 | * You should have received a copy of the GNU General Public License * 22 | * along with this program; if not, write to the Free Software * 23 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, * 24 | * Boston, MA 02110-1301 USA * 25 | * * 26 | ***************************************************************************/ 27 | 28 | #ifndef CONFIG_H 29 | #define CONFIG_H 30 | 31 | #define LIBORIGIN_VERSION_MAJOR ${LIBORIGIN_VERSION_MAJOR} 32 | #define LIBORIGIN_VERSION_MINOR ${LIBORIGIN_VERSION_MINOR} 33 | #define LIBORIGIN_VERSION_BUGFIX ${LIBORIGIN_VERSION_BUGFIX} 34 | #define LIBORIGIN_VERSION ((LIBORIGIN_VERSION_MAJOR << 24) | \ 35 | (LIBORIGIN_VERSION_MINOR << 16) | \ 36 | (LIBORIGIN_VERSION_BUGFIX << 8) ) 37 | #define LIBORIGIN_VERSION_STRING "${LIBORIGIN_VERSION_MAJOR}.${LIBORIGIN_VERSION_MINOR}.${LIBORIGIN_VERSION_BUGFIX}" 38 | 39 | #endif // ifndef CONFIG_H 40 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | python-liborigin2 2 | --------------------- 3 | 4 | This code is an (almost) standalone library for reading OriginLab project files. 5 | 6 | It is based on the code at 7 | * http://sourceforge.net/projects/liborigin 8 | * http://soft.proindependent.com/liborigin2 9 | 10 | AUTHORS: Stefan Gerlach, Ion Vasilief, Alex Kargovsky, Miquel Garriga 11 | 12 | PYTHON WRAPPING: Tigran Saluev 13 | 14 | Dependencies 15 | --------------------------------------------------------------------------- 16 | To compile, liborigin (still) depends on 17 | * BOOST C++ libraries http://www.boost.org/ 18 | boost/algorithm/string.hpp, boost/variant.hpp and its dependencies. 19 | * tree.hh (included) http://tree.phi-sci.com/ 20 | * latest version of Cython http://cython.org/ 21 | * Doxygen (optional, just for documentation) https://doxygen.nl/ 22 | 23 | Note that the BOOST libraries are not needed at run time, neither are linked in the executable. 24 | For Ubuntu users both BOOST and Doxygen can be installed via package manager: 25 | 26 | sudo apt install build-essential libboost-system-dev libboost-thread-dev libboost-program-options-dev libboost-test-dev doxygen 27 | 28 | Compiling 29 | --------------------------------------------------------------------------- 30 | liborigin uses CMake for the building process. 31 | CMake is available at http://www.cmake.org/ . 32 | 33 | After installing CMake and the BOOST C++ library headers on your system, issue the following commands 34 | to build .a liborigin2 library: 35 | 36 | $ mkdir build 37 | $ cd build 38 | $ cmake ../ 39 | $ make 40 | $ doxygen Doxyfile 41 | $ cd .. 42 | 43 | (You'll surely need Doxygen installed to build documentation.) 44 | 45 | To build Python module, just type 46 | 47 | $ python setup.py build_ext --inplace 48 | 49 | Python Usage 50 | --------------------------------------------------------------------------- 51 | 52 | In your script, import the path to the `liborigin.pyx` package using your favorite method (see https://fortierq.github.io/python-import/). 53 | 54 | To import the content of an Origin project `.opj`, simply type: 55 | 56 | ```python 57 | import liborigin 58 | file_contents = liborigin.parseOriginFile("my_awesome_project.opj") 59 | ``` 60 | 61 | (Rename the directory with liborigin.so to liborigin first.) 62 | 63 | Features 64 | --------------------------------------------------------------------------- 65 | * supports the import of 3.5 to latest (2017) projects. 66 | 67 | --------------------------------------------------------------------------- 68 | -------------------------------------------------------------------------------- /OriginAnyParser.h: -------------------------------------------------------------------------------- 1 | /* 2 | * OriginAnyParser.h 3 | * 4 | * Copyright 2017 Miquel Garriga 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | * 19 | * Parser for all versions. Based mainly on Origin750Parser.h 20 | */ 21 | #ifndef ORIGIN_ANY_PARSER_H 22 | #define ORIGIN_ANY_PARSER_H 23 | 24 | #include "OriginParser.h" 25 | #include "endianfstream.hh" 26 | #include 27 | #include // for floor() 28 | 29 | using namespace std; 30 | using namespace Origin; 31 | 32 | class OriginAnyParser : public OriginParser 33 | { 34 | public: 35 | OriginAnyParser(const string& fileName); 36 | bool parse(ProgressCallback callback = NULL, void *user_data = NULL); 37 | 38 | protected: 39 | unsigned int readObjectSize(); 40 | string readObjectAsString(unsigned int); 41 | void readFileVersion(); 42 | void readGlobalHeader(); 43 | bool readDataSetElement(); 44 | bool readWindowElement(); 45 | bool readLayerElement(); 46 | unsigned int readAnnotationList(); 47 | bool readAnnotationElement(); 48 | bool readCurveElement(); 49 | bool readAxisBreakElement(); 50 | bool readAxisParameterElement(unsigned int); 51 | bool readParameterElement(); 52 | bool readNoteElement(); 53 | void readProjectTree(); 54 | unsigned int readFolderTree(tree::iterator, unsigned int); 55 | void readProjectLeaf(tree::iterator); 56 | void readAttachmentList(); 57 | bool getColumnInfoAndData(string, unsigned int, string, unsigned int); 58 | void getMatrixValues(string, unsigned int, short, char, char, int); 59 | void getWindowProperties(Origin::Window&, string, unsigned int); 60 | void getLayerProperties(string, unsigned int); 61 | Origin::Color getColor(string); 62 | void getAnnotationProperties(string, unsigned int, string, unsigned int, string, unsigned int, string, unsigned int); 63 | void getCurveProperties(string, unsigned int, string, unsigned int); 64 | void getAxisBreakProperties(string, unsigned int); 65 | void getAxisParameterProperties(string, unsigned int, int); 66 | void getNoteProperties(string, unsigned int, string, unsigned int, string, unsigned int); 67 | void getColorMap(ColorMap&, string, unsigned int); 68 | void getZcolorsMap(ColorMap&, string, unsigned int); 69 | void getProjectLeafProperties(tree::iterator, string, unsigned int); 70 | void getProjectFolderProperties(tree::iterator, string, unsigned int); 71 | void outputProjectTree(); 72 | 73 | inline time_t doubleToPosixTime(double jdt) 74 | { 75 | /* 2440587.5 is julian date for the unixtime epoch */ 76 | return (time_t) floor((jdt - 2440587) * 86400. + 0.5); 77 | } 78 | 79 | iendianfstream file; 80 | FILE *logfile; 81 | 82 | unsigned int d_file_size, objectIndex; 83 | int ispread, imatrix, iexcel, igraph; 84 | int ilayer; 85 | }; 86 | 87 | #endif // ORIGIN_ANY_PARSER_H 88 | -------------------------------------------------------------------------------- /OriginFile.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | File : OriginFile.h 3 | -------------------------------------------------------------------- 4 | Copyright : (C) 2005-2007 Stefan Gerlach 5 | (C) 2007-2008 Alex Kargovsky, Ion Vasilief 6 | Email (use @ for *) : kargovsky*yumr.phys.msu.su, ion_vasilief*yahoo.fr 7 | Description : Origin file import class 8 | 9 | ***************************************************************************/ 10 | 11 | /*************************************************************************** 12 | * * 13 | * This program is free software; you can redistribute it and/or modify * 14 | * it under the terms of the GNU General Public License as published by * 15 | * the Free Software Foundation; either version 2 of the License, or * 16 | * (at your option) any later version. * 17 | * * 18 | * This program is distributed in the hope that it will be useful, * 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 21 | * GNU General Public License for more details. * 22 | * * 23 | * You should have received a copy of the GNU General Public License * 24 | * along with this program; if not, write to the Free Software * 25 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, * 26 | * Boston, MA 02110-1301 USA * 27 | * * 28 | ***************************************************************************/ 29 | 30 | #ifndef ORIGIN_FILE_H 31 | #define ORIGIN_FILE_H 32 | 33 | #include "config.h" 34 | #include "OriginObj.h" 35 | #include "OriginParser.h" 36 | #include 37 | 38 | using namespace std; 39 | 40 | class OriginFile 41 | { 42 | public: 43 | OriginFile(const string& fileName); 44 | 45 | bool parse(ProgressCallback callback = NULL, void *user_data = NULL); //!< parse Origin file 46 | double version() const; //!< get version of Origin file 47 | 48 | vector::size_type spreadCount() const; //!< get number of spreadsheets 49 | Origin::SpreadSheet& spread(vector::size_type s) const; //!< get spreadsheet s 50 | 51 | vector::size_type matrixCount() const; //!< get number of matrices 52 | Origin::Matrix& matrix(vector::size_type m) const; //!< get matrix m 53 | 54 | vector::size_type functionCount() const; //!< get number of functions 55 | vector::size_type functionIndex(const string& name) const; //!< get name of function s 56 | Origin::Function& function(vector::size_type f) const; //!< get function f 57 | 58 | vector::size_type graphCount() const; //!< get number of graphs 59 | Origin::Graph& graph(vector::size_type g) const; //!< get graph g 60 | 61 | vector::size_type noteCount() const; //!< get number of notes 62 | Origin::Note& note(vector::size_type n) const; //!< get note n 63 | 64 | const tree* project() const; //!< get project tree 65 | string resultsLogString() const; //!< get Results Log 66 | 67 | private: 68 | unsigned int fileVersion, buildVersion; 69 | unique_ptr parser; 70 | }; 71 | 72 | #endif // ORIGIN_FILE_H 73 | -------------------------------------------------------------------------------- /OriginParser.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | File : OriginParser.h 3 | -------------------------------------------------------------------- 4 | Copyright : (C) 2008 Alex Kargovsky 5 | Email (use @ for *) : kargovsky*yumr.phys.msu.su 6 | Description : Origin file parser base class 7 | 8 | ***************************************************************************/ 9 | 10 | /*************************************************************************** 11 | * * 12 | * This program is free software; you can redistribute it and/or modify * 13 | * it under the terms of the GNU General Public License as published by * 14 | * the Free Software Foundation; either version 2 of the License, or * 15 | * (at your option) any later version. * 16 | * * 17 | * This program is distributed in the hope that it will be useful, * 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 20 | * GNU General Public License for more details. * 21 | * * 22 | * You should have received a copy of the GNU General Public License * 23 | * along with this program; if not, write to the Free Software * 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, * 25 | * Boston, MA 02110-1301 USA * 26 | * * 27 | ***************************************************************************/ 28 | 29 | #ifndef ORIGIN_PARSER_H 30 | #define ORIGIN_PARSER_H 31 | 32 | #include "OriginObj.h" 33 | #include "tree.hh" 34 | 35 | #ifndef NO_CODE_GENERATION_FOR_LOG 36 | #define LOG_PRINT( logfile, args... ) \ 37 | { \ 38 | /*int ioret=*/ fprintf(logfile, args); \ 39 | /*assert(ioret>0);*/ \ 40 | } 41 | #else // !NO_CODE_GENERATION_FOR_LOG 42 | #define LOG_PRINT( logfile, args... ) {}; 43 | #endif // NO_CODE_GENERATION_FOR_LOG 44 | 45 | class OriginParser 46 | { 47 | public: 48 | virtual ~OriginParser() {}; 49 | virtual bool parse(ProgressCallback = NULL, void* = NULL) = 0; 50 | 51 | vector::difference_type findSpreadByName(const string& name) const; 52 | vector::difference_type findMatrixByName(const string& name) const; 53 | vector::difference_type findFunctionByName(const string& name) const; 54 | vector::difference_type findExcelByName(const string& name) const; 55 | 56 | protected: 57 | vector::difference_type findSpreadColumnByName(vector::size_type spread, const string& name) const; 58 | vector::difference_type findExcelColumnByName(vector::size_type excel, vector::size_type sheet, const string& name) const; 59 | pair findDataByIndex(unsigned int index) const; 60 | pair findObjectByIndex(unsigned int index) const; 61 | void convertSpreadToExcel(vector::size_type spread); 62 | 63 | int findColumnByName(int spread, const string& name); 64 | 65 | public: 66 | vector speadSheets; 67 | vector matrixes; 68 | vector excels; 69 | vector functions; 70 | vector graphs; 71 | vector notes; 72 | tree projectTree; 73 | string resultsLog; 74 | unsigned int windowsCount; 75 | unsigned int fileVersion, buildVersion; 76 | }; 77 | 78 | OriginParser* createOriginAnyParser(const string& fileName); 79 | 80 | #endif // ORIGIN_PARSER_H 81 | -------------------------------------------------------------------------------- /opj2dat.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | File : opj2dat.cpp 3 | -------------------------------------------------------------------- 4 | Copyright : (C) 2008 Stefan Gerlach 5 | (C) 2017 Miquel Garriga 6 | Email (use @ for *) : stefan.gerlach*uni-konstanz.de 7 | Description : Origin project converter 8 | 9 | ***************************************************************************/ 10 | 11 | /*************************************************************************** 12 | * * 13 | * This program is free software; you can redistribute it and/or modify * 14 | * it under the terms of the GNU General Public License as published by * 15 | * the Free Software Foundation; either version 3 of the License, or * 16 | * (at your option) any later version. * 17 | * * 18 | * This program is distributed in the hope that it will be useful, * 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 21 | * GNU General Public License for more details. * 22 | * * 23 | * You should have received a copy of the GNU General Public License * 24 | * along with this program; if not, write to the Free Software * 25 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, * 26 | * Boston, MA 02110-1301 USA * 27 | * * 28 | ***************************************************************************/ 29 | 30 | #include "OriginFile.h" 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | using namespace std; 37 | 38 | 39 | int main(int argc, char *argv[]) { 40 | if (argc < 2) { 41 | cout << "Usage : ./opj2dat [--check-only] " << endl; 42 | return -1; 43 | } 44 | 45 | cout << "opj2dat " << LIBORIGIN_VERSION_STRING << ", Copyright (C) 2008 Stefan Gerlach, 2017 Miquel Garriga" << endl; 46 | 47 | if (string(argv[1]) == "-v") 48 | return 0; 49 | 50 | bool write_spreads = true; 51 | if ((argc > 2) && (string(argv[1]) == "--check-only")) write_spreads = false; 52 | 53 | string inputfile=argv[argc-1]; 54 | OriginFile opj(inputfile); 55 | int status = opj.parse(); 56 | cout << "Parsing status = " << status << endl; 57 | cout << "OPJ PROJECT \"" << inputfile.c_str() << "\" VERSION = " << opj.version() << endl; 58 | 59 | cout << "number of spreadsheets = " << opj.spreadCount() << endl; 60 | cout << "number of matrixes = " << opj.matrixCount() << endl; 61 | cout << "number of functions = " << opj.functionCount() << endl; 62 | cout << "number of graphs = " << opj.graphCount() << endl; 63 | cout << "number of notes = " << opj.noteCount() << endl; 64 | 65 | for (unsigned int s=0;s(value); 103 | if (v != _ONAN) { 104 | outf << v << "; "; 105 | } else { 106 | outf << nan("NaN") << "; "; 107 | } 108 | } 109 | if (value.type() == typeid(string)) { 110 | outf << boost::get(value).c_str() << "; "; 111 | } 112 | } else { 113 | outf << "; "; 114 | } 115 | } 116 | outf << endl; 117 | } 118 | outf.close(); 119 | } 120 | } 121 | return 0; 122 | } 123 | 124 | -------------------------------------------------------------------------------- /OriginFile.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | File : OriginFile.cpp 3 | -------------------------------------------------------------------- 4 | Copyright : (C) 2005-2008 Stefan Gerlach 5 | (C) 2007-2008 Alex Kargovsky, Ion Vasilief 6 | Email (use @ for *) : kargovsky*yumr.phys.msu.su, ion_vasilief*yahoo.fr 7 | Description : Origin file import class 8 | 9 | ***************************************************************************/ 10 | 11 | /*************************************************************************** 12 | * * 13 | * This program is free software; you can redistribute it and/or modify * 14 | * it under the terms of the GNU General Public License as published by * 15 | * the Free Software Foundation; either version 2 of the License, or * 16 | * (at your option) any later version. * 17 | * * 18 | * This program is distributed in the hope that it will be useful, * 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 21 | * GNU General Public License for more details. * 22 | * * 23 | * You should have received a copy of the GNU General Public License * 24 | * along with this program; if not, write to the Free Software * 25 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, * 26 | * Boston, MA 02110-1301 USA * 27 | * * 28 | ***************************************************************************/ 29 | 30 | #include "OriginFile.h" 31 | #include 32 | #include 33 | 34 | OriginFile::OriginFile(const string& fileName) 35 | : fileVersion(0) 36 | { 37 | ifstream file(fileName.c_str(), ios_base::binary); 38 | 39 | if (!file.is_open()) 40 | { 41 | cerr << "Could not open " << fileName.c_str() << "!" << endl; 42 | exit(EXIT_FAILURE); 43 | } 44 | 45 | #ifndef NO_CODE_GENERATION_FOR_LOG 46 | FILE *logfile = NULL; 47 | logfile = fopen("./opjfile.log", "w"); 48 | if (logfile == NULL) 49 | { 50 | cerr << "Could not open opjfile.log !" << endl; 51 | exit(EXIT_FAILURE); 52 | } 53 | #endif // NO_CODE_GENERATION_FOR_LOG 54 | 55 | string vers; 56 | getline(file, vers); 57 | unsigned int majorVersion = strtol(vers.substr(5,1).c_str(),0,10); 58 | char locale_decpoint = vers[6]; 59 | (void) locale_decpoint; // supress compiler warning 60 | buildVersion = strtol(vers.substr(7).c_str(),0,10); 61 | unsigned int buildNumber = strtol(vers.substr(12).c_str(),0,10); 62 | (void) buildNumber; // supress compiler warning 63 | file.close(); 64 | LOG_PRINT(logfile, "File: %s\n", fileName.c_str()) 65 | 66 | // translate version 67 | if (majorVersion==3) { 68 | if (buildVersion < 830) 69 | fileVersion = 350; 70 | else 71 | fileVersion = 410; 72 | } else if (buildVersion >= 110 && buildVersion <= 141) // 4.1 73 | fileVersion = 410; 74 | else if (buildVersion <= 210) // 5.0 75 | fileVersion = 500; 76 | else if (buildVersion <= 2623) // 6.0 77 | fileVersion = 600; 78 | else if (buildVersion <= 2627) // 6.0 SR1 79 | fileVersion = 601; 80 | else if (buildVersion <2635) // 6.0 SR4 81 | fileVersion = 604; 82 | else if (buildVersion <2656) // 6.1 83 | fileVersion = 610; 84 | else if (buildVersion <2659) // 7.0 SR0 (2656-2658) 85 | fileVersion = 700; 86 | else if (buildVersion <2664) // 7.0 SR1 (2659-2663) 87 | fileVersion = 701; 88 | else if (buildVersion <2672) // 7.0 SR2 (2664-2671) 89 | fileVersion = 702; 90 | else if (buildVersion <2673) // 7.0 SR3 (2672-2672) 91 | fileVersion = 703; 92 | else if (buildVersion <2766) // 7.0 SR4 (2673-2765) 93 | fileVersion = 704; 94 | else if (buildVersion <2878) // 7.5 (2766-2877) 95 | fileVersion = 750; 96 | else if (buildVersion <2881) // 8.0 SR0 (2878-2880) 97 | fileVersion = 800; 98 | else if (buildVersion <2892) // 8.0 SR1,SR2,SR3 (2878-2891) 99 | fileVersion = 801; 100 | else if (buildVersion <2944) // 8.0 SR4, 8.1 SR1-SR4 (2891-2943) 101 | fileVersion = 810; 102 | else { 103 | fileVersion = 850; // 8.5 SR0 and newer (2944-) 104 | LOG_PRINT(logfile, "Found project version 8.5 or newer\n") 105 | } 106 | 107 | if (fileVersion != 850) { 108 | LOG_PRINT(logfile, "Found project version %.2f\n", fileVersion/100.0) 109 | } 110 | // Close logfile, will be reopened in parser routine. 111 | // There are ways to keep logfile open and pass it to parser routine, 112 | // but I choose to do the same as with 'file', close it and reopen in 'parse' 113 | // routines. 114 | #ifndef NO_CODE_GENERATION_FOR_LOG 115 | fclose(logfile); 116 | #endif // NO_CODE_GENERATION_FOR_LOG 117 | parser.reset(createOriginAnyParser(fileName)); 118 | } 119 | 120 | bool OriginFile::parse(ProgressCallback callback, void *user_data) 121 | { 122 | parser->buildVersion = buildVersion; 123 | parser->fileVersion = fileVersion; 124 | return parser->parse(callback, user_data); 125 | } 126 | 127 | double OriginFile::version() const 128 | { 129 | return (parser->fileVersion)/100.0; 130 | } 131 | 132 | const tree* OriginFile::project() const 133 | { 134 | return &parser->projectTree; 135 | } 136 | 137 | vector::size_type OriginFile::spreadCount() const 138 | { 139 | return parser->speadSheets.size(); 140 | } 141 | 142 | Origin::SpreadSheet& OriginFile::spread(vector::size_type s) const 143 | { 144 | return parser->speadSheets[s]; 145 | } 146 | 147 | vector::size_type OriginFile::matrixCount() const 148 | { 149 | return parser->matrixes.size(); 150 | } 151 | 152 | Origin::Matrix& OriginFile::matrix(vector::size_type m) const 153 | { 154 | return parser->matrixes[m]; 155 | } 156 | 157 | vector::size_type OriginFile::functionCount() const 158 | { 159 | return parser->functions.size(); 160 | } 161 | 162 | vector::size_type OriginFile::functionIndex(const string& name) const 163 | { 164 | return parser->findFunctionByName(name); 165 | } 166 | 167 | Origin::Function& OriginFile::function(vector::size_type f) const 168 | { 169 | return parser->functions[f]; 170 | } 171 | 172 | vector::size_type OriginFile::graphCount() const 173 | { 174 | return parser->graphs.size(); 175 | } 176 | 177 | Origin::Graph& OriginFile::graph(vector::size_type g) const 178 | { 179 | return parser->graphs[g]; 180 | } 181 | 182 | vector::size_type OriginFile::noteCount() const 183 | { 184 | return parser->notes.size(); 185 | } 186 | 187 | Origin::Note& OriginFile::note(vector::size_type n) const 188 | { 189 | return parser->notes[n]; 190 | } 191 | 192 | string OriginFile::resultsLogString() const 193 | { 194 | return parser->resultsLog; 195 | } 196 | -------------------------------------------------------------------------------- /OriginParser.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | File : OriginParser.cpp 3 | -------------------------------------------------------------------- 4 | Copyright : (C) 2008 Alex Kargovsky 5 | Email (use @ for *) : kargovsky*yumr.phys.msu.su 6 | Description : Origin file parser base class 7 | 8 | ***************************************************************************/ 9 | 10 | /*************************************************************************** 11 | * * 12 | * This program is free software; you can redistribute it and/or modify * 13 | * it under the terms of the GNU General Public License as published by * 14 | * the Free Software Foundation; either version 2 of the License, or * 15 | * (at your option) any later version. * 16 | * * 17 | * This program is distributed in the hope that it will be useful, * 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 20 | * GNU General Public License for more details. * 21 | * * 22 | * You should have received a copy of the GNU General Public License * 23 | * along with this program; if not, write to the Free Software * 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, * 25 | * Boston, MA 02110-1301 USA * 26 | * * 27 | ***************************************************************************/ 28 | 29 | #include "OriginParser.h" 30 | #include 31 | #include // for iequals 32 | 33 | using namespace boost::algorithm; 34 | using namespace Origin; 35 | 36 | vector::difference_type OriginParser::findSpreadByName(const string& name) const 37 | { 38 | for (vector::const_iterator it = speadSheets.begin(); it != speadSheets.end(); ++it) 39 | { 40 | if (iequals(it->name, name, locale())) return it - speadSheets.begin(); 41 | } 42 | return -1; 43 | } 44 | 45 | vector::difference_type OriginParser::findExcelByName(const string& name) const 46 | { 47 | for (vector::const_iterator it = excels.begin(); it != excels.end(); ++it) 48 | { 49 | if (iequals(it->name, name, locale())) return it - excels.begin(); 50 | } 51 | return -1; 52 | } 53 | 54 | vector::difference_type OriginParser::findSpreadColumnByName(vector::size_type spread, const string& name) const 55 | { 56 | for (vector::const_iterator it = speadSheets[spread].columns.begin(); it != speadSheets[spread].columns.end(); ++it) 57 | { 58 | if (it->name == name) return it - speadSheets[spread].columns.begin(); 59 | } 60 | return -1; 61 | } 62 | 63 | vector::difference_type OriginParser::findExcelColumnByName(vector::size_type excel, vector::size_type sheet, const string& name) const 64 | { 65 | for (vector::const_iterator it = excels[excel].sheets[sheet].columns.begin(); it != excels[excel].sheets[sheet].columns.end(); ++it) 66 | { 67 | if (it->name == name) return it - excels[excel].sheets[sheet].columns.begin(); 68 | } 69 | return -1; 70 | } 71 | 72 | vector::difference_type OriginParser::findMatrixByName(const string& name) const 73 | { 74 | for (vector::const_iterator it = matrixes.begin(); it != matrixes.end(); ++it) 75 | { 76 | if (iequals(it->name, name, locale())) return it - matrixes.begin(); 77 | } 78 | return -1; 79 | } 80 | 81 | vector::difference_type OriginParser::findFunctionByName(const string& name) const 82 | { 83 | for (vector::const_iterator it = functions.begin(); it != functions.end(); ++it) 84 | { 85 | if (iequals(it->name, name, locale())) return it - functions.begin(); 86 | } 87 | return -1; 88 | } 89 | 90 | pair OriginParser::findDataByIndex(unsigned int index) const 91 | { 92 | for(vector::const_iterator it = speadSheets.begin(); it != speadSheets.end(); ++it) 93 | { 94 | for(vector::const_iterator it1 = it->columns.begin(); it1 != it->columns.end(); ++it1) 95 | { 96 | if(it1->index == index) 97 | return make_pair("T_" + it->name, it1->name); 98 | } 99 | } 100 | 101 | for(vector::const_iterator it = matrixes.begin(); it != matrixes.end(); ++it) 102 | { 103 | for(vector::const_iterator it1 = it->sheets.begin(); it1 != it->sheets.end(); ++it1) 104 | { 105 | if(it1->index == index) 106 | return make_pair("M_" + it->name, it1->name); 107 | } 108 | 109 | } 110 | 111 | 112 | for(vector::const_iterator it = excels.begin(); it != excels.end(); ++it) 113 | { 114 | for(vector::const_iterator it1 = it->sheets.begin(); it1 != it->sheets.end(); ++it1) 115 | { 116 | for(vector::const_iterator it2 = it1->columns.begin(); it2 != it1->columns.end(); ++it2) 117 | { 118 | if(it2->index == index) 119 | return make_pair("E_" + it->name, it2->name); 120 | } 121 | } 122 | } 123 | 124 | for(vector::const_iterator it = functions.begin(); it != functions.end(); ++it) 125 | { 126 | if(it->index == index) 127 | return make_pair("F_" + it->name, it->name); 128 | } 129 | 130 | return pair(); 131 | } 132 | 133 | pair OriginParser::findObjectByIndex(unsigned int index) const 134 | { 135 | for(vector::const_iterator it = speadSheets.begin(); it != speadSheets.end(); ++it) 136 | { 137 | if(it->objectID == (int)index) 138 | return make_pair(ProjectNode::SpreadSheet, it->name); 139 | } 140 | 141 | for(vector::const_iterator it = matrixes.begin(); it != matrixes.end(); ++it) 142 | { 143 | if(it->objectID == (int)index) 144 | return make_pair(ProjectNode::Matrix, it->name); 145 | } 146 | 147 | for(vector::const_iterator it = excels.begin(); it != excels.end(); ++it) 148 | { 149 | if(it->objectID == (int)index) 150 | return make_pair(ProjectNode::Excel, it->name); 151 | } 152 | 153 | for(vector::const_iterator it = graphs.begin(); it != graphs.end(); ++it) 154 | { 155 | if(it->objectID == (int)index){ 156 | if (it->is3D) 157 | return make_pair(ProjectNode::Graph3D, it->name); 158 | else 159 | return make_pair(ProjectNode::Graph, it->name); 160 | } 161 | } 162 | 163 | return pair(); 164 | } 165 | 166 | void OriginParser::convertSpreadToExcel(vector::size_type spread) 167 | { 168 | //add new Excel sheet 169 | excels.push_back(Excel(speadSheets[spread].name, speadSheets[spread].label, speadSheets[spread].maxRows, speadSheets[spread].hidden, speadSheets[spread].loose)); 170 | 171 | for(vector::iterator it = speadSheets[spread].columns.begin(); it != speadSheets[spread].columns.end(); ++it) 172 | { 173 | unsigned int index = 0; 174 | int pos = it->name.find_last_of("@"); 175 | if(pos != -1) 176 | { 177 | index = strtol(it->name.substr(pos + 1).c_str(), 0, 10) - 1; 178 | it->name = it->name.substr(0, pos); 179 | } 180 | 181 | if(excels.back().sheets.size() <= index) 182 | excels.back().sheets.resize(index + 1); 183 | 184 | excels.back().sheets[index].columns.push_back(*it); 185 | } 186 | 187 | speadSheets.erase(speadSheets.begin() + spread); 188 | } 189 | 190 | int OriginParser::findColumnByName(int spread, const string& name) 191 | { 192 | unsigned int columns = speadSheets[spread].columns.size(); 193 | for (unsigned int i = 0; i < columns; i++){ 194 | string colName = speadSheets[spread].columns[i].name; 195 | if (colName.size() >= 11) 196 | colName.resize(11); 197 | 198 | if (name == colName) 199 | return i; 200 | } 201 | return -1; 202 | } 203 | -------------------------------------------------------------------------------- /endianfstream.hh: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | File : endianfstream.hh 3 | -------------------------------------------------------------------- 4 | Copyright : (C) 2008 Alex Kargovsky 5 | Email (use @ for *) : kargovsky*yumr.phys.msu.su 6 | Description : Endianless file stream class 7 | 8 | ***************************************************************************/ 9 | 10 | /*************************************************************************** 11 | * * 12 | * This program is free software; you can redistribute it and/or modify * 13 | * it under the terms of the GNU General Public License as published by * 14 | * the Free Software Foundation; either version 2 of the License, or * 15 | * (at your option) any later version. * 16 | * * 17 | * This program is distributed in the hope that it will be useful, * 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 20 | * GNU General Public License for more details. * 21 | * * 22 | * You should have received a copy of the GNU General Public License * 23 | * along with this program; if not, write to the Free Software * 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, * 25 | * Boston, MA 02110-1301 USA * 26 | * * 27 | ***************************************************************************/ 28 | 29 | #ifndef ENDIAN_FSTREAM_H 30 | #define ENDIAN_FSTREAM_H 31 | 32 | #include 33 | #include "OriginObj.h" 34 | 35 | namespace std 36 | { 37 | class iendianfstream : public ifstream 38 | { 39 | 40 | public: 41 | 42 | ProgressCallback callback; 43 | void *callback_user_data; 44 | 45 | iendianfstream(const char *_Filename, ios_base::openmode _Mode = ios_base::in) 46 | : ifstream(_Filename, _Mode), callback(NULL), callback_user_data(NULL) 47 | { 48 | short word = 0x4321; 49 | bigEndian = (*(char*)& word) != 0x21; 50 | 51 | // get file size 52 | ifstream tmp(_Filename, ios::binary | ios::ate); 53 | size = tmp.tellg(); 54 | tmp.close(); 55 | 56 | lastProgress = 0; 57 | }; 58 | 59 | iendianfstream& operator>>(bool& value) 60 | { 61 | char c; 62 | get(c); 63 | value = (c != 0); 64 | tell(); 65 | return *this; 66 | } 67 | 68 | iendianfstream& operator>>(char& value) 69 | { 70 | get(value); 71 | tell(); 72 | return *this; 73 | } 74 | 75 | iendianfstream& operator>>(unsigned char& value) 76 | { 77 | get(reinterpret_cast(value)); 78 | tell(); 79 | return *this; 80 | } 81 | 82 | iendianfstream& operator>>(short& value) 83 | { 84 | read(reinterpret_cast(&value), sizeof(value)); 85 | if(bigEndian) 86 | swap_bytes(reinterpret_cast(&value), sizeof(value)); 87 | 88 | tell(); 89 | return *this; 90 | } 91 | 92 | iendianfstream& operator>>(unsigned short& value) 93 | { 94 | read(reinterpret_cast(&value), sizeof(value)); 95 | if(bigEndian) 96 | swap_bytes(reinterpret_cast(&value), sizeof(value)); 97 | 98 | tell(); 99 | return *this; 100 | } 101 | 102 | iendianfstream& operator>>(int& value) 103 | { 104 | read(reinterpret_cast(&value), sizeof(value)); 105 | if(bigEndian) 106 | swap_bytes(reinterpret_cast(&value), sizeof(value)); 107 | 108 | tell(); 109 | return *this; 110 | } 111 | 112 | iendianfstream& operator>>(unsigned int& value) 113 | { 114 | read(reinterpret_cast(&value), sizeof(value)); 115 | if(bigEndian) 116 | swap_bytes(reinterpret_cast(&value), sizeof(value)); 117 | 118 | tell(); 119 | return *this; 120 | } 121 | 122 | iendianfstream& operator>>(long& value) 123 | { 124 | read(reinterpret_cast(&value), sizeof(value)); 125 | if(bigEndian) 126 | swap_bytes(reinterpret_cast(&value), sizeof(value)); 127 | 128 | tell(); 129 | return *this; 130 | } 131 | 132 | iendianfstream& operator>>(unsigned long& value) 133 | { 134 | read(reinterpret_cast(&value), sizeof(value)); 135 | if(bigEndian) 136 | swap_bytes(reinterpret_cast(&value), sizeof(value)); 137 | 138 | tell(); 139 | return *this; 140 | } 141 | 142 | iendianfstream& operator>>(float& value) 143 | { 144 | read(reinterpret_cast(&value), sizeof(value)); 145 | if(bigEndian) 146 | swap_bytes(reinterpret_cast(&value), sizeof(value)); 147 | 148 | tell(); 149 | return *this; 150 | } 151 | 152 | iendianfstream& operator>>(double& value) 153 | { 154 | read(reinterpret_cast(&value), sizeof(value)); 155 | if(bigEndian) 156 | swap_bytes(reinterpret_cast(&value), sizeof(value)); 157 | 158 | tell(); 159 | return *this; 160 | } 161 | 162 | iendianfstream& operator>>(long double& value) 163 | { 164 | read(reinterpret_cast(&value), sizeof(value)); 165 | if(bigEndian) 166 | swap_bytes(reinterpret_cast(&value), sizeof(value)); 167 | 168 | tell(); 169 | return *this; 170 | } 171 | 172 | iendianfstream& operator>>(string& value) 173 | { 174 | read(reinterpret_cast(&value[0]), value.size()); 175 | string::size_type pos = value.find_first_of('\0'); 176 | if(pos != string::npos) 177 | value.resize(pos); 178 | 179 | tell(); 180 | return *this; 181 | } 182 | 183 | iendianfstream& operator>>(Origin::Color& value) 184 | { 185 | unsigned char color[4]; 186 | read(reinterpret_cast(&color), sizeof(color)); 187 | switch(color[3]) 188 | { 189 | case 0: 190 | if(color[0] < 0x64) 191 | { 192 | value.type = Origin::Color::Regular; 193 | value.regular = color[0]; 194 | } 195 | else 196 | { 197 | switch(color[2]) 198 | { 199 | case 0: 200 | value.type = Origin::Color::Indexing; 201 | break; 202 | case 0x40: 203 | value.type = Origin::Color::Mapping; 204 | break; 205 | case 0x80: 206 | value.type = Origin::Color::RGB; 207 | break; 208 | } 209 | 210 | value.column = color[0] - 0x64; 211 | } 212 | 213 | break; 214 | case 1: 215 | value.type = Origin::Color::Custom; 216 | for(int i = 0; i < 3; ++i) 217 | value.custom[i] = color[i]; 218 | break; 219 | case 0x20: 220 | value.type = Origin::Color::Increment; 221 | value.starting = color[1]; 222 | break; 223 | case 0xFF: 224 | if(color[0] == 0xFC) 225 | value.type = Origin::Color::None; 226 | else if(color[0] == 0xF7) 227 | value.type = Origin::Color::Automatic; 228 | 229 | break; 230 | 231 | default: 232 | value.type = Origin::Color::Regular; 233 | value.regular = color[0]; 234 | break; 235 | 236 | } 237 | 238 | tell(); 239 | return *this; 240 | } 241 | 242 | private: 243 | bool bigEndian; 244 | long size; 245 | void swap_bytes(unsigned char* data, int size) 246 | { 247 | register int i = 0; 248 | register int j = size - 1; 249 | while(i < j) 250 | { 251 | std::swap(data[i], data[j]); 252 | ++i, --j; 253 | } 254 | } 255 | int lastProgress; 256 | inline void tell(void) 257 | { 258 | long pos = tellg(); 259 | if(callback && callback_user_data)// && pos % 10240 /*x 10KB*/ == 0) 260 | { 261 | double progress = pos / (double)size; 262 | int currProgress = 100 * progress; 263 | if(currProgress > lastProgress) 264 | { 265 | cout << "\rliborigin: " << currProgress << "% done "; 266 | cout.flush(); 267 | callback(0.9 * progress, callback_user_data); 268 | } 269 | lastProgress = currProgress; 270 | } 271 | } 272 | }; 273 | } 274 | 275 | #endif // ENDIAN_FSTREAM_H 276 | -------------------------------------------------------------------------------- /doc/Doxyfile.in: -------------------------------------------------------------------------------- 1 | #--------------------------------------------------------------------------- 2 | # Project related configuration options 3 | #--------------------------------------------------------------------------- 4 | PROJECT_NAME = liborigin 5 | PROJECT_NUMBER = ${LIBORIGIN_VERSION_MAJOR}.${LIBORIGIN_VERSION_MINOR}.${LIBORIGIN_VERSION_BUGFIX} 6 | OUTPUT_DIRECTORY = . 7 | CREATE_SUBDIRS = NO 8 | OUTPUT_LANGUAGE = English 9 | USE_WINDOWS_ENCODING = NO 10 | BRIEF_MEMBER_DESC = YES 11 | REPEAT_BRIEF = YES 12 | ABBREVIATE_BRIEF = 13 | ALWAYS_DETAILED_SEC = NO 14 | INLINE_INHERITED_MEMB = NO 15 | FULL_PATH_NAMES = YES 16 | STRIP_FROM_PATH = 17 | STRIP_FROM_INC_PATH = 18 | SHORT_NAMES = NO 19 | JAVADOC_AUTOBRIEF = NO 20 | MULTILINE_CPP_IS_BRIEF = NO 21 | DETAILS_AT_TOP = YES 22 | INHERIT_DOCS = YES 23 | DISTRIBUTE_GROUP_DOC = NO 24 | TAB_SIZE = 4 25 | ALIASES = 26 | OPTIMIZE_OUTPUT_FOR_C = NO 27 | OPTIMIZE_OUTPUT_JAVA = NO 28 | SUBGROUPING = YES 29 | #--------------------------------------------------------------------------- 30 | # Build related configuration options 31 | #--------------------------------------------------------------------------- 32 | EXTRACT_ALL = YES 33 | EXTRACT_PRIVATE = YES 34 | EXTRACT_STATIC = YES 35 | EXTRACT_LOCAL_CLASSES = YES 36 | EXTRACT_LOCAL_METHODS = NO 37 | HIDE_UNDOC_MEMBERS = NO 38 | HIDE_UNDOC_CLASSES = NO 39 | HIDE_FRIEND_COMPOUNDS = NO 40 | HIDE_IN_BODY_DOCS = NO 41 | INTERNAL_DOCS = NO 42 | CASE_SENSE_NAMES = YES 43 | HIDE_SCOPE_NAMES = NO 44 | SHOW_INCLUDE_FILES = YES 45 | INLINE_INFO = YES 46 | SORT_MEMBER_DOCS = YES 47 | SORT_BRIEF_DOCS = YES 48 | SORT_BY_SCOPE_NAME = NO 49 | GENERATE_TODOLIST = YES 50 | GENERATE_TESTLIST = YES 51 | GENERATE_BUGLIST = YES 52 | GENERATE_DEPRECATEDLIST= YES 53 | ENABLED_SECTIONS = 54 | MAX_INITIALIZER_LINES = 30 55 | SHOW_USED_FILES = YES 56 | SHOW_DIRECTORIES = YES 57 | FILE_VERSION_FILTER = 58 | #--------------------------------------------------------------------------- 59 | # configuration options related to warning and progress messages 60 | #--------------------------------------------------------------------------- 61 | QUIET = NO 62 | WARNINGS = YES 63 | WARN_IF_UNDOCUMENTED = YES 64 | WARN_IF_DOC_ERROR = YES 65 | WARN_NO_PARAMDOC = NO 66 | WARN_FORMAT = "$file:$line: $text" 67 | WARN_LOGFILE = 68 | #--------------------------------------------------------------------------- 69 | # configuration options related to the input files 70 | #--------------------------------------------------------------------------- 71 | INPUT = ${CMAKE_CURRENT_SOURCE_DIR} 72 | FILE_PATTERNS = *.c \ 73 | *.cc \ 74 | *.cxx \ 75 | *.cpp \ 76 | *.c++ \ 77 | *.dox \ 78 | *.h \ 79 | *.hh \ 80 | *.hxx \ 81 | *.hpp \ 82 | *.h++ \ 83 | *.txt \ 84 | *.CC \ 85 | *.C++ \ 86 | *.HH \ 87 | *.H++ \ 88 | *.C \ 89 | *.H 90 | RECURSIVE = yes 91 | EXCLUDE = 92 | EXCLUDE_SYMLINKS = NO 93 | EXCLUDE_PATTERNS = *moc_* 94 | EXAMPLE_PATH = .. 95 | EXAMPLE_PATTERNS = 96 | EXAMPLE_RECURSIVE = NO 97 | IMAGE_PATH = 98 | INPUT_FILTER = 99 | FILTER_PATTERNS = 100 | FILTER_SOURCE_FILES = NO 101 | #--------------------------------------------------------------------------- 102 | # configuration options related to source browsing 103 | #--------------------------------------------------------------------------- 104 | SOURCE_BROWSER = NO 105 | INLINE_SOURCES = NO 106 | STRIP_CODE_COMMENTS = YES 107 | REFERENCED_BY_RELATION = YES 108 | REFERENCES_RELATION = YES 109 | VERBATIM_HEADERS = YES 110 | #--------------------------------------------------------------------------- 111 | # configuration options related to the alphabetical class index 112 | #--------------------------------------------------------------------------- 113 | ALPHABETICAL_INDEX = YES 114 | COLS_IN_ALPHA_INDEX = 5 115 | IGNORE_PREFIX = 116 | #--------------------------------------------------------------------------- 117 | # configuration options related to the HTML output 118 | #--------------------------------------------------------------------------- 119 | GENERATE_HTML = YES 120 | HTML_OUTPUT = html 121 | HTML_FILE_EXTENSION = .html 122 | HTML_HEADER = 123 | HTML_FOOTER = 124 | HTML_STYLESHEET = 125 | HTML_ALIGN_MEMBERS = YES 126 | GENERATE_HTMLHELP = NO 127 | CHM_FILE = 128 | HHC_LOCATION = 129 | GENERATE_CHI = NO 130 | BINARY_TOC = NO 131 | TOC_EXPAND = NO 132 | DISABLE_INDEX = NO 133 | ENUM_VALUES_PER_LINE = 4 134 | GENERATE_TREEVIEW = NO 135 | TREEVIEW_WIDTH = 250 136 | #--------------------------------------------------------------------------- 137 | # configuration options related to the LaTeX output 138 | #--------------------------------------------------------------------------- 139 | GENERATE_LATEX = NO 140 | LATEX_OUTPUT = latex 141 | LATEX_CMD_NAME = latex 142 | MAKEINDEX_CMD_NAME = makeindex 143 | COMPACT_LATEX = NO 144 | PAPER_TYPE = a4wide 145 | EXTRA_PACKAGES = 146 | LATEX_HEADER = 147 | PDF_HYPERLINKS = NO 148 | USE_PDFLATEX = NO 149 | LATEX_BATCHMODE = NO 150 | LATEX_HIDE_INDICES = NO 151 | #--------------------------------------------------------------------------- 152 | # configuration options related to the RTF output 153 | #--------------------------------------------------------------------------- 154 | GENERATE_RTF = NO 155 | RTF_OUTPUT = rtf 156 | COMPACT_RTF = NO 157 | RTF_HYPERLINKS = NO 158 | RTF_STYLESHEET_FILE = 159 | RTF_EXTENSIONS_FILE = 160 | #--------------------------------------------------------------------------- 161 | # configuration options related to the man page output 162 | #--------------------------------------------------------------------------- 163 | GENERATE_MAN = NO 164 | MAN_OUTPUT = man 165 | MAN_EXTENSION = .3 166 | MAN_LINKS = NO 167 | #--------------------------------------------------------------------------- 168 | # configuration options related to the XML output 169 | #--------------------------------------------------------------------------- 170 | GENERATE_XML = NO 171 | XML_OUTPUT = xml 172 | XML_SCHEMA = 173 | XML_DTD = 174 | XML_PROGRAMLISTING = YES 175 | #--------------------------------------------------------------------------- 176 | # configuration options for the AutoGen Definitions output 177 | #--------------------------------------------------------------------------- 178 | GENERATE_AUTOGEN_DEF = NO 179 | #--------------------------------------------------------------------------- 180 | # configuration options related to the Perl module output 181 | #--------------------------------------------------------------------------- 182 | GENERATE_PERLMOD = NO 183 | PERLMOD_LATEX = NO 184 | PERLMOD_PRETTY = YES 185 | PERLMOD_MAKEVAR_PREFIX = 186 | #--------------------------------------------------------------------------- 187 | # Configuration options related to the preprocessor 188 | #--------------------------------------------------------------------------- 189 | ENABLE_PREPROCESSING = YES 190 | MACRO_EXPANSION = NO 191 | EXPAND_ONLY_PREDEF = NO 192 | SEARCH_INCLUDES = YES 193 | INCLUDE_PATH = 194 | INCLUDE_FILE_PATTERNS = 195 | PREDEFINED = 196 | EXPAND_AS_DEFINED = 197 | SKIP_FUNCTION_MACROS = YES 198 | #--------------------------------------------------------------------------- 199 | # Configuration::additions related to external references 200 | #--------------------------------------------------------------------------- 201 | TAGFILES = 202 | GENERATE_TAGFILE = 203 | ALLEXTERNALS = NO 204 | EXTERNAL_GROUPS = YES 205 | PERL_PATH = /usr/bin/perl 206 | #--------------------------------------------------------------------------- 207 | # Configuration options related to the dot tool 208 | #--------------------------------------------------------------------------- 209 | CLASS_DIAGRAMS = YES 210 | HIDE_UNDOC_RELATIONS = YES 211 | # recommendation: install graphviz and use HAVE_DOT = YES 212 | HAVE_DOT = NO 213 | CLASS_GRAPH = YES 214 | COLLABORATION_GRAPH = YES 215 | GROUP_GRAPHS = YES 216 | UML_LOOK = NO 217 | TEMPLATE_RELATIONS = NO 218 | INCLUDE_GRAPH = YES 219 | INCLUDED_BY_GRAPH = YES 220 | CALL_GRAPH = NO 221 | GRAPHICAL_HIERARCHY = YES 222 | DIRECTORY_GRAPH = YES 223 | DOT_IMAGE_FORMAT = png 224 | DOT_PATH = 225 | DOTFILE_DIRS = 226 | MAX_DOT_GRAPH_WIDTH = 1024 227 | MAX_DOT_GRAPH_HEIGHT = 1024 228 | MAX_DOT_GRAPH_DEPTH = 1000 229 | DOT_TRANSPARENT = NO 230 | DOT_MULTI_TARGETS = NO 231 | GENERATE_LEGEND = YES 232 | DOT_CLEANUP = YES 233 | #--------------------------------------------------------------------------- 234 | # Configuration::additions related to the search engine 235 | #--------------------------------------------------------------------------- 236 | SEARCHENGINE = NO 237 | -------------------------------------------------------------------------------- /objects.pxd: -------------------------------------------------------------------------------- 1 | from libcpp.pair cimport pair 2 | from libcpp.vector cimport vector 3 | from libcpp.string cimport string 4 | from libcpp cimport bool 5 | cdef extern from "": 6 | ctypedef long time_t 7 | 8 | cdef extern from "boost/variant.hpp" namespace "boost": 9 | cdef cppclass boostvariant "variant" [T1, T2]: 10 | pass 11 | 12 | cdef extern from "tree.hh": 13 | cdef cppclass tree_node "tree_node_" [T]: 14 | pass 15 | 16 | cdef cppclass tree[T]: 17 | 18 | cppclass iterator_base: 19 | T& operator*() const 20 | tree_node[T] *node 21 | unsigned int number_of_children() const 22 | iterator_base() 23 | iterator_base(tree_node[T] *) 24 | 25 | cppclass leaf_iterator(iterator_base): 26 | bool operator==(const leaf_iterator&) const 27 | bool operator!=(const leaf_iterator&) const 28 | leaf_iterator& operator++() 29 | leaf_iterator& operator--() 30 | leaf_iterator operator++(int) 31 | leaf_iterator operator--(int) 32 | leaf_iterator(tree_node[T] *node): iterator_base(node) 33 | 34 | cppclass pre_order_iterator(iterator_base): 35 | bool operator==(const pre_order_iterator&) const 36 | bool operator!=(const pre_order_iterator&) const 37 | pre_order_iterator& operator++() 38 | pre_order_iterator& operator--() 39 | pre_order_iterator operator++(int) 40 | pre_order_iterator operator--(int) 41 | 42 | inline pre_order_iterator begin() const 43 | inline pre_order_iterator end() const 44 | leaf_iterator begin_leaf() const 45 | leaf_iterator end_leaf() const 46 | int size() const 47 | 48 | 49 | #################################################################################################### 50 | ############################################ ############################################ 51 | ########################################### OriginObj.h ############################################ 52 | ########################################### ############################################# 53 | #################################################################################################### 54 | 55 | cdef enum Color_ColorType: 56 | ctNone, ctAutomatic, ctRegular, ctCustom, ctIncrement, ctIndexing, ctRGB, ctMapping 57 | cdef enum Color_RegularColor: 58 | Black = 0, Red = 1, Green = 2, Blue = 3, Cyan = 4, Magenta = 5, Yellow = 6, DarkYellow = 7, Navy = 8, 59 | Purple = 9, Wine = 10, Olive = 11, DarkCyan = 12, Royal= 13, Orange = 14, Violet = 15, Pink = 16, White = 17, 60 | LightGray = 18, Gray = 19, LTYellow = 20, LTCyan = 21, LTMagenta = 22, DarkGray = 23#, Custom = 255 61 | cdef enum Window_State: 62 | wsNormal, wsMinimized, wsMaximized 63 | cdef enum Window_Title: 64 | wtName, wtLabel, wtBoth 65 | cdef enum SpreadColumn_ColumnType: 66 | ctX, ctY, ctZ, ctXErr, ctYErr, ctLabel, ctNONE 67 | cdef enum VectorProperties_VectorPosition: 68 | vpTail, vpMidpoint, vpHead 69 | cdef enum Matrix_ViewType: 70 | vtDataView, vtImageView 71 | cdef enum Matrix_HeaderViewType: 72 | hvtColumnRow, hvtXY 73 | cdef enum Function_FunctionType: 74 | ftNormal, ftPolar 75 | cdef enum TextProperties_Justify: 76 | jLeft, jCenter, jRight 77 | cdef enum SurfaceProperties_Type: # WTF, it is not used 78 | ColorMap3D, ColorFill, WireFrame, Bars 79 | cdef enum SurfaceProperties_Grids: 80 | gNone, X, Y, XY 81 | # WTF, the following 3 enums are not used 82 | cdef enum GraphCurve_Plot: 83 | pLine "Line" = 200, Scatter=201, LineSymbol=202, Column = 203, Area = 204, HiLoClose = 205, Box = 206, 84 | ColumnFloat = 207, Vector = 208, PlotDot = 209, Wall3D = 210, Ribbon3D = 211, Bar3D = 212, ColumnStack = 213, 85 | AreaStack = 214, Bar = 215, BarStack = 216, FlowVector = 218, Histogram = 219, MatrixImage = 220, Pie = 225, 86 | Contour = 226, Unknown = 230, ErrorBar = 231, TextPlot = 232, XErrorBar = 233, SurfaceColorMap = 236, 87 | SurfaceColorFill = 237, SurfaceWireframe = 238, SurfaceBars = 239, Line3D = 240, Text3D = 241, Mesh3D = 242, 88 | XYZContour = 243, XYZTriangular = 245, LineSeries = 246, YErrorBar = 254, XYErrorBar = 255, GraphScatter3D = 0x8AF0, 89 | GraphTrajectory3D = 0x8AF1, Polar = 0x00020000, SmithChart = 0x00040000, FillArea = 0x00800000 90 | cdef enum GraphCurve_LineStyle: 91 | Solid = 0, Dash = 1, Dot = 2, DashDot = 3, DashDotDot = 4, ShortDash = 5, ShortDot = 6, ShortDashDot = 7 92 | cdef enum GraphCurve_LineConnect: 93 | NoLine = 0, Straight = 1, TwoPointSegment = 2, ThreePointSegment = 3, BSpline = 8, Spline = 9, 94 | StepHorizontal = 11, StepVertical = 12, StepHCenter = 13, StepVCenter = 14, Bezier = 15 95 | cdef enum GraphAxis_AxisPosition: 96 | apLeft = 0, apBottom, apRight, apTop, apFront, apBack 97 | cdef enum GraphAxis_Scale: # WTF, this enum is not used 98 | Linear = 0, Log10 = 1, Probability = 2, Probit = 3, Reciprocal = 4, 99 | OffsetReciprocal = 5, Logit = 6, Ln = 7, Log2 = 8 100 | cdef enum Figure_FigureType: 101 | Rectangle, Circle 102 | cdef enum ProjectNode_NodeType: 103 | ntSpreadSheet "Spreadsheet", ntMatrix "Matrix", ntExcel "Excel", 104 | ntGraph "Graph", ntGraph3D "Graph3D", ntNote "Note", ntFolder "Folder" 105 | 106 | cdef extern from "OriginObj.h" namespace "Origin": 107 | 108 | cdef enum ValueType: 109 | Numeric = 0, Text = 1, Time = 2, Date = 3, Month = 4, Day = 5, ColumnHeading = 6, 110 | TickIndexedDataset = 7, TextNumeric = 9, Categorical = 10 111 | cdef enum NumericDisplayType: 112 | DefaultDecimalDigits = 0, DecimalPlaces = 1, SignificantDigits = 2 113 | cdef enum Attach: 114 | Frame = 0, Page = 1, Scale = 2 115 | cdef enum BorderType: 116 | BlackLine = 0, Shadow = 1, DarkMarble = 2, WhiteOut = 3, BlackOut = 4, btNone "None" = -1 117 | cdef enum FillPattern: 118 | NoFill, BDiagDense, BDiagMedium, BDiagSparse, FDiagDense, FDiagMedium, FDiagSparse, 119 | DiagCrossDense, DiagCrossMedium, DiagCrossSparse, HorizontalDense, HorizontalMedium, HorizontalSparse, 120 | VerticalDense, VerticalMedium, VerticalSparse, CrossDense, CrossMedium, CrossSparse 121 | 122 | cdef cppclass Color: 123 | Color_ColorType type 124 | 125 | unsigned char regular # 126 | unsigned char *custom # this is a union actually 127 | unsigned char starting # 128 | unsigned char column # 129 | 130 | cdef cppclass Rect: 131 | short left 132 | short top 133 | short right 134 | short bottom 135 | Rect(short width = 0, short height = 0) 136 | int height() const 137 | int width() const 138 | bool isValid() const 139 | 140 | cdef cppclass ColorMapLevel: 141 | Color fillColor 142 | unsigned char fillPattern 143 | Color fillPatternColor 144 | double fillPatternLineWidth 145 | bool lineVisible 146 | Color lineColor 147 | unsigned char lineStyle 148 | double lineWidth 149 | bool labelVisible 150 | 151 | ctypedef vector[pair[double, ColorMapLevel]] ColorMapVector 152 | 153 | cdef cppclass ColorMap: 154 | bool fillEnabled 155 | ColorMapVector levels 156 | 157 | cdef cppclass Window: 158 | string name 159 | string label 160 | int objectID 161 | bool hidden 162 | Window_State state 163 | Window_Title title 164 | Rect frameRect 165 | time_t creationDate 166 | time_t modificationDate 167 | Window(const string& _name= "", const string& _label = "", bool _hidden = false) 168 | 169 | ctypedef boostvariant[double, string] variant 170 | const double *getDoubleFromVariant(const variant *v) 171 | const string *getStringFromVariant(const variant *v) 172 | 173 | cdef cppclass SpreadColumn: 174 | string name 175 | SpreadColumn_ColumnType type 176 | ValueType valueType 177 | int valueTypeSpecification 178 | int significantDigits 179 | int decimalPlaces 180 | NumericDisplayType numericDisplayType 181 | string command 182 | string comment 183 | int width 184 | unsigned int index 185 | unsigned int colIndex 186 | unsigned int sheet 187 | vector[variant] data 188 | SpreadColumn(const string& _name = "", unsigned int _index = 0) 189 | 190 | cdef cppclass SpreadSheet(Window): 191 | unsigned int maxRows 192 | bool loose 193 | unsigned int sheets 194 | vector[SpreadColumn] columns 195 | #SpreadSheet(const string& _name = "") 196 | 197 | cdef cppclass Excel(Window): # WTF, is this class necessary? 198 | unsigned int maxRows 199 | bool loose 200 | vector[SpreadSheet] sheets 201 | #Excel(const string& _name = "", const string& _label = "", int _maxRows = 0, bool _hidden = false, bool _loose = true) 202 | 203 | cdef cppclass MatrixSheet: 204 | string name 205 | unsigned short rowCount 206 | unsigned short columnCount 207 | int valueTypeSpecification 208 | int significantDigits 209 | int decimalPlaces 210 | NumericDisplayType numericDisplayType 211 | string command 212 | unsigned short width 213 | unsigned int index 214 | Matrix_ViewType view 215 | ColorMap colorMap 216 | vector[double] data 217 | vector[double] coordinates 218 | #Matrix(const string& _name = "", unsigned int _index = 0) 219 | 220 | cdef cppclass Matrix(Window): 221 | unsigned int activeSheet 222 | Matrix_HeaderViewType header 223 | vector[MatrixSheet] sheets 224 | 225 | cdef cppclass Function: 226 | string name 227 | Function_FunctionType type 228 | string formula 229 | double begin 230 | double end 231 | int totalPoints 232 | unsigned int index 233 | #Function(const string& _name = "", unsigned int _index = 0) 234 | 235 | cdef cppclass TextBox: 236 | string text 237 | Rect clientRect 238 | Color color 239 | unsigned short fontSize 240 | int rotation 241 | int tab 242 | BorderType borderType 243 | Attach attach 244 | #TextBox(const string& _text = "") 245 | #TextBox(const string& _text, const Rect& _clientRect, const Color& _color, unsigned short _fontSize, int _rotation, int _tab, BorderType _borderType, Attach _attach) 246 | 247 | cdef cppclass PieProperties: 248 | unsigned char viewAngle 249 | unsigned char thickness 250 | bool clockwiseRotation 251 | short rotation 252 | unsigned short radius 253 | unsigned short horizontalOffset 254 | unsigned long displacedSectionCount 255 | unsigned short displacement 256 | bool formatAutomatic 257 | bool formatValues 258 | bool formatPercentages 259 | bool formatCategories 260 | bool positionAssociate 261 | unsigned short distance 262 | PieProperties() 263 | 264 | cdef cppclass VectorProperties: 265 | Color color 266 | double width 267 | unsigned short arrowLenght 268 | unsigned char arrowAngle 269 | bool arrowClosed 270 | string endXColumnName 271 | string endYColumnName 272 | VectorProperties_VectorPosition position 273 | string angleColumnName 274 | string magnitudeColumnName 275 | float multiplier 276 | int constAngle 277 | int constMagnitude 278 | VectorProperties() 279 | 280 | cdef cppclass TextProperties: 281 | Color color 282 | bool fontBold 283 | bool fontItalic 284 | bool fontUnderline 285 | bool whiteOut 286 | TextProperties_Justify justify 287 | short rotation 288 | short xOffset 289 | short yOffset 290 | unsigned short fontSize 291 | 292 | cdef cppclass SurfaceProperties: 293 | cppclass SurfaceColoration: 294 | bool fill 295 | bool contour 296 | Color lineColor 297 | double lineWidth 298 | unsigned char type 299 | SurfaceProperties_Grids grids 300 | double gridLineWidth 301 | Color gridColor 302 | bool backColorEnabled 303 | Color frontColor 304 | Color backColor 305 | bool sideWallEnabled 306 | Color xSideWallColor 307 | Color ySideWallColor 308 | SurfaceColoration surface 309 | SurfaceColoration topContour 310 | SurfaceColoration bottomContour 311 | ColorMap colorMap 312 | 313 | cdef cppclass PercentileProperties: 314 | unsigned char maxSymbolType 315 | unsigned char p99SymbolType 316 | unsigned char meanSymbolType 317 | unsigned char p1SymbolType 318 | unsigned char minSymbolType 319 | Color symbolColor 320 | Color symbolFillColor 321 | unsigned short symbolSize 322 | unsigned char boxRange 323 | unsigned char whiskersRange 324 | double boxCoeff 325 | double whiskersCoeff 326 | bool diamondBox 327 | unsigned char labels 328 | 329 | cdef cppclass GraphCurve: 330 | bool hidden 331 | unsigned char type 332 | string dataName 333 | string xDataName 334 | string xColumnName 335 | string yColumnName 336 | string zColumnName 337 | Color lineColor 338 | unsigned char lineTransparency 339 | unsigned char lineStyle 340 | unsigned char lineConnect 341 | unsigned char boxWidth 342 | double lineWidth 343 | bool fillArea 344 | unsigned char fillAreaType 345 | unsigned char fillAreaPattern 346 | Color fillAreaColor 347 | unsigned char fillAreaTransparency 348 | bool fillAreaWithLineTransparency 349 | Color fillAreaPatternColor 350 | double fillAreaPatternWidth 351 | unsigned char fillAreaPatternBorderStyle 352 | Color fillAreaPatternBorderColor 353 | double fillAreaPatternBorderWidth 354 | unsigned short symbolType 355 | Color symbolColor 356 | Color symbolFillColor 357 | unsigned char symbolFillTransparency 358 | double symbolSize 359 | unsigned char symbolThickness 360 | unsigned char pointOffset 361 | bool connectSymbols 362 | PieProperties pie 363 | VectorProperties vector 364 | TextProperties text 365 | SurfaceProperties surface 366 | ColorMap colorMap 367 | 368 | cdef cppclass GraphAxisBreak: 369 | bool show 370 | bool log10 371 | double gabFrom "from" 372 | double to 373 | double position 374 | double scaleIncrementBefore 375 | double scaleIncrementAfter 376 | unsigned char minorTicksBefore 377 | unsigned char minorTicksAfter 378 | GraphAxisBreak() 379 | 380 | cdef cppclass GraphGrid: 381 | bool hidden 382 | unsigned char color 383 | unsigned char style 384 | double width 385 | 386 | cdef cppclass GraphAxisFormat: 387 | bool hidden 388 | unsigned char color 389 | double thickness 390 | double majorTickLength 391 | int majorTicksType 392 | int minorTicksType 393 | int axisPosition 394 | double axisPositionValue 395 | TextBox label 396 | string prefix 397 | string suffix 398 | string factor 399 | 400 | cdef cppclass GraphAxisTick: 401 | bool showMajorLabels 402 | unsigned char color 403 | ValueType valueType 404 | int valueTypeSpecification 405 | int decimalPlaces 406 | unsigned short fontSize 407 | bool fontBold 408 | string dataName 409 | string columnName 410 | int rotation 411 | 412 | cdef cppclass GraphAxis: 413 | GraphAxis_AxisPosition position 414 | bool zeroLine 415 | bool oppositeLine 416 | double min 417 | double max 418 | double step 419 | unsigned char majorTicks 420 | unsigned char minorTicks 421 | unsigned char scale 422 | GraphGrid majorGrid 423 | GraphGrid minorGrid 424 | GraphAxisFormat *formatAxis # this is actually a size-2 array 425 | GraphAxisTick *tickAxis # this is actually a size-2 array 426 | 427 | cdef cppclass Figure: 428 | Figure_FigureType type 429 | Rect clientRect 430 | Attach attach 431 | Color color 432 | unsigned char style 433 | double width 434 | Color fillAreaColor 435 | unsigned char fillAreaPattern 436 | Color fillAreaPatternColor 437 | double fillAreaPatternWidth 438 | bool useBorderColor 439 | Figure(Figure_FigureType _type = Rectangle) 440 | 441 | cdef cppclass LineVertex: 442 | unsigned char shapeType 443 | double shapeWidth 444 | double shapeLength 445 | double x 446 | double y 447 | LineVertex() 448 | 449 | cdef cppclass Line: 450 | Rect clientRect 451 | Color color 452 | Attach attach 453 | double width 454 | unsigned char style 455 | LineVertex begin 456 | LineVertex end 457 | 458 | cdef cppclass Bitmap: 459 | Rect clientRect 460 | Attach attach 461 | unsigned long size 462 | string windowName 463 | BorderType borderType 464 | unsigned char* data 465 | Bitmap(const string& _name = "") 466 | Bitmap(const Bitmap& bitmap) 467 | 468 | cdef cppclass ColorScale: 469 | bool visible 470 | bool reverseOrder 471 | unsigned short labelGap 472 | unsigned short colorBarThickness 473 | Color labelsColor 474 | 475 | cdef cppclass GraphLayer: 476 | Rect clientRect 477 | TextBox legend 478 | Color backgroundColor 479 | BorderType borderType 480 | GraphAxis xAxis 481 | GraphAxis yAxis 482 | GraphAxis zAxis 483 | GraphAxisBreak xAxisBreak 484 | GraphAxisBreak yAxisBreak 485 | GraphAxisBreak zAxisBreak 486 | double histogramBin 487 | double histogramBegin 488 | double histogramEnd 489 | PercentileProperties percentile 490 | ColorScale colorScale 491 | vector[TextBox] texts 492 | vector[TextBox] pieTexts 493 | vector[Line] lines 494 | vector[Figure] figures 495 | vector[Bitmap] bitmaps 496 | vector[GraphCurve] curves 497 | float xAngle 498 | float yAngle 499 | float zAngle 500 | float xLength 501 | float yLength 502 | float zLength 503 | int imageProfileTool 504 | double vLine 505 | double hLine 506 | bool isWaterfall 507 | int xOffset 508 | int yOffset 509 | bool gridOnTop 510 | bool exchangedAxes 511 | bool isXYY3D 512 | bool orthographic3D 513 | GraphLayer() 514 | #bool threeDimensional 515 | bool is3D() const 516 | 517 | cdef cppclass GraphLayerRange: 518 | double min 519 | double max 520 | double step 521 | GraphLayerRange(double _min = 0.0, double _max = 0.0, double _step = 0.0) 522 | 523 | cdef cppclass Graph(Window): 524 | vector[GraphLayer] layers 525 | unsigned short width 526 | unsigned short height 527 | bool is3D 528 | bool isLayout 529 | bool connectMissingData 530 | string templateName 531 | #Graph(const string& _name = "") 532 | 533 | cdef cppclass Note(Window): 534 | string text 535 | #Note(const string& _name = "") 536 | 537 | cdef cppclass ProjectNode: 538 | ProjectNode_NodeType type 539 | string name 540 | time_t creationDate 541 | time_t modificationDate 542 | bool active 543 | ProjectNode(const string& _name = "", ProjectNode_NodeType _type = Folder, const time_t _creationDate = time(NULL), const time_t _modificationDate = time(NULL)) 544 | 545 | cdef extern from "OriginObj.h": 546 | ctypedef void (*ProgressCallback)(double progress, void *user_data) 547 | 548 | ctypedef SurfaceProperties.SurfaceColoration SurfaceColoration 549 | 550 | #################################################################################################### 551 | ########################################### ############################################ 552 | ########################################## OriginFile.h ############################################ 553 | ########################################## ############################################# 554 | #################################################################################################### 555 | cdef extern from "OriginFile.h": 556 | cdef cppclass OriginFile: 557 | OriginFile(const string& fileName) nogil 558 | 559 | bool parse(ProgressCallback callback, void *user_data) nogil 560 | double version() const 561 | 562 | int spreadCount() const 563 | int matrixCount() const 564 | int functionCount() const 565 | int graphCount() const 566 | int noteCount() const 567 | 568 | SpreadSheet& spread(int s) const 569 | Matrix& matrix(int m) const 570 | Function& function(int f) const 571 | Graph& graph(int g) const 572 | Note& note(int n) const 573 | 574 | int functionIndex(const string& name) const 575 | 576 | const tree[ProjectNode]* project() const 577 | 578 | -------------------------------------------------------------------------------- /OriginObj.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | File : OriginObj.h 3 | -------------------------------------------------------------------- 4 | Copyright : (C) 2005-2007 Stefan Gerlach 5 | (C) 2007-2008 Alex Kargovsky, Ion Vasilief 6 | Email (use @ for *) : kargovsky*yumr.phys.msu.su, ion_vasilief*yahoo.fr 7 | Description : Origin internal object classes 8 | 9 | ***************************************************************************/ 10 | 11 | /*************************************************************************** 12 | * * 13 | * This program is free software; you can redistribute it and/or modify * 14 | * it under the terms of the GNU General Public License as published by * 15 | * the Free Software Foundation; either version 2 of the License, or * 16 | * (at your option) any later version. * 17 | * * 18 | * This program is distributed in the hope that it will be useful, * 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 21 | * GNU General Public License for more details. * 22 | * * 23 | * You should have received a copy of the GNU General Public License * 24 | * along with this program; if not, write to the Free Software * 25 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, * 26 | * Boston, MA 02110-1301 USA * 27 | * * 28 | ***************************************************************************/ 29 | 30 | 31 | #ifndef ORIGIN_OBJ_H 32 | #define ORIGIN_OBJ_H 33 | 34 | #include 35 | #include 36 | #include 37 | #include "boost/variant.hpp" 38 | 39 | using namespace std; 40 | 41 | #define _ONAN (-1.23456789E-300) 42 | 43 | namespace Origin 44 | { 45 | 46 | typedef void (*ParsingProgressCallback)(double progress, void *user_data); 47 | 48 | enum ValueType {Numeric = 0, Text = 1, Time = 2, Date = 3, Month = 4, Day = 5, ColumnHeading = 6, TickIndexedDataset = 7, TextNumeric = 9, Categorical = 10}; 49 | enum NumericDisplayType {DefaultDecimalDigits = 0, DecimalPlaces = 1, SignificantDigits = 2}; 50 | enum Attach {Frame = 0, Page = 1, Scale = 2}; 51 | enum BorderType {BlackLine = 0, Shadow = 1, DarkMarble = 2, WhiteOut = 3, BlackOut = 4, None = -1}; 52 | enum FillPattern {NoFill, BDiagDense, BDiagMedium, BDiagSparse, FDiagDense, FDiagMedium, FDiagSparse, 53 | DiagCrossDense, DiagCrossMedium, DiagCrossSparse, HorizontalDense, HorizontalMedium, HorizontalSparse, 54 | VerticalDense, VerticalMedium, VerticalSparse, CrossDense, CrossMedium, CrossSparse}; 55 | 56 | struct Color 57 | { 58 | enum ColorType {None, Automatic, Regular, Custom, Increment, Indexing, RGB, Mapping}; 59 | enum RegularColor {Black = 0, Red = 1, Green = 2, Blue = 3, Cyan = 4, Magenta = 5, Yellow = 6, DarkYellow = 7, Navy = 8, 60 | Purple = 9, Wine = 10, Olive = 11, DarkCyan = 12, Royal= 13, Orange = 14, Violet = 15, Pink = 16, White = 17, 61 | LightGray = 18, Gray = 19, LTYellow = 20, LTCyan = 21, LTMagenta = 22, DarkGray = 23/*, Custom = 255*/}; 62 | 63 | ColorType type; 64 | union 65 | { 66 | unsigned char regular; 67 | unsigned char custom[3]; 68 | unsigned char starting; 69 | unsigned char column; 70 | }; 71 | }; 72 | 73 | struct Rect 74 | { 75 | short left; 76 | short top; 77 | short right; 78 | short bottom; 79 | 80 | Rect(short width = 0, short height = 0) 81 | : left(0) 82 | , top(0) 83 | , right(width) 84 | , bottom(height) 85 | { 86 | }; 87 | 88 | int height() const 89 | { 90 | return bottom - top; 91 | }; 92 | 93 | int width() const 94 | { 95 | return right - left; 96 | }; 97 | 98 | bool isValid() const 99 | { 100 | return height() > 0 && width() > 0; 101 | } 102 | }; 103 | 104 | struct ColorMapLevel 105 | { 106 | Color fillColor; 107 | unsigned char fillPattern; 108 | Color fillPatternColor; 109 | double fillPatternLineWidth; 110 | 111 | bool lineVisible; 112 | Color lineColor; 113 | unsigned char lineStyle; 114 | double lineWidth; 115 | 116 | bool labelVisible; 117 | }; 118 | 119 | typedef vector > ColorMapVector; 120 | 121 | struct ColorMap 122 | { 123 | bool fillEnabled; 124 | ColorMapVector levels; 125 | }; 126 | 127 | struct Window 128 | { 129 | enum State {Normal, Minimized, Maximized}; 130 | enum Title {Name, Label, Both}; 131 | 132 | string name; 133 | string label; 134 | int objectID; 135 | bool hidden; 136 | State state; 137 | Title title; 138 | Rect frameRect; 139 | time_t creationDate; 140 | time_t modificationDate; 141 | 142 | Window(const string& _name= "", const string& _label = "", bool _hidden = false) 143 | : name(_name) 144 | , label(_label) 145 | , objectID(-1) 146 | , hidden(_hidden) 147 | , state(Normal) 148 | , title(Both) 149 | {}; 150 | }; 151 | 152 | typedef boost::variant variant; 153 | /* Two following functions are necessary because 154 | Boost is way too difficult for Cython. 155 | BTW, I had to add new .cpp file for their implementation. :[ */ 156 | const double *getDoubleFromVariant(const variant *v); 157 | const string *getStringFromVariant(const variant *v); 158 | 159 | struct SpreadColumn 160 | { 161 | enum ColumnType {X, Y, Z, XErr, YErr, Label, NONE}; 162 | 163 | string name; 164 | ColumnType type; 165 | ValueType valueType; 166 | int valueTypeSpecification; 167 | int significantDigits; 168 | int decimalPlaces; 169 | NumericDisplayType numericDisplayType; 170 | string command; 171 | string comment; 172 | int width; 173 | unsigned int index; 174 | unsigned int colIndex; 175 | unsigned int sheet; 176 | vector data; 177 | 178 | SpreadColumn(const string& _name = "", unsigned int _index = 0) 179 | : name(_name) 180 | , valueType(Numeric) 181 | , valueTypeSpecification(0) 182 | , significantDigits(6) 183 | , decimalPlaces(6) 184 | , numericDisplayType(DefaultDecimalDigits) 185 | , command("") 186 | , comment("") 187 | , width(8) 188 | , index(_index) 189 | , colIndex(0) 190 | , sheet(0) 191 | {}; 192 | }; 193 | 194 | struct SpreadSheet : public Window 195 | { 196 | unsigned int maxRows; 197 | bool loose; 198 | unsigned int sheets; 199 | vector columns; 200 | 201 | SpreadSheet(const string& _name = "") 202 | : Window(_name) 203 | , loose(true) 204 | , sheets(1) 205 | {}; 206 | }; 207 | 208 | struct Excel : public Window 209 | { 210 | unsigned int maxRows; 211 | bool loose; 212 | vector sheets; 213 | 214 | Excel(const string& _name = "", const string& _label = "", int _maxRows = 0, bool _hidden = false, bool _loose = true) 215 | : Window(_name, _label, _hidden) 216 | , maxRows(_maxRows) 217 | , loose(_loose) 218 | { 219 | }; 220 | }; 221 | 222 | struct MatrixSheet 223 | { 224 | enum ViewType {DataView, ImageView}; 225 | 226 | string name; 227 | unsigned short rowCount; 228 | unsigned short columnCount; 229 | int valueTypeSpecification; 230 | int significantDigits; 231 | int decimalPlaces; 232 | NumericDisplayType numericDisplayType; 233 | string command; 234 | unsigned short width; 235 | unsigned int index; 236 | ViewType view; 237 | ColorMap colorMap; 238 | vector data; 239 | vector coordinates; 240 | 241 | MatrixSheet(const string& _name = "", unsigned int _index = 0) 242 | : name(_name) 243 | , valueTypeSpecification(0) 244 | , significantDigits(6) 245 | , decimalPlaces(6) 246 | , numericDisplayType(DefaultDecimalDigits) 247 | , command("") 248 | , width(8) 249 | , index(_index) 250 | , view(DataView) 251 | {coordinates.push_back(10.0);coordinates.push_back(10.0);coordinates.push_back(1.0);coordinates.push_back(1.0);}; 252 | }; 253 | 254 | struct Matrix : public Window 255 | { 256 | enum HeaderViewType {ColumnRow, XY}; 257 | 258 | unsigned int activeSheet; 259 | HeaderViewType header; 260 | vector sheets; 261 | 262 | Matrix(const string& _name = "") 263 | : Window(_name) 264 | , activeSheet(0) 265 | , header(ColumnRow) 266 | {}; 267 | }; 268 | 269 | struct Function 270 | { 271 | enum FunctionType {Normal, Polar}; 272 | 273 | string name; 274 | FunctionType type; 275 | string formula; 276 | double begin; 277 | double end; 278 | int totalPoints; 279 | unsigned int index; 280 | 281 | Function(const string& _name = "", unsigned int _index = 0) 282 | : name(_name) 283 | , type(Normal) 284 | , formula("") 285 | , begin(0.0) 286 | , end(0.0) 287 | , totalPoints(0) 288 | , index(_index) 289 | {}; 290 | }; 291 | 292 | 293 | struct TextBox 294 | { 295 | string text; 296 | Rect clientRect; 297 | Color color; 298 | unsigned short fontSize; 299 | int rotation; 300 | int tab; 301 | BorderType borderType; 302 | Attach attach; 303 | 304 | TextBox(const string& _text = "") 305 | : text(_text) 306 | {}; 307 | 308 | TextBox(const string& _text, const Rect& _clientRect, const Color& _color, unsigned short _fontSize, int _rotation, int _tab, BorderType _borderType, Attach _attach) 309 | : text(_text) 310 | , clientRect(_clientRect) 311 | , color(_color) 312 | , fontSize(_fontSize) 313 | , rotation(_rotation) 314 | , tab(_tab) 315 | , borderType(_borderType) 316 | , attach(_attach) 317 | {}; 318 | }; 319 | 320 | struct PieProperties 321 | { 322 | unsigned char viewAngle; 323 | unsigned char thickness; 324 | bool clockwiseRotation; 325 | short rotation; 326 | unsigned short radius; 327 | unsigned short horizontalOffset; 328 | unsigned long displacedSectionCount; // maximum - 32 sections 329 | unsigned short displacement; 330 | 331 | //labels 332 | bool formatAutomatic; 333 | bool formatValues; 334 | bool formatPercentages; 335 | bool formatCategories; 336 | bool positionAssociate; 337 | unsigned short distance; 338 | 339 | PieProperties() 340 | : clockwiseRotation(false) 341 | , formatAutomatic(false) 342 | , formatValues(false) 343 | , formatPercentages(false) 344 | , formatCategories(false) 345 | , positionAssociate(false) 346 | {}; 347 | }; 348 | 349 | struct VectorProperties 350 | { 351 | enum VectorPosition {Tail, Midpoint, Head}; 352 | 353 | Color color; 354 | double width; 355 | unsigned short arrowLenght; 356 | unsigned char arrowAngle; 357 | bool arrowClosed; 358 | string endXColumnName; 359 | string endYColumnName; 360 | 361 | VectorPosition position; 362 | string angleColumnName; 363 | string magnitudeColumnName; 364 | float multiplier; 365 | int constAngle; 366 | int constMagnitude; 367 | 368 | VectorProperties() 369 | : arrowClosed(false) 370 | , position(Tail) 371 | , multiplier(1.0) 372 | , constAngle(0) 373 | , constMagnitude(0) 374 | {}; 375 | }; 376 | 377 | struct TextProperties 378 | { 379 | enum Justify {Left, Center, Right}; 380 | 381 | Color color; 382 | bool fontBold; 383 | bool fontItalic; 384 | bool fontUnderline; 385 | bool whiteOut; 386 | Justify justify; 387 | 388 | short rotation; 389 | short xOffset; 390 | short yOffset; 391 | unsigned short fontSize; 392 | }; 393 | 394 | struct SurfaceProperties 395 | { 396 | struct SurfaceColoration 397 | { 398 | bool fill; 399 | bool contour; 400 | Color lineColor; 401 | double lineWidth; 402 | }; 403 | 404 | enum Type {ColorMap3D, ColorFill, WireFrame, Bars}; 405 | enum Grids {None, X, Y, XY}; 406 | 407 | unsigned char type; 408 | Grids grids; 409 | double gridLineWidth; 410 | Color gridColor; 411 | 412 | bool backColorEnabled; 413 | Color frontColor; 414 | Color backColor; 415 | 416 | bool sideWallEnabled; 417 | Color xSideWallColor; 418 | Color ySideWallColor; 419 | 420 | SurfaceColoration surface; 421 | SurfaceColoration topContour; 422 | SurfaceColoration bottomContour; 423 | 424 | ColorMap colorMap; 425 | }; 426 | 427 | struct PercentileProperties 428 | { 429 | unsigned char maxSymbolType; 430 | unsigned char p99SymbolType; 431 | unsigned char meanSymbolType; 432 | unsigned char p1SymbolType; 433 | unsigned char minSymbolType; 434 | Color symbolColor; 435 | Color symbolFillColor; 436 | unsigned short symbolSize; 437 | unsigned char boxRange; 438 | unsigned char whiskersRange; 439 | double boxCoeff; 440 | double whiskersCoeff; 441 | bool diamondBox; 442 | unsigned char labels; 443 | }; 444 | 445 | struct GraphCurve 446 | { 447 | enum Plot {Line = 200, Scatter=201, LineSymbol=202, Column = 203, Area = 204, HiLoClose = 205, Box = 206, 448 | ColumnFloat = 207, Vector = 208, PlotDot = 209, Wall3D = 210, Ribbon3D = 211, Bar3D = 212, ColumnStack = 213, 449 | AreaStack = 214, Bar = 215, BarStack = 216, FlowVector = 218, Histogram = 219, MatrixImage = 220, Pie = 225, 450 | Contour = 226, Unknown = 230, ErrorBar = 231, TextPlot = 232, XErrorBar = 233, SurfaceColorMap = 236, 451 | SurfaceColorFill = 237, SurfaceWireframe = 238, SurfaceBars = 239, Line3D = 240, Text3D = 241, Mesh3D = 242, 452 | XYZContour = 243, XYZTriangular = 245, LineSeries = 246, YErrorBar = 254, XYErrorBar = 255, GraphScatter3D = 0x8AF0, 453 | GraphTrajectory3D = 0x8AF1, Polar = 0x00020000, SmithChart = 0x00040000, FillArea = 0x00800000}; 454 | enum LineStyle {Solid = 0, Dash = 1, Dot = 2, DashDot = 3, DashDotDot = 4, ShortDash = 5, ShortDot = 6, ShortDashDot = 7}; 455 | enum LineConnect {NoLine = 0, Straight = 1, TwoPointSegment = 2, ThreePointSegment = 3, BSpline = 8, Spline = 9, StepHorizontal = 11, StepVertical = 12, StepHCenter = 13, StepVCenter = 14, Bezier = 15}; 456 | 457 | bool hidden; 458 | unsigned char type; 459 | string dataName; 460 | string xDataName; 461 | string xColumnName; 462 | string yColumnName; 463 | string zColumnName; 464 | Color lineColor; 465 | unsigned char lineTransparency; 466 | unsigned char lineStyle; 467 | unsigned char lineConnect; 468 | unsigned char boxWidth; 469 | double lineWidth; 470 | 471 | bool fillArea; 472 | unsigned char fillAreaType; 473 | unsigned char fillAreaPattern; 474 | Color fillAreaColor; 475 | unsigned char fillAreaTransparency; 476 | bool fillAreaWithLineTransparency; 477 | Color fillAreaPatternColor; 478 | double fillAreaPatternWidth; 479 | unsigned char fillAreaPatternBorderStyle; 480 | Color fillAreaPatternBorderColor; 481 | double fillAreaPatternBorderWidth; 482 | 483 | unsigned short symbolType; 484 | Color symbolColor; 485 | Color symbolFillColor; 486 | unsigned char symbolFillTransparency; 487 | double symbolSize; 488 | unsigned char symbolThickness; 489 | unsigned char pointOffset; 490 | 491 | bool connectSymbols; 492 | 493 | //pie 494 | PieProperties pie; 495 | 496 | //vector 497 | VectorProperties vector; 498 | 499 | //text 500 | TextProperties text; 501 | 502 | //surface 503 | SurfaceProperties surface; 504 | 505 | //contour 506 | ColorMap colorMap; 507 | }; 508 | 509 | struct GraphAxisBreak 510 | { 511 | bool show; 512 | 513 | bool log10; 514 | double from; 515 | double to; 516 | double position; 517 | 518 | double scaleIncrementBefore; 519 | double scaleIncrementAfter; 520 | 521 | unsigned char minorTicksBefore; 522 | unsigned char minorTicksAfter; 523 | 524 | GraphAxisBreak() 525 | : show(false) 526 | {}; 527 | }; 528 | 529 | struct GraphGrid 530 | { 531 | bool hidden; 532 | unsigned char color; 533 | unsigned char style; 534 | double width; 535 | }; 536 | 537 | struct GraphAxisFormat 538 | { 539 | bool hidden; 540 | unsigned char color; 541 | double thickness; 542 | double majorTickLength; 543 | int majorTicksType; 544 | int minorTicksType; 545 | int axisPosition; 546 | double axisPositionValue; 547 | TextBox label; 548 | string prefix; 549 | string suffix; 550 | string factor; 551 | }; 552 | 553 | struct GraphAxisTick 554 | { 555 | bool showMajorLabels; 556 | unsigned char color; 557 | ValueType valueType; 558 | int valueTypeSpecification; 559 | int decimalPlaces; 560 | unsigned short fontSize; 561 | bool fontBold; 562 | string dataName; 563 | string columnName; 564 | int rotation; 565 | }; 566 | 567 | struct GraphAxis 568 | { 569 | enum AxisPosition {Left = 0, Bottom, Right, Top, Front, Back}; 570 | enum Scale {Linear = 0, Log10 = 1, Probability = 2, Probit = 3, Reciprocal = 4, OffsetReciprocal = 5, Logit = 6, Ln = 7, Log2 = 8}; 571 | 572 | AxisPosition position; 573 | bool zeroLine; 574 | bool oppositeLine; 575 | double min; 576 | double max; 577 | double step; 578 | unsigned char majorTicks; 579 | unsigned char minorTicks; 580 | unsigned char scale; 581 | GraphGrid majorGrid; 582 | GraphGrid minorGrid; 583 | GraphAxisFormat formatAxis[2]; 584 | GraphAxisTick tickAxis[2]; //bottom-top, left-right 585 | }; 586 | 587 | struct Figure 588 | { 589 | enum FigureType {Rectangle, Circle}; 590 | 591 | FigureType type; 592 | Rect clientRect; 593 | Attach attach; 594 | Color color; 595 | unsigned char style; 596 | double width; 597 | Color fillAreaColor; 598 | unsigned char fillAreaPattern; 599 | Color fillAreaPatternColor; 600 | double fillAreaPatternWidth; 601 | bool useBorderColor; 602 | 603 | Figure(FigureType _type = Rectangle) 604 | : type(_type) 605 | { 606 | }; 607 | }; 608 | 609 | struct LineVertex 610 | { 611 | unsigned char shapeType; 612 | double shapeWidth; 613 | double shapeLength; 614 | double x; 615 | double y; 616 | 617 | LineVertex() 618 | : shapeType(0) 619 | , shapeWidth(0.0) 620 | , shapeLength(0.0) 621 | , x(0.0) 622 | , y(0.0) 623 | {}; 624 | }; 625 | 626 | struct Line 627 | { 628 | Rect clientRect; 629 | Color color; 630 | Attach attach; 631 | double width; 632 | unsigned char style; 633 | LineVertex begin; 634 | LineVertex end; 635 | }; 636 | 637 | struct Bitmap 638 | { 639 | Rect clientRect; 640 | Attach attach; 641 | unsigned long size; 642 | string windowName; 643 | BorderType borderType; 644 | unsigned char* data; 645 | 646 | Bitmap(const string& _name = "") 647 | : size(0) 648 | , windowName(_name) 649 | , borderType(Origin::None) 650 | , data(0) 651 | { 652 | }; 653 | 654 | Bitmap(const Bitmap& bitmap) 655 | : clientRect(bitmap.clientRect) 656 | , attach(bitmap.attach) 657 | , size(bitmap.size) 658 | , windowName(bitmap.windowName) 659 | , borderType(bitmap.borderType) 660 | { 661 | if(size > 0) 662 | { 663 | data = new unsigned char[size]; 664 | memcpy(data, bitmap.data, size); 665 | } 666 | }; 667 | 668 | ~Bitmap() 669 | { 670 | if(size > 0) 671 | delete data; 672 | }; 673 | }; 674 | 675 | struct ColorScale 676 | { 677 | bool visible; 678 | bool reverseOrder; 679 | unsigned short labelGap; 680 | unsigned short colorBarThickness; 681 | Color labelsColor; 682 | }; 683 | 684 | struct GraphLayer 685 | { 686 | Rect clientRect; 687 | TextBox legend; 688 | Color backgroundColor; 689 | BorderType borderType; 690 | 691 | GraphAxis xAxis; 692 | GraphAxis yAxis; 693 | GraphAxis zAxis; 694 | 695 | GraphAxisBreak xAxisBreak; 696 | GraphAxisBreak yAxisBreak; 697 | GraphAxisBreak zAxisBreak; 698 | 699 | double histogramBin; 700 | double histogramBegin; 701 | double histogramEnd; 702 | 703 | PercentileProperties percentile; 704 | ColorScale colorScale; 705 | ColorMap colorMap; 706 | 707 | vector texts; 708 | vector pieTexts; 709 | vector lines; 710 | vector
figures; 711 | vector bitmaps; 712 | vector curves; 713 | 714 | float xAngle; 715 | float yAngle; 716 | float zAngle; 717 | 718 | float xLength; 719 | float yLength; 720 | float zLength; 721 | 722 | int imageProfileTool; 723 | double vLine; 724 | double hLine; 725 | 726 | bool isWaterfall; 727 | int xOffset; 728 | int yOffset; 729 | 730 | bool gridOnTop; 731 | bool exchangedAxes; 732 | bool isXYY3D; 733 | bool orthographic3D; 734 | 735 | GraphLayer() 736 | : imageProfileTool(0) 737 | , isWaterfall(false) 738 | , gridOnTop(false) 739 | , exchangedAxes(false) 740 | , isXYY3D(false) 741 | , orthographic3D(false) 742 | {colorScale.visible = false;}; 743 | 744 | //bool threeDimensional; 745 | bool is3D() const 746 | { 747 | for (vector::const_iterator it = curves.begin(); it != curves.end(); ++it) 748 | { 749 | if (it->type == GraphCurve::Line3D) return true; 750 | if (it->type == GraphCurve::Mesh3D) return true; 751 | } 752 | return false; 753 | } 754 | }; 755 | 756 | struct GraphLayerRange 757 | { 758 | double min; 759 | double max; 760 | double step; 761 | 762 | GraphLayerRange(double _min = 0.0, double _max = 0.0, double _step = 0.0) 763 | : min(_min) 764 | , max(_max) 765 | , step(_step) 766 | {}; 767 | }; 768 | 769 | struct Graph : public Window 770 | { 771 | vector layers; 772 | unsigned short width; 773 | unsigned short height; 774 | bool is3D; 775 | bool isLayout; 776 | bool connectMissingData; 777 | string templateName; 778 | 779 | Graph(const string& _name = "") 780 | : Window(_name) 781 | , is3D(false) 782 | , isLayout(false) 783 | , connectMissingData(false) 784 | , templateName("") 785 | {}; 786 | }; 787 | 788 | struct Note : public Window 789 | { 790 | string text; 791 | Note(const string& _name = "") 792 | : Window(_name) 793 | {}; 794 | }; 795 | 796 | struct ProjectNode 797 | { 798 | enum NodeType {SpreadSheet, Matrix, Excel, Graph, Graph3D, Note, Folder}; 799 | 800 | NodeType type; 801 | string name; 802 | time_t creationDate; 803 | time_t modificationDate; 804 | bool active; 805 | 806 | ProjectNode(const string& _name = "", NodeType _type = Folder, const time_t _creationDate = time(NULL), const time_t _modificationDate = time(NULL), bool _active = false) 807 | : type(_type) 808 | , name(_name) 809 | , creationDate(_creationDate) 810 | , modificationDate(_modificationDate) 811 | , active(_active) 812 | {}; 813 | }; 814 | } 815 | 816 | typedef Origin::ParsingProgressCallback ProgressCallback; 817 | 818 | #endif // ORIGIN_OBJ_H 819 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /liborigin.pyx: -------------------------------------------------------------------------------- 1 | 2 | cimport objects 3 | from objects cimport bool, string, vector, pair, tree, tree_node, OriginFile 4 | cimport cython.operator 5 | from cython.operator import dereference as deref 6 | #from PyQt4 import QtCore, QtGui 7 | #Qt = QtCore.Qt 8 | 9 | #################################################################################################### 10 | ########################################## ########################################### 11 | ######################################### Object classes ########################################### 12 | ######################################### ############################################ 13 | #################################################################################################### 14 | 15 | cdef class Color: 16 | 17 | cdef public int type # enum 18 | cdef public int regular, starting, column 19 | cdef public object custom 20 | 21 | cdef void copy(self, const objects.Color *arg): 22 | self.type = arg.type 23 | self.regular = arg.regular 24 | self.starting = arg.starting 25 | self.column = arg.column 26 | 27 | cdef class Rect: 28 | 29 | cdef public int left, top, right, bottom 30 | 31 | cdef void copy(self, const objects.Rect *arg): 32 | self.left = arg.left 33 | self.top = arg.top 34 | self.right = arg.right 35 | self.bottom = arg.bottom 36 | 37 | cdef class ColorMapLevel: 38 | 39 | cdef public object fillColor, fillPatternColor, lineColor 40 | cdef public int fillPattern, lineStyle 41 | cdef public float fillPatternLineWidth, lineWidth 42 | cdef public bool lineVisible, labelVisible 43 | 44 | cdef void copy(self, const objects.ColorMapLevel *lvl): 45 | self.fillColor = makeColor(lvl.fillColor) 46 | self.fillPatternColor = makeColor(lvl.fillPatternColor) 47 | self.lineColor = makeColor(lvl.lineColor) 48 | self.fillPattern = lvl.fillPattern 49 | self.lineStyle = lvl.lineStyle 50 | self.fillPatternLineWidth = lvl.fillPatternLineWidth 51 | self.lineWidth = lvl.lineWidth 52 | self.lineVisible = lvl.lineVisible 53 | self.labelVisible = lvl.labelVisible 54 | 55 | cdef class ColorMap: 56 | 57 | cdef public bool fillEnabled 58 | cdef public object levels 59 | 60 | cdef void copy(self, const objects.ColorMap *mp): 61 | self.fillEnabled = mp.fillEnabled 62 | self.levels = [] 63 | for i in xrange(mp.levels.size()): 64 | self.levels.append((mp.levels[i].first, makeColorMapLevel(mp.levels[i].second))) 65 | 66 | cdef class Window: 67 | 68 | cdef public string name, label 69 | cdef public int objectID 70 | cdef public bool hidden 71 | cdef public int state, title # enums 72 | cdef public object frameRect 73 | cdef public long creationDate, modificationDate 74 | 75 | cdef void copy(self, const objects.Window *wnd): 76 | self.name = wnd.name 77 | self.label = wnd.label 78 | self.objectID = wnd.objectID 79 | self.hidden = wnd.hidden 80 | self.state = wnd.state 81 | self.title = wnd.title 82 | self.frameRect = makeRect(wnd.frameRect) 83 | self.creationDate = wnd.creationDate 84 | self.modificationDate = wnd.modificationDate 85 | 86 | cdef class SpreadColumn: 87 | 88 | cdef public string name, command, comment 89 | cdef public int type, valueType, numericDisplayType # enums 90 | cdef public int valueTypeSpecification, significantDigits, decimalPlaces, width, index, colIndex, sheet 91 | cdef public object data 92 | 93 | cdef void copy(self, const objects.SpreadColumn *col): 94 | cdef const double *doublePointer 95 | cdef const string *stringPointer 96 | cdef double doubleValue 97 | cdef string stringValue 98 | self.name = col.name 99 | self.type = col.type 100 | self.valueType = col.valueType 101 | self.valueTypeSpecification = col.valueTypeSpecification 102 | self.significantDigits = col.significantDigits 103 | self.decimalPlaces = col.decimalPlaces 104 | self.numericDisplayType = col.numericDisplayType 105 | self.command = col.command 106 | self.comment = col.comment 107 | self.width = col.width 108 | self.index = col.index 109 | self.colIndex = col.colIndex 110 | self.sheet = col.sheet 111 | self.data = [] 112 | # data copying is... umm... complicated. 113 | # Because of FUCKING BOOST::VARIANT!11 114 | dataSize = col.data.size() 115 | for i in range(dataSize): 116 | doublePointer = objects.getDoubleFromVariant(&(col.data[i])) 117 | stringPointer = objects.getStringFromVariant(&(col.data[i])) 118 | if doublePointer: 119 | doubleValue = deref(doublePointer) 120 | self.data.append(float(doubleValue)) 121 | else: 122 | stringValue = deref(stringPointer) 123 | self.data.append(stringValue) 124 | 125 | cdef class SpreadSheet(Window): 126 | 127 | cdef public int maxRows, sheets 128 | cdef public bool loose 129 | cdef public object columns 130 | 131 | cdef void copy(self, const objects.Window *wnd): 132 | Window.copy(self, wnd) 133 | cdef const objects.SpreadSheet *sht = wnd 134 | self.maxRows = sht.maxRows 135 | self.loose = sht.loose 136 | self.sheets = sht.sheets 137 | self.columns = [makeSpreadColumn(sht.columns[i]) for i in xrange(sht.columns.size())] 138 | 139 | cdef class MatrixSheet: 140 | 141 | cdef public int rowCount, columnCount, valueTypeSpecification, significantDigits, decimalPlaces 142 | cdef public int numericDisplayType, view # enums 143 | cdef public string command, name 144 | cdef public int width, index, sheets 145 | cdef public object colorMap, data, coordinates 146 | 147 | cdef void copy(self, const objects.MatrixSheet *mtxsh): 148 | self.rowCount = mtxsh.rowCount 149 | self.columnCount = mtxsh.columnCount 150 | self.valueTypeSpecification = mtxsh.valueTypeSpecification 151 | self.significantDigits = mtxsh.significantDigits 152 | self.decimalPlaces = mtxsh.decimalPlaces 153 | self.numericDisplayType = mtxsh.numericDisplayType 154 | self.command = mtxsh.command 155 | self.name = mtxsh.name 156 | self.width = mtxsh.width 157 | self.index = mtxsh.index 158 | self.view = mtxsh.view 159 | self.colorMap = makeColorMap(mtxsh.colorMap) 160 | self.data = [mtxsh.data[i] for i in xrange(mtxsh.data.size())] 161 | self.coordinates = [mtxsh.coordinates[i] for i in xrange(mtxsh.coordinates.size())] 162 | 163 | cdef class Matrix(Window): 164 | 165 | cdef public int activeSheet 166 | cdef public int header # enums 167 | cdef public object sheets 168 | 169 | cdef void copy(self, const objects.Window *wnd): 170 | Window.copy(self, wnd) 171 | cdef const objects.Matrix *mtx = wnd 172 | self.header = mtx.header 173 | self.activeSheet = mtx.activeSheet 174 | self.sheets = [makeMatrixSheet(mtx.sheets[i]) for i in xrange(mtx.sheets.size())] 175 | 176 | cdef class Function: 177 | 178 | cdef public string name, formula 179 | cdef public int type # enum 180 | cdef public float begin, end 181 | cdef public int totalPoints, index 182 | 183 | cdef void copy(self, const objects.Function *f): 184 | self.name = f.name 185 | self.formula = f.formula 186 | self.type = f.type 187 | self.begin = f.begin 188 | self.end = f.end 189 | self.totalPoints = f.totalPoints 190 | self.index = f.index 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | cdef class TextBox: 200 | 201 | cdef public string text 202 | cdef public object clientRect, color 203 | cdef public int fontSize, rotation, tab 204 | cdef public int borderType, attach #enums 205 | 206 | cdef void copy(self, const objects.TextBox *tb): 207 | self.text = tb.text 208 | self.clientRect = makeRect(tb.clientRect) 209 | self.color = makeColor(tb.color) 210 | self.fontSize = tb.fontSize 211 | self.rotation = tb.rotation 212 | self.tab = tb.tab 213 | self.borderType = tb.borderType 214 | self.attach = tb.attach 215 | 216 | cdef class PieProperties: 217 | 218 | cdef public int viewAngle, thickness, rotation, radius, \ 219 | horizontalOffset, displacedSectionCount, displacement, distance 220 | cdef public bool clockwiseRotation, formatAutomatic, formatValues, formatPercentages, \ 221 | formatCategories, positionAssociate 222 | 223 | cdef void copy(self, const objects.PieProperties *arg): 224 | self.clockwiseRotation = arg.clockwiseRotation 225 | self.formatAutomatic = arg.formatAutomatic 226 | self.formatValues = arg.formatValues 227 | self.formatPercentages = arg.formatPercentages 228 | self.formatCategories = arg.formatCategories 229 | self.positionAssociate = arg.positionAssociate 230 | 231 | 232 | cdef class TextProperties: 233 | 234 | cdef public object color # Color 235 | cdef public bool fontBold, fontItalic, fontUnderline, whiteOut 236 | cdef public int justify # enum 237 | cdef public int rotation, xOffset, yOffset, fontSize 238 | 239 | cdef void copy(self, const objects.TextProperties *arg): 240 | self.color = makeColor(arg.color) 241 | self.fontBold = arg.fontBold 242 | self.fontItalic = arg.fontItalic 243 | self.fontUnderline = arg.fontUnderline 244 | self.whiteOut = arg.whiteOut 245 | self.justify = arg.justify 246 | self.rotation = arg.rotation 247 | self.xOffset = arg.xOffset 248 | self.yOffset = arg.yOffset 249 | self.fontSize = arg.fontSize 250 | 251 | 252 | cdef class VectorProperties: 253 | 254 | cdef public object color # Color 255 | cdef public float width, multiplier 256 | cdef public int arrowLength, arrowAngle, constAngle, constMagnitude # original arrowLength has a typo 257 | cdef public bool arrowClosed 258 | cdef public string endXColumnName, endYColumnName, angleColumnName, magnitudeColumnName 259 | 260 | cdef void copy(self, const objects.VectorProperties *arg): 261 | self.color = makeColor(arg.color) 262 | self.width = arg.width 263 | self.multiplier = arg.multiplier 264 | self.arrowClosed = arg.arrowClosed 265 | self.endXColumnName = arg.endXColumnName 266 | self.endYColumnName = arg.endYColumnName 267 | self.angleColumnName = arg.angleColumnName 268 | self.magnitudeColumnName = arg.magnitudeColumnName 269 | 270 | 271 | cdef class SurfaceColoration: 272 | 273 | cdef public bool fill, contour 274 | cdef public object lineColor # Color 275 | cdef public float lineWidth 276 | 277 | cdef void copy(self, const objects.SurfaceColoration *arg): 278 | self.fill = arg.fill 279 | self.contour = arg.contour 280 | self.lineColor = makeColor(arg.lineColor) 281 | self.lineWidth = arg.lineWidth 282 | 283 | 284 | cdef class SurfaceProperties: 285 | 286 | cdef public int type 287 | cdef public int grids # enum 288 | cdef public float gridLineWidth 289 | cdef public object gridColor, frontColor, backColor, xSideWallColor, ySideWallColor # Color 290 | cdef public object surface, topContour, bottomContour # SurfaceColoration 291 | cdef public object colorMap # ColorMap 292 | cdef public bool backColorEnabled, sideWallEnabled 293 | 294 | cdef void copy(self, const objects.SurfaceProperties *arg): 295 | self.type = arg.type 296 | self.grids = arg.grids 297 | self.gridLineWidth = arg.gridLineWidth 298 | self.gridColor = makeColor(arg.gridColor) 299 | self.frontColor = makeColor(arg.frontColor) 300 | self.backColor = makeColor(arg.backColor) 301 | self.xSideWallColor = makeColor(arg.xSideWallColor) 302 | self.ySideWallColor = makeColor(arg.ySideWallColor) 303 | self.surface = makeSurfaceColoration(arg.surface) 304 | self.topContour = makeSurfaceColoration(arg.topContour) 305 | self.bottomContour = makeSurfaceColoration(arg.bottomContour) 306 | self.colorMap = makeColorMap(arg.colorMap) 307 | self.backColorEnabled = arg.backColorEnabled 308 | self.sideWallEnabled = arg.sideWallEnabled 309 | 310 | 311 | cdef class PercentileProperties: 312 | 313 | cdef public int maxSymbolType, p99SymbolType, meanSymbolType, p1SymbolType, minSymbolType, \ 314 | symbolSize, boxRange, whiskersRange, labels 315 | cdef public object symbolColor, symbolFillColor # Color 316 | cdef public float boxCoeff, whiskersCoeff 317 | cdef public bool diamondBox 318 | 319 | cdef void copy(self, const objects.PercentileProperties *arg): 320 | self.maxSymbolType = arg.maxSymbolType 321 | self.p99SymbolType = arg.p99SymbolType 322 | self.meanSymbolType = arg.meanSymbolType 323 | self.p1SymbolType = arg.p1SymbolType 324 | self.minSymbolType = arg.minSymbolType 325 | self.boxRange = arg.boxRange 326 | self.whiskersRange = arg.whiskersRange 327 | self.symbolColor = makeColor(arg.symbolColor) 328 | self.symbolFillColor = makeColor(arg.symbolFillColor) 329 | self.boxCoeff = arg.boxCoeff 330 | self.whiskersCoeff = arg.whiskersCoeff 331 | self.diamondBox = arg.diamondBox 332 | self.labels = arg.labels 333 | 334 | 335 | cdef class GraphCurve: 336 | 337 | cdef public int type, lineTransparency, lineStyle, lineConnect, boxWidth, fillAreaType, fillAreaPattern, \ 338 | fillAreaTransparency, fillAreaPatternBorderStyle, symbolType, symbolFillTransparency, symbolThickness, pointOffset 339 | cdef public string dataName, xDataName, xColumnName, yColumnName, zColumnName 340 | cdef public object lineColor, fillAreaColor, fillAreaPatternColor, fillAreaPatternBorderColor, \ 341 | symbolColor, symbolFillColor # Color 342 | cdef public object pie, vector, text, surface, colorMap 343 | cdef public float lineWidth, fillAreaPatternWidth, fillAreaPatternBorderWidth, symbolSize 344 | cdef public bool hidden, fillArea, fillAreaWithLineTransparency, connectSymbols 345 | 346 | cdef void copy(self, const objects.GraphCurve *arg): 347 | self.hidden = arg.hidden 348 | self.type = arg.type 349 | self.lineStyle = arg.lineStyle 350 | self.lineTransparency = arg.lineTransparency 351 | self.lineConnect = arg.lineConnect 352 | self.boxWidth = arg.boxWidth 353 | self.fillAreaType = arg.fillAreaType 354 | self.fillAreaPattern = arg.fillAreaPattern 355 | self.fillAreaTransparency = arg.fillAreaTransparency 356 | self.fillAreaWithLineTransparency = arg.fillAreaWithLineTransparency 357 | self.symbolFillTransparency = arg.symbolFillTransparency 358 | self.symbolThickness = arg.symbolThickness 359 | self.pointOffset = arg.pointOffset 360 | self.dataName = arg.dataName 361 | self.xDataName = arg.xDataName 362 | self.xColumnName = arg.xColumnName 363 | self.yColumnName = arg.yColumnName 364 | self.zColumnName = arg.zColumnName 365 | self.lineColor = makeColor(arg.lineColor) 366 | self.fillAreaColor = makeColor(arg.fillAreaColor) 367 | self.fillAreaPatternColor = makeColor(arg.fillAreaPatternColor) 368 | self.fillAreaPatternBorderColor = makeColor(arg.fillAreaPatternBorderColor) 369 | self.symbolColor = makeColor(arg.symbolColor) 370 | self.symbolFillColor = makeColor(arg.symbolFillColor) 371 | self.pie = makePieProperties(arg.pie) 372 | self.vector = makeVectorProperties(arg.vector) 373 | self.text = makeTextProperties(arg.text) 374 | self.surface = makeSurfaceProperties(arg.surface) 375 | self.colorMap = makeColorMap(arg.colorMap) 376 | self.lineWidth = arg.lineWidth 377 | self.fillAreaPatternWidth = arg.fillAreaPatternWidth 378 | self.fillAreaPatternBorderWidth = arg.fillAreaPatternBorderWidth 379 | self.symbolSize = arg.symbolSize 380 | self.fillArea = arg.fillArea 381 | self.connectSymbols = arg.connectSymbols 382 | 383 | 384 | cdef class GraphAxisBreak: 385 | 386 | cdef public bool show, log10 387 | cdef public float gabFrom, to, position, scaleIncrementBefore, scaleIncrementAfter 388 | cdef public int minorTicksBefore, minorTicksAfter 389 | 390 | cdef void copy(self, const objects.GraphAxisBreak *arg): 391 | self.show = arg.show 392 | self.log10 = arg.log10 393 | self.gabFrom = arg.gabFrom 394 | self.to = arg.to 395 | self.position = arg.position 396 | self.scaleIncrementBefore = arg.scaleIncrementBefore 397 | self.scaleIncrementAfter = arg.scaleIncrementAfter 398 | self.minorTicksBefore = arg.minorTicksBefore 399 | self.minorTicksAfter = arg.minorTicksAfter 400 | 401 | 402 | cdef class GraphGrid: 403 | 404 | cdef public bool hidden 405 | cdef public int color, style 406 | cdef public float width 407 | 408 | cdef void copy(self, const objects.GraphGrid *arg): 409 | self.hidden = arg.hidden 410 | self.color = arg.color 411 | self.style = arg.style 412 | self.width = arg.width 413 | 414 | 415 | cdef class GraphAxisFormat: 416 | 417 | cdef public bool hidden 418 | cdef public int color, majorTicksType, minorTicksType, axisPosition 419 | cdef public float thickness, majorTickLength, axisPositionValue 420 | cdef public object label # TextBox 421 | cdef public string prefix, suffix, factor 422 | 423 | cdef void copy(self, const objects.GraphAxisFormat *arg): 424 | self.hidden = arg.hidden 425 | self.color = arg.color 426 | self.majorTicksType = arg.majorTicksType 427 | self.minorTicksType = arg.minorTicksType 428 | self.axisPosition = arg.axisPosition 429 | self.thickness = arg.thickness 430 | self.majorTickLength = arg.majorTickLength 431 | self.axisPositionValue = arg.axisPositionValue 432 | self.label = makeTextBox(arg.label) 433 | self.prefix = arg.prefix 434 | self.suffix = arg.suffix 435 | self.factor = arg.factor 436 | 437 | 438 | cdef class GraphAxisTick: 439 | 440 | cdef public bool showMajorLabels, fontBold 441 | cdef public int color, valueTypeSpecification, decimalPlaces, fontSize, rotation 442 | cdef public int valueType # enum 443 | cdef public string dataName, columnName 444 | 445 | cdef void copy(self, const objects.GraphAxisTick *arg): 446 | self.showMajorLabels = arg.showMajorLabels 447 | self.fontBold = arg.fontBold 448 | self.color = arg.color 449 | self.valueTypeSpecification = arg.valueTypeSpecification 450 | self.decimalPlaces = arg.decimalPlaces 451 | self.fontSize = arg.fontSize 452 | self.rotation = arg.rotation 453 | self.valueType = arg.valueType 454 | self.dataName = arg.dataName 455 | self.columnName = arg.columnName 456 | 457 | 458 | cdef class GraphAxis: 459 | 460 | cdef public int position # enum 461 | cdef public bool zeroLine, oppositeLine 462 | cdef public float min, max, step 463 | cdef public int majorTicks, minorTicks, scale 464 | cdef public object majorGrid, minorGrid # GraphGrid 465 | cdef public object formatAxis # GraphAxisFormat x 2 466 | cdef public object tickAxis # GraphAxisTick x 2 467 | 468 | cdef void copy(self, const objects.GraphAxis *arg): 469 | self.position = arg.position 470 | self.zeroLine = arg.zeroLine 471 | self.oppositeLine = arg.oppositeLine 472 | self.min = arg.min 473 | self.max = arg.max 474 | self.step = arg.step 475 | self.majorTicks = arg.majorTicks 476 | self.minorTicks = arg.minorTicks 477 | self.scale = arg.scale 478 | self.majorGrid = makeGraphGrid(arg.majorGrid) 479 | self.minorGrid = makeGraphGrid(arg.minorGrid) 480 | self.formatAxis = [makeGraphAxisFormat(arg.formatAxis[0]), makeGraphAxisFormat(arg.formatAxis[1])] 481 | self.tickAxis = [makeGraphAxisTick(arg.tickAxis[0]), makeGraphAxisTick(arg.tickAxis[1])] 482 | 483 | 484 | 485 | cdef class Figure: 486 | 487 | cdef public int type, attach # enums 488 | cdef public object clientRect # Rect 489 | cdef public object color, fillAreaColor, fillAreaPatternColor # Color 490 | cdef public int style, fillAreaPattern, 491 | cdef public float width, fillAreaPatternWidth 492 | cdef public bool useBorderColor 493 | 494 | cdef void copy(self, const objects.Figure *arg): 495 | self.type = arg.type 496 | self.attach = arg.attach 497 | self.clientRect = makeRect(arg.clientRect) 498 | self.color = makeColor(arg.color) 499 | self.fillAreaColor = makeColor(arg.fillAreaColor) 500 | self.fillAreaPatternColor = makeColor(arg.fillAreaPatternColor) 501 | self.width = arg.width 502 | self.fillAreaPatternWidth = arg.fillAreaPatternWidth 503 | self.useBorderColor = arg.useBorderColor 504 | 505 | 506 | cdef class LineVertex: 507 | 508 | cdef public int shapeType 509 | cdef public float shapeWidth, shapeLength, x, y 510 | 511 | cdef void copy(self, const objects.LineVertex *arg): 512 | self.shapeType = arg.shapeType 513 | self.shapeWidth = arg.shapeWidth 514 | self.shapeLength = arg.shapeLength 515 | self.x = arg.x 516 | self.y = arg.y 517 | 518 | 519 | cdef class Line: 520 | 521 | cdef public object clientRect # Rect 522 | cdef public object color # Color 523 | cdef public int attach # enum 524 | cdef public float width 525 | cdef public int style 526 | cdef public object begin, end # LineVertex 527 | 528 | cdef void copy(self, const objects.Line *arg): 529 | self.clientRect = makeRect(arg.clientRect) 530 | self.color = makeColor(arg.color) 531 | self.attach = arg.attach 532 | self.width = arg.width 533 | self.style = arg.style 534 | self.begin = makeLineVertex(arg.begin) 535 | self.end = makeLineVertex(arg.end) 536 | 537 | 538 | cdef class Bitmap: 539 | 540 | cdef public object clientRect # Rect 541 | cdef public int attach, borderType # enums 542 | cdef public int size 543 | cdef public string windowName 544 | cdef public object data 545 | 546 | cdef void copy(self, const objects.Bitmap *arg): 547 | self.clientRect = makeRect(arg.clientRect) 548 | self.attach = arg.attach 549 | self.borderType = arg.borderType 550 | self.size = arg.size 551 | self.windowName = arg.windowName 552 | self.data = [arg.data[i] for i in xrange(self.size)] 553 | 554 | 555 | cdef class ColorScale: 556 | 557 | cdef public bool visible, reverseOrder 558 | cdef public int labelGap, colorBarThickness 559 | cdef public object labelsColor # Color 560 | 561 | cdef void copy(self, const objects.ColorScale *arg): 562 | self.visible = arg.visible 563 | self.reverseOrder = arg.reverseOrder 564 | self.labelGap = arg.labelGap 565 | self.colorBarThickness = arg.colorBarThickness 566 | self.labelsColor = makeColor(arg.labelsColor) 567 | 568 | 569 | cdef class GraphLayer: 570 | 571 | cdef public object clientRect # Rect 572 | cdef public object legend # TextBox 573 | cdef public object backgroundColor # Color 574 | cdef public int borderType # enum 575 | cdef public int imageProfileTool, xOffset, yOffset 576 | cdef public object xAxis, yAxis, zAxis # GraphAxis 577 | cdef public object xAxisBreak, yAxisBreak, zAxisBreak # GraphAxisBreak 578 | cdef public float histogramBin, histogramBegin, histogramEnd, xAngle, yAngle, zAngle,\ 579 | xLength, yLength, zLength, vLine, hLine 580 | cdef public object percentile # PercentileProperties 581 | cdef public object colorScale # ColorScale 582 | cdef public object texts, pieTexts, lines, figures, bitmaps, curves 583 | cdef public bool isWaterfall, gridOnTop, exchangedAxes, isXYY3D, orthographic3D 584 | 585 | cdef void copy(self, const objects.GraphLayer *arg): 586 | self.clientRect = makeRect(arg.clientRect) 587 | self.legend = makeTextBox(arg.legend) 588 | self.backgroundColor = makeColor(arg.backgroundColor) 589 | self.borderType = arg.borderType 590 | self.xAxis = makeGraphAxis(arg.xAxis) 591 | self.yAxis = makeGraphAxis(arg.yAxis) 592 | self.zAxis = makeGraphAxis(arg.zAxis) 593 | self.xAxisBreak = makeGraphAxisBreak(arg.xAxisBreak) 594 | self.yAxisBreak = makeGraphAxisBreak(arg.yAxisBreak) 595 | self.zAxisBreak = makeGraphAxisBreak(arg.zAxisBreak) 596 | self.histogramBin = arg.histogramBin 597 | self.histogramBegin = arg.histogramBegin 598 | self.histogramEnd = arg.histogramEnd 599 | self.vLine = arg.vLine 600 | self.hLine = arg.hLine 601 | self.percentile = makePercentileProperties(arg.percentile) 602 | self.colorScale = makeColorScale(arg.colorScale) 603 | self.texts = [makeTextBox (arg.texts[i] ) for i in xrange(arg.texts.size() )] 604 | self.pieTexts = [makeTextBox (arg.pieTexts[i]) for i in xrange(arg.pieTexts.size())] 605 | self.lines = [makeLine (arg.lines[i] ) for i in xrange(arg.lines.size() )] 606 | self.figures = [makeFigure (arg.figures[i] ) for i in xrange(arg.figures.size() )] 607 | self.bitmaps = [makeBitmap (arg.bitmaps[i] ) for i in xrange(arg.bitmaps.size() )] 608 | self.curves = [makeGraphCurve(arg.curves[i] ) for i in xrange(arg.curves.size() )] 609 | self.xAngle = arg.xAngle 610 | self.yAngle = arg.yAngle 611 | self.zAngle = arg.zAngle 612 | self.xLength = arg.xLength 613 | self.yLength = arg.yLength 614 | self.zLength = arg.zLength 615 | self.imageProfileTool = arg.imageProfileTool 616 | self.isWaterfall = arg.isWaterfall 617 | self.xOffset = arg.xOffset 618 | self.yOffset = arg.yOffset 619 | self.gridOnTop = arg.gridOnTop 620 | self.exchangedAxes = arg.exchangedAxes 621 | self.isXYY3D = arg.isXYY3D 622 | self.orthographic3D = arg.orthographic3D 623 | 624 | 625 | cdef class GraphLayerRange: 626 | 627 | cdef public float min, max, step 628 | 629 | cdef void copy(self, const objects.GraphLayerRange *arg): 630 | self.min = arg.min 631 | self.max = arg.max 632 | self.step = arg.step 633 | 634 | cdef class Graph(Window): 635 | 636 | cdef public object layers 637 | cdef public int width, height 638 | cdef public bool is3D, isLayout, connectMissingData 639 | cdef public string templateName 640 | 641 | cdef void copy(self, const objects.Window *wnd): 642 | Window.copy(self, wnd) 643 | cdef const objects.Graph *grph = wnd 644 | self.layers = [makeGraphLayer(grph.layers[i]) for i in xrange(grph.layers.size())] 645 | self.width = grph.width 646 | self.height = grph.height 647 | self.is3D = grph.is3D 648 | self.isLayout = grph.isLayout 649 | self.connectMissingData = grph.connectMissingData 650 | self.templateName = grph.templateName 651 | 652 | cdef class Note(Window): 653 | 654 | cdef public string text 655 | 656 | cdef void copy(self, const objects.Window *wnd): 657 | Window.copy(self, wnd) 658 | cdef const objects.Note *nt = wnd 659 | self.text = nt.text 660 | 661 | cdef class ProjectNode: 662 | 663 | cdef public int type # enum 664 | cdef public string name 665 | cdef public int creationDate, modificationDate 666 | cdef public bool active 667 | 668 | cdef void copy(self, const objects.ProjectNode *pn): 669 | self.type = pn.type 670 | self.name = pn.name 671 | self.creationDate = pn.creationDate 672 | self.modificationDate = pn.modificationDate 673 | self.active = pn.active 674 | 675 | #################################################################################################### 676 | ########################################## ############################################ 677 | ######################################### Object makers ############################################ 678 | ######################################### ############################################# 679 | #################################################################################################### 680 | 681 | cdef makeColor(const objects.Color &arg): 682 | result = Color() 683 | result.copy(&arg) 684 | return result 685 | #if clr.cType == objects.ctRegular: # TODO: implement commented colors 686 | # result = [Qt.black, Qt.red, Qt.green, Qt.blue, Qt.cyan, Qt.magenta, Qt.yellow, Qt.darkYellow, 687 | # "Qt.navy", "Qt.purple", "Qt.wine", "Qt.olive", Qt.darkCyan, "Qt.royal", "Qt.orange", 688 | # "Qt.violet", "Qt.pink", Qt.white, Qt.lightGray, Qt.gray, "Qt.lightYellow", 689 | # "Qt.lightCyan", "Qt.lightMagenta", Qt.darkGray][clr.regular] # TODO: check which byte is used 690 | #elif clr.cType == objects.ctRGB: 691 | # result = QtGui.QColor(clr.custom[0], clr.custom[1], clr.custom[2]) 692 | #elif clr.cType == objects.ctNone: 693 | # result = None 694 | #elif clr.cType == objects.ctAutomatic: 695 | # result = "auto" 696 | #else: # TODO: other color objects 697 | # print "Unimplemented color: %d" % clr.cType 698 | # result = QtGui.QColor() 699 | #return result 700 | 701 | cdef makeRect(const objects.Rect &arg): 702 | result = Rect() 703 | result.copy(&arg) 704 | return result 705 | #return QtCore.QRect(QtCore.QPoint(arg.left, arg.top), QtCore.QPoint(arg.right, arg.bottom)) 706 | 707 | cdef makeColorMapLevel(const objects.ColorMapLevel &lvl): 708 | result = ColorMapLevel() 709 | result.copy(&lvl) 710 | return result 711 | 712 | cdef makeColorMap(const objects.ColorMap &mp): 713 | result = ColorMap() 714 | result.copy(&mp) 715 | return result 716 | 717 | cdef makeSpreadColumn(const objects.SpreadColumn &col): 718 | result = SpreadColumn() 719 | result.copy(&col) 720 | return result 721 | 722 | cdef makeSpreadSheet(const objects.SpreadSheet &sht): 723 | result = SpreadSheet() 724 | result.copy(&sht) 725 | print "Loading book #%d(%s/%s) (%d sheets, %d columns)" % (result.objectID, result.name, result.label.replace(b"\n", b""), result.sheets, len(result.columns)) 726 | return result 727 | 728 | cdef makeMatrixSheet(const objects.MatrixSheet &mtxsh): 729 | result = MatrixSheet() 730 | result.copy(&mtxsh) 731 | return result 732 | 733 | cdef makeMatrix(const objects.Matrix &mtx): 734 | result = Matrix() 735 | result.copy(&mtx) 736 | print "Loading matrix #%d(%s/%s)" % (result.objectID, result.name, result.label.replace(b"\n", b"")) 737 | return result 738 | 739 | cdef makeFunction(const objects.Function &f): 740 | result = Function() 741 | result.copy(&f) 742 | print "Loading function #%d(%s)" % (result.index, result.name) 743 | return result 744 | 745 | cdef makeTextBox(const objects.TextBox &arg): 746 | result = TextBox() 747 | result.copy(&arg) 748 | return result 749 | 750 | cdef makePieProperties(const objects.PieProperties &arg): 751 | result = PieProperties() 752 | result.copy(&arg) 753 | return result 754 | 755 | cdef makeVectorProperties(const objects.VectorProperties &arg): 756 | result = VectorProperties() 757 | result.copy(&arg) 758 | return result 759 | 760 | cdef makeTextProperties(const objects.TextProperties &arg): 761 | result = TextProperties() 762 | result.copy(&arg) 763 | return result 764 | 765 | cdef makeSurfaceColoration(const objects.SurfaceColoration &arg): 766 | result = SurfaceColoration() 767 | result.copy(&arg) 768 | return result 769 | 770 | cdef makeSurfaceProperties(const objects.SurfaceProperties &arg): 771 | result = SurfaceProperties() 772 | result.copy(&arg) 773 | return result 774 | 775 | cdef makePercentileProperties(const objects.PercentileProperties &arg): 776 | result = PercentileProperties() 777 | result.copy(&arg) 778 | return result 779 | 780 | cdef makeGraphCurve(const objects.GraphCurve &arg): 781 | result = GraphCurve() 782 | result.copy(&arg) 783 | return result 784 | 785 | cdef makeGraphAxisBreak(const objects.GraphAxisBreak &arg): 786 | result = GraphAxisBreak() 787 | result.copy(&arg) 788 | return result 789 | 790 | cdef makeGraphGrid(const objects.GraphGrid &arg): 791 | result = GraphGrid() 792 | result.copy(&arg) 793 | return result 794 | 795 | cdef makeGraphAxisFormat(const objects.GraphAxisFormat &arg): 796 | result = GraphAxisFormat() 797 | result.copy(&arg) 798 | return result 799 | 800 | cdef makeGraphAxisTick(const objects.GraphAxisTick &arg): 801 | result = GraphAxisTick() 802 | result.copy(&arg) 803 | return result 804 | 805 | cdef makeGraphAxis(const objects.GraphAxis &arg): 806 | result = GraphAxis() 807 | result.copy(&arg) 808 | return result 809 | 810 | cdef makeFigure(const objects.Figure &arg): 811 | result = Figure() 812 | result.copy(&arg) 813 | return result 814 | 815 | cdef makeLineVertex(const objects.LineVertex &arg): 816 | result = LineVertex() 817 | result.copy(&arg) 818 | return result 819 | 820 | cdef makeLine(const objects.Line &arg): 821 | result = Line() 822 | result.copy(&arg) 823 | return result 824 | 825 | cdef makeBitmap(const objects.Bitmap &arg): 826 | result = Bitmap() 827 | result.copy(&arg) 828 | return result 829 | 830 | cdef makeColorScale(const objects.ColorScale &arg): 831 | result = ColorScale() 832 | result.copy(&arg) 833 | return result 834 | 835 | cdef makeGraphLayer(const objects.GraphLayer &arg): 836 | result = GraphLayer() 837 | result.copy(&arg) 838 | return result 839 | 840 | cdef makeGraphLayerRange(const objects.GraphLayerRange &arg): 841 | result = GraphLayerRange() 842 | result.copy(&arg) 843 | return result 844 | 845 | cdef makeGraph(const objects.Graph &arg): 846 | result = Graph() 847 | result.copy(&arg) 848 | print "Loading graph #%d(%s/%s) (%d layers, 3D: %s)" % (result.objectID, result.name, result.label.replace(b"\n", b""), len(result.layers), result.is3D) 849 | return result 850 | 851 | cdef makeNote(const objects.Note &nt): 852 | result = Note() 853 | result.copy(&nt) 854 | print "Loading note #%d(%s/%s)" % (result.objectID, result.name, result.label.replace(b"\n", b"")) 855 | return result 856 | 857 | cdef makeProjectNode(const objects.ProjectNode &pn): 858 | result = ProjectNode() 859 | result.copy(&pn) 860 | return result 861 | 862 | cdef makeTreeNode(tree_node[objects.ProjectNode] *nd): 863 | cdef tree[objects.ProjectNode].leaf_iterator *it = new tree[objects.ProjectNode].leaf_iterator(nd) 864 | cdef tree[objects.ProjectNode].iterator_base *tmp = new tree[objects.ProjectNode].iterator_base(nd) 865 | numel = tmp.number_of_children() 866 | del tmp 867 | children = [] 868 | for i in xrange(numel): 869 | child = makeProjectNode(deref(deref(it))) 870 | print child.name 871 | children.append(child) 872 | cython.operator.preincrement(it) 873 | del it 874 | return children 875 | 876 | cdef makeTree(const tree[objects.ProjectNode] *tr): 877 | cdef tree[objects.ProjectNode].pre_order_iterator it = tr.begin() 878 | print "Going to pythonify tree with %d nodes." % tr.size() 879 | return makeTreeNode(it.node) 880 | 881 | 882 | #################################################################################################### 883 | ####################################### ############################################ 884 | ###################################### Python interface ############################################ 885 | ###################################### ############################################# 886 | #################################################################################################### 887 | 888 | cdef void cProgressCallback(double progress, void *user_data): 889 | pyProgressCallback = user_data 890 | if pyProgressCallback: 891 | pyProgressCallback(float(progress)) 892 | 893 | 894 | cdef void tell(int &objCount, int &objHandled, void *callback): 895 | cython.operator.preincrement(objHandled) 896 | if callback != NULL: 897 | pyCallback = callback 898 | # pyCallback(0.9 + 0.1 * (objHandled / float(objCount))) 899 | 900 | cdef getNodes(OriginFile *originFile, pyCallback): 901 | 902 | print "Origin file version: %g" % originFile.version() 903 | 904 | spreadCount = originFile.spreadCount() 905 | matrixCount = originFile.matrixCount() 906 | functionCount = originFile.functionCount() 907 | graphCount = originFile.graphCount() 908 | noteCount = originFile.noteCount() 909 | print spreadCount, matrixCount, functionCount, graphCount, noteCount 910 | cdef int objectsCount = spreadCount + matrixCount + functionCount + graphCount + noteCount 911 | cdef int objectsHandled = 0 912 | 913 | spreads, matrices, functions, graphs, notes = [], [], [], [], [] 914 | for i in xrange(spreadCount): 915 | spreads.append(makeSpreadSheet(originFile.spread(i))) 916 | tell(objectsCount, objectsHandled, pyCallback) 917 | matrices = [makeMatrix (originFile.matrix (i)) for i in xrange(matrixCount )] 918 | objectsHandled += matrixCount 919 | functions = [makeFunction (originFile.function(i)) for i in xrange(functionCount)] 920 | objectsHandled += functionCount 921 | for i in xrange(graphCount): 922 | graphs.append(makeGraph(originFile.graph(i))) 923 | tell(objectsCount, objectsHandled, pyCallback) 924 | notes = [makeNote (originFile.note (i)) for i in xrange(noteCount )] 925 | objectsHandled += noteCount 926 | 927 | #spreads = [makeSpreadSheet(originFile.spread (i)) for i in xrange(spreadCount )] 928 | #matrices = [makeMatrix (originFile.matrix (i)) for i in xrange(matrixCount )] 929 | #functions = [makeFunction (originFile.function(i)) for i in xrange(functionCount)] 930 | #graphs = [makeGraph (originFile.graph (i)) for i in xrange(graphCount )] 931 | #notes = [makeNote (originFile.note (i)) for i in xrange(noteCount )] 932 | #cdef const tree[objects.ProjectNode] *project = originFile.project() 933 | #tree = makeTree(project) 934 | return {'functions': functions, 935 | 'matrices': matrices, 936 | 'spreads': spreads, 937 | 'graphs': graphs, 938 | 'notes': notes} 939 | 940 | 941 | def parseOriginFile(filename, pyCallback=None): 942 | cdef OriginFile *originFile = new OriginFile(str.encode(filename)) 943 | cdef objects.ProgressCallback cCallback = cProgressCallback 944 | cdef void *pyCallbackPtr = pyCallback 945 | result = originFile.parse(cCallback, pyCallbackPtr) # FIXME: something is wrong here 946 | return result and getNodes(originFile, pyCallback) 947 | 948 | 949 | 950 | 951 | --------------------------------------------------------------------------------