Пример #1
0
 private OnlineMapsJSONItem SaveSettings()
 {
     return(OnlineMapsJSON.Serialize(new
     {
         speed
     }));
 }
Пример #2
0
        private void OnSuggestComplete(string response)
        {
            Debug.Log(response);

            // Converts the response string from AutoSuggest or StandardBlend to result object.
            OnlineMapsWhat3WordsSBResult result = OnlineMapsWhat3Words.GetSuggestionsBlendsResult(response);

            Debug.Log(OnlineMapsJSON.Serialize(result).ToString());
        }
Пример #3
0
        private void OnGridComplete(string response)
        {
            Debug.Log(response);

            // Converts the response string from Grid to result object.
            OnlineMapsWhat3WordsGridResult result = OnlineMapsWhat3Words.GetGridResult(response);

            Debug.Log(OnlineMapsJSON.Serialize(result).ToString());
        }
 protected virtual OnlineMapsJSONItem SaveSettings()
 {
     return(OnlineMapsJSON.Serialize(new
     {
         allowZoom,
         allowUserControl,
         zoomInOnDoubleClick,
         smoothZoom
     }));
 }
Пример #5
0
        private void OnReverseComplete(string response)
        {
            Debug.Log(response);

            // Converts the response string from Forward or Reverse geocoding to result object.
            OnlineMapsWhat3WordsFRResult result = OnlineMapsWhat3Words.GetForwardReverseResult(response);

            words = result.words;

            Debug.Log(OnlineMapsJSON.Serialize(result).ToString());
        }
Пример #6
0
        private void OnForwardComplete(string response)
        {
            Debug.Log(response);

            // Converts the response string from Forward or Reverse geocoding to result object.
            OnlineMapsWhat3WordsFRResult result = OnlineMapsWhat3Words.GetForwardReverseResult(response);

            OnlineMaps.instance.position = result.geometry;

            Debug.Log(OnlineMapsJSON.Serialize(result).ToString());
        }
Пример #7
0
    private void OnReverseGeocodeComplete(OnlineMapsWWW www)
    {
        if (www.hasError)
        {
            Debug.Log(www.error);
            return;
        }

        OnlineMapsJSONItem json = OnlineMapsJSON.Parse(www.text);

        Debug.Log(json["address/LongLabel"].V <string>());
    }
 public void Add(string name, object value)
 {
     if (value is string || value is bool || value is int || value is long || value is short || value is float || value is double)
     {
         _table[name] = new OnlineMapsJSONValue(value);
     }
     else if (value is UnityEngine.Object)
     {
         _table[name] = new OnlineMapsJSONValue((value as UnityEngine.Object).GetInstanceID());
     }
     else
     {
         _table[name] = OnlineMapsJSON.Serialize(value);
     }
 }
Пример #9
0
    private static void PlaymodeStateChanged(PlayModeStateChange playModeStateChange)
