public void DrawPath(FacData originFac, FacData destFac) { bool update = false; if (prevOrigin != originFac || prevDest != destFac) { if (prevOrigin != originFac) { prevOrigin = originFac; } if (prevDest != destFac) { prevDest = destFac; } if (originFac != null && prevDest != null) { update = true; } } //it only one of the wand changes the target will create new arcs if (update) { //var existed = GameObject.FindGameObjectsWithTag("Arc"); ////Debug.Log(existed.Length); //foreach (GameObject arc in existed) //{ // arc.SetActive(false); //} //Debug.Log("origin selects " + originFac.SLIC); //Debug.Log("dest selects " + destFac.SLIC); Visualizer.DrawPath(originFac.SLIC, destFac.SLIC); } }
public void SetDest(FacData dFac) { destFac = dFac; UpdateInfo(); }
public void SetOrigin(FacData oFac) { originFac = oFac; UpdateInfo(); }
public void CreateFacilities(SeriesLocData[] allSeries) { Facility.PointMaterial = PointMaterial; SeriesLocData seriesData = allSeries[0]; Transform folder = new GameObject("Facilities").transform; folder.SetParent(transform, false); //Debug.Log(seriesData.Data.Length); for (int j = 0; j < seriesData.Data.Length; j += 9) { string SLIC = seriesData.Data[j].ToString(); float latitude = float.Parse(seriesData.Data[j + 1]); float longitude = float.Parse(seriesData.Data[j + 2]); string CC = seriesData.Data[j + 3].ToString(); string SORT = seriesData.Data[j + 4].ToString(); string CAP = seriesData.Data[j + 5].ToString(); string SPAN = seriesData.Data[j + 6].ToString(); string STRT = seriesData.Data[j + 7].ToString(); string STATE = seriesData.Data[j + 8].ToString(); if (STATE == " DC") { STATE = " WA"; } //if (STATE == " FL") //{ // Debug.Log("Florida Facility: " + SLIC); //} FacData fac = GetFacility(SLIC, latitude, longitude, CC, SORT, CAP, SPAN, STRT, STATE); if (!locations.ContainsKey(fac.SLIC)) { List <FacData> loc = new List <FacData>(); loc.Add(fac); locations.Add(fac.SLIC, loc); } else { locations[fac.SLIC].Add(fac); } //draw facility only once if (!buildings.ContainsKey(fac.pos)) { buildings.Add(fac.pos, fac.SLIC); GameObject p = Instantiate(PointPrefab); p.transform.SetParent(folder, false); p.transform.localScale = new Vector3(1, 1, 0.001f); p.transform.localPosition = fac.pos; p.transform.forward = fac.pos; // make cube point outwards p.GetComponent <MeshRenderer>().material = PointMaterial; p.AddComponent <BoxCollider>().isTrigger = true; p.AddComponent <Facility>().SetFac(fac); //p.AddComponent<HelloWorld>(); p.tag = "Location"; p.name = "Facility SLIC: " + fac.SLIC; points.Add(p); } //else //{ // //Debug.Log("adding facility" + fac.SLIC); // //buildings[fac.pos].Add(fac); //} } }