Esempio n. 1
0
        public void DrawNodeLabel(string text, Font font, Color color, RectangleF rect, NodeModel node, int depth)
        {
            QFont qfont = GetQFont(font);

            float height = LabelHeight;

            if (Model.ViewLayout == LayoutType.TreeMap)
            {
                height = depth * LevelSize + GetNodeHeight(node); // put over call lines
            }
            if (SelectionMode != SelectionModes.None)
            {
                SelectionMap[node.ID] = node;
                color = Color.FromArgb((255 << 24) | node.ID);

                var textArea = qfont.Measure(text, rect.Size, QFontAlignment.Left);

                var normal = new Vector3(0, 1, 0);
                var v1     = new Vector3(rect.X, height, rect.Y);
                var v2     = new Vector3(rect.X, height, rect.Y + textArea.Height);
                var v3     = new Vector3(rect.X + textArea.Width, height, rect.Y + textArea.Height);
                var v4     = new Vector3(rect.X + textArea.Width, height, rect.Y);

                Nodes.AddVerticies(color, normal, v1, v2, v3, v1, v3, v4);
            }
            else
            {
                qfont.PrintToVBO(text, QFontAlignment.Left, new Vector3(rect.X, rect.Y, -height), color, rect.Size);
            }
        }
Esempio n. 2
0
        public void DrawNodeLabel(string text, Font font, Color color, RectangleF rect, NodeModel node, int depth)
        {
            if (!ClientRect.IntersectsWith(rect))
            {
                return;
            }

            QFont qfont = GetQFont(font);

            qfont.PrintToVBO(text, QFontAlignment.Left, new Vector3(rect.X, rect.Y, 0), color, rect.Size);
        }
Esempio n. 3
0
        public void DrawString(string text, Font font, Color color, float x, float y, float width, float height)
        {
            var rect = new RectangleF(x, y, width, height);

            if (!ClientRect.IntersectsWith(rect))
            {
                return;
            }

            QFont qfont = GetQFont(font);

            qfont.PrintToVBO(text, QFontAlignment.Left, new Vector3(x, y, 0), color, new SizeF(width, height));
        }
        public void setDimensions(Vector2 newDim)
        {
            mDimensions = new Vector2(newDim.X, newDim.Y / ( float )(mPoints.Count + 1));
            QFont.RefreshViewport();

            float scale   = (mMaxHeight * 2f) / mDimensions.Y;
            float yOffset = mDimensions.Y;

            mLargeFont.ResetVBOs();
            mSmallFont.ResetVBOs();
            //Prints sensor labels
            foreach (var kvp in mPoints)
            {
                mLargeFont.PrintToVBO("Sensor " + kvp.Key, new Vector3(0, yOffset - 15f, 0), Color.White);
                mSmallFont.PrintToVBO("1g", new Vector3(mDimensions.X - (mDimensions.X / 8), (220f / scale) + yOffset, 0), Color.WhiteSmoke);
                mSmallFont.PrintToVBO("2g", new Vector3(mDimensions.X - (mDimensions.X / 8), (440f / scale) + yOffset, 0), Color.WhiteSmoke);
                mSmallFont.PrintToVBO("1g", new Vector3(mDimensions.X - (mDimensions.X / 8), yOffset - (220f / scale), 0), Color.WhiteSmoke);
                mSmallFont.PrintToVBO("2g", new Vector3(mDimensions.X - (mDimensions.X / 8), yOffset - (440f / scale), 0), Color.WhiteSmoke);
                yOffset += mDimensions.Y;
            }
            mLargeFont.LoadVBOs();
            mSmallFont.LoadVBOs();
        }
 /// <summary>
 /// Adds the specified text to the font object for drawing
 /// </summary>
 /// <param name="text"></param>
 /// <param name="worldPos"></param>
 /// <param name="color"></param>
 public void addFontText(string text, Vector3 worldPos, Color color)
 {
     mFont.PrintToVBO(text, form3Dto2D(worldPos), color);
 }