X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Ffileio.cpp;h=53911621df677879cfeb652f9ab94c0f567d4de3;hb=c20f82651fdc4dd26172bcb71a85e6eb29eacd43;hp=ace5bfa247713a3adc4aabee61f0dc3871a4c0aa;hpb=97cfdecd62ced6cb1237a9ac6c7cbce2092fde99;p=architektonas diff --git a/src/fileio.cpp b/src/fileio.cpp index ace5bfa..5391162 100644 --- a/src/fileio.cpp +++ b/src/fileio.cpp @@ -304,7 +304,7 @@ enum ObjectTypeFile { OTFContainer, OTFContainerEnd, OTFObject, OTFEndOfFile }; 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) @@ -346,7 +346,7 @@ enum ObjectTypeFile { OTFContainer, OTFContainerEnd, OTFObject, OTFEndOfFile }; } -/*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]; @@ -415,8 +415,13 @@ if (errno) { 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) { @@ -440,7 +445,7 @@ if (errno) 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); } } @@ -471,7 +476,7 @@ if (errno) 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;