private void DlgShadowAnalysis_FormClosing(object sender, FormClosingEventArgs e) { this.RegisterEvents(false); if (m_shadowQuery != null) { m_shadowQuery.Clear(); m_shadowQuery = null; } m_bAnalyisSucess = false; this.cb_GetShadowRatio.Enabled = false; this.label_shadowRatio.Text = "当前点的阴影率为:***"; this.label_shadowRatio.Enabled = false; m_sceneControl.Scene.TrackingLayer.Clear(); }
//清除所有分析结果 private void btn_ClearResult_Click(object sender, EventArgs e) { this.RegisterEvents(false); if (m_shadowQuery != null) { m_shadowQuery.Clear(); m_shadowQuery = null; } m_bAnalyisSucess = false; this.cb_GetShadowRatio.Enabled = false; this.label_shadowRatio.Text = "当前点的阴影率为:***"; this.label_shadowRatio.Enabled = false; m_sceneControl.Scene.TrackingLayer.Clear(); this.btn_StartAnalysis.Enabled = true; this.btn_ClearResult.Enabled = false; }
private ShadowVisibilityQuery CreateShadowVisibilityQuery() { ShadowVisibilityQuery shadowQuery = new ShadowVisibilityQuery(m_sceneControl.Scene); shadowQuery.BaseUtcOffset = m_baseUtcOffset; shadowQuery.Spacing = m_spacing; shadowQuery.StartTime = m_startTime; shadowQuery.EndTime = m_endTime; shadowQuery.TimeInterval = m_timeInterval; //设置颜色表 ColorDictionary colorDict = new ColorDictionary(); colorDict[0] = Color.Blue; colorDict[30] = Color.Green; colorDict[60] = Color.Orange; colorDict[100] = Color.Red; shadowQuery.ColorDictTable = colorDict; return(shadowQuery); }
//绘制区域并开始分析 private void btn_StartAnalysis_Click(object sender, EventArgs e) { if (m_shadowType == ShadowType.SELECTION) { //目前只允许一次选择一个图层中的对象 Layer3Ds layers = m_sceneControl.Scene.Layers; for (int i = 0; i < layers.Count; i++) { Layer3D layer = layers[i]; Selection3D seletion3D = layer.Selection; if (seletion3D != null) { m_selection = seletion3D; break; } } if (m_selection == null) { MessageBox.Show("请先选择要产生阴影的对象!"); return; } } this.RegisterEvents(false); this.RegisterEvents(true); m_oldAction = m_sceneControl.Action; m_sceneControl.Action = Action3D.CreatePolygon; if (m_shadowQuery == null) { m_shadowQuery = this.CreateShadowVisibilityQuery(); } this.btn_StartAnalysis.Enabled = false; this.btn_ClearResult.Enabled = true; }