MCPcopy Create free account
hub / github.com/antvis/F2Native / ParseDashArray

Function ParseDashArray

core/graphics/util/json.cpp:26–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24nlohmann::json ParseString(const std::string &json) { return nlohmann::json::parse(json, nullptr, false); }
25
26std::vector<float> ParseDashArray(const nlohmann::json &json, float ratio, const std::vector<float> &defVal) {
27 if(json.is_array() && json.size() > 0) {
28 std::vector<float> rst;
29 for(std::size_t i = 0; i < json.size(); ++i) {
30 if(json[i].is_number()) {
31 rst.push_back(json[i].get<float>() * ratio);
32 }
33 }
34
35 return rst;
36 }
37 return defVal;
38}
39
40void ParseRoundings(const nlohmann::json &data, float *rst, float ratio) {
41 if(data.is_array() && data.size() >= 4) {

Callers 6

_ShowCrosshairsMethod · 0.85
RenderMethod · 0.85
DrawAxisMethod · 0.85
DrawLineMethod · 0.85
drawLinesMethod · 0.85
ParseDashArrayMethod · 0.85

Calls 2

push_backMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected