MCPcopy Create free account
hub / github.com/Kitware/VTK / WriteScalar

Method WriteScalar

IO/GeoJSON/vtkGeoJSONWriter.cxx:187–230  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

185
186//------------------------------------------------------------------------------
187void vtkGeoJSONWriter::WriteScalar(vtkDataArray* da, vtkIdType ptId)
188{
189 if (this->ScalarFormat == 0)
190 {
191 return;
192 }
193 if (da)
194 {
195 double b = da->GetTuple1(ptId);
196 if (this->ScalarFormat == 1)
197 {
198 vtkLookupTable* lut = this->GetLookupTable();
199 if (!lut)
200 {
201 lut = vtkLookupTable::New();
202 lut->SetNumberOfColors(256);
203 lut->SetHueRange(0.0, 0.667);
204 lut->SetRange(da->GetRange());
205 lut->Build();
206 this->SetLookupTable(lut);
207 lut->Delete();
208 }
209 const unsigned char* color = lut->MapValue(b);
210 this->WriterHelper->append(",");
211 this->WriterHelper->append((double)color[0] / 255.0);
212 this->WriterHelper->append(",");
213 this->WriterHelper->append((double)color[1] / 255.0);
214 this->WriterHelper->append(",");
215 this->WriterHelper->append((double)color[2] / 255.0);
216 }
217 else
218 {
219 if (vtkMath::IsNan(b))
220 {
221 this->WriterHelper->append(",null");
222 }
223 else
224 {
225 this->WriterHelper->append(",");
226 this->WriterHelper->append(b);
227 }
228 }
229 }
230}
231
232//------------------------------------------------------------------------------
233void vtkGeoJSONWriter::WriteData()

Callers 1

WriteDataMethod · 0.95

Calls 12

IsNanFunction · 0.85
GetTuple1Method · 0.80
SetNumberOfColorsMethod · 0.80
DeleteMethod · 0.65
NewFunction · 0.50
GetLookupTableMethod · 0.45
SetRangeMethod · 0.45
GetRangeMethod · 0.45
BuildMethod · 0.45
SetLookupTableMethod · 0.45
MapValueMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected