code: функция отладки SVG формата
Этот коммит содержится в:
8
main.cpp
8
main.cpp
@@ -3,7 +3,7 @@
|
||||
#include <hist_proc.h>
|
||||
#include "histogram.h"
|
||||
#include <text.h>
|
||||
|
||||
#include <svg.h>
|
||||
|
||||
|
||||
|
||||
@@ -34,13 +34,15 @@ cin >> in.bin_count;
|
||||
return in;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
auto in = input_data();
|
||||
auto bins = make_histogram(in.numbers, in.bin_count);
|
||||
auto procent = make_histogram_proc(in.numbers, in.bin_count, bins);
|
||||
show_histogram(in.bin_count, bins, procent);
|
||||
|
||||
show_histogram_svg(bins);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
26
svg.cpp
Обычный файл
26
svg.cpp
Обычный файл
@@ -0,0 +1,26 @@
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <svg.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
void
|
||||
svg_begin(double width, double height) {
|
||||
cout << "<?xml version='1.0' encoding='UTF-8'?>\n";
|
||||
cout << "<svg ";
|
||||
cout << "width='" << width << "' ";
|
||||
cout << "height='" << height << "' ";
|
||||
cout << "viewBox='0 0 " << width << " " << height << "' ";
|
||||
cout << "xmlns='http://www.w3.org/2000/svg'>\n";
|
||||
}
|
||||
|
||||
void
|
||||
svg_end() {
|
||||
cout << "</svg>\n";
|
||||
}
|
||||
|
||||
void
|
||||
show_histogram_svg(const vector<size_t>& bins) {
|
||||
svg_begin(400, 300);
|
||||
svg_end();
|
||||
}
|
||||
13
svg.h
Обычный файл
13
svg.h
Обычный файл
@@ -0,0 +1,13 @@
|
||||
#ifndef SVG_H_INCLUDED
|
||||
#define SVG_H_INCLUDED
|
||||
|
||||
void
|
||||
svg_begin(double width, double height);
|
||||
|
||||
void
|
||||
svg_end();
|
||||
|
||||
void
|
||||
show_histogram_svg(const std::vector<size_t>& bins);
|
||||
|
||||
#endif // SVG_H_INCLUDED
|
||||
Ссылка в новой задаче
Block a user