private void TryGetMarkers(int z, double tlx, double tly, double brx, double bry, ref List <OnlineMapsMarker> markers)
        {
            if (zoom < 3 || zoom < z || totalCount < instance.minClusteredItems)
            {
                for (int i = 0; i < count; i++)
                {
                    childs[i].GetMarkers(z, tlx, tly, brx, bry, ref markers);
                }
            }
            else
            {
                if (markerRef == null)
                {
                    UpdatePosition();

                    markerRef = new OnlineMapsMarker();
                    markerRef.SetPosition(longitude, latitude);
                    markerRef.texture = instance.groupTexture;
                    markerRef.label   = "Group (childs: " + totalCount + ")";

                    if (OnCreateInstance != null)
                    {
                        OnCreateInstance(this, markerRef);
                    }
                    markerRef.Init();
                }

                markers.Add(markerRef);
            }
        }
示例#2
0
    // Update is called once per frame
    void Update()
    {
        var timeDiff = DateTime.Now - startTime;

        timeText.text = String.Format("{0}:{1}:{2}", timeDiff.Hours.ToString("D2"), timeDiff.Minutes.ToString("D2"), timeDiff.Seconds.ToString("D2"));
        //Convert.ToInt64(timeDiff.TotalSeconds).ToString();
        markerUser.SetPosition(map.position.x, map.position.y);
        markerUser.rotationDegree = -compassDiff;
        _timer      += Time.deltaTime;
        _timerShlik += Time.deltaTime;

        if (_timerShlik > _waitTimeShlik)
        {
            if (isGame && !isAnswerMode)
            {
                NextPoint();
            }
            _timerShlik = 0f;
        }

        if (_timer >= _waitTime)
        {
            if (isGame && !isAnswerMode)
            {
                CheckInfo();
            }

            _timer = 0f;
        }
    }
示例#3
0
 // Initialization of the point data
 public void Init()
 {
     _Pin = new OnlineMapsMarker();
     _Pin.SetPosition(_Position.Latitude, _Position.Longitude);
     _Pin.label   = _Label;
     _Pin.texture = _Icon;
     _Pin.tags.Add(_Type.ToString());
 }
示例#4
0
    public void AddMarker(Location Location)
    {
        OnlineMaps       map    = FindObjectOfType <OnlineMaps>();
        OnlineMapsMarker marker = new OnlineMapsMarker();

        marker.SetPosition(Location.Longitude, Location.Latitude);
        marker.texture  = Location.Thumbnail;
        marker.OnClick += delegate(OnlineMapsMarkerBase obj) { ScriptEventSystem.Instance.SelectedMapMarker(Location); };
        marker.Init();
        map.AddMarker(marker);
    }
    protected override void updateGraphicsCoordinates()
    {
        if (marker3D != null)
        {
            marker3D.SetPosition(getX(), getY());
        }

        if (marker2D != null)
        {
            marker2D.SetPosition(getX(), getY());
        }
    }
示例#6
0
    public void AddWebMarker(Newsarticle article, Texture2D ArticleTexture)
    {
        OnlineMaps       map    = FindObjectOfType <OnlineMaps>();
        OnlineMapsMarker marker = new OnlineMapsMarker();

        marker.SetPosition(article.Longitude, article.Latitude);
        marker.texture = ArticleTexture;
        //marker.OnClick += delegate (OnlineMapsMarkerBase obj) { Application.OpenURL(article.Link); };
        marker.OnClick += delegate(OnlineMapsMarkerBase obj) { ScriptEventSystem.Instance.SelectedNewsarticleMarker(article); };
        marker.Init();
        map.AddMarker(marker);
    }
    private void updateMarker(double lng, double lat, int gpsID, string timeStr)
    {
        Dictionary <int, OnlineMapsMarker> markersDict = GPSInfosManager.Insatance.markersDict;

        if (markersDict.ContainsKey(gpsID))
        {
            OnlineMapsMarker m = markersDict[gpsID];
            m.SetPosition(lng, lat);
            m.label = gpsID + " " + timeStr;
        }
        else
        {
            OnlineMapsMarker m = OnlineMapsMarkerManager.CreateItem(lng, lat, gpsID + " " + timeStr);
            markersDict.Add(gpsID, m);
        }
    }
    void LocationUpdate()
    {
        Debug.Log("\t\tLocation update round");
        // Debug.Log ("\t\t MAP == " + map);

        using (UnityWebRequest locReq = SendLocationsRequest()) {
            LocationEntity[] locations;
            locReq.SendWebRequest();
            while (!locReq.isDone)
            {
            }
            if (locReq.error != null)
            {
                Debug.Log("\t\t" + "Transmission error for locations \n" + locReq.error);
                loadingText.text = "Ошибка передачи данных локаций \n" + locReq.error;
                return;
            }
            else
            {
                string result = locReq.downloadHandler.text;
                // Debug.Log ("LOCATIONS RESULT: |" + result + "|");
                locations = JsonHelper.getJsonArray <LocationEntity> (result);
                markers   = new List <OnlineMapsMarker> ();

                for (int i = 0; i < locations.Length; i++)
                {
                    // Debug.Log ("PROCESSING MARKER FOR " + locations [i].name);
                    OnlineMapsMarker marker = new OnlineMapsMarker();
                    marker.SetPosition(locations [i].longitude, locations [i].latitude);
                    marker.label = locations [i].name;
                    markers.Add(marker);
                }


                for (int i = 0; i < map.markers.Length; i++)
                {
                    if (map.markers[i].label != "Текущая Позиция")
                    {
                        map.RemoveMarker(map.markers [i], true);
                    }
                }

                Debug.Log("ADDING LOCATION MARKERS");
                markers.ForEach(marker => map.AddMarker(marker));
            }
        }
    }
