public InsertThumb(MapCanvas parent, PathFigure figure, int prevIndex, int nextIndex, double scale, List <MoveThumb> thumbList) { ParentCanvas = parent; ThumbList = thumbList; Figure = figure; this.scale = scale; PointCollection points = (figure.Segments[0] as PolyLineSegment).Points; Point prevPosition = points[prevIndex]; Point nextPosition = points[nextIndex]; Canvas.SetLeft(this, (prevPosition.X + nextPosition.X) * 0.5 * scale); Canvas.SetTop(this, (prevPosition.Y + nextPosition.Y) * 0.5 * scale); }
public MainWindow() { InitializeComponent(); Themes.Load("StudioBlue"); openFileDialog = new OpenFileDialog { InitialDirectory = Directory.GetParent(System.Reflection.Assembly.GetExecutingAssembly().Location).FullName, Filter = "Shapefiles (*.shp)|*.shp" }; saveFileDialog = new SaveFileDialog { InitialDirectory = Directory.GetParent(System.Reflection.Assembly.GetExecutingAssembly().Location).FullName, Filter = "Shapefiles (*.shp)|*.shp" }; List <GMapProvider> choosableMapProviders = new List <GMapProvider> { GMapProviders.OpenStreetMap, GMapProviders.GoogleMap, GMapProviders.GoogleHybridMap, GMapProviders.GoogleSatelliteMap, GMapProviders.GoogleTerrainMap }; mapSettings.Providers = choosableMapProviders; map.EmptyMapBackground = new SolidColorBrush(Colors.Black); map.DragButton = MouseButton.Left; map.ShowCenter = false; //map.Position = BMECoordinates; map.Position = new PointLatLng(0, 0); //map.Zoom = 18; map.Zoom = 2; Layers = new ObservableCollection <Layer>(); DataContext = this; mapCanvas = new MapCanvas(map) { Layers = Layers }; map.Markers.Add(mapCanvas.Marker); Closed += delegate(object o, EventArgs e) { consoleRedirectWriter.Release(); }; }
public MoveThumb(MapCanvas parent, PathFigure figure, int index, double scale, List <MoveThumb> thumbList /*, bool isDragging = false*/) { ParentCanvas = parent; ThumbList = thumbList; Figure = figure; this.scale = scale; PointCollection points = (figure.Segments[0] as PolyLineSegment).Points; Point position = points[index]; Canvas.SetLeft(this, position.X * scale); Canvas.SetTop(this, position.Y * scale); if (index == 0) { figure.StartPoint = position; } DragDelta += OnDragDelta; //IsDragging = isDragging; //if (isDragging) // Mouse.Capture(this, CaptureMode.); //Console.WriteLine(isDragging); }