<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Infinity Code Forum — Change map type]]></title>
		<link>https://forum.infinity-code.com/viewtopic.php?id=1193</link>
		<atom:link href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=1193&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Change map type.]]></description>
		<lastBuildDate>Wed, 22 May 2019 19:55:48 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Change map type]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=5022#p5022</link>
			<description><![CDATA[<p>Hello.</p><p>You can set keys in this way:<br /></p><div class="codebox"><pre><code>using UnityEngine;

public class SwitchToProviderWithKey : MonoBehaviour
{
    private void OnGUI()
    {
        if (GUILayout.Button(&quot;Set DigitalGlobe&quot;))
        {
            string mapTypeID = &quot;digitalglobe.satellite&quot;;

            OnlineMaps.instance.mapType = mapTypeID;

            OnlineMapsProvider.MapType mapType = OnlineMapsProvider.FindMapType(mapTypeID);
            OnlineMapsProvider.ExtraField field = GetExtraField(mapType.extraFields, &quot;accesstoken&quot;);
            if (field == null) field = GetExtraField(mapType.provider.extraFields, &quot;accesstoken&quot;);

            if (field != null) field.value = &quot;My DigitalGlobe Token&quot;;
        }
    }

    private static OnlineMapsProvider.ExtraField GetExtraField(OnlineMapsProvider.IExtraField[] extraFields, string token)
    {
        if (extraFields == null) return null;
        foreach (var field in extraFields)
        {
            if (field is OnlineMapsProvider.ExtraField)
            {
                OnlineMapsProvider.ExtraField f = field as OnlineMapsProvider.ExtraField;
                if (f.token == token) return f;
            }
            else if (field is OnlineMapsProvider.ToggleExtraGroup)
            {
                var res = GetExtraField((field as OnlineMapsProvider.ToggleExtraGroup).fields, token);
                if (res != null) return res;
            }
        }

        return null;
    }
}</code></pre></div><p>Which tokens are needed for providers you can see in OnlineMapsProvider.InitProviders method.</p>]]></description>
			<author><![CDATA[null@example.com (Alex Vertax)]]></author>
			<pubDate>Wed, 22 May 2019 19:55:48 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=5022#p5022</guid>
		</item>
		<item>
			<title><![CDATA[Change map type]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=5019#p5019</link>
			<description><![CDATA[<p>Hi</p><p>I want to offer the possibility to the user to select the provider and type of map he wants.</p><p>I&#039;m using this example : </p><p><a href="http://infinity-code.com/atlas/online-maps/pages/ChangeProviderAndTypeExample.html">http://infinity-code.com/atlas/online-m … ample.html</a></p><p>So far so good, i&#039;m dynamically loading all the providers in a dropdown menu, with a second dropdown just for the type of map.<br />It&#039;s working well with several providers, but not all of them. The reason is, i believe, that some of the providers need an api key and other don&#039;t.</p><p>I looked into the doc:</p><p><a href="http://infinity-code.com/doxygen/online-maps/classOnlineMapsProvider.html">http://infinity-code.com/doxygen/online … vider.html</a> </p><p>but couldn&#039;t find a way to check if a key is needed / to provide the key. Could you point me a way to achieve that ?</p><br /><p>Thanks,<br />Thibault</p>]]></description>
			<author><![CDATA[null@example.com (Thibault)]]></author>
			<pubDate>Wed, 22 May 2019 18:41:53 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=5019#p5019</guid>
		</item>
	</channel>
</rss>
