Changeset 2114 for trunk/packages/vizservers/vtkvis/RpVtkRenderer.cpp
- Timestamp:
- Mar 1, 2011, 1:54:57 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/vizservers/vtkvis/RpVtkRenderer.cpp
r2113 r2114 368 368 369 369 /** 370 * \brief Create a new PseudoColor rendering for the specified DataSet371 */372 void Renderer::addPseudoColor(DataSetId id)373 {374 DataSet *ds = getDataSet(id);375 if (ds == NULL)376 return;377 378 if (getPseudoColor(id)) {379 WARN("Replacing existing pseudocolor %s", id.c_str());380 deletePseudoColor(id);381 }382 PseudoColor *pc = new PseudoColor();383 _pseudoColors[id] = pc;384 385 pc->setDataSet(ds);386 387 _renderer->AddActor(pc->getActor());388 389 initCamera();390 _needsRedraw = true;391 }392 393 /**394 * \brief Get the PseudoColor associated with the specified DataSet395 */396 PseudoColor *Renderer::getPseudoColor(DataSetId id)397 {398 PseudoColorHashmap::iterator itr = _pseudoColors.find(id);399 400 if (itr == _pseudoColors.end()) {401 TRACE("PseudoColor not found: %s", id.c_str());402 return NULL;403 } else404 return itr->second;405 }406 407 /**408 370 * \brief Turn on/off rendering of all axes gridlines 409 371 */ … … 630 592 631 593 /** 594 * \brief Create a new PseudoColor rendering for the specified DataSet 595 */ 596 void Renderer::addPseudoColor(DataSetId id) 597 { 598 DataSet *ds = getDataSet(id); 599 if (ds == NULL) 600 return; 601 602 if (getPseudoColor(id)) { 603 WARN("Replacing existing pseudocolor %s", id.c_str()); 604 deletePseudoColor(id); 605 } 606 PseudoColor *pc = new PseudoColor(); 607 _pseudoColors[id] = pc; 608 609 pc->setDataSet(ds); 610 611 _renderer->AddActor(pc->getActor()); 612 613 initCamera(); 614 _needsRedraw = true; 615 } 616 617 /** 618 * \brief Get the PseudoColor associated with the specified DataSet 619 */ 620 PseudoColor *Renderer::getPseudoColor(DataSetId id) 621 { 622 PseudoColorHashmap::iterator itr = _pseudoColors.find(id); 623 624 if (itr == _pseudoColors.end()) { 625 TRACE("PseudoColor not found: %s", id.c_str()); 626 return NULL; 627 } else 628 return itr->second; 629 } 630 631 /** 632 632 * \brief Associate an existing named color map with a DataSet 633 633 */ … … 716 716 717 717 /** 718 * \brief Turn mesh lighting on/off for the specified DataSet 719 */ 720 void Renderer::setPseudoColorLighting(DataSetId id, bool state) 721 { 722 PseudoColor *pc = getPseudoColor(id); 723 if (pc) { 724 pc->setLighting(state); 725 _needsRedraw = true; 726 } 727 } 728 729 /** 718 730 * \brief Create a new Contour2D and associate it with the named DataSet 719 731 */ … … 791 803 792 804 /** 805 * \brief Set the RGB isoline color for the specified DataSet 806 */ 807 void Renderer::setContourEdgeColor(DataSetId id, float color[3]) 808 { 809 Contour2D *contour = getContour2D(id); 810 if (contour) { 811 contour->setEdgeColor(color); 812 _needsRedraw = true; 813 } 814 } 815 816 /** 817 * \brief Set the isoline width for the specified DataSet (may be a no-op) 818 * 819 * If the OpenGL implementation/hardware does not support wide lines, 820 * this function may not have an effect. 821 */ 822 void Renderer::setContourEdgeWidth(DataSetId id, float edgeWidth) 823 { 824 Contour2D *contour = getContour2D(id); 825 if (contour) { 826 contour->setEdgeWidth(edgeWidth); 827 _needsRedraw = true; 828 } 829 } 830 831 /** 832 * \brief Turn contour lighting on/off for the specified DataSet 833 */ 834 void Renderer::setContourLighting(DataSetId id, bool state) 835 { 836 Contour2D *contour = getContour2D(id); 837 if (contour) { 838 contour->setLighting(state); 839 _needsRedraw = true; 840 } 841 } 842 843 /** 793 844 * \brief Create a new PolyData and associate it with the named DataSet 794 845 */ … … 839 890 if (polyData) { 840 891 polyData->setVisibility(state); 892 _needsRedraw = true; 893 } 894 } 895 896 /** 897 * \brief Set the RGB polygon face color for the specified DataSet 898 */ 899 void Renderer::setPolyDataColor(DataSetId id, float color[3]) 900 { 901 PolyData *polyData = getPolyData(id); 902 if (polyData) { 903 polyData->setColor(color); 904 _needsRedraw = true; 905 } 906 } 907 908 /** 909 * \brief Set the visibility of polygon edges for the specified DataSet 910 */ 911 void Renderer::setPolyDataEdgeVisibility(DataSetId id, bool state) 912 { 913 PolyData *polyData = getPolyData(id); 914 if (polyData) { 915 polyData->setEdgeVisibility(state); 916 _needsRedraw = true; 917 } 918 } 919 920 /** 921 * \brief Set the RGB polygon edge color for the specified DataSet 922 */ 923 void Renderer::setPolyDataEdgeColor(DataSetId id, float color[3]) 924 { 925 PolyData *polyData = getPolyData(id); 926 if (polyData) { 927 polyData->setEdgeColor(color); 928 _needsRedraw = true; 929 } 930 } 931 932 /** 933 * \brief Set the polygon edge width for the specified DataSet (may be a no-op) 934 * 935 * If the OpenGL implementation/hardware does not support wide lines, 936 * this function may not have an effect. 937 */ 938 void Renderer::setPolyDataEdgeWidth(DataSetId id, float edgeWidth) 939 { 940 PolyData *polyData = getPolyData(id); 941 if (polyData) { 942 polyData->setEdgeWidth(edgeWidth); 943 _needsRedraw = true; 944 } 945 } 946 947 /** 948 * \brief Set wireframe rendering for the specified DataSet 949 */ 950 void Renderer::setPolyDataWireframe(DataSetId id, bool state) 951 { 952 PolyData *polyData = getPolyData(id); 953 if (polyData) { 954 polyData->setWireframe(state); 955 _needsRedraw = true; 956 } 957 } 958 959 /** 960 * \brief Turn mesh lighting on/off for the specified DataSet 961 */ 962 void Renderer::setPolyDataLighting(DataSetId id, bool state) 963 { 964 PolyData *polyData = getPolyData(id); 965 if (polyData) { 966 polyData->setLighting(state); 841 967 _needsRedraw = true; 842 968 } … … 956 1082 void Renderer::rotateCamera(double yaw, double pitch, double roll) 957 1083 { 1084 if (_cameraMode == IMAGE) 1085 return; 958 1086 vtkSmartPointer<vtkCamera> camera = _renderer->GetActiveCamera(); 959 1087 camera->Azimuth(yaw); // Rotate about object … … 975 1103 void Renderer::panCamera(double x, double y) 976 1104 { 1105 if (_cameraMode == IMAGE) { 1106 _imgWorldOrigin[0] += x; 1107 _imgWorldOrigin[1] += y; 1108 setCameraZoomRegion(_imgWorldOrigin[0], _imgWorldOrigin[1], 1109 _imgWorldDims[0], _imgWorldDims[1]); 1110 _needsRedraw = true; 1111 return; 1112 } 977 1113 vtkSmartPointer<vtkCamera> camera = _renderer->GetActiveCamera(); 978 1114 vtkSmartPointer<vtkTransform> trans = vtkSmartPointer<vtkTransform>::New(); … … 991 1127 void Renderer::zoomCamera(double z) 992 1128 { 1129 if (_cameraMode == IMAGE) { 1130 double dx = _imgWorldDims[0]; 1131 double dy = _imgWorldDims[1]; 1132 _imgWorldDims[0] /= z; 1133 _imgWorldDims[1] /= z; 1134 dx -= _imgWorldDims[0]; 1135 dy -= _imgWorldDims[1]; 1136 _imgWorldOrigin[0] += dx/2.0; 1137 _imgWorldOrigin[1] += dy/2.0; 1138 setCameraZoomRegion(_imgWorldOrigin[0], _imgWorldOrigin[1], 1139 _imgWorldDims[0], _imgWorldDims[1]); 1140 _needsRedraw = true; 1141 return; 1142 } 993 1143 vtkSmartPointer<vtkCamera> camera = _renderer->GetActiveCamera(); 994 1144 camera->Zoom(z); // Change perspective FOV angle or ortho parallel scale … … 1208 1358 setContourVisibility(id, state); 1209 1359 setPolyDataVisibility(id, state); 1210 }1211 1212 /**1213 * \brief Set the RGB isoline color for the specified DataSet1214 */1215 void Renderer::setContourEdgeColor(DataSetId id, float color[3])1216 {1217 Contour2D *contour = getContour2D(id);1218 if (contour) {1219 contour->setEdgeColor(color);1220 _needsRedraw = true;1221 }1222 }1223 1224 /**1225 * \brief Set the isoline width for the specified DataSet (may be a no-op)1226 *1227 * If the OpenGL implementation/hardware does not support wide lines,1228 * this function may not have an effect.1229 */1230 void Renderer::setContourEdgeWidth(DataSetId id, float edgeWidth)1231 {1232 Contour2D *contour = getContour2D(id);1233 if (contour) {1234 contour->setEdgeWidth(edgeWidth);1235 _needsRedraw = true;1236 }1237 }1238 1239 /**1240 * \brief Set the RGB polygon face color for the specified DataSet1241 */1242 void Renderer::setPolyDataColor(DataSetId id, float color[3])1243 {1244 PolyData *polyData = getPolyData(id);1245 if (polyData) {1246 polyData->setColor(color);1247 _needsRedraw = true;1248 }1249 }1250 1251 /**1252 * \brief Set the visibility of polygon edges for the specified DataSet1253 */1254 void Renderer::setPolyDataEdgeVisibility(DataSetId id, bool state)1255 {1256 PolyData *polyData = getPolyData(id);1257 if (polyData) {1258 polyData->setEdgeVisibility(state);1259 _needsRedraw = true;1260 }1261 }1262 1263 /**1264 * \brief Set the RGB polygon edge color for the specified DataSet1265 */1266 void Renderer::setPolyDataEdgeColor(DataSetId id, float color[3])1267 {1268 PolyData *polyData = getPolyData(id);1269 if (polyData) {1270 polyData->setEdgeColor(color);1271 _needsRedraw = true;1272 }1273 }1274 1275 /**1276 * \brief Set the polygon edge width for the specified DataSet (may be a no-op)1277 *1278 * If the OpenGL implementation/hardware does not support wide lines,1279 * this function may not have an effect.1280 */1281 void Renderer::setPolyDataEdgeWidth(DataSetId id, float edgeWidth)1282 {1283 PolyData *polyData = getPolyData(id);1284 if (polyData) {1285 polyData->setEdgeWidth(edgeWidth);1286 _needsRedraw = true;1287 }1288 }1289 1290 /**1291 * \brief Set wireframe rendering for the specified DataSet1292 */1293 void Renderer::setPolyDataWireframe(DataSetId id, bool state)1294 {1295 PolyData *polyData = getPolyData(id);1296 if (polyData) {1297 polyData->setWireframe(state);1298 _needsRedraw = true;1299 }1300 1360 } 1301 1361
Note: See TracChangeset
for help on using the changeset viewer.