|
@@ -37,6 +37,7 @@ public class LoadController {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
+ * Reads the the JSON File and load the state into the Model
|
|
*
|
|
*
|
|
* @param path
|
|
* @param path
|
|
* @throws IOException
|
|
* @throws IOException
|
|
@@ -70,7 +71,7 @@ public class LoadController {
|
|
else
|
|
else
|
|
idCounter.setCounter(Integer.parseInt(json.get(key.toString()).toString()));
|
|
idCounter.setCounter(Integer.parseInt(json.get(key.toString()).toString()));
|
|
}
|
|
}
|
|
- System.out.println(gp.get(0));
|
|
|
|
|
|
+
|
|
dispatch(obj, json);
|
|
dispatch(obj, json);
|
|
dispatch(ele, json);
|
|
dispatch(ele, json);
|
|
dispatch(edge, json);
|
|
dispatch(edge, json);
|
|
@@ -83,6 +84,12 @@ public class LoadController {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * dispatch the Keys into the right processing
|
|
|
|
+ *
|
|
|
|
+ * @param input
|
|
|
|
+ * @param json
|
|
|
|
+ */
|
|
public void dispatch(ArrayList<String> input, JSONObject json) {
|
|
public void dispatch(ArrayList<String> input, JSONObject json) {
|
|
|
|
|
|
for (String str : input) {
|
|
for (String str : input) {
|
|
@@ -101,6 +108,11 @@ public class LoadController {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Read all Categories from the JSON file
|
|
|
|
+ *
|
|
|
|
+ * @param arr
|
|
|
|
+ */
|
|
public void readCategory(JSONArray arr) {
|
|
public void readCategory(JSONArray arr) {
|
|
|
|
|
|
Iterator<Object> i = arr.iterator();
|
|
Iterator<Object> i = arr.iterator();
|
|
@@ -110,6 +122,11 @@ public class LoadController {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Read all Objects in Category from the JSON File
|
|
|
|
+ *
|
|
|
|
+ * @param arr
|
|
|
|
+ */
|
|
public void readCategoryObject(JSONArray arr) {
|
|
public void readCategoryObject(JSONArray arr) {
|
|
Iterator<Object> i = arr.iterator();
|
|
Iterator<Object> i = arr.iterator();
|
|
|
|
|
|
@@ -127,6 +144,11 @@ public class LoadController {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Read all Objects in Canvas from JSON File
|
|
|
|
+ *
|
|
|
|
+ * @param arr
|
|
|
|
+ */
|
|
public void readCanvasObject(JSONArray arr) {
|
|
public void readCanvasObject(JSONArray arr) {
|
|
Iterator<Object> i = arr.iterator();
|
|
Iterator<Object> i = arr.iterator();
|
|
CpsObject cps = null;
|
|
CpsObject cps = null;
|
|
@@ -151,10 +173,21 @@ public class LoadController {
|
|
cvsC.addObjectIntoCanvas(cps);
|
|
cvsC.addObjectIntoCanvas(cps);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Read all Elements in Category and Canvas from JSON File
|
|
|
|
+ *
|
|
|
|
+ * @param arr
|
|
|
|
+ */
|
|
public void readElement(JSONArray arr) {
|
|
public void readElement(JSONArray arr) {
|
|
Iterator<Object> i = arr.iterator();
|
|
Iterator<Object> i = arr.iterator();
|
|
|
|
|
|
String sav = i.next().toString();
|
|
String sav = i.next().toString();
|
|
|
|
+// int id = Integer.parseInt(i.next().toString());
|
|
|
|
+//
|
|
|
|
+// HolonElement ele = new HolonElement(i.next().toString(), Integer.parseInt(i.next().toString()),
|
|
|
|
+// Float.parseFloat(i.next().toString()));
|
|
|
|
+// ele.setActive(i.next().);
|
|
|
|
+
|
|
if (sav.equals("Canvas")) {
|
|
if (sav.equals("Canvas")) {
|
|
objC.addNewElementIntoCanvasObject(Integer.parseInt(i.next().toString()), i.next().toString(),
|
|
objC.addNewElementIntoCanvasObject(Integer.parseInt(i.next().toString()), i.next().toString(),
|
|
Integer.parseInt(i.next().toString()), Float.parseFloat(i.next().toString()));
|
|
Integer.parseInt(i.next().toString()), Float.parseFloat(i.next().toString()));
|
|
@@ -163,6 +196,10 @@ public class LoadController {
|
|
Integer.parseInt(i.next().toString()), Float.parseFloat(i.next().toString()));
|
|
Integer.parseInt(i.next().toString()), Float.parseFloat(i.next().toString()));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ *
|
|
|
|
+ * @param arr
|
|
|
|
+ */
|
|
public void readEdge(JSONArray arr) {
|
|
public void readEdge(JSONArray arr) {
|
|
Iterator<Object> i = arr.iterator();
|
|
Iterator<Object> i = arr.iterator();
|
|
|
|
|