/// <summary> /// Determine whether the substation is visible on the screen /// </summary> /// <param name="Coordinates">The coordinates of the viewport</param> /// <returns></returns> public bool CheckVisibility(System.Drawing.RectangleF Coordinates, int zoomLevel) { if (!this.Permitted) { return(false); } if (float.IsNaN(LngLat.X)) { return(false); } else if (LngLat.X < Coordinates.Left || LngLat.X > Coordinates.Right || LngLat.Y > Coordinates.Top || LngLat.Y < Coordinates.Bottom) { return(false); } else { foreach (MM_KVLevel KVLevel in KVLevels) { if (zoomLevel >= KVLevel.VisibilityByZoom) { return(true); } } } return(false); }
public Vector2 MeasureString2(string text) { System.Drawing.StringFormat format = new System.Drawing.StringFormat(); System.Drawing.RectangleF rect = new System.Drawing.RectangleF(0, 0, 1000, 1000); System.Drawing.CharacterRange[] ranges = { new System.Drawing.CharacterRange(0, text.Length) }; System.Drawing.Region[] regions = new System.Drawing.Region[1]; format.SetMeasurableCharacterRanges(ranges); regions = _fontGraphics.MeasureCharacterRanges(text, _font, rect, format); rect = regions[0].GetBounds(_fontGraphics); return(new Vector2(rect.Right + 1.0f, _charHeight)); }
public void DrawString(string s, System.Drawing.Font font, System.Drawing.SolidBrush brush, System.Drawing.RectangleF layoutRectangle) { _renderTarget2D.DrawText(s, _textFormatConverterAndCacher.Convert(font), _rectangleFConverter.Convert(layoutRectangle), _solidColorBrushConverter.Convert(brush)); }