//刷新风格 private void RefreshStyle() { if (m_layer3D == null) { return; } if (m_bSelection) { m_layer3D.Selection.Style = m_style3D; m_layer3D.Selection.UpdateData(); } else { if (m_layer3D.Type == Layer3DType.Dataset) { Layer3DDataset layer3DDataset = m_layer3D as Layer3DDataset; //layer3DDataset.IsEditable = true; Layer3DSettingVector layerSetting = layer3DDataset.AdditionalSetting as Layer3DSettingVector; layerSetting.Style = m_style3D; layer3DDataset.AdditionalSetting = layerSetting; layer3DDataset.UpdateData(); } else if (m_layer3D.Type == Layer3DType.VectorFile) { Layer3DVectorFile layer3DFile = m_layer3D as Layer3DVectorFile; Layer3DSettingVector layerSetting = layer3DFile.AdditionalSetting as Layer3DSettingVector; layerSetting.Style = m_style3D; layer3DFile.AdditionalSetting = layerSetting; layer3DFile.UpdateData(); } this.m_sceneControl.Scene.Refresh(); } }
/// <summary> /// 初始化 /// </summary> /// <param name="sceneControl"></param> /// <param name="layer3D"></param> /// <param name="isSelection"></param> public void Initialize(SceneControl sceneControl, Layer3D layer3D, bool isSelection) { m_sceneControl = sceneControl; m_layer3D = layer3D; m_bSelection = isSelection; this.cb_AltitudeMode.Items.Clear(); //初始化高度模式列表 if (m_bSelection) { this.cb_AltitudeMode.Items.Add("贴地"); this.cb_AltitudeMode.Items.Add("贴对象"); } else { this.cb_AltitudeMode.Items.Add("贴地"); this.cb_AltitudeMode.Items.Add("贴对象"); this.cb_AltitudeMode.Items.Add("相对地面"); this.cb_AltitudeMode.Items.Add("绝对高度"); this.cb_AltitudeMode.Items.Add("相对地下"); } //初始化m_style3D if (m_bSelection) { m_style3D = m_layer3D.Selection.Style; } else { if (m_layer3D.Type == Layer3DType.Dataset) { Layer3DDataset layer3DDataset = m_layer3D as Layer3DDataset; Layer3DSettingVector layerSetting = layer3DDataset.AdditionalSetting as Layer3DSettingVector; m_style3D = layerSetting.Style; } else if (m_layer3D.Type == Layer3DType.VectorFile) { Layer3DVectorFile layer3DFile = m_layer3D as Layer3DVectorFile; Layer3DSettingVector layerSetting = layer3DFile.AdditionalSetting as Layer3DSettingVector; m_style3D = layerSetting.Style; } } this.UpdateData(); }
public void getAtt(Selection3D[] selections) { m_selections = selections; if (treeView1.Nodes.Count != 0) { treeView1.Nodes.Clear(); } if (dataGridView1.Columns.Count != 0) { dataGridView1.Columns.Clear(); } if (dataGridView1.Rows.Count != 0) { dataGridView1.Rows.Clear(); } List <TreeNode> tns = new List <TreeNode>(); for (int i = 0; i < selections[0].Count; i++) { TreeNode t = new TreeNode(selections[0][i].ToString()); tns.Add(t); } TreeNode tN = new TreeNode("属性", tns.ToArray()); treeView1.Nodes.Add(tN); treeView1.ExpandAll(); var lll = selections[0].Layer; if (selections[0].Layer is Layer3DDataset) { Layer3DDataset l3d = (Layer3DDataset)selections[0].Layer; ObjDV = (DatasetVector)l3d.Dataset; fieldInfos = ObjDV.FieldInfos; } else { lVF = (Layer3DVectorFile)selections[0].Layer; fieldInfos = lVF.GetFieldInfos(); } int[] ID = new int[selections[0].Count]; for (int i = 0; i < ID.Length; i++) { ID[i] = selections[0][i]; } dataGridView1.ColumnCount = 5; dataGridView1.Columns[0].Name = "字段名"; dataGridView1.Columns[1].Name = "字段别名"; dataGridView1.Columns[2].Name = "字段类型"; dataGridView1.Columns[3].Name = "必填"; dataGridView1.Columns[4].Name = "字段值"; dataGridView1.RowCount = fieldInfos.Count; for (int i = 0; i < fieldInfos.Count; i++) { dataGridView1[0, i].Value = fieldInfos[i].Name; dataGridView1[1, i].Value = fieldInfos[i].Caption; dataGridView1[2, i].Value = fieldInfos[i].Type; dataGridView1[3, i].Value = fieldInfos[i].IsRequired; } for (int i = 0; i < fieldInfos.Count; i++) { if (lVF != null && lVF.GetFieldValueOfSelectedObject(i) != null) { dataGridView1[4, i].Value = lVF.GetFieldValueOfSelectedObject(i).ToString(); } if (ObjDV != null) { QueryParameter query = new QueryParameter(); query.AttributeFilter = string.Format("SmID={0}", selections[0][0]); Recordset recordset = ObjDV.Query(query);; dataGridView1[4, i].Value = recordset.GetFieldValue(i).ToString(); } } }