Changeset 1447 for trunk/packages/vizservers/nanovis
- Timestamp:
- May 18, 2009, 11:44:11 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/vizservers/nanovis/Unirect.cpp
r1434 r1447 144 144 } else if ((c == 'u') && (strcmp(string, "units") == 0)) { 145 145 _vUnits = strdup(Tcl_GetString(objv[i+1])); 146 } else if ((c == 'o') && (strcmp(string, "order") == 0)) { 146 } else if ((c == 'c') && (strcmp(string, "components") == 0)) { 147 int n; 148 149 if (Tcl_GetIntFromObj(interp, objv[i+1], &n) != TCL_OK) { 150 return TCL_ERROR; 151 } 152 if (n <= 0) { 153 Tcl_AppendResult(interp, "bad extents value: must be > 0", 154 (char *)NULL); 155 return TCL_ERROR; 156 } 157 _nComponents = n; 158 } else if ((c == 'a') && (strcmp(string, "axisorder") == 0)) { 147 159 Tcl_Obj **axes; 148 160 int n; … … 337 349 } else if ((c == 'u') && (strcmp(string, "units") == 0)) { 338 350 _vUnits = strdup(Tcl_GetString(objv[i+1])); 339 } else if ((c == ' e') && (strcmp(string, "extents") == 0)) {351 } else if ((c == 'c') && (strcmp(string, "components") == 0)) { 340 352 int n; 341 353 … … 379 391 if (_nValues != (_xNum * _yNum * _nComponents)) { 380 392 Tcl_AppendResult(interp, 381 "wrong number of values: must be xnum*ynum* extents",393 "wrong number of values: must be xnum*ynum*components", 382 394 (char *)NULL); 395 fprintf(stderr, "x=%d y=%d c=%d, nv=%d\n", 396 _xNum, _yNum, _nComponents, _nValues); 383 397 return TCL_ERROR; 384 398 } … … 642 656 } 643 657 } 658 659 bool 660 Rappture::Unirect3d::Convert(Rappture::Unirect2d *dataPtr) 661 { 662 _initialized = false; 663 664 _xValueMin = dataPtr->xValueMin(); 665 _yValueMin = dataPtr->yValueMin(); 666 _zValueMin = 0.0; 667 _xMin = dataPtr->xMin(); 668 _yMin = dataPtr->yMin(); 669 _zMin = 0.0; 670 _xMax = dataPtr->xMax(); 671 _yMax = dataPtr->yMax(); 672 _zMax = 0.0; 673 _xNum = dataPtr->xNum(); 674 _yNum = dataPtr->yNum(); 675 _zNum = 1; 676 switch (dataPtr->nComponents()) { 677 case 1: 678 case 3: 679 if (_values != NULL) { 680 delete [] _values; 681 } 682 _values = new float[dataPtr->nValues()]; 683 memcpy(_values, dataPtr->values(), dataPtr->nValues()); 684 _nValues = dataPtr->nValues(); 685 _nComponents = dataPtr->nComponents(); 686 break; 687 case 2: 688 float *values; 689 _nValues = 3 * _xNum * _yNum * _zNum; 690 if (_values != NULL) { 691 delete [] _values; 692 } 693 _values = new float[_nValues]; 694 if (_values == NULL) { 695 return false; 696 } 697 values = dataPtr->values(); 698 size_t i, j; 699 for(j = i = 0; i < dataPtr->nValues(); i += 2, j+= 3) { 700 _values[j] = values[i]; 701 _values[j+1] = values[i+1]; 702 _values[j+2] = 0.0f; 703 } 704 _nComponents = 3; 705 break; 706 } 707 return true; 708 }
Note: See TracChangeset
for help on using the changeset viewer.