public void SetMarkers(Marker[] markers) { onlineMap.RemoveAllMarkers(); if (markers != null) { for (int i = 0; i < markers.Length; i++) { OnlineMapsMarker mark = new OnlineMapsMarker(); mark.position = markers[i].geoPos; //mark.label = markers[i].label; mark.OnClick = OnClickMark; mark.customData = markers[i]; mark.texture = markTexture; onlineMap.AddMarker(mark); } } if (GeoLocation.posicaoEncontrada) { OnlineMapsMarker me = new OnlineMapsMarker(); me.position = GeoLocation.position; me.texture = myPositionTexture; onlineMap.AddMarker(me); onlineMap.Redraw(); } }
private void SetSearchMarker(Vector2 position, string label) { if (_searchMarker == null) { Debug.Log("add search marker"); _searchMarker = _api.AddMarker(position, label); } else { _searchMarker.position = position; _searchMarker.label = label; } }
// Update is called once per frame void Update() { MapGPS.zoom = (int)mapSlider.value; if (ExploreFinish) { ExploreFinish = false; MapGPS.AddMarker(new Vector2((float)firstLong, (float)firstLat), startMarker, "Start of Exploration"); LastLat = GPS.instance.latitude; LastLong = GPS.instance.longitude; MapGPS.AddMarker(new Vector2((float)LastLong, (float)LastLat), endMarker, "End of Exploration"); } }
public void OncenterClick(int id) { // PanelPopUp.intance.OnInitInforPopUp("No service"); Vector2 position = Datacenter.instance.listCenter[id].pos; if (position != Vector2.zero) { if (_searchMarker == null) { _searchMarker = _api.AddMarker(position); } else { _searchMarker.position = position; _searchMarker.label = "center Localtion"; } _api.zoom = 15; _api.position = position; _api.Redraw(); ChooseCenter = id; } //else //{ // PanelPopUp.intance.OnInitInforPopUp("Opps","No services!"); //} }
private void OnFindLocationComplete(string result) { Vector2 position = OnlineMapsGoogleGeocoding.GetCoordinatesFromResult(result); if (position == Vector2.zero) { return; } if (searchMarker == null) { searchMarker = api.AddMarker(position, search); } else { searchMarker.position = position; searchMarker.label = search; } if (api.zoom < 13) { api.zoom = 13; } api.position = position; api.Redraw(); }
private void Start() { rwt = GetComponent <RealWorldTerrainContainer>(); if (rwt == null) { Debug.LogError("Real World Terrain Connector should be together c Real World Terrain Container."); OnlineMapsUtils.Destroy(this); return; } if (positionMode == PositionMode.transform && targetTransform == null) { Debug.LogError("Target Transform is not specified."); OnlineMapsUtils.Destroy(this); return; } map = OnlineMaps.instance; if (mode == Mode.centerOnPosition) { map.position = currentPosition; } else if (mode == Mode.markerOnPosition) { marker = map.AddMarker(currentPosition, markerTexture, markerLabel); } }
private void Start() { OnlineMaps api = OnlineMaps.instance; // Create a new markers. OnlineMapsMarker marker1 = api.AddMarker(new Vector2(0, 0), null, "Marker 1"); OnlineMapsMarker marker2 = api.AddMarker(new Vector2(10, 0), null, "Marker 2"); // Store data about labels. marker1.customData = new ShowMarkerLabelsByZoomItem(marker1.label, new OnlineMapsRange(3, 10)); marker2.customData = new ShowMarkerLabelsByZoomItem(marker2.label, new OnlineMapsRange(8, 15)); // Sunscribe to ChangeZoom event. api.OnChangeZoom += OnChangeZoom; OnChangeZoom(); }
public void OncenterClick(int id) { Vector2 position = Datacenter.instance.listCenter[id].pos; if (position != Vector2.zero) { if (_searchMarker == null) { _searchMarker = _api.AddMarker(position); } else { _searchMarker.position = position; _searchMarker.label = "center Localtion"; } if (_api.zoom < 10) { _api.zoom = 10; } _api.position = position; _api.Redraw(); ChooseCenter = id; } else { Debug.Log("Please Open services"); } }
public void OncenterClick(int id) { Vector2 position = Datacenter.instance.listCenter[id].pos; if (position != Vector2.zero) { if (_searchMarker == null) { _searchMarker = _api.AddMarker(position); } else { _searchMarker.position = position; _searchMarker.label = "center Localtion"; } if (_api.zoom < 13) { _api.zoom = 13; } _api.position = position; _api.Redraw(); } }
private void Start() { OnlineMaps api = OnlineMaps.instance; marker = api.AddMarker(api.position); fromPosition = api.topLeftPosition; toPosition = api.bottomRightPosition; }
private void Start() { OnlineMaps map = OnlineMaps.instance; marker = map.AddMarker(map.position); fromPosition = map.topLeftPosition; toPosition = map.bottomRightPosition; }
private void Start() { OnlineMaps api = OnlineMaps.instance; mapMarkerMiddle = api.AddMarker(new Vector2(0, 0)); mapMarkerTop = api.AddMarker(new Vector2(0, 0.01f)); mapMarkerBottom = api.AddMarker(new Vector2(0, -0.01f)); OnlineMapsTileSetControl.instance.markerComparer = new MarkerComparer(); Vector2 center; int zoom; OnlineMapsUtils.GetCenterPointAndZoom(api.markers, out center, out zoom); api.position = center; api.zoom = zoom; }
private void Start() { OnlineMaps api = OnlineMaps.instance; OnlineMapsMarker marker = api.AddMarker(new Vector2(), "Marker"); marker.OnRollOver += OnRollOver; marker.OnRollOut += OnRollOut; api.position = new Vector2(); }
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); }
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 Start() { OnlineMaps api = OnlineMaps.instance; // Create markers. api.AddMarker(new Vector2(0, 0)); api.AddMarker(new Vector2(0, 0.01f)); api.AddMarker(new Vector2(0, -0.01f)); // Sets a new comparer. OnlineMapsTileSetControl.instance.markerComparer = new MarkerComparer(); // Get the center point and zoom the best for all markers. Vector2 center; int zoom; OnlineMapsUtils.GetCenterPointAndZoom(api.markers, out center, out zoom); // Change the position and zoom of the map. api.position = center; api.zoom = zoom; }
private void Start() { OnlineMaps map = OnlineMaps.instance; // Create a new marker OnlineMapsMarker marker = map.AddMarker(new Vector2(), "Marker"); // Subscribe to marker events marker.OnRollOver += OnRollOver; marker.OnRollOut += OnRollOut; // Reset map position map.position = new Vector2(); }
private void DrawMarkersGUI(ref bool dirty) { int removedIndex = -1; EditorGUI.BeginChangeCheck(); for (int i = 0; i < pMarkers.arraySize; i++) { EditorGUILayout.BeginVertical(GUI.skin.box); OnlineMapsMarkerPropertyDrawer.isRemoved = false; EditorGUILayout.PropertyField(pMarkers.GetArrayElementAtIndex(i), new GUIContent("Marker " + (i + 1))); if (OnlineMapsMarkerPropertyDrawer.isRemoved) { removedIndex = i; } EditorGUILayout.EndHorizontal(); } if (EditorGUI.EndChangeCheck()) { dirty = true; } if (removedIndex != -1) { ArrayUtility.RemoveAt(ref api.markers, removedIndex); dirty = true; } EditorGUILayout.Space(); if (GUILayout.Button("Add Marker")) { if (!Application.isPlaying) { OnlineMapsMarker marker = new OnlineMapsMarker { position = api.position, align = (OnlineMapsAlign)pDefaultMarkerAlign.enumValueIndex }; ArrayUtility.Add(ref api.markers, marker); } else { OnlineMapsMarker marker = api.AddMarker(api.position); marker.align = (OnlineMapsAlign)pDefaultMarkerAlign.enumValueIndex; } dirty = true; } }
private void Start() { OnlineMaps api = OnlineMaps.instance; // Add OnClick events to static markers foreach (OnlineMapsMarker marker in api.markers) { marker.OnClick += OnMarkerClick; } // Add OnClick events to dynamic markers OnlineMapsMarker dynamicMarker = api.AddMarker(Vector2.zero, null, "Dynamic marker"); dynamicMarker.OnClick += OnMarkerClick; }
private void DrawMarkersGUI() { if (api.markers == null) { api.markers = new OnlineMapsMarker[0]; } int index = 1; bool hasDeleted = false; for (int i = 0; i < api.markers.Length; i++) { DrawMarkerGUI(i, ref index, ref hasDeleted); } if (hasDeleted) { List <OnlineMapsMarker> markers = api.markers.ToList(); markers.RemoveAll(m => m == null); api.markers = markers.ToArray(); if (Application.isPlaying) { api.Redraw(); } } EditorGUILayout.Space(); if (GUILayout.Button("Add marker")) { if (!Application.isPlaying) { OnlineMapsMarker marker = new OnlineMapsMarker { position = api.position, align = api.defaultMarkerAlign }; List <OnlineMapsMarker> markers = new List <OnlineMapsMarker>(api.markers) { marker }; api.markers = markers.ToArray(); } else { OnlineMapsMarker marker = api.AddMarker(api.position); marker.align = api.defaultMarkerAlign; } } }
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)); } } }
private void OnMouseUp() { if (Input.GetKey(KeyCode.LeftShift)) { // Get the geographical coordinates of the cursor. Vector2 cursorCoords = map.control.GetCoords(); // Create a new marker at the specified coordinates. OnlineMapsMarker marker = map.AddMarker(cursorCoords, markerTexture, "Marker " + (map.markers.Length + 1)); // Save marker and coordinates. markerPositions.Add(cursorCoords); markers.Add(marker); // Mark that markers changed. changed = true; } }
/// <summary> /// Creates a marker at the location of the cursor. /// </summary> protected void CreateMarker() { map.AddMarker(GetCoords()); }
private void Start() { rwt = GetComponent<RealWorldTerrainContainer>(); if (rwt == null) { Debug.LogError("Real World Terrain Connector should be together c Real World Terrain Container."); DestroyImmediate(this); return; } if (positionMode == OnlineMapsRWTConnectorPositionMode.transform && targetTransform == null) { Debug.LogError("Target Transform is not specified."); DestroyImmediate(this); return; } api = OnlineMaps.instance; if (mode == OnlineMapsRWTConnectorMode.centerOnPosition) { api.position = currentPosition; } else if (mode == OnlineMapsRWTConnectorMode.markerOnPosition) { marker = api.AddMarker(currentPosition, markerTexture, markerLabel); } }