while (!feof(file))
{
// Reconstruct the object (extended format!)
- Object * obj = GetObjectFromFile(file, true);
+ Object * obj = GetObjectFromFile(file, true, true);
// objectFileType is set in GetObjectFromFile()...
if (objectFileType == OTFObject)
}
-/*static*/ Object * FileIO::GetObjectFromFile(FILE * file, bool extended/*= false*/)
+/*static*/ Object * FileIO::GetObjectFromFile(FILE * file, bool extended/*= false*/, bool ext2/*= false*/)
{
char buffer[256];
char textBuffer[65536];
{
Point p1, p2;
DimensionType type;
+ double offset = 0;
fscanf(file, "(%lf,%lf) (%lf,%lf) %i", &p1.x, &p1.y, &p2.x, &p2.y, (int *)&type);
- obj = (Object *)new Dimension(p1, p2, type);
+
+ if (ext2)
+ fscanf(file, " %lf", &offset);
+
+ obj = (Object *)new Dimension(p1, p2, type, offset);
}
else if (strcmp(buffer, "CONTAINER") == 0)
{
if (extended && (obj->type != OTContainer))
{
- fscanf(file, " (%i, %f, %i)", &obj->color, &obj->thickness, &obj->style);
+ fscanf(file, " (%i, %f, %i)\n", &obj->color, &obj->thickness, &obj->style);
}
}
break;
case OTDimension:
// fprintf(file, "DIMENSION %i (%lf,%lf) (%lf,%lf) %i\n", layer, position.x, position.y, endpoint.x, endpoint.y, dimensionType);
- fprintf(file, "DIMENSION %i (%lf,%lf) (%lf,%lf) %i", obj->layer, obj->p[0].x, obj->p[0].y, obj->p[1].x, obj->p[1].y, ((Dimension *)obj)->subtype);
+ fprintf(file, "DIMENSION %i (%lf,%lf) (%lf,%lf) %i %lf", obj->layer, obj->p[0].x, obj->p[0].y, obj->p[1].x, obj->p[1].y, ((Dimension *)obj)->subtype, ((Dimension *)obj)->offset);
break;
case OTSpline:
break;