void Start() { client = ServicePropertiesClass.GetGapslabsService(ServicePropertiesClass.ServiceUri); geoinfo = transform.GetComponent <GeoInfo>(); var go = GameObject.Find("AramGISBoundaries"); mapBoundaries = go.GetComponent <MapBoundaries>(); wcfCon = mapBoundaries.OverrideDatabaseConnection ? mapBoundaries.GetOverridenConnectionString() : ServicePropertiesClass.ConnectionPostgreDatabase; boundsTemp = client.GetBounds(wcfCon); // Temporary - it appears the data for sweden includes some data that go to the north pole and it ruins all interpolations. boundsTemp.maxlon = 32; MinMaxLat = new float[2]; MinMaxLon = new float[2]; // Setting local values for target boundaries (Openstreetmap database). Used in interpolation as destination boundary. MinMaxLat[0] = (float)boundsTemp.minlat; MinMaxLat[1] = (float)boundsTemp.maxlat; MinMaxLon[0] = (float)boundsTemp.minlon; MinMaxLon[1] = (float)boundsTemp.maxlon; // Setting local values for 3d world boundaries. Used in interpolation as source boundary GameBoundaries = new BoundsWCF(); GameBoundaries.minlat = mapBoundaries.minMaxX[0]; GameBoundaries.maxlat = mapBoundaries.minMaxX[1]; GameBoundaries.minlon = mapBoundaries.minMaxY[0]; GameBoundaries.maxlon = mapBoundaries.minMaxY[1]; GameBoundLat = new float[2]; GameBoundLat[0] = (float)GameBoundaries.minlat; GameBoundLat[1] = (float)GameBoundaries.maxlat; GameBoundLon = new float[2]; GameBoundLon[0] = (float)GameBoundaries.minlon; GameBoundLon[1] = (float)GameBoundaries.maxlon; float[] MinPointOnArea = Interpolations.SimpleInterpolation( (float)mapBoundaries.minLat, (float)mapBoundaries.minLon, boundsTemp, GameBoundLat, GameBoundLon); MinPointOnMap = new Vector3(MinPointOnArea[0], 0, MinPointOnArea[1]); }
void Awake() { timeController = FindObjectOfType <TimeController>(); trafficDB = FindObjectOfType <TrafficIntegrationData>(); if (trafficDB == null) { Debug.Log("TrafficIntegrationData NOT found. "); return; } trafficController = FindObjectOfType <TrafficIntegrationController>(); if (trafficController == null) { Debug.Log("TrafficIntegrationController NOT found. "); return; } aramGisBoundaries = FindObjectOfType <MapBoundaries>(); if (aramGisBoundaries == null) { Debug.Log("MapBoundaries NOT found. "); return; } var reader = FindSimulationReader(); reader.SetTrafficDB(trafficDB); switch (trafficController.typeOfIntegration) { case TrafficIntegrationController.TypeOfIntegration.SumoLiveIntegration: SetUseNetworkStream(true); reader.SetIO(new SumoIO()); break; case TrafficIntegrationController.TypeOfIntegration.SumoFCDFile: SetUseNetworkStream(false); reader.SetFileName(trafficController.pathSumoFCDFile); reader.SetIO(new SumoIO()); break; case TrafficIntegrationController.TypeOfIntegration.VissimFZPFile: SetUseNetworkStream(false); reader.SetFileName(trafficController.pathVissimFZPFile); reader.SetIO(new VissimIO()); break; case TrafficIntegrationController.TypeOfIntegration.MatsimDatabase: reader.SetConnectionString(aramGisBoundaries.GetOverridenConnectionString()); reader.SetIO(new MatsimIO()); break; case TrafficIntegrationController.TypeOfIntegration.PWSimPWSFile: SetUseNetworkStream(false); reader.SetFileName(trafficController.pathPWSimMetaFile); reader.SetIO(new ProtoMetaIO()); break; case TrafficIntegrationController.TypeOfIntegration.DecisionTreeIntegration: return; case TrafficIntegrationController.TypeOfIntegration.NoTrafficIntegration: return; } reader.ThreadUpdate(); }