#endif
    {
        if (!EditorApplication.isPlaying && !EditorApplication.isPlayingOrWillChangePlaymode)
        {
            if (Exists())
            {
#pragma warning disable 618
                OnlineMaps map = ((OnlineMaps[])Object.FindSceneObjectsOfType(typeof(OnlineMaps))).FirstOrDefault();
#pragma warning restore 618
                if (map != null)
                {
                    try
                    {
                        IOnlineMapsSavableComponent[] savableComponents = map.GetComponents <IOnlineMapsSavableComponent>();
                        OnlineMapsSavableItem[]       savableItems      = savableComponents.SelectMany(c => c.GetSavableItems()).ToArray();
                        if (savableItems.Length != 0)
                        {
                            string prefs = EditorPrefs.GetString(prefsKey);
                            OnlineMapsJSONObject json = OnlineMapsJSON.Parse(prefs) as OnlineMapsJSONObject;
                            foreach (KeyValuePair <string, OnlineMapsJSONItem> pair in json.table)
                            {
                                OnlineMapsSavableItem savableItem = savableItems.FirstOrDefault(s => s.name == pair.Key);
                                if (savableItem != null && savableItem.loadCallback != null)
                                {
                                    savableItem.loadCallback(pair.Value as OnlineMapsJSONObject);
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Debug.LogException(ex);
                        // ignored
                    }

                    EditorPrefs.DeleteKey(prefsKey);
                    EditorUtility.SetDirty(map);
                }
            }

            if (EditorPrefs.HasKey("OnlineMapsRefreshAssets"))
            {
                EditorPrefs.DeleteKey("OnlineMapsRefreshAssets");
                AssetDatabase.Refresh();
            }
        }
    }
Пример #10
0
    private OnlineMapsJSONItem SaveSettings()
    {
        return OnlineMapsJSON.Serialize(new
        {
            useMemoryCache,
            maxMemoryCacheSize,
            memoryCacheUnloadRate,

            useFileCache,
            maxFileCacheSize,
            fileCacheUnloadRate,
            fileCacheLocation,
            fileCacheCustomPath,
            fileCacheTilePath
        });
    }
Пример #11
0
 public virtual OnlineMapsJSONItem ToJSON()
 {
     return(OnlineMapsJSON.Serialize(new
     {
         longitude,
         latitude,
         range = new
         {
             range.min,
             range.max
         },
         label,
         scale,
         enabled
     }));
 }
Пример #12
0
    protected virtual OnlineMapsJSONItem SaveSettings()
    {
        OnlineMapsJSONObject json = OnlineMapsJSON.Serialize(new
        {
            autoStopUpdateOnInput,
            updatePosition,
            restoreAfter,
            createMarkerInUserPosition,
            useGPSEmulator
        }) as OnlineMapsJSONObject;

        if (createMarkerInUserPosition)
        {
            json.AppendObject(new
            {
                markerType,
                markerScale,
                markerTooltip,
                useCompassForMarker
            });

            if (markerType == OnlineMapsLocationServiceMarkerType.twoD)
            {
                json.AppendObject(new
                {
                    marker2DAlign,
                    marker2DTexture
                });
            }
            else
            {
                json.Add("marker3DPrefab", marker3DPrefab.GetInstanceID());
                json.Add("marker3DSizeType", marker3DSizeType);
            }
        }

        if (useGPSEmulator)
        {
            json.AppendObject(new
            {
                emulatorPosition,
                emulatorCompass
            });
        }

        return(json);
    }
 /// <summary>
 /// Converts the response string to response object.
 /// </summary>
 /// <param name="response">Response string</param>
 /// <param name="outputType">Format of response string (JSON or XML)</param>
 /// <returns>Response object</returns>
 public static OnlineMapsBingMapsElevationResult GetResult(string response, Output outputType)
 {
     try
     {
         if (outputType == Output.json)
         {
             return(OnlineMapsJSON.Deserialize <OnlineMapsBingMapsElevationResult>(response));
         }
         OnlineMapsXML xml = OnlineMapsXML.Load(response);
         if (!xml.isNull)
         {
             OnlineMapsBingMapsElevationResult result = new OnlineMapsBingMapsElevationResult(xml);
             return(result);
         }
     }
     catch {}
     return(null);
 }
Пример #14
0
    private OnlineMapsJSONItem SaveSettings()
    {
        OnlineMapsJSONItem json = OnlineMapsJSON.Serialize(new
        {
            zoomRange,
            levelsRange,
            levelHeight,
            minHeight,
            heightScale,
            maxBuilding,
            maxActiveBuildings,
            generateColliders,
            useColorTag,
            materials
        });

        return(json);
    }
Пример #15
0
    private OnlineMapsJSONItem SaveSettings()
    {
        OnlineMapsJSONObject json = OnlineMapsJSON.Serialize(new {
            longitude,
            latitude,
            zoom = floatZoom,
            source,
            mapType,
            labels,
            traffic,
            redrawOnPlay,
            emptyColor,
            defaultTileTexture,
            tooltipBackgroundTexture,
            showMarkerTooltip,
            useSoftwareJPEGDecoder,
            useCurrentZoomTiles
        }) as OnlineMapsJSONObject;

        if (activeType.isCustom)
        {
            json.Add("customProviderURL", customProviderURL);
        }

        if (control.resultIsTexture)
        {
            defaultColors = texture.GetPixels();
            json.Add("texture", texture);
        }
        else
        {
            json.AppendObject(new
            {
                width,
                height
            });
        }

        return(json);
    }
Пример #16
0
    private void OnGeocodeComplete(OnlineMapsWWW www)
    {
        if (www.hasError)
        {
            Debug.Log(www.error);
            return;
        }

        OnlineMapsJSONItem json      = OnlineMapsJSON.Parse(www.text);
        OnlineMapsJSONItem firstItem = json["candidates/0"];

        if (firstItem == null)
        {
            return;
        }

        OnlineMapsVector2d center = firstItem["location"].Deserialize <OnlineMapsVector2d>();

        OnlineMapsJSONItem extent = firstItem["extent"];
        double             xmin   = extent.V <double>("xmin"),
                           ymin = extent.V <double>("ymin"),
                           xmax = extent.V <double>("xmax"),
                           ymax = extent.V <double>("ymax");

        Vector2[] points =
        {
            new Vector2((float)xmin, (float)ymin),
            new Vector2((float)xmax, (float)ymax),
        };

        Vector2 c;
        int     zoom;

        OnlineMapsUtils.GetCenterPointAndZoom(points, out c, out zoom);

        OnlineMaps.instance.SetPositionAndZoom(center.x, center.y, zoom);
    }
Пример #17
0
 /// <summary>
 /// Converts the response string to response object.
 /// </summary>
 /// <param name="response">Response string</param>
 /// <returns>Response Object</returns>
 public static OnlineMapsQQSearchResult GetResult(string response)
 {
     return(OnlineMapsJSON.Deserialize <OnlineMapsQQSearchResult>(response));
 }
 /// <summary>
 /// Parse a string that contains JSON dictonary
 /// </summary>
 /// <param name="json">String that contains JSON dictonary</param>
 /// <returns>Instance</returns>
 public static OnlineMapsJSONObject ParseObject(string json)
 {
     return(OnlineMapsJSON.Parse(json) as OnlineMapsJSONObject);
 }
 /// <summary>
 /// Converts the response string from Get Languages to result object.
 /// </summary>
 /// <param name="response">Response string</param>
 /// <returns>Result object</returns>
 public static OnlineMapsWhat3WordsLanguagesResult GetLanguagesResult(string response)
 {
     return(OnlineMapsJSON.Deserialize <OnlineMapsWhat3WordsLanguagesResult>(response));
 }
 /// <summary>
 /// Converts the response string from AutoSuggest or StandardBlend to result object.
 /// </summary>
 /// <param name="response">Response string</param>
 /// <returns>Result object</returns>
 public static OnlineMapsWhat3WordsSBResult GetSuggestionsBlendsResult(string response)
 {
     return(OnlineMapsJSON.Deserialize <OnlineMapsWhat3WordsSBResult>(response));
 }
 /// <summary>
 /// Converts the response string from Forward or Reverse geocoding to result object.
 /// </summary>
 /// <param name="response">Response string.</param>
 /// <returns>Result object</returns>
 public static OnlineMapsWhat3WordsFRResult GetForwardReverseResult(string response)
 {
     return(OnlineMapsJSON.Deserialize <OnlineMapsWhat3WordsFRResult>(response));
 }
Пример #22
0
 /// <summary>
 /// Serialize an object into JSON object
 /// </summary>
 /// <param name="data">The object to be serialized</param>
 /// <returns>JSON object</returns>
 private OnlineMapsJSONItem Serialize(Data data)
 {
     return(OnlineMapsJSON.Serialize(data));
 }
Пример #23
0
 /// <summary>
 /// Parsing JSON string
 /// </summary>
 /// <param name="jsonString">JSON string</param>
 /// <returns>JSON object</returns>
 private OnlineMapsJSONItem Parse(string jsonString)
 {
     return(OnlineMapsJSON.Parse(jsonString));
 }
Пример #24
0
        /// <summary>
        /// Full deserialization of JSON string into an object
        /// </summary>
        /// <param name="jsonString">JSON string</param>
        private void FullDeserializationOfString(string jsonString)
        {
            Data data = OnlineMapsJSON.Deserialize <Data>(jsonString);

            Debug.Log(data.items.Length);
        }
Пример #25
0
 /// <summary>
 /// Converts the response string from Open Route Service Geocoding to result object.
 /// </summary>
 /// <param name="response">Response string</param>
 /// <returns>Result object</returns>
 public static OnlineMapsOpenRouteServiceGeocodingResult GetGeocodingResults(string response)
 {
     return(OnlineMapsJSON.Deserialize <OnlineMapsOpenRouteServiceGeocodingResult>(response));
 }
Пример #26
0
    /// <summary>
    /// Parse JSON string into OnlineMapsJSONItem
    /// </summary>
    /// <param name="json">JSON string</param>
    /// <returns>Root object</returns>
    public static OnlineMapsJSONItem Parse(string json)
    {
        OnlineMapsJSON instance = new OnlineMapsJSON(json);

        return(instance.ParseValue());
    }
Пример #27
0
 private OnlineMapsJSONItem SaveSettings()
 {
     return(OnlineMapsJSON.Serialize(this));
 }
Пример #28
0
 /// <summary>
 /// Parse a string that contains an array
 /// </summary>
 /// <param name="json">JSON string</param>
 /// <returns>Instance</returns>
 public static OnlineMapsJSONArray ParseArray(string json)
 {
     return(OnlineMapsJSON.Parse(json) as OnlineMapsJSONArray);
 }
Пример #29
0
    /// <summary>
    /// Parse JSON string into Dictonary, List and Object
    /// </summary>
    /// <param name="json">JSON string</param>
    /// <returns>Root object</returns>
    public static object ParseDirect(string json)
    {
        OnlineMapsJSON instance = new OnlineMapsJSON(json);

        return(instance.ParseValueDirect());
    }
 public override OnlineMapsJSONItem AppendObject(object obj)
 {
     Combine(OnlineMapsJSON.Serialize(obj));
     return(this);
 }