public void MouseMove(object sender, MouseEventArgs e) { if (CanvasXfrmd == null) return; if (e.LeftButton == MouseButtonState.Released) { Point newMousePoint = e.GetPosition(CanvasXfrmd.Canvas); Point newWorldPoint=new Point(); newWorldPoint.X = CanvasXfrmd.TransformCanvasToWorldX(newMousePoint.X); newWorldPoint.Y = CanvasXfrmd.TransformCanvasToWorldY(newMousePoint.Y); //System.Diagnostics.Debug.WriteLine(newMousePoint.ToString()); //System.Diagnostics.Debug.WriteLine("Station {0}, Offset {1}", (CogoStation) newWorldPoint.Y, newWorldPoint.X); mouseSOE.station = newWorldPoint.Y; mouseSOE.offset = (Offset) newWorldPoint.X; mouseSOE.elevation = 0.0; this.currentCorridor_.getElevation(ref mouseSOE_); PlanStation = ((CogoStation)mouseSOE.station).ToString(); PlanOffset = mouseSOE.offset.ToString(); PlanElevation = mouseSOE.elevation.ToString(); Slope xSlope = new Slope(); this.currentCorridor_.getCrossSlope(mouseSOE_, ref xSlope); PlanCrossSlope = xSlope.ToString(); //System.Diagnostics.Debug.WriteLine("Station {0}, Offset {1}, Elevation {2}", (CogoStation)mouseSOE.station, mouseSOE.offset, mouseSOE.elevation); System.Diagnostics.Debug.WriteLine("Station {0}, Offset {1}, Elevation {2}", PlanStation, mouseSOE.offset, mouseSOE.elevation); System.Diagnostics.Debug.WriteLine(" "); e.Handled = false; return; } if (isPortWindowMoving == false) return; if (null == CanvasXfrmd) return; if (!(sender is Canvas)) return; if (sender != CanvasXfrmd.Canvas) return; if (e.LeftButton == MouseButtonState.Pressed) { Point newMousePoint = e.GetPosition(CanvasXfrmd.Canvas); WindowCenterX += (startMovingPoint.X - newMousePoint.X) / ViewScaleFeetPerInch; WindowCenterY += (startMovingPoint.Y - newMousePoint.Y) / ViewScaleFeetPerInch; } }
public virtual void DrawCrossSection(IRM21cad2dDrawingContext cadContext, ref StationOffsetElevation aSOE, int whichSide) { double LLH = LiederLineHeight; double ribbonWidth; double X1 = aSOE.offset; double Y1 = aSOE.elevation; this.moveToOuterEdge(ref aSOE, whichSide); if (X1 == aSOE.offset && Y1 == aSOE.elevation) return; cadContext.Draw(X1, Y1, aSOE.offset, aSOE.elevation); setupCrossSectionDrawing(cadContext); ribbonWidth = Math.Abs(aSOE.offset - X1); cadContext.setElementWeight(0.8); cadContext.setElementColor(Color.FromArgb(124, 255, 255, 255)); cadContext.Draw(X1, LLH + 0.5, aSOE.offset, LLH + 0.5); cadContext.Draw(aSOE.offset, 0.5, aSOE.offset, LLH + 1.5); string widthStr = (Math.Round(ribbonWidth*10)/10).ToString(); cadContext.Draw(widthStr, X1 + whichSide * ribbonWidth / 2, LLH + 0.5, 0.0); if (false == SuppressSlopeText) { Slope mySlope = new Slope((aSOE.elevation - Y1) / (aSOE.offset - X1)); if (whichSide > 0) cadContext.Draw(mySlope.ToString(), (X1 + aSOE.offset) / 2, (Y1 + aSOE.elevation) / 2, mySlope.getAsDegreesDouble()); else cadContext.Draw(mySlope.FlipDirection().ToString(), (X1 + aSOE.offset) / 2, (Y1 + aSOE.elevation) / 2, mySlope.getAsDegreesDouble()); } SuppressSlopeText = false; }