/// <summary>
        /// Handles the Go-To envelope request, actually not doing any Go-To action, but just
        /// recording this ins our history for resending later upon request.
        /// </summary>
        private void HandleGoToEnvelopeRequest(LiteGoToGeometryRequestMessage request, bool force)
        {
            if (request.StoreInHistory && request != null && !String.IsNullOrEmpty(request.Description) && request.Envelope != null)
            {
                // In case of default behavior (not forcing), remove any previous references to the same description
                // This is very loose, but the description is all the user sees so there is no way of distinguishing
                // between two similar descriptions anyway.
                if (!force)
                {
                    var description = request.Description;
                    for (int nr = RecentlyVisitedItems.Count - 1; nr >= 0; nr--)
                    {
                        if (String.Compare(description, RecentlyVisitedItems[nr].Description, StringComparison.Ordinal) == 0)
                        {
                            RecentlyVisitedItems.RemoveAt(nr);
                        }
                    }
                }

                // Insert the request
                RecentlyVisitedItems.Insert(0, request);

                if (RecentlyVisitedItems.Count > MaxRecentlyVisitedItems)
                {
                    // We have more than the allowed number of elements; get rid of the least
                    // recently visited item
                    RecentlyVisitedItems.RemoveAt(RecentlyVisitedItems.Count - 1);
                }
            }

            // Notify the world that our history has changed
            RaisePropertyChanged(HasRecentlyVisitedItemsPropertyName);
        }
        /// <summary>
        /// Sends the GoTo envelope request on the messsenger
        /// </summary>
        private async void SendGoToEnvelopeRequest(LiteGoToGeometryRequestMessage request)
        {
            RecentlyVisitedItemsIsVisible = false;

            // Allow the UI some breathing time
            await TaskEx.Yield();

            // Remove the request
            RecentlyVisitedItems.Remove(request);

            Messenger.Send(request);
        }
Пример #3
0
        /// <summary>
        /// A result has been selected in the GeoLocator
        /// </summary>
        void GeoLocatorViewModel_ResultActivated(GeoLocatorViewModel.GeoLocatorResultEventArgs resultArgs)
        {
            // A result has been found from the GeoLocator; we want to jump to it on the active map
            var address = resultArgs.Address;

            if (address != null && address.Envelope != null && !double.IsNaN(address.Envelope.CentreLeft.X))
            {
                var request = new LiteGoToGeometryRequestMessage(resultArgs.Source, address.Envelope, address.Description)
                {
                    DoHighlight    = true,
                    StoreInHistory = true
                };

                this.Messenger.Send(request);
            }
        }
Пример #4
0
        /// <summary>
        /// Handle an activation request for geometry; actually transforming this into a new Go-To request on the databus
        /// </summary>
        private void HandleGeometryActivation(object sender, Feature feature, FeatureFieldDescriptor featureFieldDescriptor, IFeatureGeometry geometry)
        {
            if (geometry != null)
            {
                var geometryField = featureFieldDescriptor as FeatureGeometryFieldDescriptor;
                var envelope      = geometry.Envelope;

                if (envelope != null && feature != null)
                {
                    var request = new LiteGoToGeometryRequestMessage(sender, new FeatureTargetGeometry(feature, geometryField, geometry))
                    {
                        DoHighlight    = true,
                        StoreInHistory = true
                    };

                    Messenger.Send(request);
                }
            }
        }
Пример #5
0
 /// <summary>
 /// A property of our Properties View Model has changed; ie, driving which records are to be exported/reported
 /// </summary>
 void Properties_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
 {
     if (e.PropertyName == LiteFeatureCollectionResultViewModelProperties.ExportReportElementsModePropertyName ||
         e.PropertyName == LiteFeatureCollectionResultViewModelProperties.ExportReportTrackModePropertyName)
     {
         // The properties that indicate which records are to be exported/reported have changed
         SetFeatureCollectionUsageFromHierarchy();
     }
     else if (e.PropertyName == LiteFeatureCollectionResultViewModelProperties.TrackSelectionInFeatureDetailsPropertyName)
     {
         // The Track Selection in Details has changed; in case this now is true, immediately send a request
         if (Properties.TrackSelectionInFeatureDetails && SelectedFeature != null)
         {
             // Let's immediately notify the world
             this.Messenger.Send(new LiteDisplayFeatureDetailsRequestMessage(this, this.SelectedFeature));
         }
     }
     else if (e.PropertyName == LiteFeatureCollectionResultViewModelProperties.TrackSelectionInMapPropertyName)
     {
         // The Track Selection in Map has changed; in case this now is true, immediately send a request
         if (Properties.TrackSelectionInMap && SelectedFeature != null)
         {
             // Send a request for jumping to (the envelope of) the selected feature
             var envelope = this.SelectedFeature.GetEnvelope();
             if (envelope != null)
             {
                 var request = new LiteGoToGeometryRequestMessage(this, envelope, SelectedFeature)
                 {
                     DoRocketJump = false
                 };
                 this.Messenger.Send(request);
             }
         }
     }
     else if (e.PropertyName == LiteFeatureCollectionResultViewModelProperties.HighlightSelectionInMapPropertyName)
     {
         // The Highlight Selection has changed; in case this now is true, immediately send a request
         if (Properties.HighlightSelectionInMap && SelectedFeature != null)
         {
             this.Messenger.Send(new LiteHighlightGeometryRequestMessage(this, SelectedFeature));
         }
     }
 }
 /// <summary>
 /// Handles the Go-To envelope request, actually not doing any Go-To action, but just
 /// recording this ins our history for resending later upon request
 /// </summary>
 private void HandleGoToEnvelopeRequest(LiteGoToGeometryRequestMessage request)
 {
     HandleGoToEnvelopeRequest(request, false);
 }