+/*static*/ bool FileIO::GetObjectFromFile(FILE * file, Object * parent, Object ** object, int * objectType)
+{
+ char buffer[256];
+ fscanf(file, "%s ", buffer);
+ bool recognized = false;
+//printf("Load: buffer = \"%s\"\n", buffer);
+
+ if (strcmp(buffer, "LINE") == 0)
+ {
+//printf(" Found LINE.\n");
+ recognized = true;
+ Vector v1, v2;
+ fscanf(file, "(%lf,%lf) (%lf,%lf)", &v1.x, &v1.y, &v2.x, &v2.y);
+//printf(" Number of params recognized: %i\n", n);
+ *object = new Line(v1, v2, parent);
+ *objectType = OTLine;
+ }
+ else if (strcmp(buffer, "CIRCLE") == 0)
+ {
+ recognized = true;
+ Vector v;
+ double r;
+ fscanf(file, "(%lf,%lf) %lf", &v.x, &v.y, &r);
+ *object = new Circle(v, r, parent);
+ *objectType = OTCircle;
+ }
+ else if (strcmp(buffer, "ARC") == 0)
+ {
+ recognized = true;
+ Vector v;
+ double r, a1, a2;
+ fscanf(file, "(%lf,%lf) %lf, %lf, %lf", &v.x, &v.y, &r, &a1, &a2);
+ *object = new Arc(v, r, a1, a2, parent);
+ *objectType = OTArc;
+ }
+ else if (strcmp(buffer, "DIMENSION") == 0)
+ {
+ recognized = true;
+ Vector v1, v2;
+ DimensionType type;
+ fscanf(file, "(%lf,%lf) (%lf,%lf) %i", &v1.x, &v1.y, &v2.x, &v2.y, &type);
+ *object = new Dimension(v1, v2, type, parent);
+ *objectType = OTDimension;
+ }
+ else if (strcmp(buffer, "CONTAINER") == 0)
+ {
+ recognized = true;
+ *objectType = OTContainer;
+ }
+ else if (strcmp(buffer, "ENDCONTAINER") == 0)
+ {
+ recognized = true;
+ *objectType = OTContainerEnd;
+ }
+ else if (strcmp(buffer, "END") == 0)
+ {
+ recognized = true;
+ *objectType = OTEndOfFile;
+ }
+
+ return recognized;
+}
+