示例#9
0
    public void Check()
    {
        //RequestSimpleResult result;
        //result = UpdateInfo(currentGame, currentPoint, true, false, true, true);

        if (isGame)
        {
            CheckResult resultCheck = Check(currentGame, map.position.y, map.position.x);
            if (resultCheck.point != -1)
            {
                resultGeneral.text = string.Format("Point {0} was found!", curreintPointIndex + 1);
                OnlineMapsMarker m = markers[resultCheck.point];
                m.SetPosition(resultCheck.lon, resultCheck.lat);
                map.Redraw();
                Debug.Log("R");
                Debug.Log(resultCheck.point);
                SetQuestion(resultCheck.point);
                if (resultCheck.point == 0)
                {
                    resultMiniGame.First = true;
                }
                if (resultCheck.point == 1)
                {
                    resultMiniGame.Second = true;
                }
                if (resultCheck.point == 2)
                {
                    resultMiniGame.Third = true;
                }
                if (resultCheck.point == 3)
                {
                    resultMiniGame.Fourth = true;
                }
                if (resultMiniGame.First && resultMiniGame.Second && resultMiniGame.Third && resultMiniGame.Fourth)
                {
                    isGame             = false;
                    resultGeneral.text = "You are a winner!";
                }
            }
        }
    }
示例#10
0
    private static void LoadMarkers(OnlineMapsXML el, OnlineMaps api)
    {
        List <OnlineMapsMarker> markers = new List <OnlineMapsMarker>();

        foreach (OnlineMapsXML m in el)
        {
            OnlineMapsMarker marker = new OnlineMapsMarker();

            double mx = m.Get <double>("Longitude");
            double my = m.Get <double>("Latitude");

            marker.SetPosition(mx, my);

            marker.range    = m.Get <OnlineMapsRange>("Range");
            marker.label    = m.Get <string>("Label");
            marker.texture  = GetObject(m.Get <int>("Texture")) as Texture2D;
            marker.align    = (OnlineMapsAlign)m.Get <int>("Align");
            marker.rotation = m.Get <float>("Rotation");
            markers.Add(marker);
        }

        api.markers = markers.ToArray();
    }
示例#11
0
        private void Update()
        {
            if (pointIndex == -1)
            {
                return;
            }

            // Start point
            OnlineMapsVector2d p1 = points[pointIndex];

            // End point
            OnlineMapsVector2d p2 = points[pointIndex + 1];

            // Total step distance
            double dx, dy;

            OnlineMapsUtils.DistanceBetweenPoints(p1.x, p1.y, p2.x, p2.y, out dx, out dy);
            double stepDistance = Math.Sqrt(dx * dx + dy * dy);

            // Total step time
            double totalTime = stepDistance / speed * 3600;

            // Current step progress
            progress += Time.deltaTime / totalTime;

            OnlineMapsVector2d position;

            if (progress < 1)
            {
                position = OnlineMapsVector2d.Lerp(p1, p2, progress);
                marker.SetPosition(position.x, position.y);

                // Orient marker
                if (orientMarkerOnNextPoint)
                {
                    marker.rotation = 1.25f - OnlineMapsUtils.Angle2D((Vector2)p1, (Vector2)p2) / 360f;
                }
            }
            else
            {
                position = p2;
                marker.SetPosition(position.x, position.y);
                pointIndex++;
                progress = 0;
                if (pointIndex >= points.Length - 1)
                {
                    Debug.Log("Finish");
                    pointIndex = -1;
                }
                else
                {
                    // Orient marker
                    if (orientMarkerOnNextPoint)
                    {
                        marker.rotation = 1.25f - OnlineMapsUtils.Angle2D(p2, points[pointIndex + 1]) / 360;
                    }
                }
            }

            if (lookToMarker)
            {
                OnlineMaps.instance.SetPosition(position.x, position.y);
            }
            OnlineMaps.instance.Redraw();
        }
示例#12
0
 // changes the position of the point
 public void UpdatePosition(double lat, double lon)
 {
     _Position = new Position(lat, lon);
     _Pin.SetPosition(_Position.Latitude, _Position.Longitude);
     _Acting = false;
 }