00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 #include <iostream>
00041 #include <cmath>
00042
00043 #include <qgarlib/ISerializable.H>
00044
00045
00046
00047 namespace qgar
00048 {
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058 template <class T>
00059 GenQgarArc<T>::GenQgarArc(int aThickness,
00060 QGEcolor aColor,
00061 QGEoutline anOutline)
00062
00063 : AbstractGenQgarPrimitive<T>(aThickness, aColor, anOutline),
00064 _geomStructure(GenPoint<T>(static_cast<T>(0),static_cast<T>(0)),
00065 GenPoint<T>(static_cast<T>(0),static_cast<T>(0)),
00066 GenPoint<T>(static_cast<T>(0),static_cast<T>(0)))
00067
00068 {
00069
00070 }
00071
00072
00073
00074
00075 template <class T>
00076 GenQgarArc<T>::GenQgarArc(const GenQgarArc<T>& aQArc)
00077
00078 : AbstractGenQgarPrimitive<T>(aQArc._thickness,
00079 aQArc._color,
00080 aQArc._outline),
00081 _geomStructure(aQArc._geomStructure)
00082
00083 {
00084
00085 }
00086
00087
00088
00089
00090 template <class T>
00091 GenQgarArc<T>::GenQgarArc(const GenArc<T>& anArc,
00092 int aThickness,
00093 QGEcolor aColor,
00094 QGEoutline anOutline)
00095
00096 : AbstractGenQgarPrimitive<T>(aThickness, aColor, anOutline),
00097 _geomStructure(anArc)
00098
00099 {
00100
00101 }
00102
00103
00104
00105
00106 template <class T>
00107 GenQgarArc<T>::GenQgarArc(const GenPoint<T>& aSource,
00108 const GenPoint<T>& aTarget,
00109 const GenPoint<T>& aCenter,
00110 int aThickness,
00111 QGEcolor aColor,
00112 QGEoutline anOutline)
00113
00114 : AbstractGenQgarPrimitive<T>(aThickness, aColor, anOutline),
00115 _geomStructure(aSource, aTarget, aCenter)
00116
00117 {
00118
00119 }
00120
00121
00122
00123
00124
00125
00126
00127 template <class T>
00128 GenQgarArc<T>::~GenQgarArc()
00129 {
00130
00131 }
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141 template <class T>
00142 GenQgarArc<T>&
00143 GenQgarArc<T>::operator=(const GenQgarArc<T>& aQArc)
00144 {
00145
00146 if (this != &aQArc)
00147 {
00148 AbstractGenQgarPrimitive<T>::operator=(aQArc);
00149 this->_geomStructure = aQArc._geomStructure;
00150 }
00151 return *this;
00152 }
00153
00154
00155
00156
00157 template <class T>
00158 inline bool
00159 GenQgarArc<T>::operator==(const GenQgarArc<T>& aQArc) const
00160 {
00161 return eq(aQArc);
00162 }
00163
00164
00165
00166
00167 template <class T>
00168 inline bool
00169 GenQgarArc<T>::operator!=(const GenQgarArc<T>& aQArc) const
00170 {
00171 return notEq(aQArc);
00172 }
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182 template <class T>
00183 inline bool
00184 GenQgarArc<T>::eq(const GenQgarArc<T>& aQArc) const
00185 {
00186 return (this->accessGeomStructure()).eq(aQArc.accessGeomStructure());
00187 }
00188
00189
00190
00191
00192 template <class T>
00193 bool
00194 GenQgarArc<T>::equal(const GenQgarArc<T>& aQArc) const
00195 {
00196 return
00197 (this->eq(aQArc))
00198 && (this->_thickness == aQArc._thickness)
00199 && (this->_color == aQArc._color)
00200 && (this->_outline == aQArc._outline);
00201 }
00202
00203
00204
00205
00206 template <class T>
00207 inline bool
00208 GenQgarArc<T>::notEq(const GenQgarArc<T>& aQArc) const
00209 {
00210 return (this->accessGeomStructure()).notEq(aQArc.accessGeomStructure());
00211 }
00212
00213
00214
00215
00216 template <class T>
00217 bool
00218 GenQgarArc<T>::notEqual(const GenQgarArc<T>& aQArc) const
00219 {
00220 return
00221 (this->notEq(aQArc))
00222 || (this->_source != aQArc._source)
00223 || (this->_target != aQArc._target)
00224 || (this->_center != aQArc._center);
00225 }
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235 template <class T>
00236 inline double
00237 GenQgarArc<T>::radius() const
00238 {
00239 return (this->_geomStructure).radius();
00240 }
00241
00242
00243
00244
00245 template <class T>
00246 inline double
00247 GenQgarArc<T>::length() const
00248 {
00249 return (this->_geomStructure).length();
00250 }
00251
00252
00253
00254
00255 template <class T>
00256 inline double
00257 GenQgarArc<T>::sourceAngle() const
00258 {
00259 return (this->_geomStructure).sourceAngle();
00260 }
00261
00262
00263
00264
00265 template <class T>
00266 inline double
00267 GenQgarArc<T>::sourceAngleDegrees() const
00268 {
00269 return (this->_geomStructure).sourceAngleDegrees();
00270 }
00271
00272
00273
00274
00275 template <class T>
00276 inline double
00277 GenQgarArc<T>::targetAngle() const
00278 {
00279 return (this->_geomStructure).targetAngle();
00280 }
00281
00282
00283
00284
00285 template <class T>
00286 inline double
00287 GenQgarArc<T>::targetAngleDegrees() const
00288 {
00289 return (this->_geomStructure).targetAngleDegrees();
00290 }
00291
00292
00293
00294
00295 template <class T>
00296 inline double
00297 GenQgarArc<T>::angle() const
00298 {
00299 return (this->_geomStructure).angle();
00300 }
00301
00302
00303
00304
00305 template <class T>
00306 inline double
00307 GenQgarArc<T>::angleDegrees() const
00308 {
00309 return (this->_geomStructure).angleDegrees();
00310 }
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320 template <class T>
00321 inline const GenPoint<T>&
00322 GenQgarArc<T>::accessCenter() const
00323 {
00324 return (this->_geomStructure).accessCenter();
00325 }
00326
00327
00328
00329
00330 template <class T>
00331 inline GenPoint<T>
00332 GenQgarArc<T>::center() const
00333 {
00334 return (this->_geomStructure).center();
00335 }
00336
00337
00338
00339
00340 template <class T>
00341 inline T
00342 GenQgarArc<T>::xCenter() const
00343 {
00344 return (this->_geomStructure).xCenter();
00345 }
00346
00347
00348
00349
00350 template <class T>
00351 inline T
00352 GenQgarArc<T>::yCenter() const
00353 {
00354 return (this->_geomStructure).yCenter();
00355 }
00356
00357
00358
00359
00360 template <class T>
00361 inline void
00362 GenQgarArc<T>::setXCenter(T aX)
00363 {
00364 (this->_geomStructure).setXCenter(aX);
00365 }
00366
00367
00368
00369
00370 template <class T>
00371 inline void
00372 GenQgarArc<T>::setYCenter(T aY)
00373 {
00374 (this->_geomStructure).setYCenter(aY);
00375 }
00376
00377
00378
00379
00380 template <class T>
00381 inline void
00382 GenQgarArc<T>::setCenter(T aX, T aY)
00383 {
00384 (this->_geomStructure).setCenter(aX,aY);
00385 }
00386
00387
00388 template <class T>
00389 inline void
00390 GenQgarArc<T>::setCenter(const GenPoint<T>& aCenter)
00391 {
00392 (this->_geomStructure).setCenter(aCenter);
00393 }
00394
00395
00396
00397
00398
00399
00400
00401 template <class T>
00402 std::istream&
00403 GenQgarArc<T>::read(std::istream& anInStream)
00404 {
00405 qgReadObjName(anInStream, "QgarArc");
00406
00407
00408
00409 qgReadObjData(anInStream, this->_geomStructure);
00410
00411
00412
00413 qgReadObjData(anInStream, this->_thickness);
00414
00415 int color;
00416 qgReadObjData(anInStream, color);
00417 this->_color = static_cast<QGEcolor>(color);
00418
00419 int outline;
00420 qgReadObjData(anInStream, outline);
00421 this->_outline = static_cast<QGEoutline>(outline);
00422
00423 return anInStream;
00424 }
00425
00426
00427 template <class T>
00428 std::ostream&
00429 GenQgarArc<T>::write(std::ostream& anOutStream) const
00430 {
00431 anOutStream << "QgarArc("
00432 << this->_geomStructure
00433 << ")("
00434 << this->_thickness
00435 << ")("
00436 << this->_color
00437 << ")("
00438 << this->_outline
00439 << ')';
00440
00441 return anOutStream;
00442 }
00443
00444
00445
00446
00447
00448
00449
00450
00451
00452
00453
00454
00455
00456
00457
00458
00459
00460
00461 template <class T>
00462 GenQgarArc<T>*
00463 GenQgarArc<T>::clone() const
00464 {
00465 return new GenQgarArc<T>(*this);
00466 }
00467
00468
00469
00470
00471
00472
00473
00474
00475
00476
00477 template <class T>
00478 inline const GenArc<T>&
00479 GenQgarArc<T>::accessGeomStructure() const
00480 {
00481 return this->_geomStructure;
00482 }
00483
00484
00485
00486
00487
00488
00489
00490
00491
00492
00493 template <class T>
00494 inline AbstractGenPrimitive<T>&
00495 GenQgarArc<T>::getGeomStructure()
00496 {
00497 return this->_geomStructure;
00498 }
00499
00500
00501
00502
00503
00504
00505
00506 }