// // Removes the panel from the scene manager // public void Remove() { IAgStkGraphicsSceneManager manager = ((IAgScenario)m_Root.CurrentScenario).SceneManager; IAgStkGraphicsScreenOverlayCollectionBase collectionBase = (IAgStkGraphicsScreenOverlayCollectionBase)manager.ScreenOverlays.Overlays; collectionBase.Remove((IAgStkGraphicsScreenOverlay)m_Panel); }
// // Adds a two-way button to the panel // public void AddButton(string enabledImage, string disabledImage, ActionDelegate action) { IAgStkGraphicsOverlay overlay = (IAgStkGraphicsOverlay)m_Panel; m_PanelWidth += OverlayButton.ButtonSize; overlay.Width = m_PanelWidth; OverlayButton newButton; newButton = new OverlayButton(action, disabledImage, m_LocationOffset, m_PanelWidth, m_Root); newButton.SetTexture(enabledImage, disabledImage); IAgStkGraphicsScreenOverlayCollectionBase collectionBase = (IAgStkGraphicsScreenOverlayCollectionBase)overlay.Overlays; collectionBase.Add(newButton.Overlay); m_ButtonHolders.Add(newButton); m_LocationOffset += OverlayButton.ButtonSize; foreach (OverlayButton button in m_ButtonHolders) { button.Resize(m_PanelWidth); } }
// // Constructor // public OverlayToolbar(AgStkObjectRoot root, AGI.STKX.Controls.AxAgUiAxVOCntrl control) { m_Root = root; m_Control3D = control; IAgStkGraphicsSceneManager manager = ((IAgScenario)m_Root.CurrentScenario).SceneManager; m_ButtonHolders = new List <OverlayButton>(); IAgStkGraphicsScreenOverlayManager ScreenOverlayManager = manager.ScreenOverlays; // // Panel // m_Panel = manager.Initializers.TextureScreenOverlay.InitializeWithXYWidthHeight(0, 0, m_PanelWidth, OverlayButton.ButtonSize); IAgStkGraphicsOverlay overlay = (IAgStkGraphicsOverlay)m_Panel; overlay.Origin = AgEStkGraphicsScreenOverlayOrigin.eStkGraphicsScreenOverlayOriginBottomLeft; overlay.BorderSize = 2; overlay.Color = Color.Transparent; overlay.BorderColor = Color.Transparent; overlay.Translucency = m_PanelTranslucencyRegular; overlay.BorderTranslucency = m_PanelBorderTranslucencyRegular; IAgStkGraphicsScreenOverlayCollectionBase managerOverlays = (IAgStkGraphicsScreenOverlayCollectionBase)manager.ScreenOverlays.Overlays; managerOverlays.Add((IAgStkGraphicsScreenOverlay)m_Panel); // // Buttons // string enabledImage, disabledImage; ActionDelegate action; // // ShowHide button // enabledImage = Path.Combine(Application.StartupPath, "ToolbarImages\\visible.png"); disabledImage = Path.Combine(Application.StartupPath, "ToolbarImages\\invisible.png"); action = new ActionDelegate(ShowHideAction); AddButton(enabledImage, disabledImage, action); // // Reset button // disabledImage = Path.Combine(Application.StartupPath, "ToolbarImages\\reset.png"); action = new ActionDelegate(ResetAction); AddButton(disabledImage, action); // DecreaseDelta button disabledImage = Path.Combine(Application.StartupPath, "ToolbarImages\\decreasedelta.png"); action = new ActionDelegate(DecreaseDeltaAction); AddButton(disabledImage, action); // // StepBack button disabledImage = Path.Combine(Application.StartupPath, "ToolbarImages\\stepreverse.png"); action = new ActionDelegate(StepReverseAction); AddButton(disabledImage, action); m_StepReverseButton = m_ButtonHolders[m_ButtonHolders.Count - 1]; // // PlayBack button // disabledImage = Path.Combine(Application.StartupPath, "ToolbarImages\\playreverse.png"); action = new ActionDelegate(PlayReverseAction); AddButton(disabledImage, action); // // Pause button // disabledImage = Path.Combine(Application.StartupPath, "ToolbarImages\\pause.png"); action = new ActionDelegate(PauseAction); AddButton(disabledImage, action); // // Play button // disabledImage = Path.Combine(Application.StartupPath, "ToolbarImages\\playforward.png"); action = new ActionDelegate(PlayForwardAction); AddButton(disabledImage, action); // // StepForward button // disabledImage = Path.Combine(Application.StartupPath, "ToolbarImages\\stepforward.png"); action = new ActionDelegate(StepForwardAction); AddButton(disabledImage, action); m_StepForwardButton = m_ButtonHolders[m_ButtonHolders.Count - 1]; // // IncreaseDelta button // disabledImage = Path.Combine(Application.StartupPath, "ToolbarImages\\increasedelta.png"); action = new ActionDelegate(IncreaseDeltaAction); AddButton(disabledImage, action); // // Zoom button // enabledImage = Path.Combine(Application.StartupPath, "ToolbarImages\\zoompressed.png"); disabledImage = Path.Combine(Application.StartupPath, "ToolbarImages\\zoom.png"); action = new ActionDelegate(ZoomAction); AddButton(enabledImage, disabledImage, action); m_ZoomButton = m_ButtonHolders[m_ButtonHolders.Count - 1]; // // Pan button // enabledImage = Path.Combine(Application.StartupPath, "ToolbarImages\\panpressed.png"); disabledImage = Path.Combine(Application.StartupPath, "ToolbarImages\\pan.png"); action = new ActionDelegate(PanAction); AddButton(enabledImage, disabledImage, action); // // Home button // disabledImage = Path.Combine(Application.StartupPath, "ToolbarImages\\home.png"); action = new ActionDelegate(HomeAction); AddButton(disabledImage, action); // // Moon Button // disabledImage = Path.Combine(Application.StartupPath, "ToolbarImages\\moon.png"); action = new ActionDelegate(MoonAction); AddButton(disabledImage, action); IAgStkGraphicsScreenOverlayCollectionBase collectionBase = (IAgStkGraphicsScreenOverlayCollectionBase)overlay.Overlays; // // Scale button // m_ScaleButton = new OverlayButton( new ActionDelegate(ScaleAction), Path.Combine(Application.StartupPath, "ToolbarImages\\scale.png"), 0, m_PanelWidth, 0.5, 0, m_Root); IAgStkGraphicsOverlay scaleOverlay = (IAgStkGraphicsOverlay)m_ScaleButton.Overlay; scaleOverlay.Origin = AgEStkGraphicsScreenOverlayOrigin.eStkGraphicsScreenOverlayOriginTopRight; collectionBase.Add(m_ScaleButton.Overlay); m_ButtonHolders.Add(m_ScaleButton); // // Rotate button // m_RotateButton = new OverlayButton( new ActionDelegate(RotateAction), Path.Combine(Application.StartupPath, "ToolbarImages\\rotate.png"), 0, m_PanelWidth, 0.5, 0, m_Root); IAgStkGraphicsOverlay rotateOverlay = (IAgStkGraphicsOverlay)m_RotateButton.Overlay; rotateOverlay.Origin = AgEStkGraphicsScreenOverlayOrigin.eStkGraphicsScreenOverlayOriginBottomRight; collectionBase.Add(m_RotateButton.Overlay); m_ButtonHolders.Add(m_RotateButton); DockBottom(); }