예제 #1
0
 public void transformPointsToLocal(double orientationOffset, double metersPerDegreeLatitude, double metersPerDegreeLongitude, double latitudeZero, double longitudeZero)
 {
     for (int i = 0; i < this.points.Length; i++)
     {
         double localY = CoordinateConversions.ConvertLatitudeToLocalY(this.points[i].y, this.points[i].x, orientationOffset, metersPerDegreeLatitude, metersPerDegreeLongitude, latitudeZero, longitudeZero);
         double localX = CoordinateConversions.ConvertLongitudeToLocalX(this.points[i].x, localY, orientationOffset, metersPerDegreeLongitude, longitudeZero);
         this.points[i].x = localX;
         this.points[i].y = localY;
     }
 }
예제 #2
0
    IEnumerator GetMaterials()
    {
        UnityWebRequest materialService = UnityWebRequest.Get("https://mms-material-service-stg.run.aws-usw02-pr.ice.predix.io/api/v2/clients/GELighting/sites/101/materials/views/lastlocation?status=active");

        materialService.SetRequestHeader("Content-Type", "application/json");
        materialService.SetRequestHeader("Authorization", Authorization.getToken());
        yield return(materialService.SendWebRequest());

        if (materialService.isNetworkError || materialService.isHttpError)
        {
            Debug.Log(materialService.error);
        }
        else
        {
            materials = JsonHelper.FromJson <MaterialClass>(JsonHelper.FixJson(materialService.downloadHandler.text));
            foreach (MaterialClass material in materials)
            {
                double     localZ           = CoordinateConversions.ConvertLatitudeToLocalY(material.y, material.x, orientationOffset, metersPerDegreeLatitude, metersPerDegreeLongitude, latitudeZero, longitudeZero);
                double     localX           = CoordinateConversions.ConvertLongitudeToLocalX(material.x, localZ, orientationOffset, metersPerDegreeLongitude, longitudeZero);
                GameObject materialInstance = Instantiate(palletAndBoxes, new Vector3((float)localX, (float)0.05420906, (float)localZ), Quaternion.Euler(-90, 0, 0));
                materialInstance.GetComponent <MaterialDetails>().MaterialId = material.materialId;
            }
        }
    }
    IEnumerator GetCarriers()
    {
        UnityWebRequest carrierService = UnityWebRequest.Get("https://mms-carrier-service-stg.run.aws-usw02-pr.ice.predix.io/api/v2/clients/GELighting/sites/101/carriers/locations/latest?active=true");

        carrierService.SetRequestHeader("Content-Type", "application/json");
        carrierService.SetRequestHeader("Authorization", Authorization.getToken());
        yield return(carrierService.SendWebRequest());

        if (carrierService.isNetworkError || carrierService.isHttpError)
        {
            Debug.Log(carrierService.error);
        }
        else
        {
            carriers = JsonHelper.FromJson <CarrierLocationClass>(JsonHelper.FixJson(carrierService.downloadHandler.text));
            foreach (CarrierLocationClass carrier in carriers)
            {
                double     localZ          = CoordinateConversions.ConvertLatitudeToLocalY(carrier.y, carrier.x, orientationOffset, metersPerDegreeLatitude, metersPerDegreeLongitude, latitudeZero, longitudeZero);
                double     localX          = CoordinateConversions.ConvertLongitudeToLocalX(carrier.x, localZ, orientationOffset, metersPerDegreeLongitude, longitudeZero);
                GameObject carrierInstance = Instantiate(forklift, new Vector3((float)localX, (float)0.06177858, (float)localZ), Quaternion.Euler(0, (float)(carrier.orientation + 90 + 40), 0));
                carrierInstance.transform.Find("forklift_truck").GetComponent <CarrierDetails>().CarrierId = carrier.carrierId;
            }
        }
    }