filter와 같이 웹에 파라미터 업로드 하는 작업 구현
2depth 구현 파라미터 입력방식 변경 git-svn-id: svn://192.168.0.12/source@172 8346c931-da38-4b9b-9d4c-e48b93cbd075
This commit is contained in:
@@ -41,6 +41,7 @@ YMOneDepthWidget::YMOneDepthWidget(QWidget *parent)
|
||||
|
||||
QGroupBox *gBox = setMorphereList();
|
||||
QGroupBox *gDate = setDate();
|
||||
QGroupBox *gData = setData();
|
||||
QGroupBox *gFilter = setFilter();
|
||||
QGroupBox *gOther = setOther();
|
||||
QGroupBox *gSort = setSort();
|
||||
@@ -50,7 +51,9 @@ YMOneDepthWidget::YMOneDepthWidget(QWidget *parent)
|
||||
|
||||
hboxlayout->addWidget(gBox,5);
|
||||
|
||||
vboxlayout->addWidget(gData,3);
|
||||
vboxlayout->addWidget(gDate,3);
|
||||
|
||||
//vboxlayout->addWidget(gFilter,3);
|
||||
vboxlayout->addWidget(gSort,2);
|
||||
vboxlayout->addWidget(gOther,2);
|
||||
@@ -70,6 +73,7 @@ YMOneDepthWidget::YMOneDepthWidget(QWidget *parent)
|
||||
|
||||
vMainLayout->addWidget(m_ptwData, 8);
|
||||
setLayout(vMainLayout);
|
||||
|
||||
}
|
||||
|
||||
QGroupBox *YMOneDepthWidget::setMorphereList()
|
||||
@@ -130,6 +134,7 @@ QGroupBox *YMOneDepthWidget::setDate()
|
||||
{
|
||||
QHBoxLayout *hlayout = new QHBoxLayout;
|
||||
QHBoxLayout *hlayout1 = new QHBoxLayout;
|
||||
QHBoxLayout *hlayout2 = new QHBoxLayout;
|
||||
QVBoxLayout *vlayout = new QVBoxLayout;
|
||||
|
||||
QGroupBox *groupBox = new QGroupBox(tr("Date"));
|
||||
@@ -153,6 +158,13 @@ QGroupBox *YMOneDepthWidget::setDate()
|
||||
m_pcbPeriod = new QComboBox;
|
||||
m_pcbPeriod->addItems(QStringList() << "None" << "1 Day" << "1 Week" << "1 Month");
|
||||
|
||||
m_pleDates = new QLineEdit;
|
||||
m_pleDates->setValidator(new QIntValidator(1, 100));
|
||||
|
||||
|
||||
m_pcbDuring = new QComboBox;
|
||||
m_pcbDuring->addItems(QStringList() << "None" << "Days" << "Weeks" << "Months" << "Years");
|
||||
|
||||
hlayout->addWidget(m_pcbDate);
|
||||
hlayout->addWidget(new QLabel("Start:"));
|
||||
hlayout->addWidget(m_pdeStart);
|
||||
@@ -162,11 +174,14 @@ QGroupBox *YMOneDepthWidget::setDate()
|
||||
hlayout1->addWidget(new QLabel("Period:"));
|
||||
hlayout1->addWidget(m_pcbPeriod);
|
||||
|
||||
hlayout2->addWidget(new QLabel("Recent:"));
|
||||
hlayout2->addWidget(m_pleDates);
|
||||
hlayout2->addWidget(m_pcbDuring);
|
||||
|
||||
vlayout->addLayout(hlayout2);
|
||||
vlayout->addLayout(hlayout);
|
||||
vlayout->addLayout(hlayout1);
|
||||
|
||||
vlayout->addLayout(hlayout);
|
||||
vlayout->addLayout(hlayout1);
|
||||
groupBox->setCheckable(true);
|
||||
|
||||
groupBox->setLayout(vlayout);
|
||||
@@ -294,15 +309,42 @@ QGroupBox *YMOneDepthWidget::setDictionary()
|
||||
}
|
||||
|
||||
|
||||
QGroupBox *YMOneDepthWidget::setData()
|
||||
{
|
||||
QHBoxLayout *hlayout = new QHBoxLayout;
|
||||
|
||||
m_pcbData = new QComboBox;
|
||||
m_pcbData->addItems(QStringList() << "Title" << "Body" << "Title+Body" << "PlatformTitle");
|
||||
|
||||
m_pcbData->setCurrentIndex(2);
|
||||
|
||||
hlayout->addWidget(new QLabel("Data: "));
|
||||
hlayout->addWidget(m_pcbData);
|
||||
|
||||
|
||||
QGroupBox *groupBox = new QGroupBox(tr("Data"));
|
||||
|
||||
groupBox->setCheckable(true);
|
||||
groupBox->setLayout(hlayout);
|
||||
groupBox->setChecked(true);
|
||||
return groupBox;
|
||||
}
|
||||
|
||||
|
||||
|
||||
QGroupBox *YMOneDepthWidget::setCenterKeyword()
|
||||
{
|
||||
QHBoxLayout *hlayout = new QHBoxLayout;
|
||||
|
||||
m_pleCKeyword = new QLineEdit;
|
||||
m_pcbCountMethod = new QComboBox;
|
||||
m_pcbCountMethod->addItems(QStringList() << "Duplicate" << "NonDuplicate");
|
||||
|
||||
|
||||
hlayout->addWidget(new QLabel("Center Keyword: "));
|
||||
hlayout->addWidget(m_pleCKeyword);
|
||||
hlayout->addWidget(new QLabel("CountMethod: "));
|
||||
hlayout->addWidget(m_pcbCountMethod);
|
||||
|
||||
QGroupBox *groupBox = new QGroupBox(tr("Center Keyword"));
|
||||
|
||||
@@ -572,6 +614,201 @@ void YMOneDepthWidget::MemClear()
|
||||
m_mapViewResult.clear();
|
||||
}
|
||||
|
||||
void YMOneDepthWidget::D3View()
|
||||
{
|
||||
QString strCKeyword = getCenterKeyword();
|
||||
//qDebug() << "executed";
|
||||
/*
|
||||
QString strjson = "{\n\t\"name\":\" " + strCKeyword + "\",\n";
|
||||
strjson += ("\t\"children\": [\n");
|
||||
|
||||
STable* pTable = (STable*)((QTabWidget*)(m_ptwTable->currentWidget()))->currentWidget();
|
||||
int nCountIndex = pTable->columnCount() - 1;
|
||||
int nKeywordIndex = pTable->columnCount() - 2;
|
||||
|
||||
for (int i = 0; i < pTable->rowCount(); i++)
|
||||
{
|
||||
QString strKeyword = pTable->item(i, nKeywordIndex)->text().trimmed();
|
||||
int nCount = pTable->item(i, nCountIndex)->text().trimmed().toInt();
|
||||
strjson += ("\t{\"name\": \"" + strKeyword + "\", \"size\": " + QString::number(nCount) + "},\n");
|
||||
}
|
||||
strjson = strjson.trimmed();
|
||||
strjson = strjson.left(strjson.length() - 1);
|
||||
strjson += "\n\t]\n}";
|
||||
*/
|
||||
QString strjson = "{\"name\":\" " + strCKeyword + "\",";
|
||||
strjson += ("\"children\": [");
|
||||
|
||||
STable* pTable = (STable*)((QTabWidget*)(m_ptwTable->currentWidget()))->currentWidget();
|
||||
int nCountIndex = pTable->columnCount() - 1;
|
||||
int nKeywordIndex = pTable->columnCount() - 2;
|
||||
|
||||
for (int i = 0; i < pTable->rowCount(); i++)
|
||||
{
|
||||
QString strKeyword = pTable->item(i, nKeywordIndex)->text().trimmed();
|
||||
int nCount = pTable->item(i, nCountIndex)->text().trimmed().toInt();
|
||||
strjson += ("{\"name\": \"" + strKeyword + "\", \"size\": " + QString::number(nCount) + "},");
|
||||
}
|
||||
strjson = strjson.trimmed();
|
||||
strjson = strjson.left(strjson.length() - 1);
|
||||
strjson += "]}";
|
||||
|
||||
QString strHtml;
|
||||
|
||||
strHtml = "<html>"
|
||||
"\n<meta charset=\"utf-8\">"
|
||||
"\n<style>"
|
||||
"\n"
|
||||
"\n.node circle {"
|
||||
"\n cursor: pointer;"
|
||||
"\n stroke: #3182bd;"
|
||||
"\n stroke-width: 1.5px;"
|
||||
"\n}"
|
||||
"\n"
|
||||
"\n.node text {"
|
||||
"\n font: 10px sans-serif;"
|
||||
"\n pointer-events: none;"
|
||||
"\n text-anchor: middle;"
|
||||
"\n}"
|
||||
"\n"
|
||||
"\nline.link {"
|
||||
"\n fill: none;"
|
||||
"\n stroke: #9ecae1;"
|
||||
"\n stroke-width: 1.5px;"
|
||||
"\n}"
|
||||
"\n"
|
||||
"\n</style>"
|
||||
"\n<body>"
|
||||
"\n<script src=\"https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js\"></script>"
|
||||
"\n<script>"
|
||||
"\n"
|
||||
"\nvar width = 1600,"
|
||||
"\n height = 900,"
|
||||
"\n root;"
|
||||
"\n"
|
||||
"\nvar force = d3.layout.force()"
|
||||
"\n .linkDistance(80)"
|
||||
"\n .charge(-120)"
|
||||
"\n .gravity(.05)"
|
||||
"\n .size([width, height])"
|
||||
"\n .on(\"tick\", tick);"
|
||||
"\n"
|
||||
"\nvar svg = d3.select(\"body\").append(\"svg\")"
|
||||
"\n .attr(\"width\", width)"
|
||||
"\n .attr(\"height\", height);"
|
||||
"\n"
|
||||
"\nvar link = svg.selectAll(\".link\"),"
|
||||
"\n node = svg.selectAll(\".node\");"
|
||||
"\n"
|
||||
//"\nd3.json(\"graph.json\", function(error, json) {"
|
||||
//"\n if (error) throw error;"
|
||||
"\n"
|
||||
"\nvar jsonparam = '" + strjson + "';"
|
||||
"\n root = JSON.parse(jsonparam);"
|
||||
"\n update();"
|
||||
//"\n});"
|
||||
"\n"
|
||||
"\nfunction update() {"
|
||||
"\n var nodes = flatten(root),"
|
||||
"\n links = d3.layout.tree().links(nodes);"
|
||||
"\n"
|
||||
"\n // Restart the force layout."
|
||||
"\n force"
|
||||
"\n .nodes(nodes)"
|
||||
"\n .links(links)"
|
||||
"\n .start();"
|
||||
"\n"
|
||||
"\n // Update links."
|
||||
"\n link = link.data(links, function(d) { return d.target.id; });"
|
||||
"\n"
|
||||
"\n link.exit().remove();"
|
||||
"\n"
|
||||
"\n link.enter().insert(\"line\", \".node\")"
|
||||
"\n .attr(\"class\", \"link\");"
|
||||
"\n"
|
||||
"\n // Update nodes."
|
||||
"\n node = node.data(nodes, function(d) { return d.id; });"
|
||||
"\n"
|
||||
"\n node.exit().remove();"
|
||||
"\n"
|
||||
"\n var nodeEnter = node.enter().append(\"g\")"
|
||||
"\n .attr(\"class\", \"node\")"
|
||||
"\n .on(\"click\", click)"
|
||||
"\n .call(force.drag);"
|
||||
"\n"
|
||||
"\n nodeEnter.append(\"circle\")"
|
||||
"\n .attr(\"r\", function(d) { return Math.sqrt(d.size) / 10 || 4.5; });"
|
||||
"\n"
|
||||
"\n nodeEnter.append(\"text\")"
|
||||
"\n .attr(\"dy\", \".35em\")"
|
||||
"\n .text(function(d) { return d.name; });"
|
||||
"\n"
|
||||
"\n node.select(\"circle\")"
|
||||
"\n .style(\"fill\", color);"
|
||||
"\n}"
|
||||
"\n"
|
||||
"\nfunction tick() {"
|
||||
"\n link.attr(\"x1\", function(d) { return d.source.x; })"
|
||||
"\n .attr(\"y1\", function(d) { return d.source.y; })"
|
||||
"\n .attr(\"x2\", function(d) { return d.target.x; })"
|
||||
"\n .attr(\"y2\", function(d) { return d.target.y; });"
|
||||
"\n"
|
||||
"\n node.attr(\"transform\", function(d) { return \"translate(\" + d.x + \",\" + d.y + \")\"; });"
|
||||
"\n}"
|
||||
"\n"
|
||||
"\nfunction color(d) {"
|
||||
"\n return d._children ? \"#3182bd\" // collapsed package"
|
||||
"\n : d.children ? \"#c6dbef\" // expanded package"
|
||||
"\n : \"#fd8d3c\"; // leaf node"
|
||||
"\n}"
|
||||
"\n"
|
||||
"\n// Toggle children on click."
|
||||
"\nfunction click(d) {"
|
||||
"\n if (d3.event.defaultPrevented) return; // ignore drag"
|
||||
"\n if (d.children) {"
|
||||
"\n d._children = d.children;"
|
||||
"\n d.children = null;"
|
||||
"\n } else {"
|
||||
"\n d.children = d._children;"
|
||||
"\n d._children = null;"
|
||||
"\n }"
|
||||
"\n update();"
|
||||
"\n}"
|
||||
"\n"
|
||||
"\n// Returns a list of all nodes under the root."
|
||||
"\nfunction flatten(root) {"
|
||||
"\n var nodes = [], i = 0;"
|
||||
"\n"
|
||||
"\n function recurse(node) {"
|
||||
"\n if (node.children) node.children.forEach(recurse);"
|
||||
"\n if (!node.id) node.id = ++i;"
|
||||
"\n nodes.push(node);"
|
||||
"\n }"
|
||||
"\n"
|
||||
"\n recurse(root);"
|
||||
"\n return nodes;"
|
||||
"\n}"
|
||||
"\n"
|
||||
"\n</script>"
|
||||
"\n";
|
||||
/*
|
||||
qDebug() << strHtml;
|
||||
|
||||
QFile file("c:/data/d3test.html");
|
||||
if(!file.open(QFile::WriteOnly | QFile::Text)) return;
|
||||
|
||||
QTextStream out(&file);
|
||||
|
||||
out << strHtml;
|
||||
|
||||
file.close();
|
||||
*/
|
||||
m_WVD3View.setHtml(strHtml);
|
||||
m_WVD3View.settings()->setObjectCacheCapacities(0,0,0);
|
||||
m_WVD3View.repaint();
|
||||
m_WVD3View.show();
|
||||
}
|
||||
|
||||
|
||||
bool YMOneDepthWidget::setListMorphere(QStringList& MorphereEN, QStringList& MorphereKO)
|
||||
{
|
||||
@@ -1116,6 +1353,10 @@ QMap<QString, QString> YMOneDepthWidget::convertToParam()
|
||||
mapParam.insert("CenterKeyword", getCenterKeyword());
|
||||
}
|
||||
|
||||
{
|
||||
mapParam.insert("CountMethod", m_pcbCountMethod->currentText().trimmed());
|
||||
}
|
||||
|
||||
{
|
||||
if(!m_pleFilterExtractor->text().trimmed().isEmpty())
|
||||
mapParam.insert("Extractor", m_pleFilterExtractor->text().trimmed());
|
||||
@@ -1137,5 +1378,15 @@ QMap<QString, QString> YMOneDepthWidget::convertToParam()
|
||||
if(!m_pleFilterRankSeparated->text().trimmed().isEmpty())
|
||||
mapParam.insert("RankFilterSeparated", m_pleFilterRankSeparated->text().trimmed());
|
||||
}
|
||||
{
|
||||
mapParam.insert("RecentDate", m_pleDates->text().trimmed());
|
||||
mapParam.insert("RecentPeriod", m_pcbDuring->currentText().trimmed());
|
||||
}
|
||||
{
|
||||
mapParam.insert("TitleBody", QString::number(m_pcbData->currentIndex()));
|
||||
}
|
||||
{
|
||||
mapParam.insert("Article",QString::number(((STable*)(((Widget*)(m_pTabWidget->currentWidget()))->GetTabWidget()->currentWidget()))->getArticleSelect()));
|
||||
}
|
||||
return mapParam;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user