KEDModel2DEditor.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. #pragma once
  2. #include <Knopf.h>
  3. #include <Array.h>
  4. #include <Punkt.h>
  5. #include <Bild.h>
  6. #include <Model2D.h>
  7. #include <DateiDialog.h>
  8. using namespace Framework;
  9. namespace Model2DEditor
  10. {
  11. class VertexData
  12. {
  13. private:
  14. Vec2< float > vertex;
  15. Punkt textur;
  16. bool selected;
  17. bool sichtbar;
  18. int ref;
  19. public:
  20. // Konstruktor
  21. VertexData( Vec2< float > v, Punkt t );
  22. // nicht constant
  23. void nachLinks( float num );
  24. void nachOben( float num );
  25. void saveTextur( Punkt tPos );
  26. void select( Punkt p1, Punkt p2 );
  27. void deSelect();
  28. void setAuswahl( bool ausw );
  29. void setSichtbar( bool s );
  30. // constant
  31. bool istSichtbar() const;
  32. bool istAusgewählt() const;
  33. Vec2< float > getPos() const;
  34. Punkt getTPos() const;
  35. // Reference Counting
  36. VertexData *getThis();
  37. VertexData *release();
  38. };
  39. class PolygonData
  40. {
  41. private:
  42. RCArray< VertexData > *vd;
  43. bool sichtbar;
  44. int ref;
  45. public:
  46. // Konstruktor
  47. PolygonData( Polygon2D &pg );
  48. // Destruktor
  49. ~PolygonData();
  50. // nicht constant
  51. void addVertex( Vec2< float >v, Punkt t );
  52. void removeVertex( int num );
  53. void nachLinks( float num );
  54. void nachOben( float num );
  55. void saveTextur( Punkt tPos );
  56. void select( Punkt p1, Punkt p2 );
  57. void deSelect();
  58. void setSichtbar( bool s );
  59. // constant
  60. bool istSichtbar() const;
  61. VertexData *zVertex( int num ) const;
  62. int getVertexAnzahl() const;
  63. void getM2( Polygon2D &pd, bool textur ) const;
  64. // Reference Counting
  65. PolygonData *getThis();
  66. PolygonData *release();
  67. };
  68. class Data
  69. {
  70. private:
  71. RCArray< PolygonData > *pd;
  72. Bild *textur;
  73. Punkt tPos;
  74. bool rTextur;
  75. int sp;
  76. int ref;
  77. public:
  78. // Konstruktor
  79. Data( Model2DData *mdl );
  80. // Destruktor
  81. ~Data();
  82. // nicht constant
  83. void addPolygon();
  84. void removePolygon( int num );
  85. void selectPolygon( int num );
  86. void nachLinks( float num );
  87. void nachOben( float num );
  88. void tNachLinks( int num );
  89. void tNachOben( int num );
  90. void setRTextur( bool rt );
  91. void saveTextur();
  92. void setTextur( Bild *t );
  93. void select( Punkt p1, Punkt p2 );
  94. void deSelect();
  95. // constant
  96. PolygonData *zPolygon( int num ) const;
  97. int getPolygonAnzahl() const;
  98. int getSelectedPolygon() const;
  99. Model2DData *getM2() const;
  100. Bild *zTextur() const;
  101. Punkt getTPos() const;
  102. // Reference Counting
  103. Data *getThis();
  104. Data *release();
  105. };
  106. class EditorListe : public Zeichnung
  107. {
  108. private:
  109. LRahmen *ram;
  110. VScrollBar *scroll;
  111. Data *data;
  112. Array< bool > ausgeklappt;
  113. Schrift *schrift;
  114. int ref;
  115. public:
  116. // Konstruktor
  117. EditorListe( Schrift *zSchrift );
  118. // Destruktor
  119. ~EditorListe();
  120. // nicht constant
  121. void setDataZ( Data *d );
  122. void doMausEreignis( MausEreignis &me ) override;
  123. bool tick( double zeit ) override;
  124. void render( Bild &zRObj ) override;
  125. // Reference Counting
  126. EditorListe *getThis();
  127. EditorListe *release();
  128. };
  129. class Editor2D : public Zeichnung
  130. {
  131. private:
  132. Punkt pos;
  133. Punkt offs;
  134. Data *data;
  135. LRahmen *ram;
  136. LRahmen *select;
  137. Schrift *schrift;
  138. Punkt mausPos;
  139. Vertex addV;
  140. bool mausIn;
  141. float größe;
  142. int ref;
  143. public:
  144. // Konstruktor
  145. Editor2D( Schrift *zSchrift );
  146. // Destruktor
  147. ~Editor2D();
  148. // nicht constant
  149. void setDataZ( Data *d );
  150. void doMausEreignis( MausEreignis &me ) override;
  151. void doTastaturEreignis( TastaturEreignis &te ) override;
  152. bool tick( double zeit ) override;
  153. void render( Bild &zRObj ) override;
  154. // Reference Counting
  155. Editor2D *getThis();
  156. Editor2D *release();
  157. };
  158. class GUI : public Zeichnung
  159. {
  160. private:
  161. Knopf *speichern;
  162. Knopf *abbrechen;
  163. Editor2D *editor;
  164. EditorListe *liste;
  165. KontrollKnopf *textur;
  166. Knopf *texturLaden;
  167. Knopf *texturVerknüpfen;
  168. DateiDialogTh *importDialog;
  169. Data *data;
  170. bool sichtbar;
  171. unsigned char alpha;
  172. int aktion;
  173. int ref;
  174. public:
  175. // Konstruktor
  176. GUI( Schrift *zSchrifto );
  177. // Destruktor
  178. ~GUI();
  179. // nicht constant
  180. void setSichtbar( bool s );
  181. void setModel( Model2DData *data );
  182. void doMausEreignis( MausEreignis &me ) override;
  183. void doTastaturEreignis( TastaturEreignis &te ) override;
  184. bool tick( double zeit ) override;
  185. void render( Bild &zRObj ) override;
  186. int getAktion();
  187. // const
  188. Model2DData *getM2Data() const;
  189. // Reference Counting
  190. GUI *getThis();
  191. GUI *release();
  192. };
  193. }