예제 #1
0
        private void LoadTreeView()
        {
            // Mantém a consistência dos nós no MapTTreeView
            loadingTreeView = true;
            foreach (TreeNode ly in MaptTreeView.Nodes)
            {
                ly.Checked = MaintainConsistency.StatusChecked(ly.Name, listLayerView);
                foreach (TreeNode pj in ly.Nodes)
                {
                    pj.Checked = MaintainConsistency.StatusChecked(pj.Name, listLayerView);
                    foreach (TreeNode qy in pj.Nodes)
                    {
                        qy.Checked = MaintainConsistency.StatusChecked(qy.Name, listLayerView);

                        // Torna a layer invisível/visível
                        if (qy.Checked)
                        {
                            MapTAxMap.set_LayerVisible(MaintainConsistency.LoadIdLayer(qy.Name, listLayerView), true);
                        }
                        else
                        {
                            MapTAxMap.set_LayerVisible(MaintainConsistency.LoadIdLayer(qy.Name, listLayerView), false);
                        }
                    }
                }
            }
            loadingTreeView = false;
        }
예제 #2
0
        private void CreatTreeView(ListLayerView listLayerView)
        {
            int nodeL = 0;

            foreach (LayerView layerview in listLayerView.LayerViews)
            {
                MaptTreeView.Nodes.Add(layerview.Label);
                MaptTreeView.Nodes[nodeL].Checked = true;
                MaptTreeView.Nodes[nodeL].Name    = layerview.IdTree;

                if (layerview.ShowNodesProjectViews)
                {
                    int nodeP = 0;
                    foreach (ProjectView projectView in layerview.ProjectViews)
                    {
                        MaptTreeView.Nodes[nodeL].Nodes.Add(projectView.Label);
                        MaptTreeView.Nodes[nodeL].Nodes[nodeP].Checked = true;
                        MaptTreeView.Nodes[nodeL].Nodes[nodeP].Name    = projectView.IdTree;

                        var ds = new OgrDatasource();
                        ds.Open(projectView.Connection.StringConexao());

                        int nodeQ = 0;
                        foreach (QueryView queryView in projectView.QueryViews)
                        {
                            MaptTreeView.Nodes[nodeL].Nodes[nodeP].Nodes.Add(queryView.Label);
                            MaptTreeView.Nodes[nodeL].Nodes[nodeP].Nodes[nodeQ].Checked = true;
                            MaptTreeView.Nodes[nodeL].Nodes[nodeP].Nodes[nodeQ].Name    = queryView.IdTree;

                            var buffer = ds.RunQuery(queryView.Query);
                            MapTAxMap.AddLayer(buffer, true);
                            buffer.GetBuffer().DefaultDrawingOptions.FillColor = queryView.Color;

                            nodeQ++;
                        }
                        nodeP++;

                        ds.Close();
                    }
                }
                nodeL++;
            }
            MaptTreeView.ExpandAll();
            MapTAxMap.ZoomToMaxVisibleExtents();
        }