Geometry.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. #ifndef GEOMETRY_H_
  2. #define GEOMETRY_H_
  3. #include <e32math.h>
  4. #include <e32base.h>
  5. #include <gdi.h>
  6. #include <w32adll.h>
  7. // ’®çª  ¢ âà¥å¬¥à­®¬ ¯à®áâà ­á⢥
  8. class T3DPoint
  9. {
  10. public:
  11. T3DPoint(): iX( 0 ), iY( 0 ), iZ( 0 ) {}
  12. T3DPoint( TInt aX, TInt aY, TInt aZ ): iX( aX ), iY( aY ), iZ( aZ ) {}
  13. T3DPoint( const T3DPoint& aItem );
  14. T3DPoint& operator = ( const T3DPoint& aPoint );
  15. public:
  16. TInt iX, iY, iZ;
  17. };
  18. // Š« áá TDouble3DPoint ¨á¯®«ì§ã¥âáï ¤«ï à áç¥â  ­®¢ëå ª®®à¤¨­ â ¢¥à設
  19. // ¯ à ««¥«¥¯¨¯¥¤ , ¯à¨ í⮬ ⥪ã饥 §­ ç¥­¨¥ iCurrent ¢ëç¨á«ï¥âáï ­  ®á­®¢¥
  20. // ­ ç «ì­®£® iOriginal
  21. class TDouble3DPoint
  22. {
  23. public:
  24. TDouble3DPoint( TInt aX, TInt aY, TInt aZ );
  25. TDouble3DPoint( const TDouble3DPoint& aItem );
  26. TDouble3DPoint& operator = ( const TDouble3DPoint& aPoint );
  27. public:
  28. T3DPoint iOriginal, iCurrent;
  29. };
  30. // Œ âà¨æ  ¯®¢®à®â  ¢ âà¥å¬¥à­®¬ ¯à®áâà ­á⢥
  31. // á¬. http://ru.wikipedia.org/wiki/%D0%9C%D0%B0%D1%82%D1%80%D0%B8%D1%86%D0%B0_%D0%BF%D0%BE%D0%B2%D0%BE%D1%80%D0%BE%D1%82%D0%B0
  32. class CTransformMatrix : public CBase
  33. {
  34. public:
  35. ~CTransformMatrix();
  36. static CTransformMatrix* NewL();
  37. void Refine( TReal anAngleXoffs, TReal anAngleYoffs, TReal anAngleZoffs );
  38. void Reset();
  39. void Multiply( T3DPoint& aMultiplier, T3DPoint& aResult );
  40. private:
  41. CTransformMatrix() {}
  42. void ConstructL();
  43. CArrayFixFlat<TReal>* InitLineL();
  44. private:
  45. CArrayFixFlat<TReal> *iLine1, *iLine2, *iLine3;
  46. TReal angleX, angleY, angleZ;
  47. };
  48. // �®«¨£®­ á ¯®¬®éìî ª®â®à®£® ®âà¨á®¢ë¢ ¥âáï £à ­ì ¯ à ««¥«¥¯¨¯¥¤ 
  49. class TParallelepipedPoly
  50. {
  51. public:
  52. TParallelepipedPoly(TRgb aColor): iColor( aColor ), iVisible( ETrue ) {}
  53. TParallelepipedPoly( const TParallelepipedPoly& aPoly );
  54. TParallelepipedPoly& operator = ( const TParallelepipedPoly& aPoly );
  55. void SetArray( TPoint* anArray );
  56. void SetPoint( TInt aPointIdx, TInt aX, TInt aY );
  57. public:
  58. TPoint iPoint1, iPoint2, iPoint3, iPoint4;
  59. TRgb iColor;
  60. TBool iVisible;
  61. };
  62. class CFbsBitmapDevice;
  63. class CFbsBitGc;
  64. // Š« áá à ááç¨â뢠¥â ª®®à¤¨­ âë ¢¥à設 ¯ à ««¥«¥¯¨¯¥¤ , ®âà¨á®¢ë¢ ¥â ¥£® ¨
  65. // ¨­¤¨ª â®àë ¯à¨à é¥­¨ï 㣫®¢ ¯®¢®à®â 
  66. class CParallelepiped : public CBase
  67. {
  68. public:
  69. CParallelepiped( TReal aMultiplier, TDisplayMode aMode );
  70. void ConstructL();
  71. ~CParallelepiped();
  72. void SetPolyPoint( TInt aPolyNo, TInt aPointNo, TInt aValueX, TInt aValueY );
  73. void SetInitPoints( const TRect& aRect, const TPoint& aPoint );
  74. void SetFocused( TInt aFocus );
  75. void SetGauge( TInt aGauge );
  76. void SetCurrentGaugeValue( TInt aValue );
  77. void Calc();
  78. void Reset();
  79. void SizeChanged( const TRect& aRect, const TPoint& aPoint );
  80. void Draw( CAnimGc& aGc ) const;
  81. void DrawGauge( CFbsBitGc& aGc, TBool aActive, TInt aValue, TInt aYOffset ) const;
  82. TBool Focused() const;
  83. private:
  84. CArrayFixFlat<TDouble3DPoint> *iPoints; // ¢¥àè¨­ë ¯ à ««¥«¥¯¨¯¥¤ 
  85. CArrayFixFlat<TParallelepipedPoly> *iPolies; // ¯®«¨£®­ë ¤«ï ®â®¡à ¦¥­¨ï £à ­¥©
  86. CTransformMatrix* iMatrix; // ¬ âà¨æ  ¯®¢®à®â 
  87. TPoint* iPoly; // ¢á¯®¬®£ â¥«ì­ë© ¬ áᨢ ¤«ï ®âà¨á®¢ª¨ £à ­¨
  88. TPoint* iGaugePoly; // ¢á¯®¬®£ â¥«ì­ë© ¬ áᨢ ¤«ï ®âà¨á®¢ª¨ ¨­¤¨ª â®à 
  89. private:
  90. TPoint iPoint; // ᬥ饭¨¥ «¥¢®£® ¢¥àå­¥£® 㣫  iOffScreenBitmap
  91. TRect iRect; // ®¡« áâì, ¨á¯®«ì§ã¥¬ ï ¤«ï ®âà¨á®¢ª¨
  92. TInt iDx, iDy, iDz; // ⥪ã騥 §­ ç¥­¨ï ¯à¨à é¥­¨© 㣫®¢ ¯®¢®à®â 
  93. TInt* iDCurrent; // ⥪ã騩 ¨­¤¨ª â®à
  94. TReal iMultiplier;
  95. TBool iFocused;
  96. // ¨§®¡à ¦¥­¨¥ ¯¥à¢®­ ç «ì­® ®âà¨á®¢ë¢ ¥âáï ­  iOffScreenBitmap
  97. TDisplayMode iMode;
  98. CFbsBitmap* iOffScreenBitmap;
  99. CFbsBitmapDevice* iOffScreenBitmapDevice;
  100. CFbsBitGc* iOffScreenBitmapGc;
  101. };
  102. #endif /*GEOMETRY_H_*/