summaryrefslogtreecommitdiff
path: root/gui/src/chainImageSet.h
blob: 6620923d84447713cf854bc8ce02c52978b5d488 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#include "ofMain.h"
#include "ofxJSON.h"
#include "chainImage.h"
#include "threadedChainImageLoader.h"
#include "threadedSystemDialogs.h"


class chainImageSet{
	public:
		chainImageSet(){
		}
		void init(){
			currentDefaultImageRatio=0.3;
			filename="";
			outputSize=ofPoint(1024,576);
			decayFactor=.9999;
			additive=false;
			intensity=1.0f;
			fitFactor=0.9f;
			dragScale=0.0f;
			dragRotate=0.0f;
			dragPoint=ofPoint(0,0);
			zoomMultiplier=1.0f;
		}
		chainImageSet(const chainImageSet& mom){
			chainImageSet();
		}
		void drawGui(int x,int y,bool is_selected);
		void drawOutput();
		void drawGpu();
		void updateOutput();
		bool addfiles(std::vector<string> &filenames);
		bool add(std::string filename,ofPoint pos=ofPoint(0,0),float ratio=0.3,float rotation=0.0);
		void keyPressed(ofKeyEventArgs &keyargs);
		void mouseDragged(int x, int y, int button);
		void mousePressed(int x, int y, int button);
		void mouseReleased(int x, int y, int button);

		bool saveJson(std::string filename);
		bool loadJson(std::string filename);

		ofPoint outputSize;

		std::list <std::unique_ptr<chainImage> >  images;

		float currentDefaultImageRatio;

		//how to make selected and currentimage work if images is a list of unique_ptr?
		//req:
		//A: a container for images
		//B: a temporary container for images that are loading
		//be able to transfer images from B to A
		//C: an iterator to A
		//be able to loop through C and identify an element which is pointed to by C

		std::list <std::unique_ptr<chainImage> >::iterator selected;
		ofPoint clickPoint;
		ofPoint dragPoint;
		float dragScale;
		float dragRotate;
		float fitFactor;
		float zoomMultiplier;

		std::string filename;

		std::list <std::unique_ptr<chainImage> >::iterator currentImage;

		float decayFactor;

		bool additive;
		float intensity;

		std::vector <std::unique_ptr<chainImage> > loadingImages;
		std::vector <int> loadingIndexes;

		threadedChainImageLoader loader;
		//threadedSystemLoadDialog loadDialog;
};