1 /*
2     Copyright (c) 2008-2009 NetAllied Systems GmbH
3 
4     This file is part of MayaDataModel.
5 
6     Licensed under the MIT Open Source License,
7     for details please see LICENSE file or the website
8     http://www.opensource.org/licenses/mit-license.php
9 */
10 #ifndef __MayaDM_HYPERVIEW_H__
11 #define __MayaDM_HYPERVIEW_H__
12 #include "MayaDMTypes.h"
13 #include "MayaDMConnectables.h"
14 #include "MayaDMDependNode.h"
15 namespace MayaDM
16 {
17 class HyperView : public DependNode
18 {
19 public:
20 public:
21 
HyperView()22 	HyperView():DependNode(){}
23 	HyperView(FILE* file,const std::string& name,const std::string& parent="",bool shared=false,bool create=true)
24 		:DependNode(file, name, parent, "hyperView", shared, create){}
~HyperView()25 	virtual ~HyperView(){}
26 
setPosition(const double2 & p)27 	void setPosition(const double2& p)
28 	{
29 		if(p == double2(0, 0)) return;
30 		fprintf(mFile,"\tsetAttr \".p\" -type \"double2\" ");
31 		p.write(mFile);
32 		fprintf(mFile,";\n");
33 	}
setPositionX(double px)34 	void setPositionX(double px)
35 	{
36 		if(px == 0.0) return;
37 		fprintf(mFile,"\tsetAttr \".p.px\" %f;\n", px);
38 	}
setPositionY(double py)39 	void setPositionY(double py)
40 	{
41 		if(py == 0.0) return;
42 		fprintf(mFile,"\tsetAttr \".p.py\" %f;\n", py);
43 	}
setViewRectLow(const double2 & vl)44 	void setViewRectLow(const double2& vl)
45 	{
46 		if(vl == double2(0, 0)) return;
47 		fprintf(mFile,"\tsetAttr \".vl\" -type \"double2\" ");
48 		vl.write(mFile);
49 		fprintf(mFile,";\n");
50 	}
setViewXL(double xl)51 	void setViewXL(double xl)
52 	{
53 		if(xl == 0.0) return;
54 		fprintf(mFile,"\tsetAttr \".vl.xl\" %f;\n", xl);
55 	}
setViewYL(double yl)56 	void setViewYL(double yl)
57 	{
58 		if(yl == 0.0) return;
59 		fprintf(mFile,"\tsetAttr \".vl.yl\" %f;\n", yl);
60 	}
setViewRectHigh(const double2 & vh)61 	void setViewRectHigh(const double2& vh)
62 	{
63 		if(vh == double2(0, 0)) return;
64 		fprintf(mFile,"\tsetAttr \".vh\" -type \"double2\" ");
65 		vh.write(mFile);
66 		fprintf(mFile,";\n");
67 	}
setViewXH(double xh)68 	void setViewXH(double xh)
69 	{
70 		if(xh == 0.0) return;
71 		fprintf(mFile,"\tsetAttr \".vh.xh\" %f;\n", xh);
72 	}
setViewYH(double yh)73 	void setViewYH(double yh)
74 	{
75 		if(yh == 0.0) return;
76 		fprintf(mFile,"\tsetAttr \".vh.yh\" %f;\n", yh);
77 	}
setDagView(bool dag)78 	void setDagView(bool dag)
79 	{
80 		if(dag == true) return;
81 		fprintf(mFile,"\tsetAttr \".dag\" %i;\n", dag);
82 	}
setDescription(const string & d)83 	void setDescription(const string& d)
84 	{
85 		if(d == "") return;
86 		fprintf(mFile,"\tsetAttr \".d\" -type \"string\" ");
87 		d.write(mFile);
88 		fprintf(mFile,";\n");
89 	}
setFullName(const string & fn)90 	void setFullName(const string& fn)
91 	{
92 		if(fn == "") return;
93 		fprintf(mFile,"\tsetAttr \".fn\" -type \"string\" ");
94 		fn.write(mFile);
95 		fprintf(mFile,";\n");
96 	}
setShortName(const string & sn)97 	void setShortName(const string& sn)
98 	{
99 		if(sn == "") return;
100 		fprintf(mFile,"\tsetAttr \".sn\" -type \"string\" ");
101 		sn.write(mFile);
102 		fprintf(mFile,";\n");
103 	}
setBuildDirection(unsigned int bd)104 	void setBuildDirection(unsigned int bd)
105 	{
106 		if(bd == 2) return;
107 		fprintf(mFile,"\tsetAttr \".bd\" %i;\n", bd);
108 	}
setGraphTraversalLimit(int gtl)109 	void setGraphTraversalLimit(int gtl)
110 	{
111 		if(gtl == -1) return;
112 		fprintf(mFile,"\tsetAttr \".gtl\" %i;\n", gtl);
113 	}
getPosition()114 	void getPosition()const
115 	{
116 		fprintf(mFile,"\"%s.p\"",mName.c_str());
117 	}
getPositionX()118 	void getPositionX()const
119 	{
120 		fprintf(mFile,"\"%s.p.px\"",mName.c_str());
121 	}
getPositionY()122 	void getPositionY()const
123 	{
124 		fprintf(mFile,"\"%s.p.py\"",mName.c_str());
125 	}
getViewRectLow()126 	void getViewRectLow()const
127 	{
128 		fprintf(mFile,"\"%s.vl\"",mName.c_str());
129 	}
getViewXL()130 	void getViewXL()const
131 	{
132 		fprintf(mFile,"\"%s.vl.xl\"",mName.c_str());
133 	}
getViewYL()134 	void getViewYL()const
135 	{
136 		fprintf(mFile,"\"%s.vl.yl\"",mName.c_str());
137 	}
getViewRectHigh()138 	void getViewRectHigh()const
139 	{
140 		fprintf(mFile,"\"%s.vh\"",mName.c_str());
141 	}
getViewXH()142 	void getViewXH()const
143 	{
144 		fprintf(mFile,"\"%s.vh.xh\"",mName.c_str());
145 	}
getViewYH()146 	void getViewYH()const
147 	{
148 		fprintf(mFile,"\"%s.vh.yh\"",mName.c_str());
149 	}
getDagView()150 	void getDagView()const
151 	{
152 		fprintf(mFile,"\"%s.dag\"",mName.c_str());
153 	}
getDescription()154 	void getDescription()const
155 	{
156 		fprintf(mFile,"\"%s.d\"",mName.c_str());
157 	}
getFocusNode()158 	void getFocusNode()const
159 	{
160 		fprintf(mFile,"\"%s.fnd\"",mName.c_str());
161 	}
getRootNode(size_t rnd_i)162 	void getRootNode(size_t rnd_i)const
163 	{
164 		fprintf(mFile,"\"%s.rnd[%i]\"",mName.c_str(),rnd_i);
165 	}
getRootNode()166 	void getRootNode()const
167 	{
168 
169 		fprintf(mFile,"\"%s.rnd\"",mName.c_str());
170 	}
getFullName()171 	void getFullName()const
172 	{
173 		fprintf(mFile,"\"%s.fn\"",mName.c_str());
174 	}
getShortName()175 	void getShortName()const
176 	{
177 		fprintf(mFile,"\"%s.sn\"",mName.c_str());
178 	}
getBuildDirection()179 	void getBuildDirection()const
180 	{
181 		fprintf(mFile,"\"%s.bd\"",mName.c_str());
182 	}
getGraphTraversalLimit()183 	void getGraphTraversalLimit()const
184 	{
185 		fprintf(mFile,"\"%s.gtl\"",mName.c_str());
186 	}
getHyperLayout()187 	void getHyperLayout()const
188 	{
189 		fprintf(mFile,"\"%s.hl\"",mName.c_str());
190 	}
191 protected:
192 	HyperView(FILE* file,const std::string& name,const std::string& parent,const std::string& nodeType,bool shared=false,bool create=true)
DependNode(file,name,parent,nodeType,shared,create)193 		:DependNode(file, name, parent, nodeType, shared, create) {}
194 
195 };
196 }//namespace MayaDM
197 #endif//__MayaDM_HYPERVIEW_H__
198