private void InitMapLayers() { Map.SetMapLocation(new System.Windows.Point(8.4044, 49.01405), 14); Map.Layers.Clear(); var meta = new XMapMetaInfo("https://api-test.cloud.ptvgroup.com/xmap/ws/XMap"); meta.SetCredentials("xtok", token); XMapLayerFactory.InsertXMapBaseLayers(Map.Layers, meta); Map.XMapStyle = "gravelpit"; xynLayer = new XynLayer(meta, "xyn", "XYN Segments") { UntiledProvider = new XMapTiledProvider(meta.Url, XMapMode.Custom) { User = meta.User, Password = meta.Password, } }; Map.Layers.Add(xynLayer); Map.MouseDown += Map_MouseDown; }
/// <summary> /// Setting all relevant information for a PTV xServer, consisting of an URL and, in case of an on-premise xServer installation, /// an customer-provided xToken. The internally available user-password-pair is not used due to its visibility during sending /// requests to the xServer. /// </summary> /// <param name="url">URL of the xServer installation.</param> /// <param name="xToken">Value provided to the customer, which grants access only to the xServer API, and no further /// rights in the context of the internal user management.</param> /// <returns>False if the settings denied access due to a wrong URL address or authentication data, otherwise true.</returns> public static bool Set(string url, string xToken) { try { #region doc:CheckConnection var newXMapMetaInfo = new XMapMetaInfo(url); newXMapMetaInfo.SetCredentials("xtok", xToken); newXMapMetaInfo.CheckCredentials("xtok", xToken); // causes an exception if something goes wrong #endregion XMapMetaInfo = newXMapMetaInfo; IsOk = true; ErrorMessage = string.Empty; // Save settings for the next session Properties.Settings.Default.XUrl = url; Properties.Settings.Default.XToken = xToken; Properties.Settings.Default.Save(); } catch (Exception exception) { IsOk = false; ErrorMessage = exception.Message; } return(IsOk); }
/// <summary> /// Get the meta info from xServer /// </summary> /// <returns></returns> private XMapMetaInfo GetMetaInfo() { // the tools class XMapMetaInfo contains the information required to intialize the xServer layers // When instantiated with the url, it tries to read the attribution text and the maximum request size from the xMap configuration // var meta = new XMapMetaInfo("http://127.0.0.1:50010/xmap/ws/XMap"); // custom xmap with reverse proxy var meta = new XMapMetaInfo("https://xmap-eu-n-test.cloud.ptvgroup.com/xmap/ws/XMap"); // xServer internet meta.SetCredentials("xtok", "561677741926322"); // set the basic authentication properties, e.g. xtok/token for xserver internet return meta; }
private void InitMapLayers() { const string cluster = "eu-n-test"; Map.SetMapLocation(new Point(9.182778, 48.775556), 12); var xmapMetaInfo = new XMapMetaInfo("https://xmap-" + cluster + ".cloud.ptvgroup.com/xmap/ws/XMap"); xmapMetaInfo.SetCredentials("xtok", "Insert your xToken here"); InsertXMapBaseLayers(Map.Layers, xmapMetaInfo, "gravelpit"); Map.InsertTrafficInfoLayer(xmapMetaInfo, "Traffic", "traffic.ptv-traffic", "Traffic information"); Map.InsertRoadEditorLayer(xmapMetaInfo, "TruckAttributes", "truckattributes", "truckattributes", "Truck attributes"); Map.InsertPoiLayer(xmapMetaInfo, "Poi", "default.points-of-interest", "Points of interest"); }
public void Initialize(Map map) { map.Layers.RemoveXMapBaseLayers(); string adjustedUrl = AdjustedUrl(); if (string.IsNullOrEmpty(adjustedUrl)) { return; } var xmapMetaInfo = new XMapMetaInfo(adjustedUrl); if (XMapCredentials?.Contains(":") ?? false) { var userPassword = XMapCredentials.Split(':'); xmapMetaInfo.SetCredentials(userPassword[0], userPassword[1]); } map.Layers.InsertXMapBaseLayers(xmapMetaInfo); }
private void InitMapLayers() { string cluster = GetCluster(); switch (cluster) { case "eu-n-test": Map.SetMapLocation(new System.Windows.Point(9.182778, 48.775556), 12); break; case "au-n-test": Map.SetMapLocation(new System.Windows.Point(138.6, -34.92), 12); break; case "na-n-test": Map.SetMapLocation(new System.Windows.Point(-71.415, 41.830833), 12); break; } Map.Layers.Clear(); var xmapMetaInfo = new XMapMetaInfo("https://xmap-" + cluster + ".cloud.ptvgroup.com/xmap/ws/XMap"); xmapMetaInfo.SetCredentials("xtok", "561677741926322"); InsertXMapBaseLayers(Map.Layers, xmapMetaInfo, GetProfile()); UpdateFeatureLayers(); Map.InsertTrafficInfoLayer(xmapMetaInfo, "Traffic", "traffic.ptv-traffic", "Traffic information"); Map.InsertRoadEditorLayer(xmapMetaInfo, "TruckAttributes", "truckattributes", "truckattributes", "Truck attributes"); Map.InsertPoiLayer(xmapMetaInfo, "Poi", "default.points-of-interest", "Points of interest"); if (cluster == "eu-n-test") Map.InsertDataManagerLayer(xmapMetaInfo, "POS", "t_f07ef3f0_ce7a_4913_90ea_b072ec07e6ff", "Points Of Sales", 10, true); }