Ejemplo n.º 1
0
        void IconHookMenuItem_Click(object sender, EventArgs s)
        {
            if (m_hookForm == null)
            {
                m_hookForm = new FormWidget(" " + this.Name);

                m_hookForm.WidgetSize     = new System.Drawing.Size(200, 250);
                m_hookForm.Location       = new System.Drawing.Point(200, 120);
                m_hookForm.DestroyOnClose = true;

                m_hookTreeNode = new SimpleTreeNodeWidget("Info");
                m_hookTreeNode.IsRadioButton = true;
                m_hookTreeNode.Expanded      = true;
                m_hookTreeNode.EnableCheck   = false;

                m_hookGeneralLabel = new LabelWidget("");
                m_hookGeneralLabel.ClearOnRender  = true;
                m_hookGeneralLabel.Format         = DrawTextFormat.WordBreak;
                m_hookGeneralLabel.Location       = new System.Drawing.Point(0, 0);
                m_hookGeneralLabel.AutoSize       = true;
                m_hookGeneralLabel.UseParentWidth = false;

                m_hookGeneralTreeNode = new SimpleTreeNodeWidget("General");
                m_hookGeneralTreeNode.IsRadioButton = true;
                m_hookGeneralTreeNode.Expanded      = true;
                m_hookGeneralTreeNode.EnableCheck   = false;

                m_hookGeneralTreeNode.Add(m_hookGeneralLabel);
                m_hookTreeNode.Add(m_hookGeneralTreeNode);

                m_hookDetailLabel = new LabelWidget("");
                m_hookDetailLabel.ClearOnRender  = true;
                m_hookDetailLabel.Format         = DrawTextFormat.WordBreak;
                m_hookDetailLabel.Location       = new System.Drawing.Point(0, 0);
                m_hookDetailLabel.AutoSize       = true;
                m_hookDetailLabel.UseParentWidth = false;

                m_hookDetailTreeNode = new SimpleTreeNodeWidget("Detail");
                m_hookDetailTreeNode.IsRadioButton = true;
                m_hookDetailTreeNode.Expanded      = true;
                m_hookDetailTreeNode.EnableCheck   = false;

                m_hookDetailTreeNode.Add(m_hookDetailLabel);
                m_hookTreeNode.Add(m_hookDetailTreeNode);

                m_hookDescTreeNode = new SimpleTreeNodeWidget("Description");
                m_hookDescTreeNode.IsRadioButton = true;
                m_hookDescTreeNode.Expanded      = true;
                m_hookDescTreeNode.EnableCheck   = false;

                m_hookDescLabel = new LabelWidget("");
                m_hookDescLabel.ClearOnRender  = true;
                m_hookDescLabel.Format         = DrawTextFormat.WordBreak;
                m_hookDescLabel.Location       = new System.Drawing.Point(0, 0);
                m_hookDescLabel.AutoSize       = true;
                m_hookDescLabel.UseParentWidth = true;

                m_hookDescTreeNode.Add(m_hookDescLabel);
                m_hookTreeNode.Add(m_hookDescTreeNode);

                m_hookForm.Add(m_hookTreeNode);

                DrawArgs.NewRootWidget.ChildWidgets.Add(m_hookForm);
            }

            UpdateHookForm();
            m_hookForm.Enabled = true;
            m_hookForm.Visible = true;
            IsHooked           = true;
        }
Ejemplo n.º 2
0
        void m_updateTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            List <WorldWind.Renderable.RenderableObject> activeList = new List <WorldWind.Renderable.RenderableObject>();

            for (int i = 0; i < ParentApplication.WorldWindow.CurrentWorld.RenderableObjects.ChildObjects.Count; i++)
            {
                WorldWind.Renderable.RenderableObject renderable = (WorldWind.Renderable.RenderableObject)ParentApplication.WorldWindow.CurrentWorld.RenderableObjects.ChildObjects[i];

                List <WorldWind.Renderable.RenderableObject> childActiveList = getActiveLayers(renderable);
                for (int j = 0; j < childActiveList.Count; j++)
                {
                    activeList.Add(childActiveList[j]);
                }
            }

            for (int i = 0; i < activeList.Count; i++)
            {
                if (m_activeLayersNode.ChildWidgets.Count == i)
                {
                    SimpleTreeNodeWidget node = new SimpleTreeNodeWidget(activeList[i].Name);
                    node.Tag                  = activeList[i];
                    node.ParentWidget         = m_activeLayersNode;
                    node.OnCheckStateChanged += new CheckStateChangedHandler(node_OnCheckStateChanged);
                    m_activeLayersNode.ChildWidgets.Add(node);
                }
                else
                {
                    SimpleTreeNodeWidget currentNode = (SimpleTreeNodeWidget)m_activeLayersNode.ChildWidgets[i];
                    WorldWind.Renderable.RenderableObject nodeRenderable = (WorldWind.Renderable.RenderableObject)currentNode.Tag;

                    if (activeList[i] != nodeRenderable)
                    {
                        SimpleTreeNodeWidget node = new SimpleTreeNodeWidget(activeList[i].Name);
                        node.Tag                  = activeList[i];
                        node.ParentWidget         = m_activeLayersNode;
                        node.OnCheckStateChanged += new CheckStateChangedHandler(node_OnCheckStateChanged);
                        m_activeLayersNode.ChildWidgets.Insert(node, i);
                    }
                }
            }

            if (m_activeLayersNode.ChildWidgets.Count != activeList.Count)
            {
                while (m_activeLayersNode.ChildWidgets.Count > activeList.Count)
                {
                    m_activeLayersNode.ChildWidgets.RemoveAt(m_activeLayersNode.ChildWidgets.Count - 1);
                }
            }

            for (int i = 0; i < ParentApplication.WorldWindow.CurrentWorld.RenderableObjects.ChildObjects.Count; i++)
            {
                WorldWind.Renderable.RenderableObject renderable = (WorldWind.Renderable.RenderableObject)ParentApplication.WorldWindow.CurrentWorld.RenderableObjects.ChildObjects[i];
                if (m_allLayersNode.ChildWidgets.Count == i)
                {
                    SimpleTreeNodeWidget childNode = new SimpleTreeNodeWidget(renderable.Name);
                    childNode.Tag                  = renderable;
                    childNode.ParentWidget         = m_allLayersNode;
                    childNode.OnCheckStateChanged += new CheckStateChangedHandler(node_OnCheckStateChanged);
                    m_allLayersNode.Add(childNode);
                }

                UpdateAllLayers((SimpleTreeNodeWidget)m_allLayersNode.ChildWidgets[i], renderable);
            }

            while (m_allLayersNode.ChildWidgets.Count > ParentApplication.WorldWindow.CurrentWorld.RenderableObjects.ChildObjects.Count)
            {
                m_allLayersNode.ChildWidgets.RemoveAt(ParentApplication.WorldWindow.CurrentWorld.RenderableObjects.ChildObjects.Count - 1);
            }
        }