private void btnRestoreDefaults_Click(object sender, EventArgs e) { // get the selected item if (cboLayerNames.SelectedIndex == -1) { return; } LayerCacheInfo layerInfo = (LayerCacheInfo)cboLayerNames.SelectedItem; if (m_layerCacheInfos.ContainsKey(layerInfo.folderName)) { layerInfo = m_layerCacheInfos[layerInfo.folderName]; // populate the form lblCacheFolderName.Text = layerInfo.folderName; lblCacheFolderPath.Text = layerInfo.folderPath; if (layerInfo.format.ToUpper().IndexOf("PNG") > -1) { rdoPNG.Checked = true; } else { rdoJPEG.Checked = true; } chkAlwaysDrawCoarsestLevel.Checked = layerInfo.alwaysDrawCoarsestLevel; chkStrictOnDemandMode.Checked = layerInfo.strictOnDemand; numDetaildThreshold.Value = Convert.ToDecimal(layerInfo.detailsThreshold); numProgressiveDrawingLevels.Value = layerInfo.progressiveDrawingLevels; numProgressiveFetchingLevels.Value = layerInfo.progressiveFetchingLevels; numMaxCacheScale.Value = Convert.ToDecimal(layerInfo.maxCacheScale); } }
private void cboLayerNames_SelectedIndexChanged(object sender, EventArgs e) { // get the layers from the map if (m_hookHelper.FocusMap.LayerCount == 0) { return; } IMap map = m_hookHelper.FocusMap; IDynamicCacheLayerManager dynamicCacheLayerManager = new DynamicCacheLayerManagerClass(); // get all of the non-dynamic layers ILayer layer; for (int i = 0; i < map.LayerCount; i++) { layer = map.get_Layer(i); if (layer is IDynamicLayer) { continue; } dynamicCacheLayerManager.Init(map, layer); LayerCacheInfo layerInfo = (LayerCacheInfo)cboLayerNames.SelectedItem; if (dynamicCacheLayerManager.FolderName == layerInfo.folderName) { // populate the form lblCacheFolderName.Text = dynamicCacheLayerManager.FolderName; lblCacheFolderPath.Text = dynamicCacheLayerManager.FolderPath; if (dynamicCacheLayerManager.Format.ToUpper().IndexOf("PNG") > -1) { rdoPNG.Checked = true; } else { rdoJPEG.Checked = true; } chkAlwaysDrawCoarsestLevel.Checked = dynamicCacheLayerManager.AlwaysDrawCoarsestLevel; numDetaildThreshold.Value = Convert.ToDecimal(dynamicCacheLayerManager.DetailsThreshold); chkStrictOnDemandMode.Checked = dynamicCacheLayerManager.StrictOnDemandMode; numProgressiveDrawingLevels.Value = dynamicCacheLayerManager.ProgressiveDrawingLevels; numProgressiveFetchingLevels.Value = dynamicCacheLayerManager.ProgressiveFetchingLevels; numMaxCacheScale.Value = Convert.ToDecimal(dynamicCacheLayerManager.MaxCacheScale); return; } } }
private void UpdateLayer() { // get the selected layer from the map if (m_hookHelper.FocusMap.LayerCount == 0) { return; } if (cboLayerNames.SelectedIndex == -1) { return; } IMap map = m_hookHelper.FocusMap; IDynamicCacheLayerManager dynamicCacheLayerManager = new DynamicCacheLayerManagerClass(); // get all of the non-dynamic layers ILayer layer; for (int i = 0; i < map.LayerCount; i++) { layer = map.get_Layer(i); if (layer is IDynamicLayer) { continue; } dynamicCacheLayerManager.Init(map, layer); LayerCacheInfo layerInfo = (LayerCacheInfo)cboLayerNames.SelectedItem; if (dynamicCacheLayerManager.FolderName == layerInfo.folderName) { dynamicCacheLayerManager.FolderPath = lblCacheFolderPath.Text; dynamicCacheLayerManager.Format = (rdoPNG.Checked ? "PNG32" : "JPEG32"); dynamicCacheLayerManager.StrictOnDemandMode = chkStrictOnDemandMode.Checked; dynamicCacheLayerManager.AlwaysDrawCoarsestLevel = chkAlwaysDrawCoarsestLevel.Checked; dynamicCacheLayerManager.DetailsThreshold = Convert.ToDouble(numDetaildThreshold.Value); dynamicCacheLayerManager.ProgressiveDrawingLevels = Convert.ToInt32(numProgressiveDrawingLevels.Value); dynamicCacheLayerManager.ProgressiveFetchingLevels = Convert.ToInt32(numProgressiveFetchingLevels.Value); dynamicCacheLayerManager.MaxCacheScale = Convert.ToDouble(numMaxCacheScale.Value); } } }
private void btnFolderPath_Click(object sender, EventArgs e) { FolderBrowserDialog dlg = new FolderBrowserDialog(); dlg.ShowNewFolderButton = true; dlg.Description = "Cache Folder"; if (cboLayerNames.SelectedIndex != -1) { LayerCacheInfo layerInfo = (LayerCacheInfo)cboLayerNames.SelectedItem; dlg.SelectedPath = layerInfo.folderPath; } if (DialogResult.OK == dlg.ShowDialog()) { if (System.IO.Directory.Exists(dlg.SelectedPath)) { lblCacheFolderPath.Text = dlg.SelectedPath; } } }