protected virtual void Initialize() { this.ShapeType = VEShapeType.Pushpin; this.Button = null; this.ParentPushPin = null; this.previousCameraAltitude = 0; this.Visibility = Visibility.Collapsed; this.Opacity = 0; this.currentState = VEPushPinState.Hidden; }
void showClock_Completed(object sender, EventArgs e) { currentState = VEPushPinState.Visible; this.Opacity = this.MaxOpacity; }
void hideClock_Completed(object sender, EventArgs e) { this.Visibility = Visibility.Collapsed; currentState = VEPushPinState.Hidden; this.Opacity = 0.0; }
public override Point?UpdatePosition(VEMap map) { if (this.Map != map) { map.AddRegisteredPosition(this, DisplayLatLong); isNewPin = false; } base.UpdatePosition(map); VEPushPinAltitudeEvent altEvent; bool isVisible; Point?anchorPosition = GetPosition(DisplayLatLong, out altEvent, out isVisible); if (isVisible) { this.SetValue(VEPushPin.VisibilityProperty, Visibility.Visible); //If transitioning from invisible if (currentState != VEPushPinState.Visible && currentState != VEPushPinState.FadingIn) { OnShow(); AnimationClock showClock = AnimateUtility.AnimateElementDouble(this, VEPushPin.OpacityProperty, 1, 0, 1); showClock.Completed += new EventHandler(showClock_Completed); currentState = VEPushPinState.FadingIn; //If transitioning and has a parent if (this.ParentPushPin != null && (altEvent == VEPushPinAltitudeEvent.TransitionIntoUpperRange)) { this.DisplayLatitude = this.ParentPushPin.Latitude; this.DisplayLongitude = this.ParentPushPin.Longitude; } if (this.DisplayLatitude != this.Latitude || this.DisplayLongitude != this.Longitude) { AnimateUtility.AnimateElementDouble(this, VEPushPin.DisplayLatitudeProperty, this.Latitude, 0, 1); AnimateUtility.AnimateElementDouble(this, VEPushPin.DisplayLongitudeProperty, this.Longitude, 0, 1); anchorPosition = GetPosition(DisplayLatLong); } } } else { //If transitioning from Visible if (currentState != VEPushPinState.Hidden && currentState != VEPushPinState.FadingOut) { OnHide(); AnimationClock hideClock = AnimateUtility.AnimateElementDouble(this, VEPushPin.OpacityProperty, 0, 0, 1); hideClock.Completed += new EventHandler(hideClock_Completed); currentState = VEPushPinState.FadingOut; //If transitioning and has a parent if (this.ParentPushPin != null && (altEvent == VEPushPinAltitudeEvent.TransitionAboveUpperRange)) { AnimateUtility.AnimateElementDouble(this, VEPushPin.DisplayLatitudeProperty, this.ParentPushPin.Latitude, 0, 1); AnimateUtility.AnimateElementDouble(this, VEPushPin.DisplayLongitudeProperty, this.ParentPushPin.Longitude, 0, 1); anchorPosition = GetPosition(DisplayLatLong); } else { //Not animating, just hide immediately //this.Visibility = Visibility.Collapsed; } } } //Update the calculated position if (anchorPosition == null || !map.IsMapLoaded) { this.Visibility = Visibility.Collapsed; this.Opacity = 0; this.currentState = VEPushPinState.Hidden; return(null); } if (!this.IsMeasureValid) { this.Opacity = 0; this.currentState = VEPushPinState.Hidden; return(null); } Point anchorOffset = GetAnchorOffset(); double displayLeft = anchorPosition.Value.X - anchorOffset.X; double displayTop = anchorPosition.Value.Y - anchorOffset.Y; return(new Point(displayLeft, displayTop)); }