/// <summary> /// 描画ステージのリサイズ /// </summary> /// <param name="obj"></param> public void resizeStage(SettingStage obj) { this.settingStage = obj; double rawZoomLevelWidth = System.Math.Floor(((double)this.defaultWidth / (double)obj.bolsterWidth) * 10) / 10; double rawZoomLevelHeight = System.Math.Floor(((double)this.defaultHeight / (double)obj.bolsterHeight) * 10) / 10; if (obj.bolsterWidth > this.defaultWidth && rawZoomLevelWidth < rawZoomLevelHeight) { this.rawZoomLevel = rawZoomLevelWidth; } else if (obj.bolsterHeight > this.defaultHeight) { this.rawZoomLevel = rawZoomLevelHeight; } else { this.rawZoomLevel = 1; } this.defaultBolsterWidth = (int)System.Math.Floor(obj.bolsterWidth * this.rawZoomLevel); this.defaultBolsterHeight = (int)System.Math.Floor(obj.bolsterHeight * this.rawZoomLevel); this.defaultUnderKanagataWidth = (int)System.Math.Floor(obj.underKanagataWidth * this.rawZoomLevel); this.defaultUnderKanagataHeight = (int)System.Math.Floor(obj.underKanagataHeight * this.rawZoomLevel); this.defaultPressKanagataWidth = (int)System.Math.Floor(obj.pressKanagataWidth * this.rawZoomLevel); this.defaultPressKanagataHeight = (int)System.Math.Floor(obj.pressKanagataHeight * this.rawZoomLevel); //センサーが範囲内にあるか判定する List<SettingItem> settings = this.locationSetting.getSettingList(); for (int i = 0; i < this.sensorList.Count; i++) { //Bセンサで if (settings[i].type == "B") //範囲外ならば if (settings[i].x != -1 && settings[i].y != -1) if (obj.bolsterWidth <= settings[i].x || obj.bolsterHeight <= settings[i].y) { removeSensor(i); //対象のセンサーを消去 setNewSensorB(i); //対象センサーを初期位置へ } } this.zoomCanvases(1); this.cvsRoot.UpdateLayout(); this.sliderZoom.Value = 1; }
/// <summary> /// /// </summary> /// <returns></returns> private SettingStage getSettingStage() { SettingStage obj = new SettingStage(); obj.kanagataDisp = this.chkDispKanagata.Checked; obj.bolsterWidth = int.Parse(this.txtBolsterWidth.Text.Trim()); obj.bolsterHeight = int.Parse(this.txtBolsterHeight.Text.Trim()); obj.underKanagataWidth = int.Parse(this.txtUnderKanagataWidth.Text.Trim()); obj.underKanagataHeight = int.Parse(this.txtUnderKanagataHeight.Text.Trim()); obj.pressKanagataWidth = int.Parse(this.txtPressKanagataWidth.Text.Trim()); obj.pressKanagataHeight = int.Parse(this.txtPressKanagataHeight.Text.Trim()); return obj; }
/// <summary> /// 与えられた設定にて初期表示 /// </summary> /// <param name="obj"></param> /// <param name="settingList"></param> public void setDefault(SettingStage obj, List<SettingItem> settingList) { this.settingStage = obj; DispatcherTimer timer; uctrlLocationSetting2 self = this; timer = new DispatcherTimer(); timer.Interval = TimeSpan.FromSeconds(0.01); timer.Tick += delegate { timer.Stop(); self.resizeStage(obj); self.setDefaultSensors(settingList); self.DoneInitailized(self, new EventArgs()); }; timer.Start(); }