int GPD_PrimMetaSQuad::loadPrivate(istream &is, int binary) { if (binary) { if (!UTread(is, &xyExp)) return -1; if (!UTread(is, &zExp)) return -1; } else { is >> xyExp >> zExp; if (!is) return -1; } if (loadMeta(is, binary) < 0) return -1; return GPD_PrimSphere::loadPrivate(is, binary); }
int GPD_2DPrimPoly::load(istream &is, int binary) { int cnt; char cflag; if (binary) { char tflag; if (!UTread(is, &tflag)) return -1; if (!UTread(is, &nVtx)) return -1; if (!UTread(is, &cflag)) return -1; if (tflag == 1) trim(); else untrim(); } else { char ttoken[GPD_BUFSIZ]; is >> ttoken; is >> nVtx >> cflag; if (!is) return -1; if (!strcmp(ttoken, "trim")) trim(); else untrim(); } if (cflag == '<') close(); else open(); vtxList = new GPD_2DVertex[nVtx]; if (loadPrivate(is,binary) < 0) return -1; for (cnt = 0; cnt < nVtx; cnt++) if (getParent()->loadVertex(is, vtxList[cnt], binary) < 0) return -1; if (!binary) // Get junk at end of line: is.ignore(GPD_BUFSIZ-1, '\n'); if (!is) return -1; return 0; }
int GPD_MetaPrim::loadMeta(istream &is, int binary) { char kname[64]; if (binary) { if (!UTread(is, kname)) return -1; if (!UTread(is, &weight)) return -1; kname[1] = 0; } else { is >> kname >> weight; if (!is) return -1; } setMetaKernel(kname); return 0; }
int GPD_Point::loadBinary(istream &is) { UTread(is, pos, sizeof(pos)/sizeof(float)); return (!is) ? -1 : 0; }