00001 /*---------------------------------------------------------------------+ 00002 | Library QgarLib, graphics analysis and recognition | 00003 | Copyright (C) 2002 Qgar Project, LORIA | 00004 | | 00005 | This library is free software; you can redistribute it and/or | 00006 | modify it under the terms of the GNU Lesser General Public | 00007 | License version 2.1, as published by the Free Software Foundation. | 00008 | | 00009 | This library is distributed in the hope that it will be useful, | 00010 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 00011 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 00012 | See the GNU Lesser General Public License for more details. | 00013 | | 00014 | The GNU Lesser General Public License is included in the file | 00015 | LICENSE.LGPL, in the root directory of the Qgar packaging. See | 00016 | http://www.gnu.org/licenses/lgpl.html for the terms of the licence. | 00017 | To receive a paper copy, write to the Free Software Foundation, | 00018 | Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. | 00019 | | 00020 | Contact Project Qgar for any information: | 00021 | LORIA - équipe Qgar | 00022 | B.P. 239, 54506 Vandoeuvre-lès-Nancy Cedex, France | 00023 | email: qgar-contact@loria.fr | 00024 | http://www.qgar.org/ | 00025 *---------------------------------------------------------------------*/ 00026 00027 00028 #ifndef __TGIFFILE_H_INCLUDED__ 00029 #define __TGIFFILE_H_INCLUDED__ 00030 00031 00032 /** 00033 * @file TgifFile.H 00034 * @brief Header file of class qgar::TgifFile. 00035 * 00036 * Adapted by Gerald Masini from the previous release 00037 * by Christian Ah-Soon and Karl Tombre. 00038 * 00039 * @author <a href="mailto:qgar-develop@loria.fr?subject=Qgar fwd Gerald Masini">Gérald Masini</a> 00040 * @date Jul, 3 2001 18:21 00041 * @since Qgar 1.0 00042 */ 00043 00044 // For RCS/CVS use: Do not delete 00045 /* $Id: TgifFile.H,v 1.19 2005/07/13 16:29:02 masini Exp $ */ 00046 00047 00048 00049 // QGAR 00050 #include <qgarlib/AbstractGraphicsFile.H> 00051 #include <qgarlib/ConnectedComponents.H> 00052 namespace qgar 00053 { 00054 // Avoid #include's when not necessary 00055 class BoundingBox; 00056 class Component; 00057 class QgarErrorDeveloper; 00058 template <class T> class AbstractGenPointChain; 00059 template <class T> class GenArc; 00060 template <class T> class GenPoint; 00061 template <class T> class GenPolyline; 00062 template <class T> class GenSegment; 00063 template <class T> class GenTreeNode; 00064 } 00065 00066 00067 00068 namespace qgar 00069 { 00070 00071 /** 00072 * @class TgifFile TgifFile.H "qgarlib/TgifFile.H" 00073 * @ingroup IO_FILE 00074 * @brief File including Tgif graphics 00075 * (designed for Tgif version 3.0, patchlevel 17). 00076 * 00077 * All information (coordinates, thickness, length, etc.) manipulated 00078 * by Tgif is integer (<b>int</b>). 00079 * 00080 * File extension must be <b>.obj</b>. 00081 * For more information about Tgif, see the 00082 * <a href="http://bourbon.cs.ucla.edu:8001/tgif/" target="_blank">Tgif home page</a>. 00083 * 00084 * When using X Window, your Tgif environment will be consistent with 00085 * that used in Qgar (especially for colors) if you initialize Tgif variables 00086 * in the <b>.Xdefaults</b> file of your home directory as follows: 00087 @verbatim 00088 Tgif*MaxColors: 20 00089 Tgif*Color0: #000000 00090 Tgif*Color1: #707070 00091 Tgif*Color2: #a0a0a0 00092 Tgif*Color3: #d0d0d0 00093 Tgif*Color4: #ffffff 00094 Tgif*Color5: #ff00ff 00095 Tgif*Color6: #cc00cc 00096 Tgif*Color7: #00ffff 00097 Tgif*Color8: #00aaee 00098 Tgif*Color9: #0000ff 00099 Tgif*Color10: #888800 00100 Tgif*Color11: #008800 00101 Tgif*Color12: #00ff00 00102 Tgif*Color13: #ffff00 00103 Tgif*Color14: #ff8000 00104 Tgif*Color15: #ff0000 00105 Tgif*Color16: #ff4080 00106 Tgif*Color17: #ff8080 00107 Tgif*Color18: #bb7020 00108 Tgif*Color19: #a02000 00109 Tgif*BackGround: white 00110 Tgif*Foreground: black 00111 Tgif*SplineTolerance: 13 00112 Tgif*InitialFont: Helvetica 00113 Tgif*InitialFontStyle: Roman 00114 Tgif*InitialFontJust: Center 00115 Tgif*InitialFontSize: 12 00116 Tgif*GridSystem: Metric 00117 Tgif*InitialGrid: -1 00118 Tgif*InitialSnapOn: false 00119 @endverbatim 00120 * 00121 * @warning 00122 * Functions to read a Tgif file (get Qgar objects from Tgif ones) 00123 * are not available. 00124 * 00125 * @author <a href="mailto:qgar-develop@loria.fr?subject=Qgar fwd Gerald Masini">Gerald Masini</a> 00126 * @date Jul, 3 2001 18:21 00127 * @since Qgar 1.0 00128 */ 00129 class TgifFile 00130 00131 : public AbstractGraphicsFile 00132 00133 { 00134 // ------------------------------------------------------------------- 00135 // P U B L I C M E M B E R S 00136 // ------------------------------------------------------------------- 00137 public: 00138 00139 /** @name Constructors */ 00140 // ============ 00141 //@{ 00142 00143 /** 00144 * @brief Initialize with given name. 00145 * 00146 * @warning A file must be opened to be used. 00147 */ 00148 TgifFile(char* aFileName); 00149 00150 //@} 00151 00152 00153 /** @name Destructor */ 00154 // ========== 00155 //@{ 00156 00157 /** 00158 * @brief Virtual destructor. 00159 */ 00160 virtual ~TgifFile(); 00161 00162 //@} 00163 00164 00165 // ------------------------------------------------------------------- 00166 // P U B L I C M E M B E R S : O U T P U T 00167 // ------------------------------------------------------------------- 00168 public: 00169 00170 // To bring (concrete) functions 'write' inherited from class 00171 // qgar::AbstractGraphicsFile into the scope of the class 00172 using AbstractGraphicsFile::write; 00173 00174 00175 /** @name Output points */ 00176 // ============= 00177 //@{ 00178 00179 /** 00180 * @brief Write a point with coordinates of type <b>int</b>. 00181 * 00182 * @param aPt a point 00183 * @param aThickness thickness of the drawing (default <b>3</b>) 00184 * @param aColor color of the drawing (default qgar::QGE_COLOR_DEFAULT) 00185 */ 00186 void write(const GenPoint<int>& aPt, 00187 int aThickness = 3, 00188 QGEcolor aColor = QGE_COLOR_DEFAULT); 00189 00190 /** 00191 * @brief Write a point with coordinates of type <b>float</b>. 00192 * 00193 * @param aPt a point 00194 * @param aThickness thickness of the drawing (default <b>3</b>) 00195 * @param aColor color of the drawing (default qgar::QGE_COLOR_DEFAULT) 00196 */ 00197 void write(const GenPoint<float>& aPt, 00198 int aThickness = 3, 00199 QGEcolor aColor = QGE_COLOR_DEFAULT); 00200 00201 /** 00202 * @brief Write a point with coordinates of type <b>double</b>. 00203 * 00204 * @param aPt a point 00205 * @param aThickness thickness of the drawing (default <b>3</b>) 00206 * @param aColor color of the drawing (default qgar::QGE_COLOR_DEFAULT) 00207 */ 00208 void write(const GenPoint<double>& aPt, 00209 int aThickness = 3, 00210 QGEcolor aColor = QGE_COLOR_DEFAULT); 00211 00212 //@} 00213 00214 00215 /** @name Output chains of points */ 00216 // ======================= 00217 //@{ 00218 00219 /** 00220 * @brief Write a chain of points with coordinates of type <b>int</b>. 00221 * 00222 * @param aChain a chain of points 00223 * @param aThickness thickness of the drawing (default <b>3</b>) 00224 * @param aColor color of the drawing (default qgar::QGE_COLOR_DEFAULT) 00225 * 00226 * @todo 00227 * Parameter <b>aChain</b> cannot be declared <b>const</b> because 00228 * functions qgar::AbstractGenPointChain::setToBegin 00229 * and qgar::AbstractGenPointChain::moveNext are not declared <b>const</b>. 00230 * In particular, their implementation in class qgar::GenLinkedChain modify 00231 * data member 00232 * qgar::GenLinkedChain::_iter, that should be declared as <b>mutable</b>. 00233 */ 00234 void write(AbstChain& aChain, 00235 int aThickness = 3, 00236 QGEcolor aColor = QGE_COLOR_DEFAULT); 00237 00238 /** 00239 * @brief Write a chain of points with coordinates of type <b>float</b>. 00240 * 00241 * @param aChain a chain of points 00242 * @param aThickness thickness of the drawing (default <b>3</b>) 00243 * @param aColor color of the drawing (default qgar::QGE_COLOR_DEFAULT) 00244 * 00245 * @todo 00246 * Parameter <b>aChain</b> cannot be declared <b>const</b> because 00247 * functions qgar::AbstractGenPointChain::setToBegin 00248 * and qgar::AbstractGenPointChain::moveNext are not declared <b>const</b>. 00249 * In particular, their implementation in class qgar::GenLinkedChain modify 00250 * data member 00251 * qgar::GenLinkedChain::_iter, that should be declared as <b>mutable</b>. 00252 */ 00253 void write(FAbstChain& aChain, 00254 int aThickness = 3, 00255 QGEcolor aColor = QGE_COLOR_DEFAULT); 00256 00257 /** 00258 * @brief Write a chain of points with coordinates of type <b>double</b>. 00259 * 00260 * @param aChain a chain of points 00261 * @param aThickness thickness of the drawing (default <b>3</b>) 00262 * @param aColor color of the drawing (default qgar::QGE_COLOR_DEFAULT) 00263 * 00264 * @todo 00265 * Parameter <b>aChain</b> cannot be declared <b>const</b> because 00266 * functions qgar::AbstractGenPointChain::setToBegin 00267 * and qgar::AbstractGenPointChain::moveNext are not declared <b>const</b>. 00268 * In particular, their implementation in class qgar::GenLinkedChain modify 00269 * data member 00270 * qgar::GenLinkedChain::_iter, that should be declared as <b>mutable</b>. 00271 */ 00272 void write(DAbstChain& aChain, 00273 int aThickness = 3, 00274 QGEcolor aColor = QGE_COLOR_DEFAULT); 00275 00276 //@} 00277 00278 00279 /** @name Output segments */ 00280 // =============== 00281 //@{ 00282 00283 /** 00284 * @brief Write a geometrical segment with coordinates of type <b>int</b>. 00285 * 00286 * @param aSeg a segment 00287 * @param aThickness thickness of the drawing (default <b>1</b>) 00288 * @param aColor color of the drawing (default qgar::QGE_COLOR_DEFAULT) 00289 * @param anOutline outline of the drawing (default qgar::QGE_OUTLINE_DEFAULT) 00290 */ 00291 void write(const GenSegment<int>& aSeg, 00292 int aThickness = 1, 00293 QGEcolor aColor = QGE_COLOR_DEFAULT, 00294 QGEoutline anOutline = QGE_OUTLINE_DEFAULT); 00295 00296 /** 00297 * @brief Write a geometrical segment with coordinates of type <b>float</b>. 00298 * 00299 * @param aSeg a segment 00300 * @param aThickness thickness of the drawing (default <b>1</b>) 00301 * @param aColor color of the drawing (default qgar::QGE_COLOR_DEFAULT) 00302 * @param anOutline outline of the drawing (default qgar::QGE_OUTLINE_DEFAULT) 00303 */ 00304 void write(const GenSegment<float>& aSeg, 00305 int aThickness = 1, 00306 QGEcolor aColor = QGE_COLOR_DEFAULT, 00307 QGEoutline anOutline = QGE_OUTLINE_DEFAULT); 00308 00309 /** 00310 * @brief Write a geometrical segment with coordinates of type <b>double</b>. 00311 * 00312 * @param aSeg a segment 00313 * @param aThickness thickness of the drawing (default <b>1</b>) 00314 * @param aColor color of the drawing (default qgar::QGE_COLOR_DEFAULT) 00315 * @param anOutline outline of the drawing (default qgar::QGE_OUTLINE_DEFAULT) 00316 */ 00317 void write(const GenSegment<double>& aSeg, 00318 int aThickness = 1, 00319 QGEcolor aColor = QGE_COLOR_DEFAULT, 00320 QGEoutline anOutline = QGE_OUTLINE_DEFAULT); 00321 00322 //@} 00323 00324 00325 /** @name Output circles and arcs of circle */ 00326 // ================================= 00327 //@{ 00328 00329 /** 00330 * @brief Write a circle with coordinates of type <b>int</b>. 00331 * 00332 * @param aCenter center of the circle 00333 * @param aRadius radius of the circle 00334 * @param aThickness thickness (default <b>1</b>) 00335 * @param aColor color (default qgar::QGE_COLOR_DEFAULT) 00336 * @param anOutline outline of the drawing (default qgar::QGE_OUTLINE_DEFAULT) 00337 */ 00338 void write(const GenPoint<int>& aCenter, 00339 double aRadius, 00340 int aThickness = 1, 00341 QGEcolor aColor = QGE_COLOR_DEFAULT, 00342 QGEoutline anOutline = QGE_OUTLINE_DEFAULT); 00343 00344 /** 00345 * @brief Write a circle with coordinates of type <b>float</b>. 00346 * 00347 * @param aCenter center of the circle 00348 * @param aRadius radius of the circle 00349 * @param aThickness thickness (default <b>1</b>) 00350 * @param aColor color (default qgar::QGE_COLOR_DEFAULT) 00351 * @param anOutline outline of the drawing (default qgar::QGE_OUTLINE_DEFAULT) 00352 */ 00353 void write(const GenPoint<float>& aCenter, 00354 double aRadius, 00355 int aThickness = 1, 00356 QGEcolor aColor = QGE_COLOR_DEFAULT, 00357 QGEoutline anOutline = QGE_OUTLINE_DEFAULT); 00358 00359 /** 00360 * @brief Write a circle with coordinates of type <b>double</b>. 00361 * 00362 * @param aCenter center of the circle 00363 * @param aRadius radius of the circle 00364 * @param aThickness thickness (default <b>1</b>) 00365 * @param aColor color (default qgar::QGE_COLOR_DEFAULT) 00366 * @param anOutline outline of the drawing (default qgar::QGE_OUTLINE_DEFAULT) 00367 */ 00368 void write(const GenPoint<double>& aCenter, 00369 double aRadius, 00370 int aThickness = 1, 00371 QGEcolor aColor = QGE_COLOR_DEFAULT, 00372 QGEoutline anOutline = QGE_OUTLINE_DEFAULT); 00373 00374 /** 00375 * @brief Write a geometrical arc with coordinates of type <b>int</b>. 00376 * 00377 * @param anArc a segment 00378 * @param aThickness thickness of the drawing (default <b>1</b>) 00379 * @param aColor color of the drawing (default qgar::QGE_COLOR_DEFAULT) 00380 * @param anOutline outline of the drawing (default qgar::QGE_OUTLINE_DEFAULT) 00381 */ 00382 void write(const GenArc<int>& anArc, 00383 int aThickness = 1, 00384 QGEcolor aColor = QGE_COLOR_DEFAULT, 00385 QGEoutline anOutline = QGE_OUTLINE_DEFAULT); 00386 00387 /** 00388 * @brief Write a geometrical arc with coordinates of type <b>float</b>. 00389 * 00390 * @param anArc a segment 00391 * @param aThickness thickness of the drawing (default <b>1</b>) 00392 * @param aColor color of the drawing (default qgar::QGE_COLOR_DEFAULT) 00393 * @param anOutline outline of the drawing (default qgar::QGE_OUTLINE_DEFAULT) 00394 */ 00395 void write(const GenArc<float>& anArc, 00396 int aThickness = 1, 00397 QGEcolor aColor = QGE_COLOR_DEFAULT, 00398 QGEoutline anOutline = QGE_OUTLINE_DEFAULT); 00399 00400 /** 00401 * @brief Write a geometrical arc with coordinates of type <b>double</b>. 00402 * 00403 * @param anArc a segment 00404 * @param aThickness thickness of the drawing (default <b>1</b>) 00405 * @param aColor color of the drawing (default qgar::QGE_COLOR_DEFAULT) 00406 * @param anOutline outline of the drawing (default qgar::QGE_OUTLINE_DEFAULT) 00407 */ 00408 void write(const GenArc<double>& anArc, 00409 int aThickness = 1, 00410 QGEcolor aColor = QGE_COLOR_DEFAULT, 00411 QGEoutline anOutline = QGE_OUTLINE_DEFAULT); 00412 00413 //@} 00414 00415 00416 /** @name Output polylines */ 00417 // ================ 00418 //@{ 00419 00420 /** 00421 * @brief Write a geometrical polyline with coordinates of type <b>int</b>. 00422 * 00423 * @param aPoly a polyline 00424 * @param aThickness thickness of the drawing (default <b>1</b>) 00425 * @param aColor color of the drawing (default qgar::QGE_COLOR_DEFAULT) 00426 * @param anOutline outline of the drawing (default qgar::QGE_OUTLINE_DEFAULT) 00427 */ 00428 void write(const GenPolyline<int>& aPoly, 00429 int aThickness = 1, 00430 QGEcolor aColor = QGE_COLOR_DEFAULT, 00431 QGEoutline anOutline = QGE_OUTLINE_DEFAULT); 00432 00433 /** 00434 * @brief Write a geometrical polyline with coordinates of type <b>float</b>. 00435 * 00436 * @param aPoly a polyline 00437 * @param aThickness thickness of the drawing (default <b>1</b>) 00438 * @param aColor color of the drawing (default qgar::QGE_COLOR_DEFAULT) 00439 * @param anOutline outline of the drawing (default qgar::QGE_OUTLINE_DEFAULT) 00440 */ 00441 void write(const GenPolyline<float>& aPoly, 00442 int aThickness = 1, 00443 QGEcolor aColor = QGE_COLOR_DEFAULT, 00444 QGEoutline anOutline = QGE_OUTLINE_DEFAULT); 00445 00446 /** 00447 * @brief Write a geometrical polyline with coordinates of type <b>double</b>. 00448 * 00449 * @param aPoly a polyline 00450 * @param aThickness thickness of the drawing (default <b>1</b>) 00451 * @param aColor color of the drawing (default qgar::QGE_COLOR_DEFAULT) 00452 * @param anOutline outline of the drawing (default qgar::QGE_OUTLINE_DEFAULT) 00453 */ 00454 void write(const GenPolyline<double>& aPoly, 00455 int aThickness = 1, 00456 QGEcolor aColor = QGE_COLOR_DEFAULT, 00457 QGEoutline anOutline = QGE_OUTLINE_DEFAULT); 00458 00459 //@} 00460 00461 00462 /** @name Output bounding boxes */ 00463 // ===================== 00464 //@{ 00465 00466 /** 00467 * @brief Write a bounding box with coordinates of type <b>int</b>. 00468 * 00469 * @param aBox a bounding box 00470 * @param aThickness thickness of the drawing (default <b>1</b>) 00471 * @param aColor color of the drawing (default qgar::QGE_COLOR_DEFAULT) 00472 * @param anOutline outline of the drawing (default qgar::QGE_OUTLINE_DEFAULT) 00473 */ 00474 void write(const BoundingBox& aBox, 00475 int aThickness = 1, 00476 QGEcolor aColor = QGE_COLOR_DEFAULT, 00477 QGEoutline anOutline = QGE_OUTLINE_DEFAULT); 00478 00479 //@} 00480 00481 00482 /** @name Output components */ 00483 // ================= 00484 //@{ 00485 00486 /** 00487 * @brief Write the contour of a (connected) component and of all 00488 * included components (i.e. children in the component tree). 00489 * 00490 * @param aPNode pointer to the node of the component tree 00491 * including the component 00492 * @param aThickness thickness of the drawing (default <b>1</b>) 00493 * @param aColor color of the drawing (default qgar::QGE_COLOR_DEFAULT) 00494 * @param anOutline outline of the drawing (default qgar::QGE_OUTLINE_DEFAULT) 00495 * 00496 * @see class qgar::Component 00497 */ 00498 void write(const ConnectedComponents::node_type* const aPNode, 00499 int aThickness = 1, 00500 QGEcolor aColor = QGE_COLOR_DEFAULT, 00501 QGEoutline anOutline = QGE_OUTLINE_DEFAULT); 00502 00503 //@} 00504 00505 00506 // ------------------------------------------------------------------- 00507 // P R O T E C T E D M E M B E R S 00508 // ------------------------------------------------------------------- 00509 protected: 00510 00511 00512 /** @name Tgif specific information */ 00513 // ========================= 00514 //@{ 00515 00516 /** 00517 * @brief Current Tgif version. 00518 */ 00519 static const char* _s_tgif_version; 00520 00521 /** 00522 * @brief Table of Tgif colors (see enum type qgar::QGEcolor). 00523 */ 00524 static const char* _s_tgif_colors[21]; 00525 00526 /** 00527 * @brief Table of Tgif outline types (see enum type qgar::QGEoutline). 00528 */ 00529 static const unsigned char _s_tgif_outlines[10]; 00530 00531 /** 00532 * @brief Tgif resolution: Number of pixels per inch. 00533 */ 00534 static const int _s_tgif_pix_per_inch; 00535 00536 /** 00537 * @brief Tgif A4 page width (in pixels). 00538 */ 00539 static const float _s_tgif_a4_page_width; 00540 00541 /** 00542 * @brief Tgif A4 page height (in pixels). 00543 */ 00544 static const float _s_tgif_a4_page_height; 00545 00546 /** 00547 * @brief Number of objects in the file. 00548 */ 00549 int _tgifObjectCnt; 00550 00551 //@} 00552 00553 00554 /** @name Output */ 00555 // ====== 00556 //@{ 00557 00558 /** 00559 * @brief Write file header. 00560 */ 00561 void writeHeader(); 00562 00563 /** 00564 * @brief Write file footer (nothing to do). 00565 */ 00566 void writeFooter(); 00567 00568 //@} 00569 00570 00571 /** @name Save predicates describing Tgif objects */ 00572 // ======================================= 00573 //@{ 00574 00575 /** 00576 * @brief Save the beginning part of the predicate 00577 * describing a Tgif polyline. 00578 * 00579 * @param aVerticesCnt number of vertices of the polyline 00580 * @param aColor color of the drawing 00581 */ 00582 void beginSavePoly(int aVerticesCnt, QGEcolor aColor); 00583 00584 /** 00585 * @brief Save the ending part of the predicate 00586 * describing a Tgif polyline. 00587 * 00588 * @param aVerticesCnt number of vertices of the polyline 00589 * @param aThickness thickness of the drawing 00590 * @param anOutline outline of the drawing 00591 */ 00592 void endSavePoly(int aVerticesCnt, 00593 int aThickness, 00594 QGEoutline anOutline); 00595 00596 /** 00597 * @brief Save the predicate describing a Tgif box. 00598 * 00599 * @param aXTopLeft X coordinate of top left point 00600 * @param aYTopLeft Y coordinate of top left point 00601 * @param aXBottomRight X coordinate of bottom right point 00602 * @param aYBottomRight Y coordinate of bottom right point 00603 * @param aThickness thickness of the drawing 00604 * @param aColor color of the drawing 00605 * @param anOutline outline of the drawing 00606 */ 00607 void saveBox(int aXTopLeft, 00608 int aYTopLeft, 00609 int aXBottomRight, 00610 int aYBottomRight, 00611 int aThickness, 00612 QGEcolor aColor, 00613 QGEoutline anOutline); 00614 00615 /** 00616 * @brief Save the predicate describing a Tgif circle. 00617 * 00618 * @param aXCenter X coordinate of the center 00619 * @param aYCenter Y coordinate of the center 00620 * @param aRadius radius 00621 * @param aThickness thickness of the drawing 00622 * @param aColor color of the drawing 00623 * @param anOutline outline of the drawing 00624 */ 00625 void saveCircle(int aXCenter, 00626 int aYCenter, 00627 int aRadius, 00628 int aThickness, 00629 QGEcolor aColor, 00630 QGEoutline anOutline); 00631 00632 /** 00633 * @brief Save the predicate describing a Tgif arc. 00634 * 00635 * @param aXSource X coordinate of source point 00636 * @param aYSource Y coordinate of source point 00637 * @param aXTarget X coordinate of target point 00638 * @param aYTarget Y coordinate of target point 00639 * @param aXCenter X coordinate of the center 00640 * @param aYCenter Y coordinate of the center 00641 * @param aSourceAngle angle at source point 00642 * @param aTargetAngle angle at target point 00643 * @param aRadius radius of the arc 00644 * @param aThickness thickness of the drawing 00645 * @param aColor color of the drawing 00646 * @param anOutline outline of the drawing 00647 */ 00648 void saveArc(int aXSource, 00649 int aYSource, 00650 int aXTarget, 00651 int aYTarget, 00652 int aXCenter, 00653 int aYCenter, 00654 int aSourceAngle, 00655 int aTargetAngle, 00656 int aRadius, 00657 int aThickness, 00658 QGEcolor aColor, 00659 QGEoutline anOutline); 00660 00661 /** 00662 * @brief Save the predicate describing a point. 00663 * 00664 * As a point is not a Tgif object, it is described by 00665 * a polyline including only one vertice (integer coordinates). 00666 * 00667 * @param aX X coordinate of the point 00668 * @param aY Y coordinate of the point 00669 * @param aThickness thickness of the drawing 00670 * @param aColor color of the drawing 00671 */ 00672 void savePoint(int aX, 00673 int aY, 00674 int aThickness, 00675 QGEcolor aColor); 00676 00677 /** 00678 * @brief Save the predicate describing a chain of points 00679 * with coordinates of type <b>T</b>. 00680 * 00681 * As points are not Tgif objects, the chain is described by 00682 * a polyline whose vertices are the points of the chain. 00683 * 00684 * @param aChain a chain 00685 * @param aThickness thickness of the drawing 00686 * @param aColor color of the drawing 00687 * 00688 * @todo 00689 * Argument <b>aChain</b> cannot be declared <b>const</b> 00690 * because iterating on a list occasions some modifications 00691 * in the list (see function <b>setInitialPosition()</b> of class 00692 * qgar::GenChain, for example). Class <b>AbstractGenPointChain</b> 00693 * and its descendants should be modified by declaring some data 00694 * members as <b>mutable</b>. 00695 */ 00696 template <class T> 00697 void 00698 saveChain(AbstractGenPointChain<T>& aChain, 00699 int aThickness, 00700 QGEcolor aColor); 00701 00702 /** 00703 * @brief Save the predicate describing a segment. 00704 * 00705 * As a segment is not a Tgif object, it is described 00706 * by a polyline including two points (the source and target 00707 * of the segment). 00708 * 00709 * @param aXSource X coordinate of the source point 00710 * @param aYSource Y coordinate of the source point 00711 * @param aXTarget X coordinate of the target point 00712 * @param aYTarget Y coordinate of the target point 00713 * @param aThickness thickness of the drawing 00714 * @param aColor color of the drawing 00715 * @param anOutline outline of the drawing 00716 */ 00717 void saveSegment(int aXSource, 00718 int aYSource, 00719 int aXTarget, 00720 int aYTarget, 00721 int aThickness, 00722 QGEcolor aColor, 00723 QGEoutline anOutline); 00724 00725 /** 00726 * @brief Save the predicate describing a polyline 00727 * with coordinates of type <b>T</b>. 00728 * 00729 * @param aPoly a polyline 00730 * @param aThickness thickness of the drawing 00731 * @param aColor color of the drawing 00732 * @param anOutline outline of the drawing 00733 */ 00734 template <class T> 00735 void 00736 savePolyline(const GenPolyline<T>& aPoly, 00737 int aThickness, 00738 QGEcolor aColor, 00739 QGEoutline anOutline); 00740 00741 //@} 00742 00743 00744 // ------------------------------------------------------------------- 00745 // P R I V A T E M E M B E R S 00746 // ------------------------------------------------------------------- 00747 private: 00748 00749 // ============================================================ 00750 /** @name Not yet implemented 00751 These functions belong to the private section 00752 as they are not yet implemented and thus should not be used. 00753 */ 00754 // ============================================================ 00755 //@{ 00756 00757 /** 00758 * @brief Read file header. 00759 * 00760 * @warning Not yet implemented. 00761 * @exception qgar::QgarErrorDeveloper (not yet implemented) 00762 * 00763 * @todo Implement qgar::TgifFile::readHeader() 00764 */ 00765 void readHeader() throw(QgarErrorDeveloper); 00766 00767 //@} 00768 00769 00770 /** @name AUXILIARIES */ 00771 // =========== 00772 //@{ 00773 00774 /** 00775 * @brief Write the contour of a (connected) component and of all 00776 * included components (i.e. children in the component tree). 00777 * 00778 * @param aPNode pointer to the node of the component tree 00779 * including the component 00780 * @param aThickness thickness of the drawing 00781 * @param aColor color of the drawing 00782 * @param anOutline outline of the drawing 00783 * 00784 * @see class qgar::Component 00785 */ 00786 void 00787 PRIVATEwriteComponent(const ConnectedComponents::node_type* const aPNode, 00788 int aThickness, 00789 QGEcolor aColor, 00790 QGEoutline anOutline); 00791 00792 //@} 00793 00794 00795 // ------------------------------------------------------------------- 00796 }; // class TgifFile 00797 00798 } // namespace qgar 00799 00800 00801 #endif /* __TGIFFILE_H_INCLUDED__ */