-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
321 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ const char kOutFolderName[] = "davis_htmls/"; | |
const char kPlotlyJsWorkPath[] = "./davis_htmls/plotly-2.27.0.min.js"; | ||
const char kPlotlyJsName[] = "plotly-2.27.0.min.js"; | ||
const char kPlotlyJsResourcePath[] = "plotly_maker/plotly-2.27.0.min.js"; | ||
const char kWarningPagePath[] = "./davis_htmls/warning_js_absent.html"; | ||
|
||
} // namespace dvs end | ||
|
||
|
@@ -138,6 +139,142 @@ colorbar: { | |
title: "" | ||
} | ||
}];)"; | ||
|
||
const char kWarningJSLibAbsentPage[] = R"( | ||
<html> | ||
<head> | ||
<style> | ||
.coffe_img { | ||
margin:2%; | ||
display: grid; | ||
grid-template-columns: 33% 66% | ||
} | ||
.dont_worry{ | ||
padding-top:5% | ||
} | ||
.download{ | ||
} | ||
.download_text{ | ||
margin-left:2%; | ||
margin-top:5%; | ||
color:#34495E; | ||
font-size: 40px; | ||
font-family:calibri | ||
} | ||
.worry_text{ | ||
color:#3498DB; | ||
font-size: 40px; | ||
font-family:calibri | ||
} | ||
.link_style{ | ||
padding-top:2%; | ||
padding-left:2%; | ||
color:#34495E; | ||
font-size: 40px; | ||
font-family:calibri | ||
} | ||
.email_style{ | ||
padding-top:6%; | ||
padding-left:35%; | ||
color:#34495E; | ||
font-size: 40px; | ||
font-family:calibri | ||
} | ||
</style> | ||
</head> | ||
<div class="coffe_img"> | ||
<div> | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> | ||
<!-- Creator: CorelDRAW 2020 (64-Bit) --> | ||
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="112.371mm" height="82.3636mm" version="1.1" style="shape-rendering:geometricPrecision; text-rendering:geometricPrecision; image-rendering:optimizeQuality; fill-rule:evenodd; clip-rule:evenodd" | ||
viewBox="0 0 11237.16 8236.39" | ||
xmlns:xlink="http://www.w3.org/1999/xlink" | ||
xmlns:xodm="http://www.corel.com/coreldraw/odm/2003"> | ||
<defs> | ||
<style type="text/css"> | ||
<![CDATA[ | ||
.fil8 {fill:#878787;fill-rule:nonzero} | ||
.fil0 {fill:#9D9D9C;fill-rule:nonzero} | ||
.fil7 {fill:#BC926F;fill-rule:nonzero} | ||
.fil6 {fill:#C69A71;fill-rule:nonzero} | ||
.fil5 {fill:#CEA275;fill-rule:nonzero} | ||
.fil4 {fill:#E0B1B1;fill-rule:nonzero} | ||
.fil10 {fill:#E0C0A6;fill-rule:nonzero} | ||
.fil11 {fill:#EDEDED;fill-rule:nonzero} | ||
.fil2 {fill:#EFBDBB;fill-rule:nonzero} | ||
.fil3 {fill:#F7D0CD;fill-rule:nonzero} | ||
.fil1 {fill:#F9C7C3;fill-rule:nonzero} | ||
.fil9 {fill:white;fill-rule:nonzero;fill-opacity:0.678431} | ||
]]> | ||
</style> | ||
</defs> | ||
<g id="Слой_x0020_1"> | ||
<metadata id="CorelCorpID_0Corel-Layer"/> | ||
<g id="_2622218307280"> | ||
<ellipse class="fil0" cx="7672.67" cy="8004.42" rx="441.5" ry="102.27"/> | ||
<ellipse class="fil0" cx="9141.85" cy="7605.33" rx="441.5" ry="102.27"/> | ||
<ellipse class="fil0" cx="10825.55" cy="6914.38" rx="339.23" ry="77.32"/> | ||
<ellipse class="fil0" cx="3260.13" cy="7682.65" rx="3260.13" ry="553.74"/> | ||
<path class="fil1" d="M6662.45 3332.47l0 4215.48c0,319.28 -853.07,581.19 -1905.7,581.19 -1052.62,0 -1905.7,-259.41 -1905.7,-581.19l0 -4215.48 0 0c7.48,319.28 858.06,576.2 1905.7,576.2 1047.63,2.49 1898.22,-256.92 1905.7,-576.2l0 0z"/> | ||
<path class="fil2" d="M4729.32 8129.14c-1040.15,-4.99 -1878.26,-261.91 -1878.26,-581.19l0 -4215.48 0 0c4.99,279.37 665.99,513.84 1539.03,566.22l339.23 4230.45z"/> | ||
<path class="fil3" d="M6662.45 3329.98c0,2.49 0,2.49 0,4.99 -7.48,319.28 -858.06,576.2 -1905.7,576.2 -1047.63,0 -1898.22,-256.92 -1905.7,-576.2 0,-2.49 0,-2.49 0,-4.99 0,-319.28 853.07,-581.19 1905.7,-581.19 1052.62,0 1905.7,259.41 1905.7,581.19z"/> | ||
<path class="fil4" d="M6343.17 3327.48c0,64.85 -57.37,124.72 -157.14,179.59 -236.96,-149.66 -803.18,-254.42 -1464.2,-254.42 -628.58,0 -1169.85,94.79 -1426.78,231.98 -77.33,-47.39 -119.73,-102.27 -119.73,-157.14 0,-226.99 708.4,-414.06 1583.93,-414.06 873.02,2.48 1583.92,187.06 1583.92,414.05z"/> | ||
<path class="fil5" d="M6183.53 3507.08c-256.92,137.19 -798.19,231.98 -1426.78,231.98 -661,0 -1227.22,-104.76 -1464.2,-254.42 119.73,-152.16 269.39,-117.23 463.95,-192.07 316.78,-122.22 878.01,-107.26 1112.48,-67.35 251.93,44.9 503.86,-7.48 703.41,57.37 386.63,127.21 566.22,84.8 611.12,224.49z"/> | ||
<path class="fil6" d="M5934.1 3604.36c-289.35,82.31 -708.4,134.7 -1174.84,134.7 -471.43,0 -895.47,-54.88 -1184.82,-139.68 119.73,-44.9 241.95,-87.3 364.18,-127.21 64.85,-19.95 129.71,-39.91 197.05,-44.9 109.75,-9.98 222,19.95 331.75,32.43 259.41,32.43 526.31,-17.46 783.23,29.93 59.86,12.47 119.73,27.44 179.59,34.92 69.84,7.48 137.19,4.99 207.03,9.98 99.77,9.96 202.04,32.41 296.83,69.83z"/> | ||
<path class="fil1" d="M8685.38 5278.08c0,830.62 -673.48,1501.61 -1501.61,1501.61 -182.09,0 -359.19,-32.43 -521.32,-92.29l0 -770.76c142.18,114.74 321.77,184.58 521.32,184.58 453.97,0 823.14,-369.16 823.14,-823.14 0,-453.97 -369.16,-823.14 -823.14,-823.14 -197.05,0 -379.14,69.84 -521.32,184.58l0 -770.76c162.13,-59.86 336.74,-92.29 521.32,-92.29 828.13,0.02 1501.61,673.49 1501.61,1501.63z"/> | ||
<path class="fil2" d="M7141.38 3776.47l0 678.47c-182.09,9.98 -346.72,77.33 -478.92,184.58l0 -770.76c149.66,-54.88 311.79,-87.31 478.92,-92.29z"/> | ||
<path class="fil2" d="M6662.45 5916.64c132.2,107.26 296.83,174.61 478.92,184.58l0 678.47c-167.12,-4.99 -329.26,-37.42 -478.92,-92.29l0 -770.76z"/> | ||
<path class="fil6" d="M7952.04 7370.86c-341.73,-107.26 -334.24,137.19 -311.79,174.61 -119.73,74.83 22.45,374.15 112.25,446.49 239.46,192.07 448.98,9.98 486.4,-139.68 47.39,-187.09 -127.22,-434.03 -286.86,-481.42zm92.29 518.82c-7.48,-22.45 -17.46,-44.9 -29.93,-64.85 -9.98,-19.95 -24.94,-39.91 -39.91,-54.88 -27.44,-34.92 -64.85,-57.37 -107.26,-69.84 -9.98,-4.99 -19.95,-4.99 -32.43,-7.48 -9.98,-2.49 -22.45,-2.49 -34.92,-4.99 -24.94,-4.99 -49.89,-9.98 -72.34,-19.95 -24.94,-9.98 -47.39,-27.44 -62.36,-47.39 -14.97,-19.95 -22.45,-47.39 -22.45,-72.34 9.98,22.45 22.45,42.4 39.91,54.88 17.46,14.97 37.42,22.45 57.37,27.44 19.95,4.99 42.4,7.48 67.35,9.98 22.45,2.49 49.89,4.99 74.83,12.47 49.89,14.97 97.28,49.89 122.22,94.79 14.97,22.45 24.94,44.9 29.93,69.84 7.5,22.44 12.49,47.38 9.99,72.32z"/> | ||
<path class="fil7" d="M7605.33 7590.36c-42.4,112.25 72.34,339.23 149.66,401.59 189.57,152.16 361.68,67.35 444,-47.39 -336.75,49.89 -508.86,-167.12 -593.66,-354.2z"/> | ||
<path class="fil6" d="M9710.56 7450.68c-157.14,366.67 -521.32,197.05 -628.58,99.77 -241.95,-217.01 -89.8,-291.84 -52.38,-304.31 12.47,9.98 27.44,19.95 42.4,27.44 22.45,12.47 47.39,24.94 72.34,34.92 47.39,19.95 97.28,34.92 149.66,47.39 49.89,12.47 102.27,24.94 152.16,32.43 52.38,7.48 102.27,12.47 154.65,12.47 -47.39,-19.95 -97.28,-34.92 -147.17,-49.89 -49.89,-14.97 -99.77,-27.44 -149.66,-42.4 -49.89,-12.47 -99.77,-24.94 -149.66,-37.42 -24.94,-7.48 -49.89,-12.47 -74.83,-19.95 -14.97,-4.99 -32.43,-9.98 -47.39,-14.97 -19.95,-37.42 -107.26,-234.47 231.98,-226.99 396.6,12.48 481.4,364.18 446.48,441.51z"/> | ||
<path class="fil7" d="M9633.24 7577.89c-177.1,194.56 -456.47,57.37 -548.76,-24.94 -197.05,-177.1 -132.2,-259.41 -82.31,-291.84 74.83,139.68 244.44,289.34 631.07,316.78z"/> | ||
<path class="fil6" d="M11237.12 6764.72c-14.97,249.44 -264.4,226.99 -346.72,192.07 -187.08,-74.83 -114.74,-152.16 -94.79,-167.12 9.98,2.49 19.95,4.99 32.43,7.48 17.46,2.49 32.43,4.99 49.89,4.99 32.43,0 64.85,0 97.28,-2.49 32.43,-2.49 64.85,-7.48 97.28,-14.97 32.43,-7.48 62.36,-14.97 94.79,-24.94 -32.43,-2.49 -64.85,0 -97.28,2.49 -32.43,2.49 -64.85,4.99 -94.79,7.48 -32.43,2.49 -64.85,7.48 -94.79,9.98 -14.97,2.49 -32.43,2.49 -47.39,4.99 -9.98,0 -19.95,2.49 -29.93,2.49 -19.95,-17.46 -112.25,-114.74 87.3,-182.09 224.5,-82.32 349.22,107.26 346.72,159.64z"/> | ||
<path class="fil7" d="M11217.17 6854.51c-62.36,152.16 -256.92,132.2 -326.76,102.27 -152.16,-62.36 -134.7,-122.22 -109.75,-152.16 72.33,67.35 204.53,117.24 436.51,49.89z"/> | ||
<circle class="fil8" cx="3856.29" cy="5303.02" r="84.81"/> | ||
<circle class="fil8" cx="4806.65" cy="5303.02" r="84.81"/> | ||
<path class="fil8" d="M4499.84 5572.41c22.45,49.89 12.47,117.23 -27.44,167.12 -37.42,49.89 -102.27,82.31 -167.12,79.82 -64.85,0 -129.71,-29.93 -167.12,-79.82 -37.42,-49.89 -49.89,-114.74 -27.44,-167.12 22.45,49.89 52.38,84.81 87.3,107.26 34.92,22.45 69.84,32.43 107.26,32.43 37.42,0 72.34,-9.98 107.26,-32.43 34.92,-24.94 64.85,-57.37 87.3,-107.26z"/> | ||
<path class="fil9" d="M7784.92 4098.24c-42.4,-12.47 24.94,-79.82 64.85,-82.31 67.35,-2.49 209.53,94.79 239.46,149.66 29.93,54.88 -87.3,69.84 -87.3,69.84 0,0 -102.27,-124.72 -217.01,-137.19z"/> | ||
<path class="fil11" d="M4457.44 92.29c-77.33,74.83 -149.66,152.16 -209.53,234.47 -59.86,82.31 -109.75,169.62 -134.7,259.41 -7.48,22.45 -9.98,44.9 -14.97,67.35 0,9.98 -2.49,22.45 -2.49,32.43l0 32.43c2.49,42.4 9.98,84.81 24.94,127.21 32.43,82.31 87.3,157.14 157.14,224.49l54.88 52.38 32.43 29.93c9.98,9.98 19.95,22.45 29.93,32.43 19.95,22.45 37.42,47.39 54.88,72.34 14.97,27.44 32.43,54.88 42.4,84.81 22.45,57.37 37.42,122.22 37.42,184.58 0,62.36 -12.47,122.22 -29.93,179.59 -39.91,112.25 -104.76,207.03 -177.1,286.85 -37.42,39.91 -77.33,77.33 -119.73,112.25 -42.4,34.92 -87.3,64.85 -132.2,92.29 67.35,-82.31 129.71,-169.62 182.09,-256.92 52.38,-87.3 92.29,-182.09 112.25,-271.89 9.98,-44.9 12.47,-92.29 7.48,-134.7 -4.99,-42.4 -14.97,-84.81 -34.92,-122.22l-7.48 -14.97c-2.49,-4.99 -4.99,-9.98 -7.48,-14.97l-17.46 -27.44c-14.97,-17.46 -24.94,-34.92 -42.4,-52.38 -7.48,-7.48 -14.97,-17.46 -22.45,-24.94l-24.94 -22.45 -62.36 -54.88c-19.95,-19.95 -39.91,-42.4 -59.86,-62.36 -9.98,-9.98 -17.46,-22.45 -27.44,-34.92 -9.98,-12.47 -17.46,-22.45 -27.44,-34.92 -14.97,-24.94 -32.43,-49.89 -44.9,-77.33 -7.48,-14.97 -14.97,-27.44 -19.95,-42.4 -4.99,-14.97 -9.98,-29.93 -14.97,-44.9 -17.46,-59.86 -27.44,-122.22 -22.45,-184.58 2.49,-62.36 19.95,-122.22 42.4,-177.1 47.39,-109.75 119.73,-199.55 202.04,-271.89 42.4,-37.42 84.81,-69.84 132.2,-99.77 47.39,-29.92 94.78,-54.86 144.67,-77.31z"/> | ||
<path class="fil11" d="M5430.24 0c-84.81,94.79 -159.64,194.56 -219.5,301.82 -59.86,104.76 -107.26,217.01 -129.71,331.75 -9.98,57.37 -14.97,112.25 -12.47,169.62 2.49,54.88 12.47,109.75 27.44,164.63 32.43,107.26 89.8,207.03 164.63,294.33l59.86 69.84c9.98,12.47 22.45,27.44 32.43,39.91l29.93 42.4c9.98,14.97 17.46,29.93 27.44,44.9 7.48,14.97 17.46,29.93 24.94,47.39 7.48,17.46 14.97,32.43 22.45,49.89 4.99,17.46 12.47,34.92 17.46,49.89 39.91,137.19 37.42,284.36 0,414.06 -34.92,132.2 -94.79,249.44 -169.62,356.69 -37.42,52.38 -77.33,104.76 -122.22,149.66 -22.45,22.45 -44.9,47.39 -67.35,67.35 -24.94,22.45 -47.39,42.4 -72.34,62.36 72.34,-104.76 134.7,-214.51 184.58,-324.27 52.38,-112.25 89.8,-226.99 107.26,-341.73 7.48,-57.37 12.47,-114.74 7.48,-169.62 -4.99,-54.88 -14.97,-109.75 -32.43,-162.13 -17.46,-52.38 -44.9,-99.77 -74.83,-144.67l-24.94 -34.92c-9.98,-9.98 -17.46,-22.45 -27.44,-32.43l-62.36 -72.34c-12.47,-12.47 -19.95,-27.44 -29.93,-39.91l-29.93 -42.4c-9.98,-14.97 -17.46,-29.93 -27.44,-42.4 -7.48,-14.97 -19.95,-29.93 -24.94,-44.9 -14.97,-32.43 -32.43,-62.36 -42.4,-94.79 -4.99,-17.46 -12.47,-32.43 -17.46,-49.89l-14.97 -49.89c-14.97,-67.35 -24.94,-139.68 -22.45,-209.53 2.49,-69.84 14.97,-139.68 34.92,-204.54 39.91,-132.2 109.75,-246.94 194.56,-346.72 42.4,-49.89 87.3,-97.28 137.19,-137.19 44.9,-39.89 94.79,-79.8 152.16,-112.22z"/> | ||
</g> | ||
</g> | ||
</svg> | ||
</div> | ||
<div class ="dont_worry"> | ||
<p class="worry_text">If you see this page it means that plotly-2.27.0.min.js | ||
<br>file is absent...</br> | ||
</p> | ||
<div class="worry_text">But don't worry!</div> | ||
</div> | ||
</div> | ||
<div class="download_text"> | ||
Please download this .js file and add to the directory | ||
<div class="worry_text"> | ||
%1 | ||
</div> | ||
</div> | ||
<div class ="link_style"> | ||
Download plotly javascript library from | ||
<a href="https://github.com/DevToolsOrganization/matrix-data-visualization-DAVIS">our github</a> | ||
or | ||
<a href="https://cdn.plot.ly/plotly-2.27.0.min.js">official plotly site</a> | ||
<div class="email_style"> | ||
For any questions please contact | ||
<br>[email protected]</br> | ||
<div> | ||
</div> | ||
</div> | ||
</html> | ||
)"; | ||
// *INDENT-ON* | ||
|
||
} // namespace dvs end | ||
|
@@ -153,7 +290,7 @@ using std::string; | |
#include <unistd.h> | ||
#endif | ||
|
||
inline bool is_file_exists(const string& file_name) { | ||
bool is_file_exists(const string& file_name) { | ||
std::ifstream file(file_name.c_str()); | ||
if (!file) { | ||
return false; | ||
|
@@ -173,7 +310,7 @@ void openFileBySystem(const string& file_name) { | |
#error "Unknown compiler" | ||
#endif | ||
command.append(file_name); | ||
system(command.c_str()); | ||
std::ignore = system(command.c_str()); | ||
} | ||
|
||
string getCurrentPath() { | ||
|
@@ -348,7 +485,7 @@ bool make_string(const string& src, | |
} | ||
// create out according on the road map | ||
out.reserve(reserve_size); | ||
for (int i = 0; i < road_map.size(); ++i) { | ||
for (size_t i = 0; i < road_map.size(); ++i) { | ||
auto size = road_map[i].size(); | ||
if (size == 2) { | ||
out.append(src.substr(road_map[i][0], road_map[i][1])); | ||
|
@@ -364,6 +501,7 @@ bool make_string(const string& src, | |
return true; | ||
} | ||
|
||
|
||
} // namespace dvs end | ||
|
||
namespace dvs { | ||
|
@@ -444,7 +582,11 @@ inline bool heatmap_and_surface(const vector<vector<double>>& values, | |
mayBeCreateJsWorkingFolder(); | ||
pageName.append("./").append(kOutFolderName).append(title).append(".html"); | ||
saveStringToFile(pageName, page); | ||
openPlotlyHtml(pageName); | ||
if (isPlotlyScriptExists()) { | ||
openPlotlyHtml(pageName); | ||
} else { | ||
showWarningJsAbsentPage(); | ||
} | ||
return true;// TODO handle different exceptions | ||
}; | ||
|
||
|
@@ -554,7 +696,11 @@ bool showLineChartInBrowser(const vector<double>& values, | |
mayBeCreateJsWorkingFolder(); | ||
pageName.append("./").append(kOutFolderName).append(title).append(".html"); | ||
saveStringToFile(pageName, page); | ||
openPlotlyHtml(pageName); | ||
if (isPlotlyScriptExists()) { | ||
openPlotlyHtml(pageName); | ||
} else { | ||
showWarningJsAbsentPage(); | ||
} | ||
return true; | ||
} | ||
|
||
|
@@ -583,6 +729,19 @@ bool showSurfaceInBrowser(const string& values, | |
return true; | ||
} | ||
|
||
void showWarningJsAbsentPage() { | ||
string out; | ||
string davis_dir; | ||
#ifdef _WIN32 | ||
davis_dir = "\\davis_htmls"; | ||
#elif __linux__ | ||
davis_dir = "/davis_htmls"; | ||
#endif | ||
vector<string>args = {getCurrentPath() + davis_dir}; | ||
make_string(kWarningJSLibAbsentPage, args, out); | ||
saveStringToFile(kWarningPagePath, out); | ||
openFileBySystem(kWarningPagePath); | ||
} | ||
|
||
} // namespace dvs end | ||
|
Oops, something went wrong.