Changeset 2112 for trunk/packages/vizservers/vtkvis/RpPseudoColor.cpp
- Timestamp:
- Feb 28, 2011 2:57:29 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/vizservers/vtkvis/RpPseudoColor.cpp
r2100 r2112 19 19 PseudoColor::PseudoColor() : 20 20 _dataSet(NULL), 21 _opacity(1.0) 22 { 21 _opacity(1.0), 22 _edgeWidth(1.0) 23 { 24 _edgeColor[0] = 0.0; 25 _edgeColor[1] = 0.0; 26 _edgeColor[2] = 0.0; 23 27 } 24 28 … … 58 62 _dsMapper->StaticOff(); 59 63 60 vtkLookupTable *lut = ds->GetPointData()->GetScalars()->GetLookupTable(); 61 TRACE("Data set scalars lookup table: %p\n", lut); 62 if (_lut == NULL) { 63 if (lut) 64 _lut = lut; 65 else 64 if (ds->GetPointData() == NULL || 65 ds->GetPointData()->GetScalars() == NULL) { 66 ERROR("No scalar point data in dataset %s", _dataSet->getName().c_str()); 67 if (_lut == NULL) { 66 68 _lut = vtkSmartPointer<vtkLookupTable>::New(); 69 } 67 70 } else { 68 69 } 71 vtkLookupTable *lut = ds->GetPointData()->GetScalars()->GetLookupTable(); 72 TRACE("Data set scalars lookup table: %p\n", lut); 73 if (_lut == NULL) { 74 if (lut) 75 _lut = lut; 76 else 77 _lut = vtkSmartPointer<vtkLookupTable>::New(); 78 } 79 } 80 70 81 _lut->SetRange(dataRange); 71 82 … … 81 92 82 93 /** 83 * \brief Get the VTK Actor for the colormap iamge94 * \brief Get the VTK Actor for the colormapped dataset 84 95 */ 85 96 vtkActor *PseudoColor::getActor() … … 89 100 90 101 /** 91 * \brief Create and initialize a VTK actor to render the colormap image102 * \brief Create and initialize a VTK actor to render the colormapped dataset 92 103 */ 93 104 void PseudoColor::initActor() … … 96 107 _dsActor = vtkSmartPointer<vtkActor>::New(); 97 108 _dsActor->GetProperty()->SetOpacity(_opacity); 109 _dsActor->GetProperty()->SetEdgeColor(_edgeColor[0], _edgeColor[1], _edgeColor[2]); 110 _dsActor->GetProperty()->SetLineWidth(_edgeWidth); 111 _dsActor->GetProperty()->EdgeVisibilityOff(); 98 112 } 99 113 } … … 118 132 } 119 133 134 double dataRange[2]; 120 135 if (_dataSet != NULL) { 121 double dataRange[2];122 136 _dataSet->getDataRange(dataRange); 123 137 _lut->SetRange(dataRange); 124 125 if (_dataSet->getVtkDataSet()->GetPointData()->GetScalars()->GetLookupTable()) { 138 #ifdef notdef 139 if (_dataSet->getVtkDataSet()->GetPointData() && 140 _dataSet->getVtkDataSet()->GetPointData()->GetScalars() && 141 _dataSet->getVtkDataSet()->GetPointData()->GetScalars()->GetLookupTable()) { 126 142 TRACE("Change scalar table: %p %p\n", 127 143 _dataSet->getVtkDataSet()->GetPointData()->GetScalars()->GetLookupTable(), … … 130 146 TRACE("Scalar Table: %p\n", _dataSet->getVtkDataSet()->GetPointData()->GetScalars()->GetLookupTable()); 131 147 } 148 #endif 132 149 } 133 150 if (_dsMapper != NULL) { 134 151 _dsMapper->SetLookupTable(_lut); 135 } 136 } 137 138 /** 139 * \brief Turn on/off rendering of this colormap image 152 if (_dataSet != NULL) { 153 _dsMapper->SetScalarRange(dataRange); 154 } 155 } 156 } 157 158 /** 159 * \brief Turn on/off rendering of this colormapped dataset 140 160 */ 141 161 void PseudoColor::setVisibility(bool state) … … 147 167 148 168 /** 149 * \brief Set opacity used to render the colormap image 169 * \brief Get visibility state of the colormapped dataset 170 * 171 * \return Is PseudoColor visible? 172 */ 173 bool PseudoColor::getVisibility() 174 { 175 if (_dsActor == NULL) { 176 return false; 177 } else { 178 return (_dsActor->GetVisibility() != 0); 179 } 180 } 181 182 /** 183 * \brief Set opacity used to render the colormapped dataset 150 184 */ 151 185 void PseudoColor::setOpacity(double opacity) … … 157 191 158 192 /** 193 * \brief Turn on/off rendering of mesh edges 194 */ 195 void PseudoColor::setEdgeVisibility(bool state) 196 { 197 if (_dsActor != NULL) { 198 _dsActor->GetProperty()->SetEdgeVisibility((state ? 1 : 0)); 199 } 200 } 201 202 /** 203 * \brief Set RGB color of polygon edges 204 */ 205 void PseudoColor::setEdgeColor(float color[3]) 206 { 207 _edgeColor[0] = color[0]; 208 _edgeColor[1] = color[1]; 209 _edgeColor[2] = color[2]; 210 if (_dsActor != NULL) 211 _dsActor->GetProperty()->SetEdgeColor(_edgeColor[0], _edgeColor[1], _edgeColor[2]); 212 } 213 214 /** 215 * \brief Set pixel width of polygon edges (may be a no-op) 216 */ 217 void PseudoColor::setEdgeWidth(float edgeWidth) 218 { 219 _edgeWidth = edgeWidth; 220 if (_dsActor != NULL) 221 _dsActor->GetProperty()->SetLineWidth(_edgeWidth); 222 } 223 224 /** 159 225 * \brief Set a group of world coordinate planes to clip rendering 226 * 227 * Passing NULL for planes will remove all cliping planes 160 228 */ 161 229 void PseudoColor::setClippingPlanes(vtkPlaneCollection *planes) 162 230 { 163 if (_dsMapper != NULL) 164 _dsMapper->SetClippingPlanes(planes); 165 } 231 if (_dsMapper != NULL) { 232 if (planes == NULL) 233 _dsMapper->RemoveAllClippingPlanes(); 234 else 235 _dsMapper->SetClippingPlanes(planes); 236 } 237 }
Note: See TracChangeset
for help on using the changeset viewer.