70 using System.Collections.Generic;
84 public List<List<Vector3>>
ReadFile(
string fieldlines_file_content, Vector3 Offset)
86 List<List<Vector3>> linelist=
new List<List<Vector3>>();
87 StringReader sr =
new StringReader(fieldlines_file_content);
90 string[] tok = line.Split(
' ');
95 List<Vector3> particlelist =
new List<Vector3>();
98 tok = line.Split(
' ');
99 if(tok[0] ==
"n" && particlelist.Count > 0)
101 linelist.Add(particlelist);
102 particlelist =
new List<Vector3>();
108 Vector3 values =
new Vector3(-
float.Parse(tok[1]) + Offset.x,
109 float.Parse(tok[2]) + Offset.y,
110 float.Parse(tok[3]) + Offset.z
112 particlelist.Add(values);
114 line = sr.ReadLine();
116 if(particlelist.Count > 0)
117 linelist.Add(particlelist);
119 Debug.Log(
"Reading Fieldlines apf ERROR");
126 Debug.Log(((Hashtable)value)[
"lines"]);
127 ArrayList FieldLinesarray=(ArrayList)(((Hashtable)value)[
"lines"]);
131 Debug.Log(FieldLinesarray.Count);
133 for (
int i=0; i<FieldLinesarray.Count; i++)
135 List<Vector3> particlelist=
new List<Vector3>();
136 for(
int j=0;j<((ArrayList)FieldLinesarray[i]).Count;j+=3)
142 double x=-(double)(((ArrayList)FieldLinesarray[i])[j]);
143 double y=(double)(((ArrayList)FieldLinesarray[i])[j+1]);
144 double z=(double)(((ArrayList)FieldLinesarray[i])[j+2]);
145 particlelist.Add(
new Vector3(
float.Parse(
System.Convert.ToString(x))+Offset.x,
float.Parse(
System.Convert.ToString(y))+Offset.y,
float.Parse(
System.Convert.ToString(z))+Offset.z));
151 linelist.Add(particlelist);
155 m_fieldlines = linelist;
156 return GetFieldLines();
List< List< Vector3 > > ReadFile(string fieldlines_file_content, Vector3 Offset)
List< List< Vector3 > > m_fieldlines
This class encodes and decodes JSON strings.
static object JsonDecode(string json)
Parses the string json into a value
List< List< Vector3 > > GetFieldLines()