Пример #1
0
    public IEnumerator loadTransect(string transect)
    {
        string url       = "http://localhost/ReefTransects/" + transect;
        WWW    wwwImage  = new WWW(url + ".jpg");
        WWW    wwwCoords = new WWW(url + ".txt");

        yield return(wwwImage);

        yield return(wwwCoords);

        Texture2D texture = new Texture2D(10, 10);

        wwwImage.LoadImageIntoTexture(texture);
        TransectSelection.transectTextures.Add(transect, texture);
        string[] coords = wwwCoords.text.ToString().Split(',');
        float    xPos   = CoordConversion.calcX(float.Parse(coords[1]));
        float    zPos   = CoordConversion.calcZ(float.Parse(coords[0]));

        GameObject sphere = GameObject.CreatePrimitive(PrimitiveType.Sphere);

        sphere.name = transect;
        Vector3 worldPos = new Vector3(xPos, 0, zPos);

        sphere.transform.position = new Vector3(xPos, RandomTerrainGenerator.terrain.SampleHeight(worldPos) - 6f, zPos);
        sphere.GetComponent <Renderer>().material.mainTexture = texture;
        sphere.AddComponent <Rigidbody>().isKinematic         = true;
        sphere.GetComponent <Rigidbody>().useGravity          = false;
        sphere.tag = "transect";
    }
Пример #2
0
    public float ConvertZ(float z)
    {
        float zvalue = z;

        zValueConverted = CoordConversion.calcLat(z);
        return(zValueConverted);
    }
Пример #3
0
    public float ConvertX(float x)
    {
        float xvalue = x;

        xValueConverted = CoordConversion.calcLon(x);
        return(xValueConverted);
    }
Пример #4
0
    // Updates the player on the google map
    public void updatePlayer(float x, float z)
    {
        float lon = CoordConversion.calcLon(x);
        float lat = CoordConversion.calcLat(z);

        markers[0].locations[0].longitude = lon;
        markers[0].locations[0].latitude  = lat;
        centerLocation.latitude           = lat;
        centerLocation.longitude          = lon;
    }
Пример #5
0
    public void loadDummyMesh(string reefSection)
    {
        string path = @"C:\dummyserver\" + reefSection;

        string[] coords = System.IO.File.ReadAllText(path + ".txt").Split(',');
        print(coords[0] + "   " + coords[1]);
        float xPos = CoordConversion.calcX(float.Parse(coords[1]));
        float zPos = CoordConversion.calcZ(float.Parse(coords[0]));

        GetComponent <PLYImporter>().ReadBinaryFile(path + ".ply", xPos, 0f, zPos);
    }
Пример #6
0
 void Start()
 {
     CoordConversion.resetOrigin(152.7106403f, -24.1131252f);         // these values will come from the lobby mesh selection
     canShowMap = true;
     mapType    = MapType.Satellite;
     gameObject.GetComponent <Renderer> ().enabled = false;
     initMarkers();
     addMarker(CoordConversion.oLat, CoordConversion.oLon, 0);         // Automatically add player marker
     updatePlayer(GameObject.Find("GetPlayerPos").transform.position.x, GameObject.Find("GetPlayerPos").transform.position.z);
     if (loadOnStart)
     {
         StartCoroutine(_Refresh());
     }
     StartCoroutine(refreshMapOnTimer());
     isChecked = false;
 }
Пример #7
0
    // Adds a marker to the google map
    public void addMarker(float y, float x, int markerType)
    {
        switch (markerType)
        {
        case 0:
            markers[0].color = GoogleMapColor.red;
            markers[0].label = "Player";
            break;

        case 1:
            markers[1].color = GoogleMapColor.blue;
            markers[1].label = "Water";
            markerCount[1]++;
            break;

        case 2:
            markers[markerType].color = GoogleMapColor.green;
            markers[markerType].label = "Algae";
            markerCount[2]++;
            break;

        case 3:
            markers[markerType].color = GoogleMapColor.yellow;
            markers[markerType].label = "Sand";
            markerCount[3]++;
            break;

        case 4:
            markers[markerType].color = GoogleMapColor.orange;
            markers[markerType].label = "Coral";
            markerCount[4]++;
            break;

        case 5:
            markers[markerType].color = GoogleMapColor.brown;
            markers[markerType].label = "Rock";
            markerCount[5]++;
            break;
        }
        markers[markerType].locations[markerCount[markerType]].longitude = CoordConversion.calcLon(x);
        markers[markerType].locations[markerCount[markerType]].latitude  = CoordConversion.calcLat(y);
        markers[markerType].size = GoogleMapMarker.GoogleMapMarkerSize.Mid;
    }
Пример #8
0
    // Loads the mesh "reefSection".ply at the coordinate position desiganted in the txt file "reefSection".txt
    // which are saved on the localhost at "http://localhost/ReefMeshes/"
    public IEnumerator loadMesh(string reefSection)
    {
        string url       = "http://localhost/ReefMeshes/" + reefSection;
        string path      = @"C:\ReefData\" + reefSection;
        WWW    wwwScript = new WWW(url + ".ply");
        WWW    wwwMeta   = new WWW(url + ".txt"); // real server stuff

        yield return(wwwScript);

        yield return(wwwMeta);


        File.WriteAllBytes(path + ".ply", wwwScript.bytes);

        string[] coords = wwwMeta.text.ToString().Split(',');

        float xPos = CoordConversion.calcX(float.Parse(coords[1]));
        float zPos = CoordConversion.calcZ(float.Parse(coords[0]));

        CoordConversion.resetOrigin(xPos, zPos);          // resets origin and puts mesh in origin position- easily changed
        GetComponent <PLYImporter>().ReadBinaryFile(path + ".ply", 0, 0f, 0);
    }
 public static string CoordConversionToStr(CoordConversion conv) {
   string ret = VisionLabPINVOKE.CoordConversionToStr((int)conv);
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
Пример #10
0
 public static XYCoord Coord2DToXYCoord(Coord2D c, CoordConversion conv) {
   XYCoord ret = new XYCoord(VisionLabPINVOKE.Coord2DToXYCoord__SWIG_0(Coord2D.getCPtr(c), (int)conv), true);
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }