MCPcopy Create free account
hub / github.com/MeshInspector/MeshLib / saveCurrentToJson

Method saveCurrentToJson

source/MRViewer/MRPalette.cpp:194–213  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

192}
193
194void Palette::saveCurrentToJson( Json::Value& root ) const
195{
196 Json::Value colorsArray = Json::arrayValue;
197 const std::vector<Color>& colors = texture_.pixels;
198 const auto colorsSize = colors.size() / 2; // second half is gray color
199 for ( int i = 0; i < colorsSize; ++i )
200 serializeToJson( colors[i], colorsArray[i] );
201 root["Colors"] = colorsArray;
202
203 Json::Value ranges = Json::arrayValue;
204 const int rangesSize = int( parameters_.ranges.size() );
205 for ( int i = 0; i < rangesSize; ++i )
206 ranges[i] = parameters_.ranges[i];
207 root["Ranges"] = ranges;
208
209 root["Discretization"] = parameters_.discretization;
210
211 std::string str = texture_.filter == FilterType::Linear ? "Linear" : "Discrete";
212 root["Filter"] = str;
213}
214
215void Palette::setZeroCentredLabels_()
216{

Callers 1

savePresetMethod · 0.80

Calls 2

serializeToJsonFunction · 0.70
sizeMethod · 0.45

Tested by

no test coverage detected