Changeset 4904 for nanovis/branches/1.1/VtkReader.cpp
- Timestamp:
- Dec 22, 2014, 4:18:59 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
nanovis/branches/1.1/VtkReader.cpp
r4889 r4904 8 8 #include <float.h> 9 9 10 #include <RpOutcome.h>11 10 #include <RpField1D.h> 12 11 #include <RpFieldRect3D.h> … … 16 15 #include "ReaderCommon.h" 17 16 17 #include "config.h" 18 18 #include "nanovis.h" 19 19 #include "VtkReader.h" … … 183 183 184 184 Volume * 185 nv::load_vtk_volume_stream( Rappture::Outcome& result,const char *tag, std::iostream& fin)185 nv::load_vtk_volume_stream(const char *tag, std::iostream& fin) 186 186 { 187 187 TRACE("Enter tag:%s", tag); … … 207 207 fin.getline(line, sizeof(line) - 1); 208 208 if (fin.fail()) { 209 result.error("Error in data stream");209 ERROR("Error in data stream"); 210 210 return NULL; 211 211 } … … 222 222 isRect = 1; 223 223 } else { 224 result.addError("Unsupported DataSet type '%s'", str);224 ERROR("Unsupported DataSet type '%s'", str); 225 225 return NULL; 226 226 } 227 227 } else if (sscanf(start, "DIMENSIONS %d %d %d", &nx, &ny, &nz) == 3) { 228 228 if (nx <= 0 || ny <= 0 || nz <= 0) { 229 result.error("Found non-positive dimensions");229 ERROR("Found non-positive dimensions"); 230 230 return NULL; 231 231 } … … 235 235 } else if (sscanf(start, "SPACING %lg %lg %lg", &dx, &dy, &dz) == 3) { 236 236 if ((nx > 1 && dx == 0.0) || (ny > 1 && dy == 0.0) || (nz > 1 && dz == 0.0)) { 237 result.error("Found zero spacing for dimension");237 ERROR("Found zero spacing for dimension"); 238 238 return NULL; 239 239 } … … 241 241 } else if (sscanf(start, "POINT_DATA %d", &npts) == 1) { 242 242 if (npts < 1 || npts != nx * ny * nz) { 243 result.addError("Error in data stream: unexpected number of point data: %d", npts);243 ERROR("Error in data stream: unexpected number of point data: %d", npts); 244 244 return NULL; 245 245 } 246 246 if (isBinary < 0 || fin.eof()) { 247 247 // Should know if ASCII or BINARY by now 248 result.error("Error in data stream");248 ERROR("Error in data stream"); 249 249 return NULL; 250 250 } 251 251 fin.getline(line, sizeof(line) - 1); 252 252 if (fin.fail()) { 253 result.error("Error in data stream");253 ERROR("Error in data stream"); 254 254 return NULL; 255 255 } … … 257 257 ; // skip leading blanks 258 258 if (sscanf(start, "SCALARS %s %s", str, type) != 2) { 259 result.error("Error in data stream");259 ERROR("Error in data stream"); 260 260 return NULL; 261 261 } … … 267 267 ftype = UCHAR; 268 268 if (!isBinary) { 269 result.addError("unsigned char only supported in binary VTK files");269 ERROR("unsigned char only supported in binary VTK files"); 270 270 return NULL; 271 271 } … … 279 279 ftype = UINT; 280 280 } else { 281 result.addError("Unsupported scalar type: '%s'", type);281 ERROR("Unsupported scalar type: '%s'", type); 282 282 return NULL; 283 283 } 284 284 if (fin.eof()) { 285 result.error("Error in data stream");285 ERROR("Error in data stream"); 286 286 return NULL; 287 287 } 288 288 fin.getline(line, sizeof(line) - 1); 289 289 if (fin.fail()) { 290 result.error("Error in data stream");290 ERROR("Error in data stream"); 291 291 return NULL; 292 292 } … … 296 296 // skip lookup table, but don't read ahead 297 297 if (fin.eof()) { 298 result.error("Error in data stream");298 ERROR("Error in data stream"); 299 299 return NULL; 300 300 } 301 301 } else { 302 302 // Lookup table line is required 303 result.error("Missing LOOKUP_TABLE");303 ERROR("Missing LOOKUP_TABLE"); 304 304 return NULL; 305 305 } … … 310 310 if (fin.fail()) { 311 311 deleteFieldData(fieldData, ftype); 312 result.error("Error in data stream");312 ERROR("Error in data stream"); 313 313 return NULL; 314 314 } … … 320 320 if (fin.fail()) { 321 321 deleteFieldData(fieldData, ftype); 322 result.error("Error in data stream");322 ERROR("Error in data stream"); 323 323 return NULL; 324 324 } … … 333 333 if (isRect < 0 || numRead != npts || npts < 1) { 334 334 deleteFieldData(fieldData, ftype); 335 result.error("Error in data stream");335 ERROR("Error in data stream"); 336 336 return NULL; 337 337 } … … 468 468 } else { 469 469 deleteFieldData(fieldData, ftype); 470 result.error("Unsupported DataSet");470 ERROR("Unsupported DataSet"); 471 471 return NULL; 472 472 } … … 495 495 float dz0 = -0.5*lz/lx; 496 496 if (volume) { 497 volume-> location(vrmath::Vector3f(dx0, dy0, dz0));498 TRACE("Set volume location to %g %g %g", dx0, dy0, dz0);497 volume->setPosition(vrmath::Vector3f(dx0, dy0, dz0)); 498 TRACE("Set volume position to %g %g %g", dx0, dy0, dz0); 499 499 } 500 500 return volume;
Note: See TracChangeset
for help on using the changeset viewer.