Settings.java 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. package model;
  2. import java.nio.file.Path;
  3. /**
  4. * This class saves the current settings. Those are needed for creating the STLs.
  5. * @author Martin Herbers
  6. *
  7. */
  8. public class Settings {
  9. public enum Temp {
  10. UNDER0, OVER0
  11. }
  12. public enum Tilt {
  13. TILT, FLIP
  14. }
  15. //The 5 interactions that can currently be detected.
  16. private boolean weight = false;
  17. private boolean acceleration = false;
  18. private boolean squeeze = false;
  19. private boolean tilt = false;
  20. private boolean temperature = false;
  21. //ADD CODE HERE FOR ADDITIONAL INTERACTION
  22. //New boolean for each interaction, allows combining them later
  23. //Some more settings to create more interaction possibilities
  24. private int weightSetting = 54;
  25. private double accelerationSetting = 5;
  26. private Temp temperatureSetting = Temp.OVER0;
  27. private Tilt tiltSetting = Tilt.TILT;
  28. //ADD CODE HERE FOR ADDITIONAL INTERACTION
  29. //Only if additional data is necessary
  30. //Settings from the settings window that can be used for multiple objects
  31. private boolean fill = false;
  32. private float sizeScreen = 4.0f;
  33. private float sizeFinger = 4.0f;
  34. private Path openScadPath = null;
  35. private static Settings settings = new Settings();
  36. public static Settings getSettings() {
  37. return settings;
  38. }
  39. public void addWeight() {
  40. weight = true;
  41. }
  42. public void removeWeight() {
  43. weight = false;
  44. }
  45. public boolean isWeight() {
  46. return weight;
  47. }
  48. public void addAcceleration() {
  49. acceleration = true;
  50. }
  51. public void removeAcceleration() {
  52. acceleration = false;
  53. }
  54. public boolean isAcceleration() {
  55. return acceleration;
  56. }
  57. public void addSqueeze() {
  58. squeeze = true;
  59. }
  60. public void removeSqueeze() {
  61. squeeze = false;
  62. }
  63. public boolean isSqueeze() {
  64. return squeeze;
  65. }
  66. public void addTilt() {
  67. tilt = true;
  68. }
  69. public void removeTilt() {
  70. tilt = false;
  71. }
  72. public boolean isTilt() {
  73. return tilt;
  74. }
  75. public void addTemperature() {
  76. temperature = true;
  77. }
  78. public void removeTemperature() {
  79. temperature = false;
  80. }
  81. public boolean isTemperature() {
  82. return temperature;
  83. }
  84. public void setWeight(int w) {
  85. weightSetting = w;
  86. }
  87. public int getWeight() {
  88. return weightSetting;
  89. }
  90. public void setAcceleration(double a) {
  91. accelerationSetting = a;
  92. }
  93. public double getAcceleration() {
  94. return accelerationSetting;
  95. }
  96. public void setTemperature(Temp t) {
  97. temperatureSetting = t;
  98. }
  99. public Temp getTemperature() {
  100. return temperatureSetting;
  101. }
  102. public void setTilting (Tilt t) {
  103. tiltSetting = t;
  104. }
  105. public Tilt getTilting() {
  106. return tiltSetting;
  107. }
  108. public void setFill(boolean b) {
  109. fill = b;
  110. }
  111. public boolean getFill() {
  112. return fill;
  113. }
  114. public void setSizeScreen(float f) {
  115. sizeScreen = f;
  116. }
  117. public float getSizeScreen() {
  118. return sizeScreen;
  119. }
  120. public void setSizeFinger(float f) {
  121. sizeFinger = f;
  122. }
  123. public float getSizeFinger() {
  124. return sizeFinger;
  125. }
  126. public void setOpenSCADPath(Path p) {
  127. openScadPath = p;
  128. }
  129. public Path getOpenSCADPath() {
  130. return openScadPath;
  131. }
  132. //ADD CODE HERE FOR ADDITIONAL INTERACTION
  133. //At least get/set for the boolean, possibly also for additional data like size
  134. }