Skip to content

Commit

Permalink
number node complete
Browse files Browse the repository at this point in the history
  • Loading branch information
SoTosorrow committed May 23, 2021
1 parent 9a3a639 commit 1fe0c3c
Show file tree
Hide file tree
Showing 12 changed files with 342 additions and 180 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,16 @@


待解决:
解耦Descriptor
序列化与反序列化——json
根据json文档扩建新节点
更便捷的注册新节点,比如在右键菜单加入和在addnode加入
历史记录栈
copy和paste
setHeight 遮住的问题两个Height的问题,是子节点的height被父节点的height遮住了吗?清减这一块问题

内存还是有一点泄漏,需要检查修复,以及内存释放的问题,包括QList<QPair>
内存还是有一点泄漏,需要检查修复,以及内存释放的问题,包括QListQPair
基类析构函数设计为virtual,解放node的desc
右键菜单的QAction会造成内存泄漏
目前已知的内存泄漏存在于没完成的deleteItem
删除节点时同时删除相关连线,优化或重写deleteItem算法
Expand Down
4 changes: 4 additions & 0 deletions src/src.pro
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,7 @@ else: unix:!android: target.path = /opt/$${TARGET}/bin
DISTFILES += \
../README.md \
../reply/nodestyle.qss


# QMAKE_CXXFLAGS += -Wno-unused-parameter
# QMAKE_CXXFLAGS += -Wno-unused-variable
2 changes: 2 additions & 0 deletions src/vapour_action_cv.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class VapourActionCvShow : public VapourAction
public:
VapourActionCvShow(cv::Mat m,int n=1){
Q_UNUSED(n);
Q_UNUSED(m);
QLineEdit* edit1 = new QLineEdit("1",this);
edit1->setAlignment(Qt::AlignLeft);
edit1->setGeometry(0,0,150,25);
Expand Down Expand Up @@ -56,6 +57,7 @@ class VapourActionCvInput : public VapourAction
public:
VapourActionCvInput(cv::Mat m,int n=1){
Q_UNUSED(n);
Q_UNUSED(m);
QLineEdit* edit = new QLineEdit("C:\\Users\\Cuimi\\Desktop\\1.png",this);
edit->setAlignment(Qt::AlignLeft);
edit->setGeometry(0,0,150,25);
Expand Down
49 changes: 46 additions & 3 deletions src/vapour_data.h
Original file line number Diff line number Diff line change
@@ -1,17 +1,34 @@
#ifndef VAPOURDATA_H
#define VAPOURDATA_H

#include<QDebug>
#include"vapour_types.h"
#include<opencv2/imgproc/imgproc.hpp>
#include<opencv2/highgui.hpp>
#include<opencv2/imgcodecs/imgcodecs.hpp>
#include<opencv2/core/core.hpp>

class VapourData
{
public:
VapourData(){}

VapourData(){
this->data_type = VapourDataTypeBasic;
}
virtual ~VapourData(){}
VapourDataType dataType(){
return this->data_type;
}


virtual void setData(double data){
qDebug()<<typeid(data).name();
}
virtual void setData(cv::Mat data){
qDebug()<<typeid(data).name();
}
virtual double getDoubleData(){ return {};}
virtual cv::Mat getMatData(){ return {};}

public:
VapourDataType data_type;
};
Expand All @@ -21,12 +38,38 @@ class VapourDataDouble : public VapourData
public:
VapourDataDouble():VapourData(){
VapourData::data_type = VapourDataTypeDouble;

this->data = 0;
}
~VapourDataDouble(){}
void setData(double data) override{
this->data = data;
}
double getDoubleData() override{
return this->data;
}


public:
double data;
};

class VapourDataMat : public VapourData
{
public:
VapourDataMat():VapourData(){
VapourData::data_type = VapourDataTypeMat;
}
~VapourDataMat(){}
void setData(cv::Mat data) override{
this->data = data;
}
cv::Mat getMatData() override{
return this->data;
}

public:
cv::Mat data;

};

#endif // VAPOURDATA_H
3 changes: 3 additions & 0 deletions src/vapour_demo.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include <QApplication>
#include<QDir>
#include"vapour_win.h"
#include"vapour_types.h"
#include"vapour_data.h"
#include<opencv2/imgproc/imgproc.hpp>
#include<opencv2/highgui.hpp>
#include<opencv2/imgcodecs/imgcodecs.hpp>
Expand Down Expand Up @@ -68,6 +70,7 @@ int main(int argc, char *argv[])




return a.exec();
}

Expand Down
6 changes: 3 additions & 3 deletions src/vapour_descriptor.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,13 @@ class VapourDescriptor : public QGraphicsItem
return this->interaction->edits[n]->text().toDouble();
}
virtual QString getFile(){
// return this->interaction->edits[0]->text();
return {};
}
virtual void test_T_image(cv::Mat m){

Q_UNUSED(m);
}
virtual QList<QString> getParams(){

return {};
}


Expand Down
6 changes: 6 additions & 0 deletions src/vapour_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ VapourNode::VapourNode(QWidget *parent)
// qDebug()<<"Create: Basic Vapour-node";
initDesc(1,1);
this->desc = new VapourDescriptorInput(input_socket_number,output_socket_number,"test",1);
setTitle("nothing here");
}


VapourNode::VapourNode(const VapourNode &node, QWidget *parent)
:QWidget(parent)
{
Expand All @@ -25,9 +27,13 @@ VapourNode::~VapourNode()
qDebug()<<"Delete: VapourNode";
qDeleteAll(input_nodes);
qDeleteAll(output_nodes);
qDeleteAll(input_datas);
qDeleteAll(output_datas);
// delete connect_info
delete desc;
input_nodes.clear();
output_nodes.clear();
input_datas.clear();
output_datas.clear();
desc = nullptr;
}
32 changes: 8 additions & 24 deletions src/vapour_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
#include<QPair>
#include<utility>
#include"vapour_types.h"
#include"vapour_descriptor.h"
#include"vapour_action_develop.h"
#include"vapour_descriptor_develop.h"
#include"vapour_data.h"

// 释放 connect_info 内存
class VapourNode : public QWidget
Expand Down Expand Up @@ -41,25 +41,9 @@ class VapourNode : public QWidget
virtual VapourDescriptor* getDesc(){
return this->desc;
}
virtual void initData(){
}
virtual void handle(){
}
virtual QList<DMat> getInputDatas(){

}
virtual QList<DMat> getOutputDatas(){

}
virtual void setInputDatas(int n,DMat m){

}
virtual void setOutputDatas(int n,DMat m){

}
virtual void transfer(){
qDebug()<<"basic transfer";
}
virtual void initData(){}
virtual void handle(){}
virtual void transfer(){}


public:
Expand All @@ -69,10 +53,10 @@ class VapourNode : public QWidget
QList<QPair<QPair<VapourNode*,VapourNode*>,QPair<int,int>>> connect_info;
QList<VapourNode*> input_nodes;
QList<VapourNode*> output_nodes;
// input_Data
// output_Data
QList<Ddata> input_datas;
QList<Ddata> output_datas;

QList<VapourData*> input_datas;
QList<VapourData*> output_datas;

int input_vaild = 0;
int output_vaild = 0;

Expand Down
Loading

0 comments on commit 1fe0c3c

Please sign in to comment.