KEDModel2DEditor.h 5.8 KB

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