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
    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);
    }
示例#3
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);
    }
    /// <summary>
    /// Creates a marker at the location of the cursor.
    /// </summary>
    protected void CreateMarker()
    {
        OnlineMapsMarker m = new OnlineMapsMarker
        {
            position = GetCoords(),
            texture  = api.defaultMarkerTexture
        };

        m.Init();
        List <OnlineMapsMarker> markerList = api.markers.ToList();

        markerList.Add(m);
        api.markers = markerList.ToArray();
        api.Redraw();
    }
示例#5
0
    /// <summary>
    /// Creates a marker at the location of the cursor.
    /// </summary>
    protected void CreateMarker()
    {
        OnlineMapsMarker m = new OnlineMapsMarker
        {
            position = GetCoords(),
            texture  = api.defaultMarkerTexture
        };

        m.Init();

        if (api.markers == null)
        {
            api.markers = new OnlineMapsMarker[0];
        }
        Array.Resize(ref api.markers, api.markers.Length + 1);
        api.markers[api.markers.Length - 1] = m;
        api.Redraw();
    }
    private IEnumerator GenerateMarkers(float timeToWait)
    {
        yield return(new WaitForSeconds(timeToWait));

        Resources.UnloadUnusedAssets();


        var objectList  = LoadJSONFromHTML();
        var startTime   = Stopwatch.StartNew();
        var objectCount = objectList.Length;


        for (var i = 0; i < objectCount; i++)
        {
            var obj = objectList[i];
            if (obj.production == null || obj.production.location == null || obj.production.location.Length == 0)
            {
                continue;
            }
            var lt = obj.production.location[0].lat;
            var lg = obj.production.location[0].@long;


            OnlineMapsMarker marker = OnlineMapsMarkerManager.CreateItem(lg, lt);
            marker.label = obj.label != null && obj.label.Length > 0 ? obj.label[0] : obj.identifier;

            marker.Init();

            marker.OnPositionChanged += delegate(OnlineMapsMarkerBase m)
            {
                Clustering2DMarkers.UpdateMarkerPosition(m as OnlineMapsMarker);
            };

            Clustering2DMarkers.Add(marker);
        }

        Debug.Log("Antes de UpdatePositions: " + (startTime.ElapsedMilliseconds * 0.001f) + " segundos");
        Clustering2DMarkers.UpdatePositions();

        Debug.Log("CARGAR TODOS LOS OBJETOS: " + (startTime.ElapsedMilliseconds * 0.001f) + " segundos");
    }
 /// <summary>
 /// Creates a marker at the location of the cursor.
 /// </summary>
 protected void CreateMarker()
 {
     OnlineMapsMarker m = new OnlineMapsMarker
     {
         position = GetCoords(),
         texture = api.defaultMarkerTexture
     };
     m.Init();
     List<OnlineMapsMarker> markerList = api.markers.ToList();
     markerList.Add(m);
     api.markers = markerList.ToArray();
     api.Redraw();
 }
示例#8
0
    /// <summary>
    /// Adds a new 2D marker on the map.
    /// </summary>
    /// <param name="markerPosition">X - Longituge. Y - Latitude.</param>
    /// <param name="markerTexture">
    /// <strong>Optional</strong><br/>
    /// Marker texture. <br/>
    /// In import settings must be enabled "Read / Write enabled". <br/>
    /// Texture format: ARGB32. <br/>
    /// If not specified, the will be used default marker texture.</param>
    /// <param name="label">
    /// <strong>Optional</strong><br/>
    /// The text that will be displayed when you hover a marker.</param>
    /// <returns>Marker instance.</returns>
    public OnlineMapsMarker AddMarker(Vector2 markerPosition, Texture2D markerTexture = null, string label = "")
    {
        if (markerTexture == null) markerTexture = defaultMarkerTexture;

        List<OnlineMapsMarker> ms = markers.ToList();
        OnlineMapsMarker marker = new OnlineMapsMarker
        {
            position = markerPosition,
            texture = markerTexture,
            label = label,
            align = defaultMarkerAlign
        };
        marker.Init();
        ms.Add(marker);
        markers = ms.ToArray();
        needRedraw = allowRedraw = true;
        return marker;
    }
示例#9
0
 /// <summary>
 /// Adds a 2D marker on the map.
 /// </summary>
 /// <param name="marker">
 /// The marker you want to add.
 /// </param>
 /// <returns>
 /// Marker instance.
 /// </returns>
 public OnlineMapsMarker AddMarker(OnlineMapsMarker marker)
 {
     List<OnlineMapsMarker> ms = markers.ToList();
     marker.Init();
     ms.Add(marker);
     markers = ms.ToArray();
     needRedraw = allowRedraw = true;
     return marker;
 }