public GenericProviderCtrl(TileProvider provider, ITileSetDefinition tsd, Action resourceChangeHandler) : this() { Check.ArgumentNotNull(provider, nameof(provider)); Check.ArgumentNotNull(tsd, nameof(tsd)); _tsd = tsd; _provider = provider; _resourceChangeHandler = resourceChangeHandler; }
/// <summary> /// Removes the given base layer group from the Map Definition /// </summary> /// <param name="map">The map</param> /// <param name="group">The group to remove</param> public static void RemoveBaseLayerGroup(this ITileSetDefinition map, IBaseMapGroup group) { Check.ArgumentNotNull(map, nameof(map)); if (null == group) { return; } map.RemoveBaseLayerGroup(group); }
/// <summary> /// Gets the finite scale list of this tile set. Must be using the default tile provider. /// </summary> /// <param name="tileSet">The tile set</param> /// <returns>The array of finite scales</returns> public static double[] GetDefaultFiniteScaleList(this ITileSetDefinition tileSet) { Check.ArgumentNotNull(tileSet, nameof(tileSet)); var p = tileSet.GetParameter("FiniteScaleList"); //NOXLATE if (p != null && !string.IsNullOrEmpty(p.Value)) { return(p.Value.Split(',').Select(x => x.Trim()).Select(x => Convert.ToDouble(x)).OrderBy(s => s).ToArray()); } return(new double[0]); }
/// <summary> /// Constructs a new instance from a Tile Set Definition /// </summary> /// <param name="tsd"></param> /// <param name="groupNames"></param> public DefaultTileWalkOptions(ITileSetDefinition tsd, string[] groupNames = null) { this.ResourceID = tsd.ResourceID; this.TileSet = tsd; this.GroupNames = groupNames?.Length > 0 ? groupNames : tsd.BaseMapLayerGroups.Select(g => g.Name).ToArray(); this.Extents = ObjectFactory.CreateEnvelope(tsd.Extents.MinX, tsd.Extents.MinY, tsd.Extents.MaxX, tsd.Extents.MaxY); this.DPI = 96; this.TileWidth = tsd.GetDefaultTileWidth() ?? 300; this.TileHeight = tsd.GetDefaultTileHeight() ?? 300; }
/// <summary> /// Gets the height of this tile set. Must be using the default tile provider. /// </summary> /// <param name="tileSet">The tile set</param> /// <returns>The height of this tile set</returns> public static int?GetDefaultTileHeight(this ITileSetDefinition tileSet) { Check.ArgumentNotNull(tileSet, nameof(tileSet)); var p = tileSet.GetParameter("TileHeight"); //NOXLATE if (p != null) { return(Convert.ToInt32(p.Value)); } return(null); }
/// <summary> /// Gets the image format of this tile set /// </summary> /// <param name="tileSet">The tile set</param> /// <returns>The image format</returns> public static string GetTileFormat(this ITileSetDefinition tileSet) { Check.ArgumentNotNull(tileSet, nameof(tileSet)); var p = tileSet.GetParameter("TileFormat"); //NOXLATE if (p != null) { return(p.Value); } return(null); }
/// <summary> /// Gets the coordinate system of this tile set. Must be using the default tile provider /// </summary> /// <param name="tileSet">The tile set</param> /// <returns>The coordinate system</returns> public static string GetDefaultCoordinateSystem(this ITileSetDefinition tileSet) { Check.ArgumentNotNull(tileSet, nameof(tileSet)); var p = tileSet.GetParameter("CoordinateSystem"); //NOXLATE if (p != null) { return(p.Value); } return(null); }
/// <summary> /// Sets the coordinate system of this tile set. Must be using the default tile provider. /// </summary> /// <param name="tileSet">The tile set</param> /// <param name="coordinateSystem">The coordinate system</param> public static void SetDefaultCoordinateSystem(this ITileSetDefinition tileSet, string coordinateSystem) { Check.ArgumentNotNull(tileSet, nameof(tileSet)); Check.ArgumentNotEmpty(coordinateSystem, nameof(coordinateSystem)); if (tileSet.TileStoreParameters.TileProvider != "Default") //NOXLATE { throw new InvalidOperationException(string.Format(Strings.ParameterNotApplicableForTileProvider, "CoordinateSystem", tileSet.TileStoreParameters.TileProvider)); } tileSet.TileStoreParameters.SetParameter("CoordinateSystem", coordinateSystem); //NOXLATE }
/// <summary> /// Gets whether the specified base group exists in the tile set /// </summary> /// <param name="tileSet">The tile set</param> /// <param name="groupName">The group name</param> /// <returns>True if the group exists. False otherwise</returns> public static bool GroupExists(this ITileSetDefinition tileSet, string groupName) { Check.ArgumentNotNull(tileSet, nameof(tileSet)); Check.ArgumentNotEmpty(groupName, nameof(groupName)); foreach (var group in tileSet.BaseMapLayerGroups) { if (groupName.Equals(group.Name)) { return(true); } } return(false); }
/// <summary> /// Sets the finite scale list of this tile set. Must be using the default tile provider. /// </summary> /// <param name="tileSet">The tile set</param> /// <param name="scales">The finite sclae list</param> public static void SetDefaultFiniteScaleList(this ITileSetDefinition tileSet, IEnumerable <double> scales) { Check.ArgumentNotNull(tileSet, nameof(tileSet)); Check.ArgumentNotNull(scales, nameof(scales)); if (tileSet.TileStoreParameters.TileProvider != "Default") //NOXLATE { throw new InvalidOperationException(string.Format(Strings.ParameterNotApplicableForTileProvider, "FiniteScaleList", tileSet.TileStoreParameters.TileProvider)); //NOXLATE } string str = string.Join(",", scales.OrderByDescending(x => x).Select(x => x.ToString(CultureInfo.InvariantCulture)).ToArray()); tileSet.TileStoreParameters.SetParameter("FiniteScaleList", str); //NOXLATE }
public void CreateTest() { var res = ObjectFactory.CreateTileSetDefinition(new Version(3, 0, 0)); Assert.IsAssignableFrom <ITileSetDefinition>(res); ITileSetDefinition tsd = (ITileSetDefinition)res; Assert.Equal("Default", tsd.TileStoreParameters.TileProvider); tsd.SetXYZProviderParameters(); Assert.Equal("XYZ", tsd.TileStoreParameters.TileProvider); var p = tsd.GetParameter("TileFormat"); Assert.NotNull(p); Assert.Equal("PNG", p.Value); Assert.Equal("PNG", tsd.GetTileFormat()); p = tsd.GetParameter("TilePath"); Assert.NotNull(p); Assert.Equal("%MG_TILE_CACHE_PATH%", p.Value); Assert.Equal("%MG_TILE_CACHE_PATH%", tsd.GetTilePath()); tsd.SetDefaultProviderParameters(256, 256, "coordsys", new double[] { 100.5, 200.5, 300.5 }); p = tsd.GetParameter("TileWidth"); Assert.NotNull(p); Assert.Equal("256", p.Value); Assert.Equal(256, tsd.GetDefaultTileWidth()); p = tsd.GetParameter("TileHeight"); Assert.NotNull(p); Assert.Equal("256", p.Value); Assert.Equal(256, tsd.GetDefaultTileHeight()); p = tsd.GetParameter("CoordinateSystem"); Assert.NotNull(p); Assert.Equal("coordsys", p.Value); Assert.Equal("coordsys", tsd.GetDefaultCoordinateSystem()); p = tsd.GetParameter("FiniteScaleList"); Assert.NotNull(p); Assert.Equal("300.5,200.5,100.5", p.Value); var value = tsd.GetDefaultFiniteScaleList(); Assert.Equal(3, value.Length); Assert.Contains(100.5, value); Assert.Contains(200.5, value); Assert.Contains(300.5, value); p = tsd.GetParameter("TileFormat"); Assert.NotNull(p); Assert.Equal("PNG", p.Value); Assert.Equal("PNG", tsd.GetTileFormat()); p = tsd.GetParameter("TilePath"); Assert.NotNull(p); Assert.Equal("%MG_TILE_CACHE_PATH%", p.Value); Assert.Equal("%MG_TILE_CACHE_PATH%", tsd.GetTilePath()); }
private static int GetGroupCount(ITileSetDefinition map, string name) { int count = 0; foreach (var grp in map.BaseMapLayerGroups) { if (grp.Name == name) { count++; } } System.Diagnostics.Debug.WriteLine($"{count} groups with the name: {name}"); //NOXLATE return(count); }
/// <summary> /// Sets XYZ provider parameters. Any existing parameters are cleared /// </summary> /// <param name="tileSet">The tile set</param> /// <param name="tileFormat">The image format</param> /// <param name="tilePath">The tile path</param> public static void SetXYZProviderParameters(this ITileSetDefinition tileSet, string tileFormat = "PNG", string tilePath = "%MG_TILE_CACHE_PATH%") { Check.ArgumentNotNull(tileSet, nameof(tileSet)); var param = tileSet.TileStoreParameters; param.TileProvider = "XYZ"; //NOXLATE param.ClearParameters(); param.AddParameter("TileFormat", tileFormat); //NOXLATE param.AddParameter("TilePath", tilePath); //NOXLATE }
private static string GenerateBaseGroupName(ITileSetDefinition tsd) { int counter = 0; string name = Strings.BaseLayerGroup; if (tsd.GroupExists(name)) { counter++; name = Strings.BaseLayerGroup + counter; } while (tsd.GroupExists(name)) { counter++; name = Strings.BaseLayerGroup + counter; } return(name); }
private void CoordinateItem_TextChanged(object sender, EventArgs e) { if (BoundsOverride.Tag as TreeNode == null || m_isUpdating) { return; } TreeNode root = BoundsOverride.Tag as TreeNode; if (!m_coordinateOverrides.ContainsKey(root.Text)) { //IEnvelope newbox = new OSGeo.MapGuide.IEnvelope(); IMapDefinition mdf = root.Tag as IMapDefinition; ITileSetDefinition tdf = root.Tag as ITileSetDefinition; IEnvelope origbox = null; if (mdf != null) { origbox = mdf.Extents; } else if (tdf != null) { origbox = tdf.Extents; } IEnvelope newbox = origbox.Clone(); m_coordinateOverrides.Add(root.Text, newbox); } double d; if (double.TryParse(txtLowerX.Text, System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.CurrentUICulture, out d)) { m_coordinateOverrides[root.Text].MinX = d; } if (double.TryParse(txtLowerY.Text, System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.CurrentUICulture, out d)) { m_coordinateOverrides[root.Text].MinY = d; } if (double.TryParse(txtUpperX.Text, System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.CurrentUICulture, out d)) { m_coordinateOverrides[root.Text].MaxX = d; } if (double.TryParse(txtUpperY.Text, System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.CurrentUICulture, out d)) { m_coordinateOverrides[root.Text].MaxY = d; } }
public GroupPropertiesCtrl(ITileSetDefinition map, IBaseMapGroup group) : this() { _init = true; try { _mdf = map; _el = group; group.PropertyChanged += WeakEventHandler.Wrap <PropertyChangedEventHandler>(OnGroupChanged, (eh) => group.PropertyChanged -= eh); txtName.Text = group.Name; TextBoxBinder.BindText(txtLegendLabel, group, nameof(group.LegendLabel)); } finally { _init = false; } }
public void DeserializationTest() { var res = ObjectFactory.DeserializeXml(Properties.Resources.UT_BaseMap); Assert.IsInstanceOf <ITileSetDefinition>(res); ITileSetDefinition tsd = (ITileSetDefinition)res; Assert.AreEqual("%MG_TILE_CACHE_PATH%", tsd.GetTilePath()); Assert.AreEqual(256, tsd.GetDefaultTileWidth()); Assert.AreEqual(256, tsd.GetDefaultTileHeight()); Assert.AreEqual("PNG", tsd.GetTileFormat()); var values = tsd.GetDefaultFiniteScaleList(); Assert.AreEqual(10, values.Length); Assert.Contains(200000, values); Assert.Contains(100000, values); Assert.Contains(50000, values); Assert.Contains(25000, values); Assert.Contains(12500, values); Assert.Contains(6250, values); Assert.Contains(3125, values); Assert.Contains(1562.5, values); Assert.Contains(781.25, values); Assert.Contains(390.625, values); Assert.False(String.IsNullOrEmpty(tsd.GetDefaultCoordinateSystem())); var ext = tsd.Extents; Assert.AreEqual(-87.79786601383196, ext.MinX); Assert.AreEqual(-87.66452777186925, ext.MaxX); Assert.AreEqual(43.6868578621819, ext.MinY); Assert.AreEqual(43.8037962206133, ext.MaxY); Assert.AreEqual(1, tsd.BaseMapLayerGroups.Count()); var grp = tsd.BaseMapLayerGroups.First(); Assert.AreEqual("BaseLayers", grp.Name); Assert.True(grp.Visible); Assert.True(grp.ShowInLegend); Assert.True(grp.ExpandInLegend); Assert.AreEqual("Base Layers", grp.LegendLabel); Assert.AreEqual(2, grp.BaseMapLayer.Count()); }
/// <summary> /// Constructs a new map to be processed /// </summary> /// <param name="parent">The parent entry</param> /// <param name="map">The resource id for the mapdefinition</param> public MapTilingConfiguration(TilingRunCollection parent, string map) { m_parent = parent; IResource res = parent.Connection.ResourceService.GetResource(map); IMapDefinition mdf = res as IMapDefinition; ITileSetDefinition tsd = res as ITileSetDefinition; if (mdf != null) { m_tileSetResourceID = mdf.ResourceID; m_tileSetExtents = mdf.Extents.Clone(); m_tileset = mdf.BaseMap; } else if (tsd != null && tsd.SupportsCustomFiniteDisplayScales) { m_tileSetResourceID = tsd.ResourceID; m_tileSetExtents = tsd.Extents.Clone(); m_tileset = tsd; } if (m_tileset == null) { throw new InvalidOperationException(OSGeo.MapGuide.MaestroAPI.Strings.UnseedableTileSet); } var baseMap = m_tileset; if (baseMap != null && baseMap.ScaleCount > 0) { m_groups = new string[baseMap.GroupCount]; for (int i = 0; i < baseMap.GroupCount; i++) { m_groups[i] = baseMap.GetGroupAt(i).Name; } m_maxscale = baseMap.GetMaxScale(); CalculateDimensions(); } }
private static string GenerateBaseLayerName(string layerId, ITileSetDefinition tileSet) { Check.ArgumentNotNull(tileSet, nameof(tileSet)); Check.ArgumentNotEmpty(layerId, nameof(layerId)); int counter = 0; string prefix = ResourceIdentifier.GetName(layerId); string name = prefix; if (tileSet.LayerExists(name)) { name = prefix + counter; } while (tileSet.LayerExists(name)) { counter++; name = prefix + counter; } return(name); }
/// <summary> /// Sets default provider parameters. Any existing parameters are cleared /// </summary> /// <param name="tileSet">The tile set</param> /// <param name="tileWidth">Tile width</param> /// <param name="tileHeight">Tile height</param> /// <param name="coordinateSystem">Coordinate system</param> /// <param name="finiteScaleList">The finite scale list</param> /// <param name="tileFormat">Image format</param> /// <param name="tilePath">Tile path</param> public static void SetDefaultProviderParameters(this ITileSetDefinition tileSet, int tileWidth, int tileHeight, string coordinateSystem, double [] finiteScaleList, string tileFormat = "PNG", //NOXLATE string tilePath = "%MG_TILE_CACHE_PATH%") //NOXLATE { Check.ArgumentNotNull(tileSet, nameof(tileSet)); var param = tileSet.TileStoreParameters; param.TileProvider = "Default"; //NOXLATE param.ClearParameters(); param.AddParameter("TileWidth", tileWidth.ToString(CultureInfo.InvariantCulture)); //NOXLATE param.AddParameter("TileHeight", tileHeight.ToString(CultureInfo.InvariantCulture)); //NOXLATE param.AddParameter("TileFormat", tileFormat); //NOXLATE param.AddParameter("CoordinateSystem", coordinateSystem); //NOXLATE string str = string.Join(",", finiteScaleList.OrderByDescending(x => x).Select(x => x.ToString(CultureInfo.InvariantCulture)).ToArray()); //NOXLATE param.AddParameter("FiniteScaleList", str); //NOXLATE param.AddParameter("TilePath", tilePath); //NOXLATE }
/// <summary> /// Sets the image format of this tile set /// </summary> /// <param name="tileSet">The tile set</param> /// <param name="format">The image format</param> public static void SetTileFormat(this ITileSetDefinition tileSet, string format) { Check.ArgumentNotNull(tileSet, nameof(tileSet)); Check.ArgumentNotEmpty(format, nameof(format)); tileSet.TileStoreParameters.SetParameter("TileFormat", format); //NOXLATE }
private void TryCalcMpu(string mapDef) { BusyWaitDialog.Run(Strings.CalculatingMpu, () => { var currentPath = Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath); var mpuCalc = Path.Combine(currentPath, "AddIns/Local/MpuCalc.exe"); //NOXLATE if (!File.Exists(mpuCalc) && mapDef.EndsWith(ResourceTypes.MapDefinition.ToString())) { int[] cmdTypes = m_connection.Capabilities.SupportedCommands; if (Array.IndexOf(cmdTypes, (int)OSGeo.MapGuide.MaestroAPI.Commands.CommandType.CreateRuntimeMap) < 0) { IMapDefinition mdf = (IMapDefinition)m_connection.ResourceService.GetResource(mapDef); var calc = m_connection.GetCalculator(); return(new MpuCalcResult() { Method = MpuMethod.BuiltIn, Result = Convert.ToDecimal(calc.Calculate(mdf.CoordinateSystem, 1.0)) }); } else { ICreateRuntimeMap create = (ICreateRuntimeMap)m_connection.CreateCommand((int)OSGeo.MapGuide.MaestroAPI.Commands.CommandType.CreateRuntimeMap); create.MapDefinition = mapDef; create.RequestedFeatures = (int)RuntimeMapRequestedFeatures.None; var info = create.Execute(); return(new MpuCalcResult() { Method = MpuMethod.CreateRuntimeMap, Result = Convert.ToDecimal(info.CoordinateSystem.MetersPerUnit) }); } } else { IResource res = m_connection.ResourceService.GetResource(mapDef); ITileSetDefinition tsd = res as ITileSetDefinition; IMapDefinition mdf = res as IMapDefinition; string coordSys = null; if (mdf != null) { coordSys = mdf.CoordinateSystem; } else if (tsd != null) { coordSys = tsd.GetDefaultCoordinateSystem(); } string output = string.Empty; if (coordSys != null) { var proc = new Process { StartInfo = new ProcessStartInfo { FileName = mpuCalc, Arguments = coordSys, UseShellExecute = false, RedirectStandardOutput = true, CreateNoWindow = true } }; proc.Start(); StringBuilder sb = new StringBuilder(); while (!proc.StandardOutput.EndOfStream) { string line = proc.StandardOutput.ReadLine(); // do something with line sb.AppendLine(line); } output = sb.ToString(); } double mpu; if (double.TryParse(output, out mpu)) { return new MpuCalcResult() { Method = MpuMethod.MpuCalcExe, Result = Convert.ToDecimal(mpu) } } ; else { return(string.Format(Strings.FailedToCalculateMpu, output)); } } }, (res, ex) => { if (ex != null) { ErrorDialog.Show(ex); } else { var mres = res as MpuCalcResult; if (mres != null) { MetersPerUnit.Value = mres.Result; if (mres.Method == MpuMethod.BuiltIn) { MessageBox.Show(Strings.ImperfectMpuCalculation); } } else { MessageBox.Show(res.ToString()); } } }); }
public SetupRun(IServerConnection connection, string[] maps, IDictionary <string, string> args) : this() { m_connection = connection; m_commandlineargs = args; m_coordinateOverrides = new Dictionary <string, IEnvelope>(); IEnvelope overrideExtents = null; if (m_commandlineargs.ContainsKey(TileRunParameters.MAPDEFINITIONS)) //NOXLATE { m_commandlineargs.Remove(TileRunParameters.MAPDEFINITIONS); //NOXLATE } if (m_commandlineargs.ContainsKey(TileRunParameters.PROVIDER) && m_commandlineargs.ContainsKey(TileRunParameters.CONNECTIONPARAMS)) { txtProvider.Text = m_commandlineargs[TileRunParameters.PROVIDER]; txtConnectionString.Text = m_commandlineargs[TileRunParameters.CONNECTIONPARAMS]; } else { txtProvider.Text = connection.ProviderName; txtConnectionString.Text = Utility.ToConnectionString(connection.CloneParameters); } if (m_commandlineargs.ContainsKey(TileRunParameters.LIMITROWS)) //NOXLATE { int i; if (int.TryParse(m_commandlineargs[TileRunParameters.LIMITROWS], out i) && i > 0) //NOXLATE { MaxRowLimit.Value = i; TilesetLimitPanel.Enabled = true; } } if (m_commandlineargs.ContainsKey(TileRunParameters.LIMITCOLS)) //NOXLATE { int i; if (int.TryParse(m_commandlineargs[TileRunParameters.LIMITCOLS], out i) && i > 0) //NOXLATE { MaxColLimit.Value = i; TilesetLimitPanel.Enabled = true; } } if (m_commandlineargs.ContainsKey(TileRunParameters.EXTENTOVERRIDE)) //NOXLATE { string[] parts = m_commandlineargs[TileRunParameters.EXTENTOVERRIDE].Split(','); if (parts.Length == 4) { double minx; double miny; double maxx; double maxy; if ( double.TryParse(parts[0], System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out minx) && double.TryParse(parts[1], System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out miny) && double.TryParse(parts[2], System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out maxx) && double.TryParse(parts[3], System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out maxy) ) { overrideExtents = ObjectFactory.CreateEnvelope(minx, miny, maxx, maxy); } } } if (m_commandlineargs.ContainsKey(TileRunParameters.METERSPERUNIT)) //NOXLATE { double d; if ( double.TryParse(m_commandlineargs[TileRunParameters.METERSPERUNIT], System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.CurrentUICulture, out d) || //NOXLATE double.TryParse(m_commandlineargs[TileRunParameters.METERSPERUNIT], System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out d) //NOXLATE ) { if (d >= (double)MetersPerUnit.Minimum && d <= (double)MetersPerUnit.Maximum) { MetersPerUnit.Value = (decimal)d; } } } if (maps == null || maps.Length == 0 || (maps.Length == 1 && maps[0].Trim().Length == 0)) { List <string> tmp = new List <string>(); foreach (ResourceListResourceDocument doc in m_connection.ResourceService.GetRepositoryResources(StringConstants.RootIdentifier, ResourceTypes.MapDefinition.ToString()).Items) { tmp.Add(doc.ResourceId); } foreach (ResourceListResourceDocument doc in m_connection.ResourceService.GetRepositoryResources(StringConstants.RootIdentifier, ResourceTypes.TileSetDefinition.ToString()).Items) { tmp.Add(doc.ResourceId); } maps = tmp.ToArray(); } var basegroupsSelected = new List <string>(); if (m_commandlineargs.ContainsKey(TileRunParameters.BASEGROUPS)) //NOXLATE { basegroupsSelected = new List <string>(m_commandlineargs[TileRunParameters.BASEGROUPS].Split(',')); //NOXLATE m_commandlineargs.Remove(TileRunParameters.BASEGROUPS); //NOXLATE } var scalesSelected = new List <int>(); if (m_commandlineargs.ContainsKey(TileRunParameters.SCALEINDEX)) //NOXLATE { foreach (string scaleIndex in m_commandlineargs[TileRunParameters.SCALEINDEX].Split(',')) //NOXLATE { scalesSelected.Add(int.Parse(scaleIndex)); } m_commandlineargs.Remove(TileRunParameters.SCALEINDEX); //NOXLATE } MapTree.Nodes.Clear(); foreach (string m in maps) { ITileSetAbstract tileSet = null; IResource res = m_connection.ResourceService.GetResource(m); IMapDefinition mdef = res as IMapDefinition; ITileSetDefinition tsd = res as ITileSetDefinition; if (mdef != null) { tileSet = mdef.BaseMap; } else if (tsd != null && tsd.SupportsCustomFiniteDisplayScales) { tileSet = tsd; } if (tileSet == null) { continue; } bool bValidTileSet = (tileSet != null && tileSet.ScaleCount > 0 && tileSet.HasGroups()); if (bValidTileSet) { TreeNode mn = MapTree.Nodes.Add(m); mn.ImageIndex = mn.SelectedImageIndex = 0; mn.Tag = (object)mdef ?? (object)tsd; foreach (var g in tileSet.BaseMapLayerGroups) { TreeNode gn = mn.Nodes.Add(g.Name); gn.Tag = g; if (basegroupsSelected.Contains(g.Name)) { mn.Checked = true; gn.Checked = true; if (overrideExtents != null && !m_coordinateOverrides.ContainsKey(m)) { m_coordinateOverrides.Add(m, overrideExtents); } } gn.ImageIndex = gn.SelectedImageIndex = 1; int counter = 0; foreach (double d in tileSet.FiniteDisplayScale) { TreeNode sn = gn.Nodes.Add(d.ToString(System.Globalization.CultureInfo.CurrentUICulture)); if (gn.Checked && scalesSelected.Contains(counter)) { sn.Checked = true; } sn.ImageIndex = sn.SelectedImageIndex = 3; counter++; } } mn.Expand(); } } MapTree_AfterSelect(null, null); }
/// <summary> /// Sets the path of this tile set /// </summary> /// <param name="tileSet">The tile set</param> /// <param name="path">The tile path</param> public static void SetTilePath(this ITileSetDefinition tileSet, string path) { Check.ArgumentNotNull(tileSet, nameof(tileSet)); Check.ArgumentNotEmpty(path, nameof(path)); tileSet.TileStoreParameters.SetParameter("TilePath", path); //NOXLATE }
/// <summary> /// Gets the tile set parameter of the specified name /// </summary> /// <param name="tileSet">The tile set</param> /// <param name="name">The name</param> /// <returns>The parameter</returns> public static INameStringPair GetParameter(this ITileSetDefinition tileSet, string name) { Check.ArgumentNotNull(tileSet, nameof(tileSet)); return(tileSet.TileStoreParameters.Parameters.FirstOrDefault(p => p.Name == name)); }