File indexing completed on 2025-04-20 03:32:16
0001 /* 0002 File : OriginObj.h 0003 Description : Origin internal object classes 0004 -------------------------------------------------------------------- 0005 SPDX-FileCopyrightText: 2005-2007, 2017 Stefan Gerlach 0006 SPDX-FileCopyrightText: 2007-2008 Alex Kargovsky <kargovsky*yumr.phys.msu.su> 0007 SPDX-FileCopyrightText: 2007-2008 Ion Vasilief <ion_vasilief*yahoo.fr> 0008 SPDX-License-Identifier: GPL-2.0-or-later 0009 */ 0010 0011 #ifndef ORIGIN_OBJ_H 0012 #define ORIGIN_OBJ_H 0013 0014 #include <cstring> 0015 #include <ctime> 0016 #include <vector> 0017 #include <string> 0018 0019 #if defined(_WIN32) && defined(ORIGIN_DLL) 0020 # ifdef ORIGIN_DLL_EXPORT 0021 # define ORIGIN_EXPORT __declspec(dllexport) 0022 # else 0023 # define ORIGIN_EXPORT __declspec(dllimport) 0024 # endif 0025 #else 0026 # define ORIGIN_EXPORT 0027 #endif 0028 0029 #define _ONAN (-1.23456789E-300) 0030 0031 namespace Origin { 0032 enum ValueType { 0033 Numeric = 0, 0034 Text = 1, 0035 Time = 2, 0036 Date = 3, 0037 Month = 4, 0038 Day = 5, 0039 ColumnHeading = 6, 0040 TickIndexedDataset = 7, 0041 TextNumeric = 9, 0042 Categorical = 10 0043 }; 0044 // Numeric Format: 0045 // 1000 | 1E3 | 1k | 1,000 0046 enum NumericFormat { Decimal = 0, Scientific = 1, Engineering = 2, DecimalWithMarks = 3 }; 0047 // Time Format: 0048 // hh:mm | hh | hh:mm:ss | hh:mm:ss.zz | hh ap | hh:mm ap | mm:ss 0049 // mm:ss.zz | hhmm | hhmmss | hh:mm:ss.zzz 0050 enum TimeFormat { 0051 TIME_HH_MM = 0, 0052 TIME_HH = 1, 0053 TIME_HH_MM_SS = 2, 0054 TIME_HH_MM_SS_ZZ = 3, 0055 TIME_HH_AP = 4, 0056 TIME_HH_MM_AP = 5, 0057 TIME_MM_SS = 6, 0058 TIME_MM_SS_ZZ = 7, 0059 TIME_HHMM = 8, 0060 TIME_HHMMSS = 9, 0061 TIME_HH_MM_SS_ZZZ = 10 0062 }; 0063 // Date Format: 0064 // dd/MM/yyyy | dd/MM/yyyy HH:mm | dd/MM/yyyy HH:mm:ss | dd.MM.yyyy | y. (year abbreviation) | MMM d 0065 // M/d | d | ddd | First letter of day | yyyy | yy | dd.MM.yyyy hh:mm | dd.MM.yyyy hh:mm:ss 0066 // yyMMdd | yyMMdd hh:mm | yyMMdd hh:mm:ss | yyMMdd hhmm | yyMMdd hhmmss | MMM 0067 // First letter of month | Quartal | M-d-yyyy (Custom1) | hh:mm:ss.zzzz (Custom2) 0068 enum DateFormat { 0069 DATE_DD_MM_YYYY = -128, 0070 DATE_DD_MM_YYYY_HH_MM = -119, 0071 DATE_DD_MM_YYYY_HH_MM_SS = -118, 0072 DATE_DDMMYYYY = 0, 0073 DATE_Y = 1, 0074 DATE_MMM_D = 2, 0075 DATE_M_D = 3, 0076 DATE_D = 4, 0077 DATE_DDD = 5, 0078 DATE_DAY_LETTER = 6, 0079 DATE_YYYY = 7, 0080 DATE_YY = 8, 0081 DATE_DDMMYYYY_HH_MM = 9, 0082 DATE_DDMMYYYY_HH_MM_SS = 10, 0083 DATE_YYMMDD = 11, 0084 DATE_YYMMDD_HH_MM = 12, 0085 DATE_YYMMDD_HH_MM_SS = 13, 0086 DATE_YYMMDD_HHMM = 14, 0087 DATE_YYMMDD_HHMMSS = 15, 0088 DATE_MMM = 16, 0089 DATE_MONTH_LETTER = 17, 0090 DATE_Q = 18, 0091 DATE_M_D_YYYY = 19, 0092 DATE_HH_MM_SS_ZZZZ = 20 0093 }; 0094 // Month Format: 0095 // MMM | MMMM | First letter of month 0096 enum MonthFormat { MONTH_MMM = 0, MONTH_MMMM = 1, MONTH_LETTER = 2 }; 0097 // ddd | dddd | First letter of day 0098 enum DayOfWeekFormat { DAY_DDD = 0, DAY_DDDD = 1, DAY_LETTER = 2 }; 0099 0100 enum NumericDisplayType { DefaultDecimalDigits = 0, DecimalPlaces = 1, SignificantDigits = 2 }; 0101 enum Attach { Frame = 0, Page = 1, Scale = 2, End_ }; 0102 enum BorderType { 0103 BlackLine = 0, 0104 Shadow = 1, 0105 DarkMarble = 2, 0106 WhiteOut = 3, 0107 BlackOut = 4, 0108 None = -1 0109 }; 0110 enum FillPattern { 0111 NoFill = 0, 0112 BDiagDense = 1, 0113 BDiagMedium = 2, 0114 BDiagSparse = 3, 0115 FDiagDense = 4, 0116 FDiagMedium = 5, 0117 FDiagSparse = 6, 0118 DiagCrossDense = 7, 0119 DiagCrossMedium = 8, 0120 DiagCrossSparse = 9, 0121 HorizontalDense = 10, 0122 HorizontalMedium = 11, 0123 HorizontalSparse = 12, 0124 VerticalDense = 13, 0125 VerticalMedium = 14, 0126 VerticalSparse = 15, 0127 CrossDense = 16, 0128 CrossMedium = 17, 0129 CrossSparse = 18 0130 }; 0131 enum ColorGradientDirection { 0132 NoGradient = 0, 0133 TopLeft = 1, 0134 Left = 2, 0135 BottomLeft = 3, 0136 Top = 4, 0137 Center = 5, 0138 Bottom = 6, 0139 TopRight = 7, 0140 Right = 8, 0141 BottomRight = 9 0142 }; 0143 0144 struct Color 0145 { 0146 enum ColorType { 0147 None = 0, 0148 Automatic = 1, 0149 Regular = 2, 0150 Custom = 3, 0151 Increment = 4, 0152 Indexing = 5, 0153 RGB = 6, 0154 Mapping = 7 0155 }; 0156 enum RegularColor { 0157 Black = 0, 0158 Red = 1, 0159 Green = 2, 0160 Blue = 3, 0161 Cyan = 4, 0162 Magenta = 5, 0163 Yellow = 6, 0164 DarkYellow = 7, 0165 Navy = 8, 0166 Purple = 9, 0167 Wine = 10, 0168 Olive = 11, 0169 DarkCyan = 12, 0170 Royal = 13, 0171 Orange = 14, 0172 Violet = 15, 0173 Pink = 16, 0174 White = 17, 0175 LightGray = 18, 0176 Gray = 19, 0177 LTYellow = 20, 0178 LTCyan = 21, 0179 LTMagenta = 22, 0180 DarkGray = 23, 0181 SpecialV7Axis = 0xF7 /*, Custom = 255*/ 0182 }; 0183 0184 ColorType type; 0185 union { 0186 unsigned char regular; 0187 unsigned char custom[3]; 0188 unsigned char starting; 0189 unsigned char column; 0190 }; 0191 }; 0192 0193 struct Rect 0194 { 0195 short left; 0196 short top; 0197 short right; 0198 short bottom; 0199 0200 Rect(short width = 0, short height = 0) : left(0), top(0), right(width), bottom(height){}; 0201 0202 int height() const { return bottom - top; }; 0203 0204 int width() const { return right - left; }; 0205 0206 bool isValid() const { return height() > 0 && width() > 0; } 0207 }; 0208 0209 struct ColorMapLevel 0210 { 0211 Color fillColor; 0212 unsigned char fillPattern; 0213 Color fillPatternColor; 0214 double fillPatternLineWidth; 0215 0216 bool lineVisible; 0217 Color lineColor; 0218 unsigned char lineStyle; 0219 double lineWidth; 0220 0221 bool labelVisible; 0222 }; 0223 0224 typedef std::vector<std::pair<double, ColorMapLevel>> ColorMapVector; 0225 0226 struct ColorMap 0227 { 0228 bool fillEnabled; 0229 ColorMapVector levels; 0230 }; 0231 0232 struct Window 0233 { 0234 enum State { Normal, Minimized, Maximized }; 0235 enum Title { Name, Label, Both }; 0236 0237 std::string name; 0238 std::string label; 0239 int objectID; 0240 bool hidden; 0241 State state; 0242 Title title; 0243 Rect frameRect; 0244 time_t creationDate; 0245 time_t modificationDate; 0246 ColorGradientDirection windowBackgroundColorGradient; 0247 Color windowBackgroundColorBase; 0248 Color windowBackgroundColorEnd; 0249 0250 Window(const std::string &_name = std::string(), const std::string &_label = std::string(), 0251 bool _hidden = false) 0252 : name(_name), 0253 label(_label), 0254 objectID(-1), 0255 hidden(_hidden), 0256 state(Normal), 0257 title(Both), 0258 creationDate(0), 0259 modificationDate(0), 0260 windowBackgroundColorGradient(NoGradient), 0261 windowBackgroundColorBase({ Color::Regular, { Color::White } }), 0262 windowBackgroundColorEnd({ Color::Regular, { Color::White } }){}; 0263 }; 0264 0265 // Variant type with boost-free functions 0266 // see 0267 // https://github.com/highperformancecoder/scidavis/commit/7c6e07dfad80dbe190af29ffa8a56c82a8aa9180 0268 // see https://www.ojdip.net/2013/10/implementing-a-variant-type-in-cpp/ 0269 // https://stackoverflow.com/questions/35648390/tagged-union-c 0270 // https://books.google.de/books?id=PSUNAAAAQBAJ&pg=PA217&lpg=PA217&dq=c%2B%2B+tagged+union+string&source=bl&ots=DqArIieZ8H&sig=k2a6okxxgUuEkLw48hFJChkIG9o&hl=en&sa=X&ved=0ahUKEwjylreR08DUAhWBVRoKHWPSBqE4ChDoAQhUMAg#v=onepage&q=c%2B%2B%20tagged%20union%20string&f=false 0271 typedef class Variant 0272 { 0273 public: 0274 enum vtype { V_DOUBLE, V_STRING }; 0275 vtype type() const { return m_type; } 0276 double as_double() const { return m_double; } 0277 const char *as_string() const { return m_string; } 0278 0279 Variant() { } 0280 Variant(const double d) : m_double(d) { } 0281 Variant(const std::string &s) : m_type(V_STRING) { asgString(s.c_str()); } 0282 0283 Variant(const Variant &v) : m_type(v.m_type) 0284 { 0285 switch (v.m_type) { 0286 case V_DOUBLE: 0287 m_double = v.m_double; 0288 break; 0289 case V_STRING: 0290 asgString(v.m_string); 0291 break; 0292 } 0293 } 0294 0295 Origin::Variant &operator=(const Origin::Variant &v) 0296 { 0297 if (m_type == V_STRING) 0298 delete[] m_string; 0299 0300 switch (v.m_type) { 0301 case V_DOUBLE: 0302 m_double = v.m_double; 0303 break; 0304 case V_STRING: 0305 asgString(v.m_string); 0306 break; 0307 } 0308 m_type = v.m_type; 0309 return *this; 0310 } 0311 0312 ~Variant() 0313 { 0314 // printf("~Variant()\n"); 0315 if (m_type == V_STRING) 0316 delete[] m_string; 0317 } 0318 0319 private: 0320 vtype m_type = V_DOUBLE; 0321 union { 0322 double m_double = 0.; 0323 char *m_string; 0324 }; 0325 void asgString(const char *x) 0326 { 0327 m_string = new char[strlen(x) + 1]; 0328 strcpy(m_string, x); 0329 } 0330 } variant; 0331 0332 struct SpreadColumn 0333 { 0334 enum ColumnType { X, Y, Z, XErr, YErr, Label, NONE }; 0335 0336 std::string name; 0337 std::string dataset_name; 0338 ColumnType type; 0339 ValueType valueType; 0340 int valueTypeSpecification; 0341 int significantDigits; 0342 int decimalPlaces; 0343 NumericDisplayType numericDisplayType; 0344 std::string command; 0345 std::string comment; 0346 int width; 0347 unsigned int index; 0348 unsigned int colIndex; 0349 unsigned int sheet; 0350 unsigned int numRows; 0351 unsigned int beginRow; 0352 unsigned int endRow; 0353 std::vector<variant> data; 0354 0355 SpreadColumn(const std::string &_name = std::string(), unsigned int _index = 0) 0356 : name(_name), 0357 type(ColumnType::Y), 0358 valueType(Numeric), 0359 valueTypeSpecification(0), 0360 significantDigits(6), 0361 decimalPlaces(6), 0362 numericDisplayType(DefaultDecimalDigits), 0363 width(8), 0364 index(_index), 0365 colIndex(0), 0366 sheet(0), 0367 numRows(0), 0368 beginRow(0), 0369 endRow(0){}; 0370 }; 0371 0372 struct SpreadSheet : public Window 0373 { 0374 unsigned int maxRows; 0375 bool loose; 0376 unsigned int sheets; 0377 std::vector<SpreadColumn> columns; 0378 0379 SpreadSheet(const std::string &_name = std::string()) 0380 : Window(_name), maxRows(30), loose(true), sheets(1){}; 0381 }; 0382 0383 struct Excel : public Window 0384 { 0385 unsigned int maxRows; 0386 bool loose; 0387 std::vector<SpreadSheet> sheets; 0388 0389 Excel(const std::string &_name = std::string(), const std::string &_label = std::string(), 0390 int _maxRows = 0, bool _hidden = false, bool _loose = true) 0391 : Window(_name, _label, _hidden), maxRows(_maxRows), loose(_loose){}; 0392 }; 0393 0394 struct MatrixSheet 0395 { 0396 enum ViewType { DataView, ImageView }; 0397 0398 std::string name; 0399 unsigned short rowCount; 0400 unsigned short columnCount; 0401 int valueTypeSpecification; 0402 int significantDigits; 0403 int decimalPlaces; 0404 NumericDisplayType numericDisplayType; 0405 std::string command; 0406 unsigned short width; 0407 unsigned int index; 0408 ViewType view; 0409 ColorMap colorMap; 0410 std::vector<double> data; 0411 std::vector<double> coordinates; 0412 0413 MatrixSheet(const std::string &_name = std::string(), unsigned int _index = 0) 0414 : name(_name), 0415 rowCount(8), 0416 columnCount(8), 0417 valueTypeSpecification(0), 0418 significantDigits(6), 0419 decimalPlaces(6), 0420 numericDisplayType(DefaultDecimalDigits), 0421 width(8), 0422 index(_index), 0423 view(DataView), 0424 colorMap() 0425 { 0426 coordinates.push_back(10.0); 0427 coordinates.push_back(10.0); 0428 coordinates.push_back(1.0); 0429 coordinates.push_back(1.0); 0430 }; 0431 }; 0432 0433 struct Matrix : public Window 0434 { 0435 enum HeaderViewType { ColumnRow, XY }; 0436 0437 unsigned int activeSheet; 0438 HeaderViewType header; 0439 std::vector<MatrixSheet> sheets; 0440 0441 Matrix(const std::string &_name = std::string()) 0442 : Window(_name), activeSheet(0), header(ColumnRow){}; 0443 }; 0444 0445 struct Function 0446 { 0447 enum FunctionType { Normal, Polar }; 0448 0449 std::string name; 0450 FunctionType type; 0451 std::string formula; 0452 double begin; 0453 double end; 0454 int totalPoints; 0455 unsigned int index; 0456 0457 Function(const std::string &_name = std::string(), unsigned int _index = 0) 0458 : name(_name), type(Normal), begin(0.0), end(0.0), totalPoints(0), index(_index){}; 0459 }; 0460 0461 struct TextBox 0462 { 0463 std::string text; 0464 Rect clientRect; 0465 Color color; 0466 unsigned short fontSize; 0467 int rotation; 0468 int tab; 0469 BorderType borderType; 0470 Attach attach; 0471 bool shown; 0472 0473 TextBox(const std::string &_text = std::string()) 0474 : text(_text), 0475 color({ Color::Regular, { Color::Black } }), 0476 fontSize(20), 0477 rotation(0), 0478 tab(8), 0479 borderType(BlackLine), 0480 attach(Frame), 0481 shown(true){}; 0482 0483 TextBox(const std::string &_text, Rect _clientRect, Color _color, unsigned short _fontSize, 0484 int _rotation, int _tab, BorderType _borderType, Attach _attach, bool _shown = true) 0485 : text(_text), 0486 clientRect(_clientRect), 0487 color(_color), 0488 fontSize(_fontSize), 0489 rotation(_rotation), 0490 tab(_tab), 0491 borderType(_borderType), 0492 attach(_attach), 0493 shown(_shown){}; 0494 }; 0495 0496 struct PieProperties 0497 { 0498 unsigned char viewAngle; 0499 unsigned char thickness; 0500 bool clockwiseRotation; 0501 short rotation; 0502 unsigned short radius; 0503 unsigned short horizontalOffset; 0504 unsigned long displacedSectionCount; // maximum - 32 sections 0505 unsigned short displacement; 0506 0507 // labels 0508 bool formatAutomatic; 0509 bool formatValues; 0510 bool formatPercentages; 0511 bool formatCategories; 0512 bool positionAssociate; 0513 unsigned short distance; 0514 0515 PieProperties() 0516 : viewAngle(33), 0517 thickness(33), 0518 clockwiseRotation(false), 0519 rotation(33), 0520 radius(70), 0521 horizontalOffset(0), 0522 displacedSectionCount(0), 0523 displacement(25), 0524 formatAutomatic(false), 0525 formatValues(false), 0526 formatPercentages(false), 0527 formatCategories(false), 0528 positionAssociate(false), 0529 distance(25){}; 0530 }; 0531 0532 struct VectorProperties 0533 { 0534 enum VectorPosition { Tail, Midpoint, Head }; 0535 0536 Color color; 0537 double width; 0538 unsigned short arrowLength; 0539 unsigned char arrowAngle; 0540 bool arrowClosed; 0541 std::string endXColumnName; 0542 std::string endYColumnName; 0543 0544 VectorPosition position; 0545 std::string angleColumnName; 0546 std::string magnitudeColumnName; 0547 float multiplier; 0548 int constAngle; 0549 int constMagnitude; 0550 0551 VectorProperties() 0552 : color({ Color::Regular, { Color::Black } }), 0553 width(2.0), 0554 arrowLength(45), 0555 arrowAngle(30), 0556 arrowClosed(false), 0557 position(Tail), 0558 multiplier(1.0), 0559 constAngle(0), 0560 constMagnitude(0){}; 0561 }; 0562 0563 struct TextProperties 0564 { 0565 enum Justify { Left, Center, Right }; 0566 0567 Color color; 0568 bool fontBold; 0569 bool fontItalic; 0570 bool fontUnderline; 0571 bool whiteOut; 0572 Justify justify; 0573 0574 short rotation; 0575 short xOffset; 0576 short yOffset; 0577 unsigned short fontSize; 0578 }; 0579 0580 struct SurfaceProperties 0581 { 0582 struct SurfaceColoration 0583 { 0584 bool fill; 0585 bool contour; 0586 Color lineColor; 0587 double lineWidth; 0588 }; 0589 0590 enum Type { ColorMap3D, ColorFill, WireFrame, Bars }; 0591 enum Grids { None, X, Y, XY }; 0592 0593 unsigned char type; 0594 Grids grids; 0595 double gridLineWidth; 0596 Color gridColor; 0597 0598 bool backColorEnabled; 0599 Color frontColor; 0600 Color backColor; 0601 0602 bool sideWallEnabled; 0603 Color xSideWallColor; 0604 Color ySideWallColor; 0605 0606 SurfaceColoration surface; 0607 SurfaceColoration topContour; 0608 SurfaceColoration bottomContour; 0609 0610 ColorMap colorMap; 0611 }; 0612 0613 struct PercentileProperties 0614 { 0615 unsigned char maxSymbolType; 0616 unsigned char p99SymbolType; 0617 unsigned char meanSymbolType; 0618 unsigned char p1SymbolType; 0619 unsigned char minSymbolType; 0620 Color symbolColor; 0621 Color symbolFillColor; 0622 unsigned short symbolSize; 0623 unsigned char boxRange; 0624 unsigned char whiskersRange; 0625 double boxCoeff; 0626 double whiskersCoeff; 0627 bool diamondBox; 0628 unsigned char labels; 0629 PercentileProperties() 0630 : maxSymbolType(1), 0631 p99SymbolType(2), 0632 meanSymbolType(3), 0633 p1SymbolType(4), 0634 minSymbolType(5), 0635 symbolColor({ Color::Regular, { Color::Black } }), 0636 symbolFillColor({ Color::Regular, { Color::White } }), 0637 symbolSize(5), 0638 boxRange(25), 0639 whiskersRange(5), 0640 boxCoeff(1.0), 0641 whiskersCoeff(1.5), 0642 diamondBox(true), 0643 labels(0){}; 0644 }; 0645 0646 struct GraphCurve 0647 { 0648 enum Plot { 0649 Scatter3D = 101, 0650 Surface3D = 103, 0651 Vector3D = 183, 0652 ScatterAndErrorBar3D = 184, 0653 TernaryContour = 185, 0654 PolarXrYTheta = 186, 0655 SmithChart = 191, 0656 Polar = 192, 0657 BubbleIndexed = 193, 0658 BubbleColorMapped = 194, 0659 Line = 200, 0660 Scatter = 201, 0661 LineSymbol = 202, 0662 Column = 203, 0663 Area = 204, 0664 HiLoClose = 205, 0665 Box = 206, 0666 ColumnFloat = 207, 0667 Vector = 208, 0668 PlotDot = 209, 0669 Wall3D = 210, 0670 Ribbon3D = 211, 0671 Bar3D = 212, 0672 ColumnStack = 213, 0673 AreaStack = 214, 0674 Bar = 215, 0675 BarStack = 216, 0676 FlowVector = 218, 0677 Histogram = 219, 0678 MatrixImage = 220, 0679 Pie = 225, 0680 Contour = 226, 0681 Unknown = 230, 0682 ErrorBar = 231, 0683 TextPlot = 232, 0684 XErrorBar = 233, 0685 SurfaceColorMap = 236, 0686 SurfaceColorFill = 237, 0687 SurfaceWireframe = 238, 0688 SurfaceBars = 239, 0689 Line3D = 240, 0690 Text3D = 241, 0691 Mesh3D = 242, 0692 XYZContour = 243, 0693 XYZTriangular = 245, 0694 LineSeries = 246, 0695 YErrorBar = 254, 0696 XYErrorBar = 255 0697 }; 0698 enum LineStyle { 0699 Solid = 0, 0700 Dash = 1, 0701 Dot = 2, 0702 DashDot = 3, 0703 DashDotDot = 4, 0704 ShortDash = 5, 0705 ShortDot = 6, 0706 ShortDashDot = 7 0707 }; 0708 enum LineConnect { 0709 NoLine = 0, 0710 Straight = 1, 0711 TwoPointSegment = 2, 0712 ThreePointSegment = 3, 0713 BSpline = 8, 0714 Spline = 9, 0715 StepHorizontal = 11, 0716 StepVertical = 12, 0717 StepHCenter = 13, 0718 StepVCenter = 14, 0719 Bezier = 15 0720 }; 0721 0722 bool hidden; 0723 unsigned char type; 0724 std::string dataName; 0725 std::string xDataName; 0726 std::string xColumnName; 0727 std::string yColumnName; 0728 std::string zColumnName; 0729 Color lineColor; 0730 unsigned char lineTransparency; 0731 unsigned char lineStyle; 0732 unsigned char lineConnect; 0733 unsigned char boxWidth; 0734 double lineWidth; 0735 0736 bool fillArea; 0737 unsigned char fillAreaType; 0738 unsigned char fillAreaPattern; 0739 Color fillAreaColor; 0740 unsigned char fillAreaTransparency; 0741 bool fillAreaWithLineTransparency; 0742 Color fillAreaPatternColor; 0743 double fillAreaPatternWidth; 0744 unsigned char fillAreaPatternBorderStyle; 0745 Color fillAreaPatternBorderColor; 0746 double fillAreaPatternBorderWidth; 0747 0748 unsigned char symbolInterior; 0749 unsigned char symbolShape; 0750 Color symbolColor; 0751 Color symbolFillColor; 0752 unsigned char symbolFillTransparency; 0753 double symbolSize; 0754 unsigned char symbolThickness; 0755 unsigned char pointOffset; 0756 0757 bool connectSymbols; 0758 0759 // pie 0760 PieProperties pie; 0761 0762 // vector 0763 VectorProperties vector; 0764 0765 // text 0766 TextProperties text; 0767 0768 // surface 0769 SurfaceProperties surface; 0770 0771 // contour 0772 ColorMap colorMap; 0773 }; 0774 0775 struct GraphAxisBreak 0776 { 0777 bool show; 0778 0779 bool log10; 0780 double from; 0781 double to; 0782 double position; 0783 0784 double scaleIncrementBefore; 0785 double scaleIncrementAfter; 0786 0787 unsigned char minorTicksBefore; 0788 unsigned char minorTicksAfter; 0789 0790 GraphAxisBreak() 0791 : show(false), 0792 log10(false), 0793 from(4.), 0794 to(6.), 0795 position(50.), 0796 scaleIncrementBefore(5), 0797 scaleIncrementAfter(5), 0798 minorTicksBefore(1), 0799 minorTicksAfter(1){}; 0800 }; 0801 0802 struct GraphGrid 0803 { 0804 bool hidden; 0805 unsigned char color; 0806 unsigned char style; 0807 double width; 0808 }; 0809 0810 struct GraphAxisFormat 0811 { 0812 bool hidden; 0813 unsigned char color; 0814 double thickness; 0815 double majorTickLength; 0816 int majorTicksType; 0817 int minorTicksType; 0818 int axisPosition; 0819 double axisPositionValue; 0820 TextBox label; 0821 std::string prefix; 0822 std::string suffix; 0823 std::string factor; 0824 }; 0825 0826 struct GraphAxisTick 0827 { 0828 bool showMajorLabels; 0829 unsigned char color; 0830 ValueType valueType; 0831 int valueTypeSpecification; 0832 int decimalPlaces; 0833 unsigned short fontSize; 0834 bool fontBold; 0835 std::string dataName; 0836 std::string columnName; 0837 int rotation; 0838 }; 0839 0840 struct GraphAxis 0841 { 0842 enum AxisPosition { Left = 0, Bottom, Right, Top, Front, Back }; 0843 enum Scale { 0844 Linear = 0, 0845 Log10 = 1, 0846 Probability = 2, 0847 Probit = 3, 0848 Reciprocal = 4, 0849 OffsetReciprocal = 5, 0850 Logit = 6, 0851 Ln = 7, 0852 Log2 = 8 0853 }; 0854 0855 AxisPosition position; 0856 bool zeroLine; 0857 bool oppositeLine; 0858 double min; 0859 double max; 0860 double step; 0861 double anchor; 0862 unsigned char majorTicks; 0863 unsigned char minorTicks; 0864 unsigned char scale; 0865 GraphGrid majorGrid; 0866 GraphGrid minorGrid; 0867 GraphAxisFormat formatAxis[2]; 0868 GraphAxisTick tickAxis[2]; // bottom-top, left-right 0869 }; 0870 0871 struct Figure 0872 { 0873 enum FigureType { Rectangle, Circle }; 0874 0875 FigureType type; 0876 Rect clientRect; 0877 Attach attach; 0878 Color color; 0879 unsigned char style; 0880 double width; 0881 Color fillAreaColor; 0882 unsigned char fillAreaPattern; 0883 Color fillAreaPatternColor; 0884 double fillAreaPatternWidth; 0885 bool useBorderColor; 0886 0887 Figure(FigureType _type = Rectangle) 0888 : type(_type), 0889 attach(Frame), 0890 color({ Color::Regular, { Color::Black } }), 0891 style(0), 0892 width(1.0), 0893 fillAreaColor({ Color::Regular, { Color::LightGray } }), 0894 fillAreaPattern(FillPattern::NoFill), 0895 fillAreaPatternColor({ Color::Regular, { Color::Black } }), 0896 fillAreaPatternWidth(1), 0897 useBorderColor(false){}; 0898 }; 0899 0900 struct LineVertex 0901 { 0902 unsigned char shapeType; 0903 double shapeWidth; 0904 double shapeLength; 0905 double x; 0906 double y; 0907 0908 LineVertex() : shapeType(0), shapeWidth(0.0), shapeLength(0.0), x(0.0), y(0.0){}; 0909 }; 0910 0911 struct Line 0912 { 0913 Rect clientRect; 0914 Color color; 0915 Attach attach; 0916 double width; 0917 unsigned char style; 0918 LineVertex begin; 0919 LineVertex end; 0920 }; 0921 0922 struct Bitmap 0923 { 0924 Rect clientRect; 0925 Attach attach; 0926 unsigned long size; 0927 std::string windowName; 0928 BorderType borderType; 0929 unsigned char *data; 0930 0931 Bitmap(const std::string &_name = std::string()) 0932 : attach(Frame), size(0), windowName(_name), borderType(BlackLine), data(nullptr){}; 0933 0934 Bitmap(const Bitmap &bitmap) 0935 : clientRect(bitmap.clientRect), 0936 attach(bitmap.attach), 0937 size(bitmap.size), 0938 windowName(bitmap.windowName), 0939 borderType(bitmap.borderType), 0940 data(nullptr) 0941 { 0942 if (size > 0) { 0943 data = new unsigned char[size]; 0944 memcpy(data, bitmap.data, size); 0945 } 0946 }; 0947 0948 ~Bitmap() 0949 { 0950 if (size > 0) 0951 delete[] data; 0952 }; 0953 }; 0954 0955 struct ColorScale 0956 { 0957 bool visible; 0958 bool reverseOrder; 0959 unsigned short labelGap; 0960 unsigned short colorBarThickness; 0961 Color labelsColor; 0962 ColorScale() 0963 : visible(true), 0964 reverseOrder(false), 0965 labelGap(5), 0966 colorBarThickness(3), 0967 labelsColor({ Color::Regular, { Color::Black } }){}; 0968 }; 0969 0970 struct GraphLayer 0971 { 0972 Rect clientRect; 0973 TextBox legend; 0974 Color backgroundColor; 0975 BorderType borderType; 0976 0977 GraphAxis xAxis; 0978 GraphAxis yAxis; 0979 GraphAxis zAxis; 0980 0981 GraphAxisBreak xAxisBreak; 0982 GraphAxisBreak yAxisBreak; 0983 GraphAxisBreak zAxisBreak; 0984 0985 double histogramBin; 0986 double histogramBegin; 0987 double histogramEnd; 0988 0989 PercentileProperties percentile; 0990 ColorScale colorScale; 0991 ColorMap colorMap; 0992 0993 std::vector<TextBox> texts; 0994 std::vector<TextBox> pieTexts; 0995 std::vector<Line> lines; 0996 std::vector<Figure> figures; 0997 std::vector<Bitmap> bitmaps; 0998 std::vector<GraphCurve> curves; 0999 1000 float xAngle; 1001 float yAngle; 1002 float zAngle; 1003 1004 float xLength; 1005 float yLength; 1006 float zLength; 1007 1008 int imageProfileTool; 1009 double vLine; 1010 double hLine; 1011 1012 bool isWaterfall; 1013 int xOffset; 1014 int yOffset; 1015 1016 bool gridOnTop; 1017 bool exchangedAxes; 1018 bool isXYY3D; 1019 bool orthographic3D; 1020 1021 GraphLayer() 1022 : backgroundColor({ Color::Regular, { Color::White } }), 1023 borderType(BlackLine), 1024 xAxis(), 1025 yAxis(), 1026 zAxis(), 1027 histogramBin(0.5), 1028 histogramBegin(0.0), 1029 histogramEnd(10.0), 1030 colorMap(), 1031 xAngle(0), 1032 yAngle(0), 1033 zAngle(0), 1034 xLength(10), 1035 yLength(10), 1036 zLength(10), 1037 imageProfileTool(0), 1038 vLine(0.0), 1039 hLine(0.0), 1040 isWaterfall(false), 1041 xOffset(10), 1042 yOffset(10), 1043 gridOnTop(false), 1044 exchangedAxes(false), 1045 isXYY3D(false), 1046 orthographic3D(false) 1047 { 1048 colorScale.visible = false; 1049 }; 1050 1051 // bool threeDimensional; 1052 bool is3D() const 1053 { 1054 for (auto &c : curves) { 1055 switch (c.type) { 1056 case GraphCurve::Scatter3D: 1057 case GraphCurve::Surface3D: 1058 case GraphCurve::Vector3D: 1059 case GraphCurve::ScatterAndErrorBar3D: 1060 case GraphCurve::TernaryContour: 1061 case GraphCurve::Line3D: 1062 case GraphCurve::Mesh3D: 1063 case GraphCurve::XYZContour: 1064 case GraphCurve::XYZTriangular: 1065 return true; 1066 default: 1067 break; 1068 } 1069 } 1070 return false; 1071 } 1072 }; 1073 1074 struct GraphLayerRange 1075 { 1076 double min; 1077 double max; 1078 double step; 1079 1080 GraphLayerRange(double _min = 0.0, double _max = 0.0, double _step = 0.0) 1081 : min(_min), max(_max), step(_step){}; 1082 }; 1083 1084 struct Graph : public Window 1085 { 1086 std::vector<GraphLayer> layers; 1087 unsigned short width; 1088 unsigned short height; 1089 bool is3D; 1090 bool isLayout; 1091 bool connectMissingData; 1092 std::string templateName; 1093 1094 Graph(const std::string &_name = std::string()) 1095 : Window(_name), 1096 width(400), 1097 height(300), 1098 is3D(false), 1099 isLayout(false), 1100 connectMissingData(false){}; 1101 }; 1102 1103 struct Note : public Window 1104 { 1105 std::string text; 1106 Note(const std::string &_name = std::string()) : Window(_name){}; 1107 }; 1108 1109 struct ProjectNode 1110 { 1111 enum NodeType { SpreadSheet, Matrix, Excel, Graph, Graph3D, Note, Folder }; 1112 1113 NodeType type; 1114 std::string name; 1115 time_t creationDate; 1116 time_t modificationDate; 1117 bool active; 1118 1119 ProjectNode(const std::string &_name = std::string(), NodeType _type = Folder, 1120 const time_t _creationDate = time(nullptr), 1121 const time_t _modificationDate = time(nullptr), bool _active = false) 1122 : type(_type), 1123 name(_name), 1124 creationDate(_creationDate), 1125 modificationDate(_modificationDate), 1126 active(_active){}; 1127 }; 1128 } 1129 1130 #endif // ORIGIN_OBJ_H