Skip to content

Commit

Permalink
Arrive Jinan West
Browse files Browse the repository at this point in the history
Power is in danger
Add precious abs
Add Draw step of Node/Text/Arrow
Add Backend load  xml step
  • Loading branch information
LaoshuBaby committed Jan 16, 2021
1 parent 0e91b3e commit ebec6ca
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 3 deletions.
22 changes: 22 additions & 0 deletions Render/Backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,34 @@

#include "Node.h"
#include "Point.h"
#include "pugixml.hpp"

using namespace std;

#pragma once

int main_Backend(void)
{
//pugi::xml_document DIAGRAM_FILE;
//pugi::xml_parse_result result = DIAGRAM_FILE.load_file("StyleSheet.unigal");


int Num_Node = 3;//min is 3
//考虑到有多个节点的情况
int iterator_i = 0;
vector<pugi::xml_document> DIAGRAM_FILE_LIST;
for (iterator_i = 0; iterator_i < Num_Node; ++iterator_i)
{
pugi::xml_document temp;
DIAGRAM_FILE_LIST.push_back(temp);
}
vector<string> DIAGRAM_FILENAME_LIST;
vector<pugi::xml_parse_result> DIAGRAM_RESULT;
for (iterator_i = 0; iterator_i < Num_Node; ++iterator_i)
{
pugi::xml_parse_result result = DIAGRAM_FILE_LIST[iterator_i].load_file(DIAGRAM_FILENAME_LIST[iterator_i]);
DIAGRAM_RESULT.push_back(result);
}

return 0;
}
41 changes: 38 additions & 3 deletions Render/Frontend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ int main_Frontend(void)
{
cout << spaceLevel(deepth) << "fill:rgb(" << StyleSheet.background_fillcolor.R << "," << StyleSheet.background_fillcolor.G << "," << StyleSheet.background_fillcolor.B << ")" << endl;
//准备后续完善后改成cout << spaceLevel(deepth) << "fill:rgb(" << argv_background_style_fill_rgb() << ")" << endl;
if (abs(StyleSheet.background_opacity - 1.00) <= 0.001)
{
cout << spaceLevel(deepth) << "fill-opacity:" << StyleSheet.background_opacity << endl;
}
}
deepth -= 1;
cout << spaceLevel(deepth) << "\"" << endl;
Expand All @@ -175,7 +179,7 @@ int main_Frontend(void)
{
//有边框
//需要绘制边框
cout << spaceLevel(deepth) << "<!-- Element:background -->" << endl;
cout << spaceLevel(deepth) << "<!-- Element:frame -->" << endl;
cout << spaceLevel(deepth) << "<rect" << endl;
deepth += 1;
{
Expand All @@ -193,8 +197,14 @@ int main_Frontend(void)
cout << spaceLevel(deepth) << "fill:rgb(" << StyleSheet.frame_fillcolor.R << "," << StyleSheet.frame_fillcolor.G << "," << StyleSheet.frame_fillcolor.B << ")" << endl;
cout << spaceLevel(deepth) << "stroke-width:" << StyleSheet.frame_strokewidth << endl;
cout << spaceLevel(deepth) << "fill:rgb(" << StyleSheet.frame_strokecolor.R << "," << StyleSheet.frame_strokecolor.G << "," << StyleSheet.frame_strokecolor.B << ")" << endl;
cout<< spaceLevel(deepth) <<"fill-opacity:" << StyleSheet.frame_fillopacity << endl;
cout << spaceLevel(deepth) << "stroke-opacity:" << StyleSheet.frame_strokeopacity << endl;
if (abs(StyleSheet.frame_fillopacity - 1.00) <= 0.001)
{
cout << spaceLevel(deepth) << "fill-opacity:" << StyleSheet.frame_fillopacity << endl;
}
if (abs(StyleSheet.frame_strokeopacity - 1.00) <= 0.001)
{
cout << spaceLevel(deepth) << "stroke-opacity:" << StyleSheet.frame_strokeopacity << endl;
}
}
deepth -= 1;
cout << spaceLevel(deepth) << "\"" << endl;
Expand All @@ -215,7 +225,32 @@ int main_Frontend(void)
}
//////NODE

typedef struct NodePosition
{
string NodeName;
Node Nodeatthis;
Point Position;
}NodePosition;
//该结构体将被Node和Text的绘制过程调用,也会被Arrow的过程拿来计算,可以说是后面三部分的共有的了。

int Num_Node;
//重头戏:计算Node的数量和位置。
//首先Node应该分成多个层次,至少分为start的周目一行,然后end的结局一行,中间的若干个行另外记。
int Num_Node_Startline;//start行的Node数量
int Num_Node_Endline;//end行的Node数量
int Num_Node_Plotheight;//plot行深度是多少
int Num_Node_Plotwide_Max;
int Num_Node_Plotwide_Min;
vector<int> Num_Node_PlotwideList;
//以上信息应该由后端读取后产生,然后包括节点位置在内,不应该由前端部分计算,应由后端部分计算。这些的定义应该放进main函数去做,并传递给前端。留待后续优化

//////TEXT
int Num_Text;
//重头戏:文字的位置需要沿用上文的Node的位置.

//////ARROW
int Num_Arrow;
//重头戏:根据获取到的Node的位置坐标和Node对象里面获取到的高度等信息,推算不同线段的起始点和终点,然后根据这些来绘图。

deepth -= 1;

Expand Down

5 comments on commit ebec6ca

@LaoshuBaby
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this series of commit is push between my goinghome.
laptop's power, no radio area, all of them turn me down

@LaoshuBaby
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now I'm arrive Jinan

@RimoChan
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

你怎么开始说英语了……

@LaoshuBaby
Copy link
Member Author

@LaoshuBaby LaoshuBaby commented on ebec6ca Jan 16, 2021 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RimoChan
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(快给GitHub安装汉化插件)

Please sign in to comment.