Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

_QGAR_AbstractGenQgarPrimitive.TCC

Go to the documentation of this file.
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 /**
00029  * @file   _QGAR_AbstractGenQgarPrimitive.TCC
00030  * @brief  Implementation of function members
00031  *         of class qgar::AbstractGenQgarPrimitive.
00032  *
00033  * @author <a href="mailto:qgar-develop@loria.fr?subject=Qgar fwd Gérald Masini">Gérald Masini</a>
00034  * @date   December 14, 2004  15:15
00035  * @since  Qgar 2.2
00036  */
00037 
00038 
00039 
00040 namespace qgar
00041 {
00042 
00043 
00044 // -------------------------------------------------------------------
00045 // JUST A FAKE CLASS (NOT DEFINED)
00046 // TO BE USED TO CAUSE COMPILATION ERRORS WHEN SOME TEMPLATE FUNCTION
00047 // CANNOT BE INSTANTIATED USING ANY TYPE
00048 // -------------------------------------------------------------------
00049 
00050 
00051 class TEMPLATE_FUNCTION_CANNOT_BE_INSTANTIATED_SEE_DOC;
00052 
00053 
00054 // -------------------------------------------------------------------
00055 // C O N S T R U C T O R S
00056 // -------------------------------------------------------------------
00057 
00058 
00059 // DEFAULT CONSTRUCTOR
00060 
00061 template <class T>
00062 AbstractGenQgarPrimitive<T>::AbstractGenQgarPrimitive(int        aThickness,
00063                                                       QGEcolor   aColor,
00064                                                       QGEoutline anOutline)
00065 
00066   : _thickness(aThickness),
00067     _color(aColor),
00068     _outline(anOutline)
00069 
00070 {
00071   // VOID
00072 }
00073 
00074 
00075 // COPY-CONSTRUCTOR
00076 
00077 template <class T>
00078 AbstractGenQgarPrimitive<T>::AbstractGenQgarPrimitive(const AbstractGenQgarPrimitive<T>& aQPrim)
00079 
00080   : _thickness(aQPrim._thickness),
00081     _color(aQPrim._color),
00082     _outline(aQPrim._outline)
00083 
00084 {
00085   // VOID
00086 }
00087 
00088 
00089 // -------------------------------------------------------------------
00090 // D E S T R U C T O R 
00091 // -------------------------------------------------------------------
00092 
00093 
00094 // VIRTUAL DESTRUCTOR
00095 
00096 template <class T>
00097 AbstractGenQgarPrimitive<T>::~AbstractGenQgarPrimitive()
00098 {
00099   // VOID
00100 }
00101 
00102 
00103 // -------------------------------------------------------------------
00104 // A C C E S S   T O   A T T R I B U T E S 
00105 // -------------------------------------------------------------------
00106 
00107 
00108 // GET THICKNESS
00109 
00110 template <class T>
00111 inline int
00112 AbstractGenQgarPrimitive<T>::thickness() const
00113 {
00114   return _thickness;
00115 }
00116 
00117 
00118 // GET COLOR
00119 
00120 template <class T>
00121 inline QGEcolor
00122 AbstractGenQgarPrimitive<T>::color() const
00123   {
00124     return _color;
00125   }
00126 
00127 
00128 // GET OUTLINE
00129 
00130 template <class T>
00131 inline QGEoutline
00132 AbstractGenQgarPrimitive<T>::outline() const
00133 {
00134   return _outline;
00135 }
00136 
00137 
00138 // -------------------------------------------------------------------
00139 // A C C E S S   T O   S O U R C E   A N D   T A R G E T 
00140 // -------------------------------------------------------------------
00141 
00142 
00143 // GET SOURCE POINT
00144 
00145 template <class T>
00146 inline const GenPoint<T>&
00147 AbstractGenQgarPrimitive<T>::accessSource() const
00148 {
00149   return accessGeomStructure().accessSource();
00150 }
00151 
00152 
00153 // GET A COPY OF THE SOURCE POINT
00154 
00155 template <class T>
00156 inline GenPoint<T>
00157 AbstractGenQgarPrimitive<T>::source() const
00158 {
00159   return accessGeomStructure().source();
00160 }
00161 
00162 
00163 // GET TARGET POINT
00164 
00165 template <class T>
00166 inline const GenPoint<T>&
00167 AbstractGenQgarPrimitive<T>::accessTarget() const
00168 {
00169   return accessGeomStructure().accessTarget();
00170 }
00171 
00172 
00173 // GET A COPY OF THE TARGET POINT
00174 
00175 template <class T>
00176 inline GenPoint<T>
00177 AbstractGenQgarPrimitive<T>::target() const
00178 {
00179   return accessGeomStructure().target();
00180 }
00181 
00182 
00183 // -------------------------------------------------------------------
00184 // A C C E S S   T O   S E P A R A T E   C O O R D I N A T E S 
00185 // -------------------------------------------------------------------
00186 
00187 
00188 // GET X COORDINATE OF THE SOURCE POINT
00189 
00190 template <class T>
00191 inline T
00192 AbstractGenQgarPrimitive<T>::xSource() const
00193 {
00194   return accessGeomStructure().xSource();
00195 }
00196 
00197 
00198 // GET X COORDINATE OF THE TARGET POINT
00199 
00200 template <class T>
00201 inline T
00202 AbstractGenQgarPrimitive<T>::xTarget() const
00203 {
00204   return accessGeomStructure().xTarget();
00205 }
00206 
00207 
00208 // GET Y COORDINATE OF THE SOURCE POINT
00209 
00210 template <class T>
00211 inline T
00212 AbstractGenQgarPrimitive<T>::ySource() const
00213 {
00214   return accessGeomStructure().ySource();
00215 }
00216 
00217 
00218 // GET Y COORDINATE OF THE TARGET POINT
00219 
00220 template <class T>
00221 inline T
00222 AbstractGenQgarPrimitive<T>::yTarget() const
00223 {
00224   return accessGeomStructure().yTarget();
00225 }
00226 
00227 
00228 // -------------------------------------------------------------------
00229 // ACCESS  TO  GEOMETRICAL  CHARACTERISTICS
00230 // -------------------------------------------------------------------
00231 
00232 
00233 // DIFFERENCE BETWEEN TARGET AND SOURCE X COORDINATES
00234 
00235 template <class T>
00236 inline T
00237 AbstractGenQgarPrimitive<T>::dx() const
00238 {
00239   return accessGeomStructure().dx();
00240 }
00241 
00242 
00243 // DIFFERENCE BETWEEN TARGET AND SOURCE Y COORDINATES
00244 
00245 template <class T>
00246 inline T
00247 AbstractGenQgarPrimitive<T>::dy() const
00248 {
00249   return accessGeomStructure().dy();
00250 }
00251 
00252 
00253 // -------------------------------------------------------------------
00254 // S E T   A T T R I B U T E S 
00255 // -------------------------------------------------------------------
00256 
00257 
00258 // SET THICKNESS
00259 
00260 template <class T>
00261 inline void
00262 AbstractGenQgarPrimitive<T>::setThickness(int aThickness)
00263 {
00264   _thickness = aThickness;
00265 }
00266 
00267 
00268 // SET COLOR
00269 
00270 template <class T>
00271 inline void
00272 AbstractGenQgarPrimitive<T>::setColor(QGEcolor aColor)
00273 {
00274   _color = aColor;
00275 }
00276 
00277 
00278 // SET OUTLINE
00279 
00280 template <class T>
00281 inline void
00282 AbstractGenQgarPrimitive<T>::setOutline(QGEoutline anOutline)
00283 {
00284   _outline = anOutline;
00285 }
00286 
00287 
00288 // -------------------------------------------------------------------
00289 // SET SOURCE AND/OR TARGET WITHOUT UPDATE
00290 // -------------------------------------------------------------------
00291 
00292 
00293 // SET SOURCE POINT
00294 
00295 
00296 template <class T>
00297 inline void
00298 AbstractGenQgarPrimitive<T>::setSource(T aX, T aY)
00299 {
00300   getGeomStructure().setSource(aX,aY);
00301 }
00302 
00303 
00304 template <class T>
00305 inline void
00306 AbstractGenQgarPrimitive<T>::setSource(const GenPoint<T>& aPt)
00307 {
00308   getGeomStructure().setSource(aPt);
00309 }
00310 
00311 
00312 // SET TARGET POINT
00313 
00314 
00315 template <class T>
00316 inline void
00317 AbstractGenQgarPrimitive<T>::setTarget(T aX, T aY)
00318 {
00319   getGeomStructure().setTarget(aX, aY);
00320 }
00321 
00322 
00323 template <class T>
00324 inline void
00325 AbstractGenQgarPrimitive<T>::setTarget(const GenPoint<T>& aPt)
00326 {
00327   getGeomStructure().setTarget(aPt);
00328 }
00329 
00330 
00331 // SET BOTH SOURCE AND TARGET POINTS
00332 
00333 
00334 template <class T>
00335 inline void
00336 AbstractGenQgarPrimitive<T>::setSourceTarget(T aXSource,
00337                                              T aYSource,
00338                                              T aXTarget,
00339                                              T aYTarget)
00340 {
00341   getGeomStructure().setSourceTarget(aXSource, aYSource, aXTarget, aYTarget);
00342 }
00343 
00344 
00345 template <class T>
00346 inline void
00347 AbstractGenQgarPrimitive<T>::setSourceTarget(const GenPoint<T>& aSource,
00348                                              const GenPoint<T>& aTarget)
00349 {
00350   getGeomStructure().setSourceTarget(aSource, aTarget);
00351 }
00352 
00353 
00354 // -------------------------------------------------------------------
00355 // SET SOURCE AND/OR TARGET WITH UPDATE
00356 // -------------------------------------------------------------------
00357 
00358 
00359 // SET SOURCE POINT
00360 
00361 
00362 template <class T>
00363 inline void
00364 AbstractGenQgarPrimitive<T>::fixSource(T aX, T aY)
00365 {
00366   getGeomStructure().fixSource(aX,aY);
00367 }
00368 
00369 
00370 template <class T>
00371 inline void
00372 AbstractGenQgarPrimitive<T>::fixSource(const GenPoint<T>& aPt)
00373 {
00374   getGeomStructure().fixSource(aPt);
00375 }
00376 
00377 
00378 // SET TARGET POINT
00379 
00380 
00381 template <class T>
00382 inline void
00383 AbstractGenQgarPrimitive<T>::fixTarget(T aX, T aY)
00384 {
00385   getGeomStructure().fixTarget(aX,aY);
00386 }
00387 
00388 
00389 template <class T>
00390 inline void
00391 AbstractGenQgarPrimitive<T>::fixTarget(const GenPoint<T>& aPt)
00392 {
00393   getGeomStructure().fixTarget(aPt);
00394 }
00395 
00396 
00397 // SET BOTH SOURCE AND TARGET POINTS
00398 
00399 
00400 template <class T>
00401 inline void
00402 AbstractGenQgarPrimitive<T>::fixSourceTarget(T aXSource,
00403                                              T aYSource,
00404                                              T aXTarget,
00405                                              T aYTarget)
00406 {
00407   getGeomStructure().fixSourceTarget(aXSource, aYSource, aXTarget, aYTarget);
00408 }
00409 
00410 
00411 template <class T>
00412 inline void
00413 AbstractGenQgarPrimitive<T>::fixSourceTarget(const GenPoint<T>& aSource,
00414                                              const GenPoint<T>& aTarget)
00415 {
00416   getGeomStructure().fixSourceTarget(aSource, aTarget);
00417 }
00418 
00419 
00420 // -------------------------------------------------------------------
00421 // SET SEPARATE COORDINATES WITHOUT UPDATE
00422 // -------------------------------------------------------------------
00423 
00424 
00425 // SET COORDINATES OF THE SOURCE POINT
00426 
00427 template <class T>
00428 inline void
00429 AbstractGenQgarPrimitive<T>::setXSource(T aX)
00430 {
00431   getGeomStructure().setXSource(aX);
00432 }
00433 
00434 
00435 // SET X COORDINATE OF THE TARGET POINT
00436 
00437 template <class T>
00438 inline void
00439 AbstractGenQgarPrimitive<T>::setXTarget(T aX)
00440 {
00441   getGeomStructure().setXTarget(aX);
00442 }
00443 
00444 
00445 // SET Y COORDINATE OF THE SOURCE POINT
00446 
00447 template <class T>
00448 inline void
00449 AbstractGenQgarPrimitive<T>::setYSource(T aY)
00450 {
00451   getGeomStructure().setYSource(aY);
00452 }
00453 
00454 
00455 // SET Y COORDINATE OF THE TARGET POINT
00456 
00457 template <class T>
00458 inline void
00459 AbstractGenQgarPrimitive<T>::setYTarget(T aY)
00460 {
00461   getGeomStructure().setYTarget(aY);
00462 }
00463 
00464 
00465 // -------------------------------------------------------------------
00466 // SET SEPARATE COORDINATES WITH UPDATE
00467 // -------------------------------------------------------------------
00468 
00469 
00470 // SET X COORDINATE OF THE SOURCE POINT
00471 
00472 template <class T>
00473 inline void
00474 AbstractGenQgarPrimitive<T>::fixXSource(T aX)
00475 {
00476   getGeomStructure().fixXSource(aX);
00477 }
00478 
00479 
00480 // SET X COORDINATE OF THE TARGET POINT
00481 
00482 template <class T>
00483 inline void
00484 AbstractGenQgarPrimitive<T>::fixXTarget(T aX)
00485 {
00486   getGeomStructure().fixXTarget(aX);
00487 }
00488 
00489 
00490 // SET Y COORDINATE OF THE SOURCE POINT
00491 
00492 template <class T>
00493 inline void
00494 AbstractGenQgarPrimitive<T>::fixYSource(T aY)
00495 {
00496   getGeomStructure().fixYSource(aY);
00497 }
00498 
00499 
00500 // SET Y COORDINATE OF THE TARGET POINT
00501 
00502 template <class T>
00503 inline void
00504 AbstractGenQgarPrimitive<T>::fixYTarget(T aY)
00505 {
00506   getGeomStructure().fixYTarget(aY);
00507 }
00508 
00509 
00510 // -------------------------------------------------------------------
00511 // O P E R A T O R S 
00512 // -------------------------------------------------------------------
00513 
00514 
00515 // ASSIGNMENT
00516 
00517 template <class T>
00518 AbstractGenQgarPrimitive<T>&
00519 AbstractGenQgarPrimitive<T>::operator=(const AbstractGenQgarPrimitive<T>& aQPrim)
00520 {
00521   // Are left hand side and right hand side different objects?
00522   if (this != &aQPrim)
00523     {
00524       _thickness = aQPrim._thickness;
00525       _color     = aQPrim._color;
00526       _outline   = aQPrim._outline;
00527     }
00528   return *this;
00529 }
00530 
00531 
00532 // -------------------------------------------------------------------
00533 // G E O M E T R Y :   T R A N S L A T I O N 
00534 // -------------------------------------------------------------------
00535 
00536 
00537 // TRANSLATE ALONG Y AND Y AXIS
00538 
00539 
00540 template <class T>
00541 inline void
00542 AbstractGenQgarPrimitive<T>::translate(T aTransX, T aTransY)
00543 {
00544   (this->getGeomStructure()).translate(aTransX, aTransY);
00545 }
00546 
00547 
00548 
00549 
00550 // // -------------------------------------------------------------------
00551 // // G E O M E T R Y :   S Y M M E T R Y 
00552 // // -------------------------------------------------------------------
00553 
00554 
00555 // // TRANSFORM CURRENT PRIMITIVE INTO ITS SYMMETRICAL PRIMITIVE
00556 // // RELATIVELY TO THE POINT OF GIVEN COORDINATES
00557 
00558 
00559 // template <class T>
00560 // inline void
00561 // AbstractGenPrimitive<T>::symmetry(T aX, T aY)
00562 // {
00563 //   (this->getGeomStructure()).symmetry(aX,aY);
00564 // }
00565 
00566 
00567 // // TRANSFORM CURRENT PRIMITIVE INTO ITS SYMMETRICAL PRIMITIVE
00568 // // RELATIVELY TO THE GIVEN CENTER
00569 
00570 
00571 // template <class T>
00572 // inline void
00573 // AbstractGenPrimitive<T>::symmetry(const GenPoint<T>& aCenter)
00574 // {
00575 //   (this->getGeomStructure()).qgSymmetry(aCenter);
00576 // }
00577 
00578 
00579 // // TRANSFORM CURRENT PRIMITIVE INTO ITS SYMMETRICAL PRIMITIVE
00580 // // RELATIVELY TO THE LINE SUPPORTING THE GIVEN SEGMENT
00581 
00582 // // WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
00583 // // W                                                                 W
00584 // // W WARNING: THESE FUNCTIONS APPLY TO POINTS WITH COORDINATES       W
00585 // // W          OF TYPE DOUBLE ONLY                                    W
00586 // // W                                                                 W
00587 // // WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
00588 
00589 
00590 // // TRANSFORM CURRENT PRIMITIVE INTO ITS SYMMETRICAL PRIMITIVE
00591 // // RELATIVELY TO THE LINE PASSING THROUGH THE GIVEN POINTS
00592 
00593 
00594 // template <>
00595 // void
00596 // AbstractGenPrimitive<double>::symmetry(const GenSegment<double>& aPt1,
00597 //                                     const GenSegment<double>& aPt2)
00598 // {
00599 //   (this->getGeomStructure()).symmetry(aPt1,aPt2);
00600 // }
00601 
00602 
00603 // template <class T>
00604 // void
00605 // AbstractGenPrimitive<T>::symmetry(const GenSegment<double>& aSeg)
00606 // {
00607 //   TEMPLATE_FUNCTION_CANNOT_BE_INSTANTIATED_SEE_DOC();
00608 // }
00609 
00610 
00611 // // TRANSFORM CURRENT PRIMITIVE INTO ITS SYMMETRICAL PRIMITIVE
00612 // // RELATIVELY TO THE LINE SUPPORTING THE GIVEN SEGMENT
00613 
00614 
00615 // template <>
00616 // void
00617 // AbstractGenPrimitive<double>::symmetry(const GenSegment<double>& aSeg)
00618 // {
00619 //   (this->getGeomStructure()).symmetry(aSeg);
00620 // }
00621 
00622 
00623 // template <class T>
00624 // void
00625 // AbstractGenPrimitive<T>::symmetry(const GenSegment<double>& aSeg)
00626 // {
00627 //   TEMPLATE_FUNCTION_CANNOT_BE_INSTANTIATED_SEE_DOC();
00628 // }
00629 
00630 
00631 // -------------------------------------------------------------------
00632 
00633 
00634 } // namespace qgar