Esempio n. 1
0
        public static bool StatusChecked(string idTree, ListLayerView listLayerView)
        {
            bool bStatusChecked = false;

            foreach (LayerView layerview in listLayerView.LayerViews)
            {
                if (layerview.IdTree == idTree)
                {
                    bStatusChecked = layerview.CheckedTree;
                }
                foreach (ProjectView projectView in layerview.ProjectViews)
                {
                    if (projectView.IdTree == idTree)
                    {
                        bStatusChecked = projectView.CheckedTree;
                    }

                    foreach (QueryView queryView in projectView.QueryViews)
                    {
                        if (queryView.IdTree == idTree)
                        {
                            bStatusChecked = queryView.CheckedTree;
                        }
                    }
                }
            }
            return(bStatusChecked);
        }
Esempio n. 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();
        }
Esempio n. 3
0
        public static int LoadIdLayer(string idTree, ListLayerView listLayerView)
        {
            int idLayer = -1;

            foreach (LayerView layerview in listLayerView.LayerViews)
            {
                foreach (ProjectView projectView in layerview.ProjectViews)
                {
                    foreach (QueryView queryView in projectView.QueryViews)
                    {
                        if (queryView.IdTree == idTree)
                        {
                            idLayer = queryView.IdLayer;
                        }
                    }
                }
            }
            return(idLayer);
        }
Esempio n. 4
0
        public static void ConsistencyCheckedTree(string idTypeObject, string idTree, bool checkedTree, ListLayerView listLayerView)
        {
            // Se o objeto alterado for uma LayerView
            if (idTypeObject == "LayerView")
            {
                foreach (LayerView layerview in listLayerView.LayerViews)
                {
                    if (layerview.IdTree == idTree)
                    {
                        layerview.CheckedTree = checkedTree;
                    }
                    foreach (ProjectView projectView in layerview.ProjectViews)
                    {
                        projectView.CheckedTree = layerview.CheckedTree;

                        foreach (QueryView queryView in projectView.QueryViews)
                        {
                            queryView.CheckedTree = checkedTree;
                        }
                    }
                }
            }
            else
            {
                if (idTypeObject == "ProjectView")
                {
                    foreach (LayerView layerview in listLayerView.LayerViews)
                    {
                        foreach (ProjectView projectView in layerview.ProjectViews)
                        {
                            if (projectView.IdTree == idTree)
                            {
                                projectView.CheckedTree = checkedTree;

                                foreach (QueryView queryView in projectView.QueryViews)
                                {
                                    queryView.CheckedTree = projectView.CheckedTree;
                                }
                            }
                        }
                    }
                }

                if (idTypeObject == "QueryView")
                {
                    // Apenas altera o atributo CheckedTree das QueryViews
                    foreach (LayerView layerview in listLayerView.LayerViews)
                    {
                        foreach (ProjectView projectView in layerview.ProjectViews)
                        {
                            foreach (QueryView queryView in projectView.QueryViews)
                            {
                                if (queryView.IdTree == idTree)
                                {
                                    queryView.CheckedTree = checkedTree;
                                }
                            }
                        }
                    }
                }

                // Mantém a consistência dos nós-pais
                foreach (LayerView layerview in listLayerView.LayerViews)
                {
                    bool projAllCkecked = false;
                    foreach (ProjectView projectView in layerview.ProjectViews)
                    {
                        bool qryAllChecked = false;
                        foreach (QueryView queryView in projectView.QueryViews)
                        {
                            if (queryView.CheckedTree)
                            {
                                qryAllChecked = true;
                            }
                        }

                        if (!qryAllChecked)
                        {
                            projectView.CheckedTree = false;
                        }
                        else
                        {
                            projectView.CheckedTree = true;
                        }

                        if (projectView.CheckedTree)
                        {
                            projAllCkecked = true;
                        }
                    }

                    if (!projAllCkecked)
                    {
                        layerview.CheckedTree = false;
                    }
                    else
                    {
                        layerview.CheckedTree = true;
                    }
                }
            }
        }