Exemplo n.º 1
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public MapLocation(Location location)
        {
            InitializeComponent();

            this.MouseLeftButtonDown += PinMouseDown;

            this.Location = location;
        }
Exemplo n.º 2
0
        public void AddPin(Location location)
        {
            MapLocation ml = new MapLocation(location);
            TransformGroup elGroup = new TransformGroup();
            TranslateTransform fixPoint = new TranslateTransform();
            fixPoint.X = (location.FeetX / StateManager.Current.MainMap.FeetX) * mapImage.Source.Width;
            fixPoint.Y = (location.FeetY / StateManager.Current.MainMap.FeetY) * mapImage.Source.Height;

            elGroup.Children.Add(antiScaler);
            elGroup.Children.Add(fixPoint);
            ml.RenderTransform = elGroup;
            this.LocationCanvas.Children.Add(ml);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Event handler for double click. Adds a pin to the map under the pointer.
 /// </summary>
 protected void MapDoubleClick(object sender, MouseEventArgs e)
 {
     Point panelPosition = e.GetPosition(this);
     double mapPositionX = (panelPosition.X - translateTransform.X) / scaler;
     double mapPositionY = (panelPosition.Y - translateTransform.Y) / scaler;
     double mapFractionX = mapPositionX / mapImage.Source.Width;
     double mapFractionY = mapPositionY / mapImage.Source.Height;
     uint feetX = (uint)(StateManager.Current.MainMap.FeetX * mapFractionX);
     uint feetY = (uint)(StateManager.Current.MainMap.FeetY * mapFractionY);
     Location l = new Location(feetX, feetY);
     this.AddPin(l);
 }