KEDModel2DEditor.h 5.8 KB

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