int GPD_2DPrimPoly::save(ostream &os, int binary) const { int cnt; if (binary) { const char tflag = isTrimmed() ? 1 : 0; if (!UTwrite(os, &tflag)) return -1; if (!UTwrite(os, &nVtx)) return -1; const char cflag = isClosed() ? '<' : ':'; if (!UTwrite(os, &cflag)) return -1; } else { os << " " << (isTrimmed() ? "trim" : "idle"); os << " " << nVtx << " " << (isClosed() ? '<' : ':'); if (!os) return -1; } if (savePrivate(os,binary) < 0) return -1; for (cnt = 0; cnt < nVtx; cnt++) if (getParent()->saveVertex(os, vtxList[cnt], binary) < 0) return -1; if (!binary) os << endl; return (!os) ? -1 : 0; }
int GPD_MetaPrim::saveMeta(ostream &os, int binary) const { const char *kname = getMetaKernel(kernel); if (binary) { if (!UTwrite(os, kname)) return -1; if (!UTwrite(os, &weight)) return -1; } else { os << " " << kname << " " << weight; if (!os) return -1; } return 0; }
int GPD_PrimMetaSQuad::savePrivate(ostream &os, int binary) const { if (binary) { if (!UTwrite(os, &xyExp)) return -1; if (!UTwrite(os, &zExp)) return -1; } else { os << " " << xyExp << " " << zExp; if (!os) return -1; } if (saveMeta(os, binary) < 0) return -1; return GPD_PrimSphere::savePrivate(os, binary); }
int GPD_Point::saveBinary(ostream &os) const { UTwrite(os, pos, sizeof(pos)/sizeof(float)); return (!os) ? -1 : 0; }