IMHOTEP Framework
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Pages
View.cs
1 using UnityEngine;
2 using System;
3 using System.Collections;
4 using System.Collections.Generic;
5 using System.Linq;
6 using System.Text;
7 using System.IO;
8 
9 public class View
10 {
11  public View( ViewJson vj )
12  {
13  name = vj.name;
14  orientation = new Quaternion( (float)vj.orientation[0],(float) vj.orientation[1], (float)vj.orientation[2], (float)vj.orientation[3] );
15  scale = new Vector3( (float)vj.scale[0], (float)vj.scale[1], (float)vj.scale[2] );
16  opacities = new Dictionary<string, double>();
17  if( vj.opacityKeys.Count == vj.opacityValues.Count )
18  {
19  int numEntries = vj.opacityKeys.Count;
20  for( int i = 0; i < numEntries; i ++ )
21  {
22  opacities.Add( vj.opacityKeys[i], vj.opacityValues[i] );
23  }
24  } else {
25  throw new System.Exception("Number of opacity values incorrect. Number of opacity keys and number of opacities must match!");
26  }
27  }
28  public View() {
29  opacities = new Dictionary<string, double>();
30  }
31  public string name { get; set; }
32  public Quaternion orientation { get; set; }
33  public Vector3 scale { get; set; }
34  public Dictionary<string, double> opacities { get; set; }
35 }
36 
37 public class ViewJson
38 {
39  public ViewJson() {
40  orientation = new double[4];
41  scale = new double[3];
42  //opacityKeys = new string[30];
43  //opacities = new double[30];
44  //opacities = new Dictionary<string, double>();
45  opacityKeys = new List<string>();
46  opacityValues = new List<double>();
47  }
48  public ViewJson( View v )
49  {
50  name = v.name;
51  orientation = new double[4];
52  orientation[0] = (double)v.orientation.x;
53  orientation[1] = (double)v.orientation.y;
54  orientation[2] = (double)v.orientation.z;
55  orientation[3] = (double)v.orientation.w;
56  scale = new double[3];
57  scale[0] = (double)v.scale.x;
58  scale[1] = (double)v.scale.y;
59  scale[2] = (double)v.scale.z;
60  opacityKeys = v.opacities.Keys.ToList();
61  opacityValues = v.opacities.Values.ToList();
62  /*opacityKeys = new string[v.opacities.Count];
63  opacities = new double[v.opacities.Count];
64  uint i = 0;
65  foreach(KeyValuePair<string, float> entry in v.opacities)
66  {
67  opacityKeys[i] = entry.Key;
68  opacities[i] = (double)entry.Value;
69  i ++;
70  }*/
71  }
72  public string name { get; set; }
73  public double[] orientation { get; set; }
74  public double[] scale { get; set; }
75  //public string[] opacityKeys;
76  //public double[] opacities;
77  public List<string> opacityKeys { get; set; }
78  public List<double> opacityValues { get; set; }
79 }
Definition: View.cs:37
Definition: View.cs:9