void queryTask_ExecuteCompleted(object sender, QueryEventArgs e) { GraphicsLayer originalGraphicsLayer = MyMap.Layers["OriginalLineGraphicsLayer"] as GraphicsLayer; foreach (Graphic g in e.FeatureSet.Features) { g.Symbol = LayoutRoot.Resources["DefaultLineSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol; g.Geometry.SpatialReference = e.UserState as SpatialReference; originalGraphicsLayer.Graphics.Add(g); foreach (ESRI.ArcGIS.Client.Geometry.PointCollection pc in (g.Geometry as ESRI.ArcGIS.Client.Geometry.Polyline).Paths) { foreach (MapPoint point in pc) { Graphic vertice = new Graphic() { Symbol = LayoutRoot.Resources["DefaultMarkerSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol, Geometry = point }; originalGraphicsLayer.Graphics.Add(vertice); } } } GeneralizeButton.IsEnabled = true; }
public bool Request_Count(int id, IList <string> seq, SynchronizationContext ctx) { SynchronizationContext.SetSynchronizationContext(ctx); var query = new Query <int>(e => { if (e.Result >= seq.Count) { e.Cancel = true; e.Result = -1; } else if (seq[e.Result] == "success") { e.Cancel = true; } else { e.Result++; } }); var args = QueryEventArgs.Create(id); Assert.That(args.Query, Is.EqualTo(id)); Assert.That(args.Result, Is.EqualTo(0)); Assert.That(args.Cancel, Is.False); while (!args.Cancel) { query.Request(args); } return(args.Result != -1); }
private void OnQueryReceived(object data, QueryEventArgs e) { _robotIDb = e.Query.RobotId; // Do logic checking increment counters here. switch (_robotIDb) { case 1: QSCounter1++; break; case 2: QSCounter2++; break; case 3: QSCounter3++; break; case 4: QSCounter4++; break; default: Debug.Log("Invalid Robot ID. "); break; } }
public void OnQuery(object sender, QueryEventArgs args) { string path = Path.Combine(Tools.RootFolder, @"EK\Capture\Dicom\DicomToolKit\Test\Data\Mwl"); args.Records = new RecordCollection(path, true); args.Records.Load(); }
private void task_QueryComplete(object sender, QueryEventArgs args) { base.OnProgress(100); if (args.FeatureSet != null) { ESRI.ArcGIS.Client.Geometry.PointCollection points = new ESRI.ArcGIS.Client.Geometry.PointCollection(); foreach (Graphic g in args.FeatureSet.Features) { if (g.Geometry is ESRI.ArcGIS.Client.Geometry.MapPoint) { points.Add(g.Geometry as ESRI.ArcGIS.Client.Geometry.MapPoint); if (this.SpatialReference == null) { if (g.Geometry.SpatialReference != null) this.SpatialReference = g.Geometry.SpatialReference; } } } MapSpatialReference = SpatialReference; HeatMapPoints = points; OnLayerChanged(); } base.Initialize(); }
private void QueryTask_ExecuteCompleted(object sender, QueryEventArgs args) { if (args.FeatureSet == null) { return; } FeatureSet featureSet = args.FeatureSet; GraphicsLayer graphicsLayer = MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer; graphicsLayer.ClearGraphics(); if (featureSet != null && featureSet.Features.Count > 0) { foreach (Graphic feature in featureSet.Features) { ESRI.ArcGIS.Client.Graphic graphic = new ESRI.ArcGIS.Client.Graphic() { Geometry = feature.Geometry, Symbol = LayoutRoot.Resources["ParcelFillSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol }; graphicsLayer.Graphics.Add(graphic); } } graphicsLayer.Graphics.Add(_unsimplifiedGraphic); }
private void QueryTask_ExecuteCompleted(object sender, QueryEventArgs e) { if (ResultReady != null) { ResultReady(this, new QueryResultEventArgs(e.FeatureSet, this.QueryLayer)); } }
public virtual IEnumerable <object> GetAll(string sortColumn = "", string sortOrder = "") { var db = GetDb(); var query = new Sql().Select("*").From(_typeInfo.TableName); var a1 = new QueryEventArgs(_typeInfo.Type, _typeInfo.TableName, query, sortColumn, sortOrder, "", null); UIOMaticObjectService.OnBuildingQuery(a1); query = a1.Query; if (!this._config.DeletedColumnName.IsNullOrWhiteSpace()) { query.Append("WHERE " + this._config.DeletedColumnName + " = 0"); } if (!string.IsNullOrEmpty(sortColumn) && !string.IsNullOrEmpty(sortOrder)) { query.OrderBy(sortColumn + " " + sortOrder); } var a2 = new QueryEventArgs(_typeInfo.Type, _typeInfo.TableName, query, sortColumn, sortOrder, "", null); UIOMaticObjectService.OnBuiltQuery(a2); query = a2.Query; return(db.Fetch(_typeInfo.Type, query)); }
private void task_QueryComplete(object sender, QueryEventArgs args) { base.OnProgress(100); if (args.FeatureSet != null) { ESRI.ArcGIS.Client.Geometry.PointCollection points = new ESRI.ArcGIS.Client.Geometry.PointCollection(); foreach (Graphic g in args.FeatureSet.Features) { if (g.Geometry is ESRI.ArcGIS.Client.Geometry.MapPoint) { points.Add(g.Geometry as ESRI.ArcGIS.Client.Geometry.MapPoint); if (this.SpatialReference == null) { if (g.Geometry.SpatialReference != null) { this.SpatialReference = g.Geometry.SpatialReference; } } } } MapSpatialReference = SpatialReference; HeatMapPoints = points; OnLayerChanged(); } base.Initialize(); }
public static void OnBuiltQuery(QueryEventArgs args) { if (BuiltQuery != null) { BuiltQuery(Instance, args); } }
public bool Request(int id, IList <string> seq, SynchronizationContext ctx) { SynchronizationContext.SetSynchronizationContext(ctx); var index = 0; var query = new Query <int, string>(e => { if (e.Result == "success" || index >= seq.Count) { e.Cancel = true; } else { e.Result = seq[index++]; } }); var args = new QueryEventArgs <int, string>(id); Assert.That(args.Query, Is.EqualTo(id)); Assert.That(args.Result, Is.Null); Assert.That(args.Cancel, Is.False); while (!args.Cancel) { query.Request(args); } return(args.Result == "success"); }
public static void UploadQueryAnswer(object sender, QueryEventArgs eventArgs) { //var answerTime = System.DateTime.Now; eventArgs.Query.DepartureTime = MissionTimer.CurrentTime; int departure = (int)eventArgs.Query.DepartureTime; int answerTime = departure - (int)eventArgs.Query.ArrivalTime; Debug.Log("THIS IS THE ANSWER TIME " + answerTime); Debug.Log(string.Format("Sending Query Answer: QID: {0} Answer: {1} Time answered: {2}", eventArgs.Query.QueryId, eventArgs.Query.Response, answerTime)); // TODO Upload proper datetime. var responseDict = new Dictionary <string, int> { { "query_id", eventArgs.Query.QueryId }, { "robot_id", eventArgs.Query.RobotId }, { "response", eventArgs.Query.Response }, { "answerTime", answerTime } }; var responseJson = JsonConvert.SerializeObject(responseDict, Formatting.Indented); Debug.Log(responseJson); GcsSocket.Emit(ServerURL.SEND_ANSWER_QUERY, responseJson); }
void queryTaskPoint_ExecuteCompleted(object sender, QueryEventArgs args) { FeatureSet featureSet = args.FeatureSet; if (featureSet == null || featureSet.Features.Count < 1) { MessageBox.Show("No features returned from query"); return; } GraphicsLayer graphicsLayer = MyMap.Layers["MyPointGraphicsLayer"] as GraphicsLayer; foreach (Graphic graphic in args.FeatureSet.Features) { graphic.Symbol = LayoutRoot.Resources["YellowMarkerSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol; graphicsLayer.Graphics.Add(graphic); } if (featureSet.Features.Count == 1000) { DispatcherTimer UpdateTimer = new System.Windows.Threading.DispatcherTimer(); UpdateTimer.Interval = new TimeSpan(0, 0, 0, 0, 250); UpdateTimer.Tick += (evtsender, a) => { LoadPointGraphics(graphicsLayer.Graphics.Count, graphicsLayer.Graphics.Count + 1000); UpdateTimer.Stop(); }; UpdateTimer.Start(); } }
public void ResetEventArgs() { TransactionOpenArgs = null; TransactionPrecommitingArgs = null; TransactionCommitingArgs = null; TransactionCommitedArgs = null; TransactionRollbackingArgs = null; TransactionRollbackedArgs = null; PersistingArgs = null; PersistedArgs = null; ChangesCancelingArgs = null; ChangesCanceledArgs = null; EntityCreatedArgs = null; EntityRemoving = null; EntityRemoved = null; EntityFieldGettingArgs = null; EntityFieldValueGetArgs = null; EntityFieldValueSettingArgs = null; EntityFieldValueSetArgs = null; QueryExecuting = null; QueryExecuted = null; DbCommandExecuting = null; DbCommandExecuted = null; }
/* ----------------------------------------------------------------- */ /// /// WhenPasswordRequired /// /// <summary> /// パスワードの要求が発生した時に実行されるハンドラです。 /// </summary> /// /* ----------------------------------------------------------------- */ private void WhenPasswordRequired(QueryEventArgs <string> e) { e.Cancel = true; throw new ArgumentException(string.Format( Properties.Resources.MessagePassword, IO.Get(e.Query).Name )); }
private void DisplayTagQuestion(object sender, QueryEventArgs e) { _query = e.Query; _greenButton.gameObject.SetActive(true); _yellowButton.gameObject.SetActive(true); _redButton.gameObject.SetActive(true); _blackButton.gameObject.SetActive(true); }
void queryTask_ExecuteCompleted(object sender, QueryEventArgs e) { FeatureSet featureSet = e.FeatureSet; if (featureSet != null && featureSet.Features.Count > 0) { OutStatisticsDataGrid.ItemsSource = featureSet.Features; } }
void queryTask_ExecuteCompleted(object sender, QueryEventArgs e) { FeatureSet featureSet = e.FeatureSet; if (featureSet != null && featureSet.Features.Count > 0) { OutStatisticsListBox.ItemsSource = featureSet.Features; } }
void queryTask_ExecuteCompleted(object sender, QueryEventArgs e) { foreach (Graphic g in e.FeatureSet.Features) { g.Symbol = LayoutRoot.Resources["BlueFillSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol; g.Geometry.SpatialReference = MyMap.SpatialReference; parcelGraphicsLayer.Graphics.Add(g); } }
public void OnQuery(object sender, QueryEventArgs args) { args.Records = new RecordCollection(@".", true); args.Records.Load(); foreach (Elements record in args.Records) { record.Set(t.ScheduledProcedureStepSequence + t.ScheduledProcedureStepStartDate, DateTime.Now.ToString("YYYYMMdd")); } }
void qt_ExecuteCompleted(object sender, QueryEventArgs e) { #region Since featureset does not include layerdefinition, we would have to populate it with appropriate drawinginfo Dictionary<string, object> layerdef = new Dictionary<string, object>(); Dictionary<string, object> defdictionary = new Dictionary<string, object>() { { "id", 0 }, { "name", "Earthquakes from last 7 days" } }; Dictionary<string, object> renderer = new Dictionary<string, object>(); renderer.Add("type", "simple"); renderer.Add("style", "esriSMSCircle"); int[] color = new int[] { 255, 0, 0, 255 }; renderer.Add("color", color); renderer.Add("size", 4); int[] outlinecolor = new int[] { 0, 0, 0, 255 }; defdictionary.Add("drawingInfo", renderer); layerdef.Add("layerDefinition", defdictionary); #endregion //Add a FeatureCollection to operational layers FeatureCollection featureCollection = null; if (e.FeatureSet.Features.Count > 0) { var sublayer = new WebMapSubLayer(); sublayer.FeatureSet = e.FeatureSet; sublayer.AddCustomProperty("layerDefinition", layerdef); featureCollection = new FeatureCollection { SubLayers = new List<WebMapSubLayer> { sublayer } }; } if (featureCollection != null) operationLayers.Add(new WebMapLayer { FeatureCollection = featureCollection }); //Create a new webmap object and add base map and operational layers webmap = new WebMap() { BaseMap = basemap, OperationalLayers = operationLayers }; Document webmapdoc = new Document(); webmapdoc.GetMapCompleted += (a, b) => { if (b.Error == null) { b.Map.Extent = new ESRI.ArcGIS.Client.Geometry.Envelope(-20000000, 1100000, -3900000, 11000000); LayoutRoot.Children.Add(b.Map); } }; webmapdoc.GetMapAsync(webmap); }
void queryTask_ExecuteCompleted(object sender, QueryEventArgs e) { GraphicsLayer parcelGraphicsLayer = MyMap.Layers["ParcelsGraphicsLayer"] as GraphicsLayer; foreach (Graphic g in e.FeatureSet.Features) { g.Symbol = LayoutRoot.Resources["BlueFillSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol; parcelGraphicsLayer.Graphics.Add(g); } }
/* --------------------------------------------------------------------- */ /// /// Model_PasswordRequired /// /// <summary> /// パスワードの要求が発生した時に実行されるハンドラです。 /// </summary> /// /* --------------------------------------------------------------------- */ private void Model_PasswordRequired(object sender, QueryEventArgs <string, string> e) => SyncWait(() => { var dialog = Views.CreatePasswordView(e.Query); var result = dialog.ShowDialog(View); e.Cancel = (dialog.DialogResult == DialogResult.Cancel); if (!e.Cancel) { e.Result = dialog.Password; } });
private async void StateOnQueryExecuted(object sender, QueryEventArgs e) { var images = GetImages(); if (!_dontShowImagesWindow) { images.View.Show(Application.Panel, DockState.Document); } await images.LoadQueryAsync(e.Query); }
public void Create_QueryEventArgsSame(string query) { var args = QueryEventArgs.Create(query); Assert.That(args.Query, Is.EqualTo(query)); Assert.That(args.Result, Is.Null); Assert.That(args.Cancel, Is.False); args.Result = nameof(Create_QueryEventArgsSame); Assert.That(args.Result, Is.EqualTo(nameof(Create_QueryEventArgsSame))); }
/* ----------------------------------------------------------------- */ /// /// ShowPasswordView /// /// <summary> /// パスワード入力画面を表示します。 /// </summary> /// /// <param name="e">パスワード情報を保持するオブジェクト</param> /// <param name="confirm">確認用入力項目の有無</param> /// /* ----------------------------------------------------------------- */ public virtual void ShowPasswordView(QueryEventArgs <string, string> e, bool confirm) { if (confirm) { ShowPasswordConfirmView(e); } else { ShowPasswordView(e); } }
internal void ProcessMessageEvent(object sender, QueryEventArgs e) { // FIXME: how to handle event raise method? throw new NotImplementedException(); /* * MethodInfo mi = GetEventHandler (xqueryCommand); * if (mi != null) * mi.Invoke (xqueryCommand, new object [] {sender, e}); */ }
public void Invoke(string obj) { var src = new QueryValue <string>(obj); var dest = QueryEventArgs.Create("OnceQuery(T)"); src.Request(dest); Assert.That(src.Value, Is.EqualTo(obj)); Assert.That(dest.Result, Is.EqualTo(obj)); Assert.That(dest.Cancel, Is.False); }
public void Create_QueryEventArgs <T>(T query) { var args = new QueryEventArgs <T, string>(query); Assert.That(args.Query, Is.EqualTo(query)); Assert.That(args.Result, Is.Null); Assert.That(args.Cancel, Is.False); args.Result = nameof(Create_QueryEventArgs); Assert.That(args.Result, Is.EqualTo(nameof(Create_QueryEventArgs))); }
public void Invoke(int obj) { var src = new QueryValue <string, int>(obj); var dest = new QueryEventArgs <string, int>("OnceQuery(T, U)"); src.Request(dest); Assert.That(src.Value, Is.EqualTo(obj)); Assert.That(dest.Result, Is.EqualTo(obj)); Assert.That(dest.Cancel, Is.False); }
/* ----------------------------------------------------------------- */ /// /// OnPasswordRequired /// /// <summary> /// パスワードが要求された時に実行されるハンドラです。 /// </summary> /// /// <remarks> /// イベントハンドラが設定されていない場合は、無限ループを防ぐ /// ために操作をキャンセルします。 /// </remarks> /// /* ----------------------------------------------------------------- */ protected virtual void OnPasswordRequired(QueryEventArgs <string> e) { if (PasswordRequired != null) { PasswordRequired(this, e); } else { e.Cancel = true; } }
public void LoadFromIDatabase(QueryEventArgs args) { var uc = new ucWorkspace(); var tab = new TabPage("Workspace " + (tabMain.TabPages.Count + 1).ToString()); uc.Dock = DockStyle.Fill; tab.Controls.Add(uc); tabMain.TabPages.Add(tab); tabMain.SelectedTab = tab; uc.LoadFromIDatabase(args); }
/* ----------------------------------------------------------------- */ /// /// ShowPasswordConfirmView /// /// <summary> /// 確認項目付パスワード入力画面を表示します。 /// </summary> /// /// <param name="e">パスワード情報を保持するオブジェクト</param> /// /* ----------------------------------------------------------------- */ private void ShowPasswordConfirmView(QueryEventArgs <string, string> e) { using (var view = new PasswordConfirmForm()) { view.StartPosition = FormStartPosition.CenterParent; e.Cancel = view.ShowDialog() == DialogResult.Cancel; if (!e.Cancel) { e.Result = view.Password; } } }
void queryTask_ExecuteCompleted(object sender, QueryEventArgs args) { FeatureSet featureSet = args.FeatureSet; if (featureSet == null || featureSet.Features.Count < 1) { MessageBox.Show("No features returned from query"); return; } GraphicsLayer graphicsLayer = MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer; foreach (Graphic graphic in featureSet.Features) graphicsLayer.Graphics.Add(graphic); }
void queryTask_ExecuteCompleted(object sender, QueryEventArgs args) { FeatureSet featureSet = args.FeatureSet; if (featureSet == null || featureSet.Features.Count < 1) { MessageBox.Show("No features returned from query"); return; } GraphicsLayer graphicsLayer = MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer; foreach (Graphic graphic in featureSet.Features) { graphic.Symbol = LayoutRoot.Resources["MediumMarkerSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol; graphicsLayer.Graphics.Add(graphic); } }
private void QueryTask_ExecuteCompleted( object sender, QueryEventArgs args ) { ObservableCollection<object> records = LayerTypeProvider.CreateLayerRecords( LayerType, args.FeatureSet.Features ); layerDataGrid.Columns.Clear(); int count = 0; foreach( FieldMetadata entry in LayerMetadata.Fields ) { if( entry.Type != "esriFieldTypeGeometry" ) { layerDataGrid.Columns.Add( new DataGridTextColumn { Header = entry.Alias, Binding = new Binding( entry.Name ) } ); count++; if( count >= 10 ) break; } } layerDataGrid.ItemsSource = records; }
private void QueryTask_ExecuteCompleted(object sender, QueryEventArgs args) { if (_originPoint == null) return; double searchDistance = (double) args.UserState; double x = _originPoint.X; double y = _originPoint.Y; Int32 id = 0; if (args.FeatureSet.Features.Count > 0) foreach (Graphic feature in args.FeatureSet.Features) { // test type of feature, and test it's end points. if (feature.Geometry is ESRI.ArcGIS.Client.Geometry.Polygon) { ESRI.ArcGIS.Client.Geometry.Polygon featurePolygon = feature.Geometry as ESRI.ArcGIS.Client.Geometry.Polygon; foreach (ESRI.ArcGIS.Client.Geometry.PointCollection pointCollection in featurePolygon.Rings) AddLineSegmentToCache(pointCollection, x, y, searchDistance, ref id); } else if (feature.Geometry is ESRI.ArcGIS.Client.Geometry.Polyline) { ESRI.ArcGIS.Client.Geometry.Polyline featurePolyline = feature.Geometry as ESRI.ArcGIS.Client.Geometry.Polyline; foreach (ESRI.ArcGIS.Client.Geometry.PointCollection pointCollection in featurePolyline.Paths) AddLineSegmentToCache(pointCollection, x, y, searchDistance, ref id); } else if (feature.Geometry is ESRI.ArcGIS.Client.Geometry.MapPoint) { ESRI.ArcGIS.Client.Geometry.MapPoint featurePoint = feature.Geometry as ESRI.ArcGIS.Client.Geometry.MapPoint; double distance = GeometryUtil.LineLength(x, y, featurePoint); if (distance < searchDistance) _snapObjects[id++] = feature.Geometry; } } System.Diagnostics.Debug.WriteLine("Async: Number of objects cached: " + args.FeatureSet.Features.Count.ToString()); CalculateAndAddLineGraphics(); // We need to redraw, so we get the right snap marker }
void queryTask_ExecuteCompleted(object sender, QueryEventArgs e) { foreach (Graphic g in e.FeatureSet.Features) { g.Symbol = LayoutRoot.Resources["BlueFillSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol; g.Geometry.SpatialReference = MyMap.SpatialReference; parcelGraphicsLayer.Graphics.Add(g); } MyDrawObject.IsEnabled = true; }
void myQueryTask_ExecuteCompleted(object sender, QueryEventArgs queryArgs) { if (queryArgs.FeatureSet == null) return; FeatureSet resultFeatureSet = queryArgs.FeatureSet; ESRI.ArcGIS.Client.GraphicsLayer graphicsLayer = MyMap.Layers["MyGraphicsLayer"] as ESRI.ArcGIS.Client.GraphicsLayer; if (resultFeatureSet != null && resultFeatureSet.Features.Count > 0) { foreach (ESRI.ArcGIS.Client.Graphic graphicFeature in resultFeatureSet.Features) { graphicFeature.Symbol = LayoutRoot.Resources["TransparentFillSymbol"] as Symbol; graphicsLayer.Graphics.Add(graphicFeature); } } }
/* ****** Identify using Query Service ****** */ private void QueryIdentifyTask_ExecuteCompleted(object sender, QueryEventArgs args) { QueryItem queryItem = args.UserState as QueryItem; if (queryItem.Index == 0) { IdentifyComboBox.Items.Clear(); _layersIdentified.Clear(); IdentifyDetailsDataGrid.ItemsSource = null; } // display search results for this layers query. if (args.FeatureSet.Features.Count > 0) { foreach (Graphic feature in args.FeatureSet.Features) { string title = queryItem.IdentifyLayerName; feature.Attributes.Remove("Shape"); feature.Attributes.Remove("OBJECTID"); _dataItems.Add(new DataItem() { Title = title, Data = feature.Attributes }); IdentifyComboBox.Items.Add(title); if (_activeIdentifyLayer == title) queryItem.ActiveLayer = _layersIdentified.Count; _layersIdentified.Add(title); } } if (queryItem.Next()) // this increments the internal index { Query query = new ESRI.ArcGIS.Client.Tasks.Query(); query.SpatialRelationship = SpatialRelationship.esriSpatialRelIntersects; query.Geometry = queryItem.BufferedPoint; query.OutFields.AddRange(new string[] { "*" }); QueryTask queryTask = new QueryTask(queryItem.IdentifyLayerUrl); queryTask.ExecuteCompleted += QueryIdentifyTask_ExecuteCompleted; queryTask.Failed += QueryIdentifyTask_Failed; queryTask.ExecuteAsync(query, queryItem); } else // We are done with all our queries, display the result. { IdentifyComboBox.SelectedIndex = queryItem.ActiveLayer; Visibility = System.Windows.Visibility.Visible; if ((_dataItems == null) || (_dataItems.Count == 0)) { NoResult.Visibility = Visibility.Visible; Results.Visibility = Visibility.Collapsed; } else { NoResult.Visibility = Visibility.Collapsed; Results.Visibility = Visibility.Visible; } } }
private void QueryTask_ExecuteCompleted(object sender, QueryEventArgs args) { if (args.FeatureSet == null) return; FeatureSet featureSet = args.FeatureSet; GraphicsLayer graphicsLayer = MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer; graphicsLayer.Graphics.Clear(); if (featureSet != null && featureSet.Features.Count > 0) { foreach (Graphic feature in featureSet.Features) { ESRI.ArcGIS.Client.Graphic graphic = new ESRI.ArcGIS.Client.Graphic() { Geometry = feature.Geometry, Symbol = LayoutRoot.Resources["ParcelFillSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol }; graphicsLayer.Graphics.Add(graphic); } } graphicsLayer.Graphics.Add(_unsimplifiedGraphic); }
/// <summary> /// Query task is complete, send an event to the caller with the result in the event argument. /// </summary> /// <param name="sender"></param> /// <param name="args"></param> public void AttributeQueryTask_ExecuteCompleted(object sender, QueryEventArgs args) { try { FeatureSet featureSet = args.FeatureSet; int iD = (int)args.UserState; ResultsEventArgs eventArgs = new ResultsEventArgs(featureSet, iD); OnFinishedAttributeQuery(eventArgs); } catch (Exception ex) { messageBoxCustom.Show(String.Format("AttributeQueryTask_ExecuteCompleted-{0}", ex.Message), GisTexts.SevereError, MessageBoxCustomEnum.MessageBoxButtonCustom.Ok); } }
void OnQueryStarted(object sender, QueryEventArgs args) { _activationCount = 0; _watch.Start(); }
void queryTaskPolygon_ExecuteCompleted(object sender, QueryEventArgs args) { FeatureSet featureSet = args.FeatureSet; if (featureSet == null || featureSet.Features.Count < 1) { MessageBox.Show("No features returned from query"); return; } GraphicsLayer graphicsLayer = MyMap.Layers["MyPolygonGraphicsLayer"] as GraphicsLayer; Random random = new Random(); // Random switch between class breaks and unique value renderers if (random.Next(0, 2) == 0) { ClassBreaksRenderer classBreakRenderer = new ClassBreaksRenderer(); classBreakRenderer.Field = "POP2000"; int classCount = 6; List<double> valueList = new List<double>(); foreach (Graphic graphic in args.FeatureSet.Features) { graphicsLayer.Graphics.Add(graphic); valueList.Add((int)graphic.Attributes[classBreakRenderer.Field]); } // LINQ IEnumerable<double> valueEnumerator = from aValue in valueList orderby aValue select aValue; int increment = Convert.ToInt32(Math.Ceiling(args.FeatureSet.Features.Count / classCount)); int rgbFactor = 255 / classCount; int j = 255; for (int i = increment; i < valueList.Count; i += increment) { ClassBreakInfo classBreakInfo = new ClassBreakInfo(); if (i == increment) classBreakInfo.MinimumValue = 0; else classBreakInfo.MinimumValue = valueEnumerator.ElementAt(i - increment); classBreakInfo.MaximumValue = valueEnumerator.ElementAt(i); SimpleFillSymbol symbol = new SimpleFillSymbol() { Fill = new SolidColorBrush(Color.FromArgb(192, (byte)j, (byte)j, (byte)j)), BorderBrush = new SolidColorBrush(Colors.Transparent), BorderThickness = 1 }; classBreakInfo.Symbol = symbol; classBreakRenderer.Classes.Add(classBreakInfo); j = j - rgbFactor; } // Set maximum value for largest class break classBreakRenderer.Classes[classBreakRenderer.Classes.Count - 1].MaximumValue = valueEnumerator.ElementAt(valueList.Count - 1) + 1; graphicsLayer.Renderer = classBreakRenderer; } else { UniqueValueRenderer uniqueValueRenderer = new UniqueValueRenderer(); uniqueValueRenderer.DefaultSymbol = LayoutRoot.Resources["RedFillSymbol"] as Symbol; uniqueValueRenderer.Field = "STATE_NAME"; foreach (Graphic graphic in args.FeatureSet.Features) { graphicsLayer.Graphics.Add(graphic); UniqueValueInfo uniqueValueInfo = new UniqueValueInfo(); SimpleFillSymbol symbol = new SimpleFillSymbol() { Fill = new SolidColorBrush(Color.FromArgb(192, (byte)random.Next(0, 255), (byte)random.Next(0, 255), (byte)random.Next(0, 255))), BorderBrush = new SolidColorBrush(Colors.Transparent), BorderThickness = 1 }; uniqueValueInfo.Symbol = symbol; uniqueValueInfo.Value = graphic.Attributes["STATE_NAME"]; uniqueValueRenderer.Infos.Add(uniqueValueInfo); } graphicsLayer.Renderer = uniqueValueRenderer; } }
void OnQueryFinished(object sender, QueryEventArgs args) { _watch.Stop(); }
private void QueryTaskExecuteCompleted(object sender, QueryEventArgs args) { QueryCompleted(args.FeatureSet.Features.Count, (QueryType) args.UserState); }
public UIOMaticPagedResult GetPaged(string typeName, int itemsPerPage, int pageNumber, string sortColumn, string sortOrder, string searchTerm) { var currentType = Type.GetType(typeName); var tableName = (TableNameAttribute)Attribute.GetCustomAttribute(currentType, typeof(TableNameAttribute)); var uioMaticAttri = (UIOMaticAttribute)Attribute.GetCustomAttribute(currentType, typeof(UIOMaticAttribute)); var db = (Database)DatabaseContext.Database; if (!string.IsNullOrEmpty(uioMaticAttri.ConnectionStringName)) db = new Database(uioMaticAttri.ConnectionStringName); var query = new Sql().Select("*").From(tableName.Value); EventHandler<QueryEventArgs> tmp = BuildingQuery; if (tmp != null) tmp(this, new QueryEventArgs(currentType,tableName.Value, query,sortColumn,sortOrder,searchTerm)); if (!string.IsNullOrEmpty(searchTerm)) { int c = 0; foreach (var property in currentType.GetProperties()) { var attris = property.GetCustomAttributes(); if (!attris.Any(x=>x.GetType() == typeof(IgnoreAttribute))) { string before = "WHERE"; if (c > 0) before = "OR"; var columnAttri = attris.Where(x => x.GetType() == typeof(ColumnAttribute)); var columnName = property.Name; if (columnAttri.Any()) columnName = ((ColumnAttribute)columnAttri.FirstOrDefault()).Name; query.Append(before + " [" + columnName + "] like @0", "%" + searchTerm + "%"); c++; } } } if (!string.IsNullOrEmpty(sortColumn) && !string.IsNullOrEmpty(sortOrder)) query.OrderBy(sortColumn + " " + sortOrder); else if(!string.IsNullOrEmpty(uioMaticAttri.SortColumn) && !string.IsNullOrEmpty(uioMaticAttri.SortOrder)) { query.OrderBy(uioMaticAttri.SortColumn + " " + uioMaticAttri.SortOrder); } else { var primaryKeyColum = "id"; var primKeyAttri = currentType.GetCustomAttributes().Where(x => x.GetType() == typeof(PrimaryKeyAttribute)); if (primKeyAttri.Any()) primaryKeyColum = ((PrimaryKeyAttribute)primKeyAttri.First()).Value; foreach (var property in currentType.GetProperties()) { var keyAttri = property.GetCustomAttributes().Where(x => x.GetType() == typeof(PrimaryKeyColumnAttribute)); if (keyAttri.Any()) primaryKeyColum = property.Name; } query.OrderBy(primaryKeyColum + " asc"); } var temp = BuildedQuery; var qea = new QueryEventArgs(currentType, tableName.Value, query,sortColumn,sortOrder,searchTerm); if (temp != null) temp(this, qea); var p = db.Page<dynamic>(pageNumber, itemsPerPage, qea.Query); var result = new UIOMaticPagedResult { CurrentPage = p.CurrentPage, ItemsPerPage = p.ItemsPerPage, TotalItems = p.TotalItems, TotalPages = p.TotalPages }; var items = new List<object>(); foreach (dynamic item in p.Items) { // get settable public properties of the type var props = currentType.GetProperties(BindingFlags.Public | BindingFlags.Instance) .Where(x => x.GetSetMethod() != null); // create an instance of the type var obj = Activator.CreateInstance(currentType); // set property values using reflection var values = (IDictionary<string, object>)item; foreach (var prop in props) { var columnAttri = prop.GetCustomAttributes().Where(x => x.GetType() == typeof(ColumnAttribute)); var propName = prop.Name; if (columnAttri.Any()) propName = ((ColumnAttribute)columnAttri.FirstOrDefault()).Name; if(values.ContainsKey(propName)) prop.SetValue(obj, values[propName]); } items.Add(obj); } result.Items = items; return result; }
private void QueryTask_ExecuteCompleted(object sender, QueryEventArgs args) { if (args.FeatureSet.Features.Count < 1) { MessageBox.Show("No features found"); return; } foreach (Graphic selectedGraphic in args.FeatureSet.Features) { selectedGraphic.Symbol = LayoutRoot.Resources["ParcelSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol; _resultsGraphicsLayer.Graphics.Add(selectedGraphic); } }