Model.java 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920
  1. package ui.model;
  2. import java.awt.Color;
  3. import java.util.ArrayList;
  4. import java.util.HashMap;
  5. import java.util.Hashtable;
  6. import java.util.LinkedList;
  7. import java.util.List;
  8. import javax.swing.JTable;
  9. import com.google.gson.JsonObject;
  10. import classes.AbstractCpsObject;
  11. import classes.Category;
  12. import classes.CpsEdge;
  13. import classes.CpsUpperNode;
  14. import classes.HolonElement;
  15. import classes.HolonSwitch;
  16. import interfaces.CategoryListener;
  17. import interfaces.GraphListener;
  18. import interfaces.ObjectListener;
  19. import ui.view.Console;
  20. import ui.view.DefaulTable;
  21. import ui.view.PropertyTable;
  22. import ui.view.StatisticGraphPanel;
  23. /**
  24. * The Class Model is the class where everything is saved. All changes made to
  25. * the Data is managed via a controller.
  26. *
  27. * @author Gruppe14
  28. *
  29. */
  30. public class Model {
  31. // Canvas Attributes
  32. private String imgPath = "";
  33. private int backgroundMode = 0;
  34. private int backgroundWidth = 0;
  35. private int backgroundHeight = 0;
  36. private int canvasX = 1000;
  37. private int canvasY = 1000;
  38. // Global Variables
  39. private static int sCALE = 50; // Picture Scale
  40. private static int sCALEdIV2 = sCALE / 2;
  41. private static int holonBodysCALE = 100; // Picture Scale
  42. private static final int ITERATIONS = 100;
  43. private int curIteration = 0;
  44. private LinkedList<Color> subNetColors = new LinkedList<>();
  45. // ID of the Selected Object
  46. private AbstractCpsObject selectedCpsObject = null;
  47. private HolonElement selectedHolonElement;
  48. private CpsEdge selectedEdge;
  49. private ArrayList<AbstractCpsObject> selectedObjects = new ArrayList<AbstractCpsObject>();
  50. private ArrayList<AbstractCpsObject> clipboardObjects = new ArrayList<AbstractCpsObject>();
  51. private Console console;
  52. private HashMap<Integer, ArrayList<HolonElement>> eleToDelete;
  53. // Capacity for Edge
  54. private float maxCapacity;
  55. // Table for HolonElements --> all cells are editable
  56. private JTable tableHolonElement;
  57. private ArrayList<GraphListener> graphListeners = new ArrayList<GraphListener>();
  58. // Iteration Speed
  59. private int timerSpeed = 1000;
  60. private int selectedID = 0;
  61. // number of the current autosave
  62. private int autoSaveNr = -1;
  63. // number of max simultaneous autosaves
  64. private int numberOfSaves = 35;
  65. // if the simulation is running and has not been reseted
  66. private boolean isSimRunning = false;
  67. /*
  68. * Array of all categories in the model. It is set by default with the
  69. * categories ENERGY, BUILDINGS and COMPONENTS
  70. */
  71. private ArrayList<Category> categories;
  72. /*
  73. * Array of all HolonObj and HolonSwitches, that should be tracked through
  74. * out the statistics tab
  75. */
  76. private ArrayList<AbstractCpsObject> trackedObjects;
  77. /*
  78. * Array of all CpsObjects in our canvas. It is set by default as an empty
  79. * list.
  80. */
  81. private ArrayList<AbstractCpsObject> objectsOnCanvas;
  82. private HashMap<String, Integer> cgIdx;
  83. private HashMap<Integer, Integer> cvsObjIdx;
  84. /*
  85. * Array of all CpsObjects in our canvas. It is set by default as an empty
  86. * list.
  87. */
  88. private ArrayList<CpsEdge> edgesOnCanvas;
  89. /*
  90. * Array for all Listeners
  91. */
  92. private List<CategoryListener> categoryListeners;
  93. private List<ObjectListener> objectListeners;
  94. private PropertyTable tableModelHolonElementMulti;
  95. private PropertyTable tableModelHolonElementSingle;
  96. private DefaulTable tableModelProperties;
  97. public String[] colNames = { "Field", "Information" };
  98. /*
  99. * Object that runs the Algorithm
  100. */
  101. private Object algorithm = null;
  102. private int selectedHolonBody;
  103. // Statistic Graph Data
  104. private Hashtable<String, StatisticGraphPanel> statisticGraphTable = new Hashtable<String, StatisticGraphPanel>();
  105. private ArrayList<JsonObject> statisticData = new ArrayList<>();
  106. /**
  107. * Constructor for the model. It initializes the categories and
  108. * objectsOnCanvas by default values. Listeners are also initialized by
  109. * default values.
  110. */
  111. public Model() {
  112. setCategories(new ArrayList<Category>());
  113. setObjectsOnCanvas(new ArrayList<AbstractCpsObject>());
  114. setEdgesOnCanvas(new ArrayList<CpsEdge>());
  115. setCategoryListeners(new LinkedList<CategoryListener>());
  116. setObjectListeners(new LinkedList<ObjectListener>());
  117. setCgIdx(new HashMap<String, Integer>());
  118. setCvsObjIdx(new HashMap<Integer, Integer>());
  119. setClipboradObjects(new ArrayList<AbstractCpsObject>());
  120. setTrackingObj(new ArrayList<AbstractCpsObject>());
  121. setEleToDelete(new HashMap<Integer, ArrayList<HolonElement>>());
  122. setSingleTable(new PropertyTable());
  123. setMultiTable(new PropertyTable());
  124. setPropertyTable(new DefaulTable(1000, colNames.length));
  125. getPropertyTable().setColumnIdentifiers(colNames);
  126. setTableHolonElement(new JTable());
  127. }
  128. /**
  129. * Returns all Categories.
  130. *
  131. * @return the categories
  132. */
  133. public ArrayList<Category> getCategories() {
  134. return categories;
  135. }
  136. /**
  137. * Sets all Categories.
  138. *
  139. * @param categories
  140. * the categories to set
  141. */
  142. public void setCategories(ArrayList<Category> categories) {
  143. this.categories = categories;
  144. }
  145. /**
  146. * Transform the Arraylist of categories into a string of all objectName
  147. * with a separation (',') between each name.
  148. *
  149. * @return String of all names separeted by ','
  150. */
  151. public String toStringCat() {
  152. String text = "";
  153. for (int i = 0; i < categories.size(); i++) {
  154. if (text == "") {
  155. text = categories.get(i).getName();
  156. } else {
  157. text = text + ", " + categories.get(i).getName();
  158. }
  159. }
  160. return text;
  161. }
  162. /**
  163. * Returns all Objects on the Canvas.
  164. *
  165. * @return the objectsOnCanvas
  166. */
  167. public ArrayList<AbstractCpsObject> getObjectsOnCanvas() {
  168. return objectsOnCanvas;
  169. }
  170. /**
  171. * Sets all Objects on the Canvas.
  172. *
  173. * @param objectsOnCanvas
  174. * the objectsOnCanvas to set
  175. */
  176. public void setObjectsOnCanvas(ArrayList<AbstractCpsObject> objectsOnCanvas) {
  177. this.objectsOnCanvas = objectsOnCanvas;
  178. }
  179. /**
  180. * Get all Edges on the Canvas.
  181. *
  182. * @return the objectsOnCanvas
  183. */
  184. public ArrayList<CpsEdge> getEdgesOnCanvas() {
  185. return edgesOnCanvas;
  186. }
  187. /**
  188. * Adds an Edge to The Canvas.
  189. *
  190. * @param edge
  191. * the edgesOnCanvas to add
  192. */
  193. public void addEdgeOnCanvas(CpsEdge edge) {
  194. this.edgesOnCanvas.add(edge);
  195. }
  196. /**
  197. * Remove an edge from the Canvas.
  198. *
  199. * @param edge
  200. * the edge to remove
  201. */
  202. public void removeEdgesOnCanvas(CpsEdge edge) {
  203. this.edgesOnCanvas.remove(edge);
  204. }
  205. /**
  206. * Sets the edges on the Canvas.
  207. *
  208. * @param arrayList
  209. * the edgesOnCanvas to set
  210. */
  211. public void setEdgesOnCanvas(ArrayList<CpsEdge> arrayList) {
  212. this.edgesOnCanvas = arrayList;
  213. }
  214. /**
  215. * Returns the ObjectListener.
  216. *
  217. * @return the objectListeners
  218. */
  219. public List<ObjectListener> getObjectListeners() {
  220. return objectListeners;
  221. }
  222. /**
  223. * Sets the ObjectListener.
  224. *
  225. * @param linkedList
  226. * the objectListeners to set
  227. */
  228. public void setObjectListeners(LinkedList<ObjectListener> linkedList) {
  229. this.objectListeners = linkedList;
  230. }
  231. /**
  232. * Returns the CategorieListener.
  233. *
  234. * @return the categoryListeners
  235. */
  236. public List<CategoryListener> getCategoryListeners() {
  237. return categoryListeners;
  238. }
  239. /**
  240. * Sets the CategorieListener.
  241. *
  242. * @param linkedList
  243. * the categoryListeners to set
  244. */
  245. public void setCategoryListeners(LinkedList<CategoryListener> linkedList) {
  246. this.categoryListeners = linkedList;
  247. }
  248. /**
  249. * Set the ID of the selected Object 0 = no Object is selected.
  250. *
  251. * @param id
  252. * the ID
  253. *
  254. */
  255. public void setSelectedObjectID(int id) {
  256. this.selectedID = id;
  257. }
  258. /**
  259. * Returns the ID of the selected Object 0 = no Object is selected.
  260. *
  261. * @return ID
  262. */
  263. public int getSelectedObjectID() {
  264. return selectedID;
  265. }
  266. /**
  267. * Returns the Selected Cps Object.
  268. *
  269. * @return selected Cps Object
  270. */
  271. public AbstractCpsObject getSelectedCpsObject() {
  272. return selectedCpsObject;
  273. }
  274. /**
  275. * Set the Selected Objecs.
  276. *
  277. * @param selectedCpsObject
  278. * Objects that are selected
  279. */
  280. public void setSelectedCpsObject(AbstractCpsObject selectedCpsObject) {
  281. this.selectedCpsObject = selectedCpsObject;
  282. }
  283. /**
  284. * Returns all selected Objects on the Canvas.
  285. *
  286. * @return The selected Objects
  287. */
  288. public ArrayList<AbstractCpsObject> getSelectedCpsObjects() {
  289. return selectedObjects;
  290. }
  291. /**
  292. * Returns all selected Objects on the Canvas.
  293. *
  294. * @return The selected Objects
  295. */
  296. public void setSelectedCpsObjects(ArrayList<AbstractCpsObject> arr) {
  297. this.selectedObjects = arr;
  298. }
  299. /**
  300. * Returns the Selected Holon Element.
  301. *
  302. * @return selected Holon Element
  303. */
  304. public HolonElement getSelectedHolonElement() {
  305. return selectedHolonElement;
  306. }
  307. /**
  308. * Sets the Selecte HolonElement.
  309. *
  310. * @param selectedHolonElement
  311. * that is Selected
  312. */
  313. public void setSelectedHolonElement(HolonElement selectedHolonElement) {
  314. this.selectedHolonElement = selectedHolonElement;
  315. }
  316. /**
  317. * Returns the sCale (Scale for the Images).
  318. *
  319. * @return sCALE
  320. */
  321. public int getScale() {
  322. return sCALE;
  323. }
  324. /**
  325. * Returns sCALEdIV2 (The Scale divided by 2).
  326. *
  327. * @return sCALEdIV2
  328. */
  329. public int getScaleDiv2() {
  330. return sCALEdIV2;
  331. }
  332. /**
  333. * Sets the Image Scale.
  334. *
  335. * @param scale
  336. * for the image
  337. */
  338. public void setScale(int scale) {
  339. sCALE = scale;
  340. sCALEdIV2 = sCALE / 2;
  341. }
  342. /**
  343. * Returns ITERATIONS.
  344. *
  345. * @return ITERATIONS
  346. */
  347. public int getIterations() {
  348. return ITERATIONS;
  349. }
  350. /**
  351. * sets the current Iteration.
  352. *
  353. * @param curIT
  354. * the current Iteration
  355. */
  356. public void setCurIteration(int curIT) {
  357. this.curIteration = curIT;
  358. notifyGraphListeners();
  359. }
  360. private void notifyGraphListeners() {
  361. for (GraphListener gl : graphListeners) {
  362. gl.repaintTree();
  363. }
  364. }
  365. /**
  366. * Returns cURiTERATION.
  367. *
  368. * @return cURiTERATION
  369. */
  370. public int getCurIteration() {
  371. return curIteration;
  372. }
  373. /**
  374. * Set the selected Edge.
  375. *
  376. * @param edge
  377. * that is selected
  378. *
  379. */
  380. public void setSelectedEdge(CpsEdge edge) {
  381. this.selectedEdge = edge;
  382. }
  383. /**
  384. * Returns the selected Edge.
  385. *
  386. * @return selectedEdge
  387. */
  388. public CpsEdge getSelectedEdge() {
  389. return selectedEdge;
  390. }
  391. /**
  392. * Returns the Categorie Index.
  393. *
  394. * @return the cgIdx
  395. */
  396. public HashMap<String, Integer> getCgIdx() {
  397. return cgIdx;
  398. }
  399. /**
  400. * Sets the Categorie Index.
  401. *
  402. * @param cgIdx
  403. * the cgIdx to set
  404. */
  405. public void setCgIdx(HashMap<String, Integer> cgIdx) {
  406. this.cgIdx = cgIdx;
  407. }
  408. /**
  409. * Returns the CanvasObject Index.
  410. *
  411. * @return the cvsObjIdx
  412. */
  413. public HashMap<Integer, Integer> getCvsObjIdx() {
  414. return cvsObjIdx;
  415. }
  416. /**
  417. * Sets the CanvasObject Index.
  418. *
  419. * @param cvsObjIdx
  420. * the cvsObjIdx to set
  421. */
  422. public void setCvsObjIdx(HashMap<Integer, Integer> cvsObjIdx) {
  423. this.cvsObjIdx = cvsObjIdx;
  424. }
  425. /**
  426. * Sets the auto save Number.
  427. *
  428. * @param autoSaveNr
  429. * the auto save number
  430. */
  431. public void setAutoSaveNr(int autoSaveNr) {
  432. this.autoSaveNr = autoSaveNr;
  433. }
  434. /**
  435. * Returns the auto save Number.
  436. *
  437. * @return the auto save Number
  438. */
  439. public int getAutoSaveNr() {
  440. return autoSaveNr;
  441. }
  442. /**
  443. * Returns the Number of Saves.
  444. *
  445. * @return the numberOfSaves
  446. */
  447. public int getNumberOfSaves() {
  448. return numberOfSaves;
  449. }
  450. /**
  451. * Set the Number of Saves.
  452. *
  453. * @param numberOfSaves
  454. * the numberOfSaves to set
  455. */
  456. public void setNumberOfSaves(int numberOfSaves) {
  457. this.numberOfSaves = numberOfSaves;
  458. }
  459. /**
  460. * Sets the ClipboardObjects.
  461. *
  462. * @param c
  463. * Array of Objects
  464. */
  465. public void setClipboradObjects(ArrayList<AbstractCpsObject> c) {
  466. this.clipboardObjects = c;
  467. }
  468. /**
  469. * Returns all Objects in the Clipboard.
  470. *
  471. * @return Objects in the Clipboard
  472. */
  473. public ArrayList<AbstractCpsObject> getClipboradObjects() {
  474. return clipboardObjects;
  475. }
  476. /**
  477. * Sets the console.
  478. *
  479. * @param console
  480. * the console
  481. */
  482. public void setConsole(Console console) {
  483. this.console = console;
  484. }
  485. /**
  486. * Returns the Console.
  487. *
  488. * @return console the console
  489. */
  490. public Console getConsole() {
  491. return console;
  492. }
  493. /**
  494. * @return the maxCapacity
  495. */
  496. public float getMaxCapacity() {
  497. return maxCapacity;
  498. }
  499. /**
  500. * @param maxCapacity
  501. * the maxCapacity to set
  502. */
  503. public void setMaxCapacity(float maxCapacity) {
  504. this.maxCapacity = maxCapacity;
  505. }
  506. /**
  507. * Sets the Interval in ms between each Iteration.
  508. *
  509. * @param t
  510. * speed for the Iterations
  511. */
  512. public void setTimerSpeed(int t) {
  513. this.timerSpeed = t;
  514. }
  515. /**
  516. * get the Interval in ms between each Iteration.
  517. *
  518. * @return timerSpeed speed for the Iterations
  519. */
  520. public int getTimerSpeed() {
  521. return this.timerSpeed;
  522. }
  523. /**
  524. * Get Canvas X Size.
  525. *
  526. * @return the cANVAS_X
  527. */
  528. public int getCanvasX() {
  529. return canvasX;
  530. }
  531. /**
  532. * Set Canvas X Size.
  533. *
  534. * @param canvasX
  535. * the cANVAS_X to set
  536. */
  537. public void setCanvasX(int canvasX) {
  538. this.canvasX = canvasX;
  539. }
  540. /**
  541. * get Canvas Y size.
  542. *
  543. * @return the cANVAS_Y
  544. */
  545. public int getCanvasY() {
  546. return canvasY;
  547. }
  548. /**
  549. * Set Canvas Y size.
  550. *
  551. * @param canvasY
  552. * the cANVAS_Y to set
  553. */
  554. public void setCanvasY(int canvasY) {
  555. this.canvasY = canvasY;
  556. }
  557. /**
  558. * get the Algorithm.
  559. *
  560. * @return the Algorithm
  561. */
  562. public Object getAlgorithm() {
  563. return algorithm;
  564. }
  565. /**
  566. * Set the Algorithm.
  567. *
  568. * @param obj
  569. * the Algorithm
  570. */
  571. public void setAlgorithm(Object obj) {
  572. this.algorithm = null;
  573. this.algorithm = obj;
  574. }
  575. /**
  576. * Add a SubNetColor.
  577. *
  578. * @param c
  579. * the Color
  580. */
  581. public void addSubNetColor(Color c) {
  582. this.subNetColors.add(c);
  583. }
  584. /**
  585. * Get the SubNetColors.
  586. *
  587. * @return SubNetColors
  588. */
  589. public LinkedList<Color> getSubNetColors() {
  590. return this.subNetColors;
  591. }
  592. public void setTrackingObj(ArrayList<AbstractCpsObject> toTrack) {
  593. trackedObjects = toTrack;
  594. }
  595. public ArrayList<AbstractCpsObject> getTrackingObj() {
  596. return trackedObjects;
  597. }
  598. public void addGraphListener(GraphListener gl) {
  599. graphListeners.add(gl);
  600. }
  601. public void setEleToDelete(HashMap<Integer, ArrayList<HolonElement>> theHash) {
  602. this.eleToDelete = theHash;
  603. }
  604. public HashMap<Integer, ArrayList<HolonElement>> getEleToDelete() {
  605. return this.eleToDelete;
  606. }
  607. public void setSingleTable(PropertyTable pt) {
  608. this.tableModelHolonElementSingle = pt;
  609. }
  610. public PropertyTable getSingleTable() {
  611. return this.tableModelHolonElementSingle;
  612. }
  613. public PropertyTable getMultiTable() {
  614. return this.tableModelHolonElementMulti;
  615. }
  616. public void setMultiTable(PropertyTable pt) {
  617. this.tableModelHolonElementMulti = pt;
  618. }
  619. public void addObjectsToGraphListeners() {
  620. for (GraphListener gl : graphListeners) {
  621. gl.addTrackedObject(trackedObjects);
  622. gl.repaintTree();
  623. }
  624. }
  625. public DefaulTable getPropertyTable() {
  626. return this.tableModelProperties;
  627. }
  628. public void setPropertyTable(DefaulTable pt) {
  629. this.tableModelProperties = pt;
  630. }
  631. public JTable getTableHolonElement() {
  632. return tableHolonElement;
  633. }
  634. public void setTableHolonElement(JTable tableHolonElement) {
  635. this.tableHolonElement = tableHolonElement;
  636. }
  637. /**
  638. * Sets the HolonBody Scale.
  639. *
  640. * @param scale
  641. * for the HolonBody
  642. */
  643. public void setHolonBodyScale(int scale) {
  644. holonBodysCALE = scale;
  645. }
  646. /**
  647. * Returns the sCale (Scale for the Images).
  648. *
  649. * @return sCALE
  650. */
  651. public int getHolonBodyScale() {
  652. return holonBodysCALE;
  653. }
  654. /**
  655. * Sets the ID of the selected HolonBody
  656. *
  657. * @param i
  658. * int
  659. */
  660. public void setSelectedHolonBody(int i) {
  661. selectedHolonBody = i;
  662. }
  663. /**
  664. * Returns the ID of the selected HolonBody
  665. *
  666. * @return selectedHolonBody
  667. */
  668. public int getSelectedHolonBody() {
  669. return selectedHolonBody;
  670. }
  671. /**
  672. * get all Switches
  673. */
  674. public ArrayList<HolonSwitch> getSwitches() {
  675. ArrayList<HolonSwitch> switches = new ArrayList<>();
  676. for (AbstractCpsObject obj : getObjectsOnCanvas()) {
  677. if (obj instanceof HolonSwitch) {
  678. switches.add((HolonSwitch) obj);
  679. } else if (obj instanceof CpsUpperNode) {
  680. getSwitchesRec(((CpsUpperNode) obj).getNodes(), switches);
  681. }
  682. }
  683. return switches;
  684. }
  685. /**
  686. * get the Amount of Switches help function
  687. *
  688. * @param objects
  689. * objects
  690. * @param switches
  691. * List of switches
  692. */
  693. private ArrayList<HolonSwitch> getSwitchesRec(ArrayList<AbstractCpsObject> objects,
  694. ArrayList<HolonSwitch> switches) {
  695. for (AbstractCpsObject obj : objects) {
  696. if (obj instanceof HolonSwitch) {
  697. switches.add((HolonSwitch) obj);
  698. } else if (obj instanceof CpsUpperNode) {
  699. getSwitchesRec(((CpsUpperNode) obj).getNodes(), switches);
  700. }
  701. }
  702. return switches;
  703. }
  704. /**
  705. * Returns the Path for the background Image of the Canvas.
  706. *
  707. * @return imgPath the Path
  708. */
  709. public String getCanvasImagePath() {
  710. return imgPath;
  711. }
  712. /**
  713. * Returns the mode for the background Image of the Canvas.
  714. *
  715. * 0 take size of the Image 1 stretch the Image 2 Custom Image size
  716. *
  717. * @return backgroundMode the mode
  718. */
  719. public int getCanvasImageMode() {
  720. return backgroundMode;
  721. }
  722. /**
  723. * Returns the Custom width of the background Image of the Canvas.
  724. *
  725. * @return backgroundWidth the Width
  726. */
  727. public int getCanvasImageWidth() {
  728. return backgroundWidth;
  729. }
  730. /**
  731. * Returns the Custom height of the background Image of the Canvas.
  732. *
  733. * @return backgroundHeight the height
  734. */
  735. public int getCanvasImageHeight() {
  736. return backgroundHeight;
  737. }
  738. /**
  739. * Set the Path for the background Image of the Canvas.
  740. *
  741. * @param paththe Path
  742. */
  743. public void setCanvasImagePath(String path) {
  744. imgPath = path;
  745. }
  746. /**
  747. * Set the mode for the background Image of the Canvas.
  748. *
  749. * 0 take size of the Image, 1 stretch the Image, 2 Custom Image size
  750. *
  751. * @param backgroundMode the mode
  752. */
  753. public void setCanvasImageMode(int mode) {
  754. backgroundMode = mode;
  755. }
  756. /**
  757. * Set the Custom width of the background Image of the Canvas.
  758. *
  759. * @param width the Width
  760. */
  761. public void setCanvasImageWidth(int width) {
  762. backgroundWidth = width;
  763. }
  764. /**
  765. * Set the Custom height of the background Image of the Canvas.
  766. *
  767. * @param height the height
  768. */
  769. public void setCanvasImageHeight(int height) {
  770. backgroundHeight = height;
  771. }
  772. /**
  773. * Set the graphtable for Statistic Graphs
  774. */
  775. public void setGraphTable(Hashtable<String, StatisticGraphPanel> gT){
  776. statisticGraphTable = gT;
  777. }
  778. /**
  779. * Returns the graphtable for Statistic Graphs.
  780. */
  781. public Hashtable<String, StatisticGraphPanel> getGraphTable(){
  782. return statisticGraphTable;
  783. }
  784. /**
  785. * Returns if the Simulation is running.
  786. */
  787. public boolean getIsSimRunning(){
  788. return isSimRunning;
  789. }
  790. /**
  791. * Sets isSimRunning.
  792. * @param isRunning
  793. */
  794. public void setIsSimRunning(boolean isRunning) {
  795. isSimRunning = isRunning;
  796. }
  797. /**
  798. * @return the statisticData
  799. */
  800. public ArrayList<JsonObject> getStatisticData() {
  801. return statisticData;
  802. }
  803. /**
  804. * @param statisticData the statisticData to set
  805. */
  806. public void setStatisticData(ArrayList<JsonObject> statisticData) {
  807. this.statisticData = statisticData;
  808. }
  809. }