コード例 #1
0
ファイル: Marker.cs プロジェクト: dokuhl/mapmo-ar-core
 public void init(Poi poi, double lat, double lon)
 {
     transform            = GetComponent <Transform>();
     mainCameraTransform  = Camera.main.transform;
     renderer_transform   = GetComponent <Renderer>().transform;
     this.poi             = poi;
     this.gameObject.name = "marker_" + poi.basic_poi.original_name;
     this.lat             = lat;
     this.lon             = lon;
     if (map == null)
     {
         map = GameObject.Find("Map").GetComponent <Map>();
     }
     if (poi_handler_script == null)
     {
         poi_handler_script = GameObject.Find("PoiHandler").GetComponent <PoiHandler>();
     }
     float[] xy = map.tilepos(lon, lat, map.zoom);
     if (poi.basic_poi.icon.Length > 4)
     {
         Texture2D texture = Resources.Load("icons/" + poi.basic_poi.icon.Substring(0, poi.basic_poi.icon.Length - 4), typeof(Texture2D)) as Texture2D;
         if (texture != null)
         {
             transform.Find("img_marker").GetComponent <SpriteRenderer>().sprite = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0, 0));
         }
     }
     this.init(map.zoom, xy[0], xy[1], 10, 10);
 }
コード例 #2
0
ファイル: InvisBuilding.cs プロジェクト: dokuhl/mapmo-ar-core
    public void init(InvisBuildingJsonRepsonse_Building building, PoiHandler poi_handler)
    {
        this.poi_handler = poi_handler;
        addPois();
        transform = GetComponent <Transform>();
        this.lat  = building.startPoint[1];
        this.lon  = building.startPoint[0];
        this.id   = building.id;
        this.name = "fade_building_" + building.id;

        Vector2[] vertices2D = new Vector2[building.building.Length / 2];
        for (int i = 0; i < building.building.Length; i += 2)
        {
            vertices2D[i / 2] = new Vector2(building.building[i], building.building[i + 1]);
        }

        if (map == null)
        {
            map = GameObject.Find("Map").GetComponent <Map>();
        }
        MeshFilter filter = gameObject.AddComponent(typeof(MeshFilter)) as MeshFilter;

        filter.mesh = CreateMesh(vertices2D);
        updateInvisBuilding();
    }
コード例 #3
0
ファイル: InvisBuilding.cs プロジェクト: dokuhl/mapmo-ar-core
 public void kill()
 {
     DestroyImmediate(building_icon, true);
     DestroyImmediate(poi_amount_icon, true);
     poi_handler = null;
     pois        = null;
     map         = null;
 }
コード例 #4
0
ファイル: Marker.cs プロジェクト: dokuhl/mapmo-ar-core
 public void init(double lat, double lon)
 {
     transform           = GetComponent <Transform>();
     mainCameraTransform = Camera.main.transform;
     renderer_transform  = GetComponent <Renderer>().transform;
     this.lat            = lat;
     this.lon            = lon;
     if (map == null)
     {
         map = GameObject.Find("Map").GetComponent <Map>();
     }
     if (poi_handler_script == null)
     {
         poi_handler_script = GameObject.Find("PoiHandler").GetComponent <PoiHandler>();
     }
     float[] xy = map.tilepos(lon, lat, map.zoom);
     this.init(map.zoom, xy[0], xy[1], 10, 10);
 }
コード例 #5
0
    void Start()
    {
        building_handler_script = building_handler.GetComponent <InvisBuildingHandler>();
        building_handler_script.initHandler(this);

        poi_handler_script = poi_handler.GetComponent <PoiHandler>();
        //routing_handler_script = routing_handler.GetComponent<RoutingHandler>();
        district_arrow_handler_script = district_arrow_handler.GetComponent <DistrictArrowHandler>();
        ////hardcoded latlon + updateCenter once
        tile_handler = GameObject.Find("MapBackground/TileHandler").GetComponent <TileHandler>();

        lat = 51.049456;
        lon = 13.737441;
        GameObject.Find("skybox_container").GetComponent <Skybox>().showDistrict("http://mapmo.de/wp-content/uploads/R0010189_20170721150835.jpg", 1.837f);
        GameObject.Find("HorseContainer").transform.FindChild("Horse").gameObject.SetActive(true);
        ////lat = 51.0291588;
        ////lon = 13.7194578;
        ////lat = 50.110479;
        ////lon = 8.682195;
        //orig_lat = (float)lat;
        //orig_lon = (float)lon;



        //++++++++++++++
        // hardcoded FOV
        fov = 60;
        // calculate horizontalFOV
        float radAngle = fov * Mathf.Deg2Rad;
        float radHFOV  = 2 * Mathf.Atan(Mathf.Tan(radAngle / 2) * Screen.width / Screen.height);

        horizontalFov = Mathf.Rad2Deg * radHFOV;
        selectedPoi   = null;


        updateCenter();
        StartCoroutine(gpsDebugUpdateRoutine());
        ////startFakeGPS();
    }