コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="visibilityHandler"></param>
        public void VisibilityChanged(IndexVisibilityHandler visibilityHandler)
        {
            foreach (Label label in labels)
            {
                bool visible = visibilityHandler.GetVisibility(label.id);
                label.visible = visible;

                if (visible)
                {
                    //visible = true;

                    // if selected we don't want to override that color
                    if (!label.selected)
                    {
                        label.colorARGB = visibleTextColor.ToArgb();
                    }
                    else // if visible and selected, then show it selected
                    {
                        label.colorARGB = selectedTextColor.ToArgb();
                    }
                }
                else
                {
                    // NOTE: do not change the selected flag, so we can
                    // put it back to selected when it's visible again
                    //label.visible = false;
                    label.colorARGB = notVisibleTextColor.ToArgb();
                }
            }
        }
コード例 #2
0
        // This method is called every time the map is rendered.
        protected override void InternalRender()
        {
            // If the input is null we cannot render.
            if (_input == null)
            {
                return;
            }

            // If the glyph is not inited, call InternalInit.
            if (!_inited)
            {
                InternalInit(_device);
                if (!_inited)
                {
                    return;
                }
            }

            _device.RenderState.CullMode = Cull.None;

            // Loops through the regions in the map.
            for (int i = 0; i < _input.GetData().GetAxisLength(Axis.Y); i++)
            {
                // Resets the world transform.
                _device.Transform.World = _layerWorldMatrix;

                // If a glyph positioner (a class that moves the glyphs to the correct position) is set, use it.
                if (ActiveGlyphPositioner != null)
                {
                    //Gets the position for the glyph with index i.
                    Vector2 pos = ActiveGlyphPositioner.GetPosition(i);
                    // Translates the world transform.
                    _device.Transform.World *= Matrix.Translation(
                        pos.X,
                        pos.Y,
                        0
                        );
                }

                if (IndexVisibilityHandler.GetVisibility(i))
                {
                    DrawAllGlyphs(i);
                }
            }
        }
コード例 #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="aGraphics"></param>
        /// <param name="aColorMap"></param>
        private void DrawChild(Graphics aGraphics, IColorMap aColorMap, List <int> aSelectedIds, IndexVisibilityHandler aVisibility)
        {
            float height = iHeight * iScale.Y;

            if (height <= 1)
            {
                return;
            }

            UpdateRectangle(aColorMap);

            // Last level: Draw Label and Fill Rectangle
            if (iChildRectangles.Count == 0)
            {
                int amount = aColorMap.GetColors().GetLength(0);
                if (amount < iId)
                {
                    iId = 0;
                }

                // *** If selected ***
                if (aSelectedIds != null && aSelectedIds.Contains(iId) && (aVisibility != null && aVisibility.GetVisibility(iId)))
                {
                    System.Drawing.Drawing2D.LinearGradientBrush brush = new
                                                                         System.Drawing.Drawing2D.LinearGradientBrush(
                        iFillRectangle,
                        aColorMap.GetColor(iId), Color.White,
                        System.Drawing.Drawing2D.LinearGradientMode.Vertical);

                    aGraphics.FillRectangle(brush, iFillRectangle);
                    DrawLabel(aGraphics, iSelectedGroupLabelPen);
                    Pen selectedPen  = new Pen(Color.Cyan, 3);
                    Pen selectedPen2 = new Pen(Color.Blue, 3);

                    aGraphics.DrawRectangle(selectedPen, iBorderRectangle.X + 3, iBorderRectangle.Y + 3, iBorderRectangle.Width - 7, iBorderRectangle.Height - 7);
                    aGraphics.DrawRectangle(selectedPen2, iBorderRectangle.X + 6, iBorderRectangle.Y + 6, iBorderRectangle.Width - 12, iBorderRectangle.Height - 12);
                }
                else
                {
                    if (aVisibility != null && aVisibility.GetVisibility(iId))
                    {
                        aGraphics.FillRectangle(iBrush, iFillRectangle);
                    }
                    else
                    {
                        aGraphics.FillRectangle(iGrayBrush, iFillRectangle);
                    }

                    DrawLabel(aGraphics);
                }
            }
            else
            {
                // Call children recursively
                foreach (TreeRectangle rectangle in iChildRectangles)
                {
                    rectangle.DrawChild(aGraphics, aColorMap, aSelectedIds, aVisibility);
                }

                // Draw the The Group Rectangle (as a border)
                aGraphics.DrawRectangle(iPen, iBorderRectangle);

                // Draw the Group Label
                DrawGroupLabel(iFillRectangle, aGraphics, iBorderPen);
            }
        }