Changeset 2627
- Timestamp:
- Oct 14, 2011, 9:26:55 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/vizservers/vtkvis/RpVtkRenderer.cpp
r2617 r2627 299 299 } 300 300 301 /** 302 * \brief Get a list of DataSets this Renderer knows about 303 */ 301 304 void Renderer::getDataSetNames(std::vector<std::string>& names) 302 305 { … … 357 360 } 358 361 362 /** 363 * \brief Set the active scalar field array by name for a DataSet 364 */ 359 365 bool Renderer::setDataSetActiveScalars(const DataSetId& id, const char *scalarName) 360 366 { … … 394 400 } 395 401 402 /** 403 * \brief Set the active vector field array by name for a DataSet 404 */ 396 405 bool Renderer::setDataSetActiveVectors(const DataSetId& id, const char *vectorName) 397 406 { … … 1062 1071 } 1063 1072 1073 /** 1074 * \brief Render a labelled legend image for the given colormap 1075 * 1076 * The field is assumed to be the active scalar or vector field 1077 * based on the legendType. 1078 * 1079 * \param[in] id ColorMap name 1080 * \param[in] dataSetID DataSet name 1081 * \param[in] legendType scalar or vector field legend 1082 * \param[in,out] title If supplied, draw title ("#auto" means to 1083 * fill in field name and draw). If blank, do not draw title. 1084 * If title was blank or "#auto", will be filled with field name on 1085 * return 1086 * \param[in,out] range Data range to use in legend. Set min > max to have 1087 * range computed, will be filled with valid min and max values 1088 * \param[in] width Pixel width of legend (aspect controls orientation) 1089 * \param[in] height Pixel height of legend (aspect controls orientation) 1090 * \param[in] numLabels Number of labels to render (includes min/max) 1091 * \param[in,out] imgData Pointer to array to fill with image bytes. Array 1092 * will be resized if needed. 1093 * \return The image is rendered into the supplied array, false is 1094 * returned if the color map is not found 1095 */ 1064 1096 bool Renderer::renderColorMap(const ColorMapId& id, 1065 1097 const DataSetId& dataSetID, … … 1103 1135 } 1104 1136 1105 1137 /** 1138 * \brief Render a labelled legend image for the given colormap 1139 * 1140 * The field is assumed to be point data, if the field is not found 1141 * as point data, cell data is used. 1142 * 1143 * \param[in] id ColorMap name 1144 * \param[in] dataSetID DataSet name 1145 * \param[in] legendType scalar or vector field legend 1146 * \param[in] fieldName Name of the field array this legend is for 1147 * \param[in,out] title If supplied, draw title ("#auto" means to 1148 * fill in field name and draw). If blank, do not draw title. 1149 * If title was blank or "#auto", will be filled with field name on 1150 * return 1151 * \param[in,out] range Data range to use in legend. Set min > max to have 1152 * range computed, will be filled with valid min and max values 1153 * \param[in] width Pixel width of legend (aspect controls orientation) 1154 * \param[in] height Pixel height of legend (aspect controls orientation) 1155 * \param[in] numLabels Number of labels to render (includes min/max) 1156 * \param[in,out] imgData Pointer to array to fill with image bytes. Array 1157 * will be resized if needed. 1158 * \return The image is rendered into the supplied array, false is 1159 * returned if the color map is not found 1160 */ 1106 1161 bool Renderer::renderColorMap(const ColorMapId& id, 1107 1162 const DataSetId& dataSetID, … … 1150 1205 * \param[in] dataSetID DataSet name 1151 1206 * \param[in] legendType scalar or vector field legend 1207 * \param[in] fieldName Name of the field array this legend is for 1208 * \param[in] type DataAttributeType of the field 1152 1209 * \param[in,out] title If supplied, draw title ("#auto" means to 1153 1210 * fill in field name and draw). If blank, do not draw title. 1154 1211 * If title was blank or "#auto", will be filled with field name on 1155 1212 * return 1156 * \param[out] range Filled with min and max values 1213 * \param[in,out] range Data range to use in legend. Set min > max to have 1214 * range computed, will be filled with valid min and max values 1157 1215 * \param[in] width Pixel width of legend (aspect controls orientation) 1158 1216 * \param[in] height Pixel height of legend (aspect controls orientation) … … 1263 1321 } 1264 1322 1265 range[0] = 0.0; 1266 range[1] = 1.0; 1323 bool needRange = false; 1324 if (range[0] > range[1]) { 1325 range[0] = 0.0; 1326 range[1] = 1.0; 1327 needRange = true; 1328 } 1267 1329 1268 1330 switch (legendType) { 1269 1331 case LEGEND_VECTOR_MAGNITUDE: 1270 if (cumulative) { 1271 getCumulativeDataRange(range, fieldName, type, 3); 1272 } else if (dataSet != NULL) { 1273 dataSet->getDataRange(range, fieldName, type); 1332 if (needRange) { 1333 if (cumulative) { 1334 getCumulativeDataRange(range, fieldName, type, 3); 1335 } else if (dataSet != NULL) { 1336 dataSet->getDataRange(range, fieldName, type); 1337 } 1274 1338 } 1275 1339 … … 1284 1348 break; 1285 1349 case LEGEND_VECTOR_X: 1286 if (cumulative) { 1287 getCumulativeDataRange(range, fieldName, type, 3, 0); 1288 } else if (dataSet != NULL) { 1289 dataSet->getDataRange(range, fieldName, type, 0); 1350 if (needRange) { 1351 if (cumulative) { 1352 getCumulativeDataRange(range, fieldName, type, 3, 0); 1353 } else if (dataSet != NULL) { 1354 dataSet->getDataRange(range, fieldName, type, 0); 1355 } 1290 1356 } 1291 1357 … … 1300 1366 break; 1301 1367 case LEGEND_VECTOR_Y: 1302 if (cumulative) { 1303 getCumulativeDataRange(range, fieldName, type, 3, 1); 1304 } else if (dataSet != NULL) { 1305 dataSet->getDataRange(range, fieldName, type, 1); 1368 if (needRange) { 1369 if (cumulative) { 1370 getCumulativeDataRange(range, fieldName, type, 3, 1); 1371 } else if (dataSet != NULL) { 1372 dataSet->getDataRange(range, fieldName, type, 1); 1373 } 1306 1374 } 1307 1375 … … 1316 1384 break; 1317 1385 case LEGEND_VECTOR_Z: 1318 if (cumulative) { 1319 getCumulativeDataRange(range, fieldName, type, 3, 2); 1320 } else if (dataSet != NULL) { 1321 dataSet->getDataRange(range, fieldName, type, 1); 1386 if (needRange) { 1387 if (cumulative) { 1388 getCumulativeDataRange(range, fieldName, type, 3, 2); 1389 } else if (dataSet != NULL) { 1390 dataSet->getDataRange(range, fieldName, type, 1); 1391 } 1322 1392 } 1323 1393 … … 1333 1403 case LEGEND_SCALAR: 1334 1404 default: 1335 if (cumulative) { 1336 getCumulativeDataRange(range, fieldName, type, 1); 1337 } else if (dataSet != NULL) { 1338 dataSet->getDataRange(range, fieldName, type); 1339 } 1405 if (needRange) { 1406 if (cumulative) { 1407 getCumulativeDataRange(range, fieldName, type, 1); 1408 } else if (dataSet != NULL) { 1409 dataSet->getDataRange(range, fieldName, type); 1410 } 1411 } 1340 1412 1341 1413 lut->SetRange(range);
Note: See TracChangeset
for help on using the changeset viewer.