public LocationLinkObj(LocationObj LocOnSection, long LocOnRef, Geometry.GridLineSegment line) { this.LocationOnSection = LocOnSection; this.LocationOnReference = LocOnRef; lineSegment = line; lineGraphic = new RoundLineCode.RoundLine((float)line.A.X, (float)line.A.Y, (float)line.B.X, (float)line.B.Y); }
public override void OnDraw(GraphicsDevice graphicsDevice, VikingXNA.Scene scene, BasicEffect basicEffect) { if (CommandActive == false) return; //Retrieve the mouse position from the last update, the base class records this for us Vector3 target = new Vector3((float)this.oldWorldPosition.X, (float)oldWorldPosition.Y, 0f); ; Color lineColor = new Color(Color.YellowGreen.R, Color.YellowGreen.G, Color.YellowGreen.B, 0.75f); double Distance = GridVector2.Distance(Origin, this.oldWorldPosition) * MeasurementExtension.Global.UnitsPerPixel; RoundLineCode.RoundLine lineToParent = new RoundLineCode.RoundLine((float)Origin.X, (float)Origin.Y, (float)target.X, (float)target.Y); Parent.LineManager.Draw(lineToParent, (float)(1 * Parent.Downsample), lineColor, scene.Camera.View * scene.Projection, 1, "Glow"); //Draw the distance near the cursor Parent.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend); GridVector2 DrawPosition = Parent.WorldToScreen(target.X, target.Y); Parent.spriteBatch.DrawString(Parent.fontArial, Distance.ToString("#0.00") + " " + Global.UnitOfMeasure, new Vector2((float)DrawPosition.X, (float)DrawPosition.Y), lineColor, 0, new Vector2(0,0), 0.5f, SpriteEffects.None, 0); Parent.spriteBatch.End(); base.OnDraw(graphicsDevice, scene, basicEffect); }