00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #ifndef DrawingMetrics_INCLUDED
00032 #define DrawingMetrics_INCLUDED
00033
00034 #include <string>
00035 #include <set>
00036
00037 #include <ostream>
00038
00039 #include <iostream>
00040
00041 #include <iomanip>
00042 #include <sstream>
00043
00044 #include <string.h>
00045 #include <stdlib.h>
00046
00047 #include "DrawingColor.h"
00048 #include <vector>
00049
00050 class DrawingMetricsLoader;
00052
00053
00054
00056 class DrawingMedia{
00057 public:
00058
00059
00060
00061
00062 DrawingMedia(const char *name="a4",double width=210.0,double height=297.0,const char *unit="mm" );
00063 const std::string getName();
00064 const std::string getUnit();
00065 double getWidth() const;
00066 double getHeight() const;
00067
00068
00069
00070
00071 struct compare
00072 {
00073 bool operator()(const DrawingMedia & m1, const DrawingMedia & m2) const
00074 {
00075 return strcasecmp(m1._name.c_str(), m2._name.c_str() ) < 0;
00076 }
00077 };
00078
00079 private:
00080
00081 friend class DrawingMetricsLoader;
00082
00083 std::string _name;
00084 double _width;
00085 double _height;
00086 std::string _unit;
00087
00088 };
00089
00090
00092
00093
00094
00096 class DrawingMetrics
00097 {
00098 public:
00099
00100 private:
00101
00102 friend class DrawingMetricsLoader;
00103 friend class DrawingLabel;
00104
00105
00106
00107
00108 static std::string _unit;
00109
00110
00111
00112 static double _horizontalInterval;
00113 static double _iconInterval;
00114 static double _iconDiameter;
00115 static double _verticalDrop1;
00116 static double _verticalDrop2;
00117 static double _cellSpacing;
00118 static double _lineHeight;
00119 static double _yMaximum;
00120 static double _yMinimum;
00121 static double _labelMargin;
00122 static double _verticalTick;
00123
00124
00125
00126
00127 static double _lineWidth;
00128 static std::string _lineWidthUnit;
00129
00130
00131
00132 static std::string _fontFamily;
00133 static double _fontSize;
00134 static double _headerFontSize;
00135 static std::string _fontSizeUnit;
00136
00137 static double _scalingFactor;
00138 static double _pointsToMmConversionFactor;
00139
00140
00141
00142
00143 static bool _isEmbedded;
00144 static bool _displayBirthOrder;
00145 static bool _blackAndWhite;
00146 static bool _color;
00147 static bool _useQuadrantShadingMethod;
00148 static bool _noIconLabels;
00149 static bool _outputPedTable;
00150 static bool _outputDataTable;
00151
00152 static bool _noLabelTruncation;
00153
00154
00155
00156
00157
00158
00159 static std::string _drawingFileNamePrefix;
00160 static bool _hasOnlyOnePedigree;
00161
00162 public:
00163
00164 static std::set<DrawingMedia,DrawingMedia::compare> media;
00165
00166
00167
00168 static std::vector<DrawingColor> monochromat;
00169 static std::vector<DrawingColor> bichromat;
00170
00171 public:
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181 static double getHorizontalInterval();
00182 static double getIconInterval();
00183 static double getIconDiameter();
00184 static double getIconRadius();
00185 static double getVerticalDrop1();
00186 static double getVerticalDrop2();
00187 static double getVerticalTick();
00188
00189 static double getLineWidth();
00190 static std::string getLineWidthUnit();
00191
00192 static double getLineHeight();
00193 static double getLabelMargin();
00194 static double getScalingFactor();
00195 static double getPointsToMmConversionFactor();
00196 static void setIconInterval(double iconInterval);
00197 static DrawingMedia getDrawingMedia(std::string name);
00198
00199 static std::string getFontFamily();
00200 static double getFontSize();
00201 static double getHeaderFontSize();
00202 static std::string getFontSizeUnit();
00203
00204 static bool getEmbeddedState();
00205 static std::string getDrawingFileNamePrefix();
00206 static bool getHasOnlyOnePedigreeState();
00207 static bool getDisplayBirthOrder();
00208
00209 static bool getColor();
00210 static bool getBlackAndWhite();
00211 static bool getQuadrantShading();
00212 static bool getNoIconLabels();
00213 static bool getHasOutputPedTable();
00214 static bool getHasOutputDataTable();
00215
00216
00217
00218 static void setLineWidth(double lineWidth);
00219 static void setLineWidthUnit(const std::string lineWidthUnit);
00220
00221 static void setFontFamily(const std::string &fontFamily);
00222 static void setFontSize(double fontSize);
00223 static void setHeaderFontSize(double headerFontSize);
00224 static void setFontSizeUnit(const std::string &fontSizeUnit);
00225
00226 static void setLineMetrics(double lineHeight,double yMaximum,double yMinimum, unsigned labelCount );
00227
00228 static double getYMaximum();
00229 static double getYMinimum();
00230
00231 static void setEmbeddedState(bool isEmbedded);
00232 static void setDrawingFileNamePrefix(const std::string &prefix);
00233 static void setHasOnlyOnePedigreeState(bool hasOnlyOne);
00234 static void setDisplayBirthOrder(bool value);
00235
00236 static void setColor(bool value);
00237 static void setBlackAndWhite(bool value);
00238 static void setQuadrantShading(bool value);
00239 static void setNoIconLabels(bool value);
00240 static void setOutputPedTable(bool value);
00241 static void setOutputDataTable(bool value);
00242
00243
00244
00245
00246 static bool getNoLabelTruncation();
00247 static void setNoLabelTruncation(bool value);
00248
00249 };
00250
00252
00253
00254
00255
00256
00257
00258
00260 class DrawingMetricsLoader
00261 {
00262 public:
00263 static DrawingMetricsLoader drawingMetricsLoader;
00264 DrawingMetricsLoader(){
00265
00266
00267
00268
00269
00270
00271 DrawingMetrics::_unit = "mm";
00272
00273
00274
00275
00276
00277 DrawingMetrics::_horizontalInterval = 12;
00278 DrawingMetrics::_iconInterval = 2*DrawingMetrics::_horizontalInterval;
00279 DrawingMetrics::_iconDiameter = 6;
00280 DrawingMetrics::_verticalDrop1=30;
00281 DrawingMetrics::_verticalDrop2 = 7.5;
00282 DrawingMetrics::_cellSpacing = 1;
00283 DrawingMetrics::_lineHeight = 3;
00284 DrawingMetrics::_labelMargin = 1;
00285 DrawingMetrics::_verticalTick=1;
00286
00287
00288
00289
00290 DrawingMetrics::_lineWidth = 0.5;
00291 DrawingMetrics::_lineWidthUnit = "mm";
00292
00293
00294
00295
00296
00297
00298
00299 DrawingMetrics::_fontFamily = "DejaVu Sans";
00300 DrawingMetrics::_fontSize = 12;
00301 DrawingMetrics::_headerFontSize = 18;
00302 DrawingMetrics::_fontSizeUnit = "px";
00303
00304
00305
00306
00307 DrawingMetrics::_isEmbedded=false;
00308 DrawingMetrics::_displayBirthOrder=false;
00309
00310
00311
00312 DrawingMetrics::_blackAndWhite=false;
00313 DrawingMetrics::_color=false;
00314
00315
00316
00317
00318 DrawingMetrics::_useQuadrantShadingMethod=false;
00319
00320
00321
00322
00323
00324
00325 DrawingMetrics::_noIconLabels=false;
00326
00327
00328
00329
00330
00331 DrawingMetrics::_noLabelTruncation=false;
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345 DrawingMetrics::_scalingFactor = 3.78;
00346
00347
00348
00349
00350
00351
00352
00353
00354 DrawingMetrics::_pointsToMmConversionFactor = 0.3527777778;
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368
00369 DrawingMetrics::media.insert(DrawingMedia("4A0",1682,2378));
00370 DrawingMetrics::media.insert(DrawingMedia("2A0",1189,1682));
00371 DrawingMetrics::media.insert(DrawingMedia("A0",841,1189));
00372 DrawingMetrics::media.insert(DrawingMedia("A2",420,594));
00373 DrawingMetrics::media.insert(DrawingMedia("A3",297,420));
00374 DrawingMetrics::media.insert(DrawingMedia("A4",210,297));
00375 DrawingMetrics::media.insert(DrawingMedia("A5",148,210));
00376 DrawingMetrics::media.insert(DrawingMedia("A6",105,148));
00377 DrawingMetrics::media.insert(DrawingMedia("A7",74,105));
00378 DrawingMetrics::media.insert(DrawingMedia("A8",52,74));
00379 DrawingMetrics::media.insert(DrawingMedia("A9",37,52));
00380 DrawingMetrics::media.insert(DrawingMedia("A10",26,37));
00381 DrawingMetrics::media.insert(DrawingMedia("B0",1000,1414));
00382 DrawingMetrics::media.insert(DrawingMedia("B1",707,1000));
00383 DrawingMetrics::media.insert(DrawingMedia("B2",500,707));
00384 DrawingMetrics::media.insert(DrawingMedia("B3",353,500));
00385 DrawingMetrics::media.insert(DrawingMedia("B4",250,353));
00386 DrawingMetrics::media.insert(DrawingMedia("B5",176,250));
00387 DrawingMetrics::media.insert(DrawingMedia("B6",125,176));
00388 DrawingMetrics::media.insert(DrawingMedia("B7",88,125));
00389 DrawingMetrics::media.insert(DrawingMedia("B8",62,88));
00390 DrawingMetrics::media.insert(DrawingMedia("B9",44,62));
00391 DrawingMetrics::media.insert(DrawingMedia("B10",31,44));
00392 DrawingMetrics::media.insert(DrawingMedia("C0",917,1297));
00393 DrawingMetrics::media.insert(DrawingMedia("C1",648,917));
00394 DrawingMetrics::media.insert(DrawingMedia("C2",458,648));
00395 DrawingMetrics::media.insert(DrawingMedia("C3",324,458));
00396 DrawingMetrics::media.insert(DrawingMedia("C4",229,324));
00397 DrawingMetrics::media.insert(DrawingMedia("C5",162,229));
00398 DrawingMetrics::media.insert(DrawingMedia("C6",114,162));
00399 DrawingMetrics::media.insert(DrawingMedia("C7",81,114));
00400 DrawingMetrics::media.insert(DrawingMedia("C8",57,81));
00401 DrawingMetrics::media.insert(DrawingMedia("C9",40,57));
00402 DrawingMetrics::media.insert(DrawingMedia("C10",28,40));
00403
00404
00405
00406
00407 DrawingMetrics::media.insert(DrawingMedia("letter",216,279));
00408 DrawingMetrics::media.insert(DrawingMedia("legal",216,356));
00409 DrawingMetrics::media.insert(DrawingMedia("executive",190,254));
00410 DrawingMetrics::media.insert(DrawingMedia("ledger",279,432));
00411
00412
00413
00414
00415 DrawingMetrics::media.insert(DrawingMedia("VGA",640,480,"px"));
00416 DrawingMetrics::media.insert(DrawingMedia("SVGA",800,600,"px"));
00417 DrawingMetrics::media.insert(DrawingMedia("XGA",1024,768,"px"));
00418 DrawingMetrics::media.insert(DrawingMedia("SXGA",1280,1024,"px"));
00419 DrawingMetrics::media.insert(DrawingMedia("UXGA",1600,1200,"px"));
00420 DrawingMetrics::media.insert(DrawingMedia("WXGA",1366,768,"px"));
00421 DrawingMetrics::media.insert(DrawingMedia("WSXGA",1680,1050,"px"));
00422 DrawingMetrics::media.insert(DrawingMedia("WUXGA",1920,1200,"px"));
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432
00433
00434
00435
00436
00437
00438
00439
00440
00441
00442
00443
00444
00445 DrawingMetrics::monochromat.push_back(DrawingColor("navy","#0000a0"));
00446 DrawingMetrics::bichromat.push_back( DrawingColor("maize","#ffd803"));
00447 DrawingMetrics::monochromat.push_back(DrawingColor("red","#800"));
00448 DrawingMetrics::bichromat.push_back( DrawingColor("banana","#ffffa2"));
00449 DrawingMetrics::monochromat.push_back(DrawingColor("forest","#003f00"));
00450 DrawingMetrics::bichromat.push_back( DrawingColor("peach","#ffcca2"));
00451 DrawingMetrics::monochromat.push_back(DrawingColor("ceramicBlue","#768dff"));
00452 DrawingMetrics::bichromat.push_back( DrawingColor("lavender","#fcf"));
00453 }
00454 };
00455
00456 #endif