POST
|
Hi, My users complained that when they drew alot of polygons (about > 200) on the map, panning became painfully slow. Is this a normal behaviour or am I drawing wrongly? I'm just doing a normal graphics.add to my graphics layer. Thanks! shweekia
... View more
03-16-2012
12:02 AM
|
0
|
1
|
363
|
POST
|
Hi, It's ok, I managed to find a workaround. I'll just display an arrow symbol to point to the 1st index whenever on mouse over the polygon. Thanks for suggestions.
... View more
03-15-2012
11:58 PM
|
0
|
0
|
261
|
POST
|
Hi Kevin, I have the same NullReferenceException problem as you as you would have read from my post. I would like to share with you what I did. The following codes will help to catch the exception and not let the application crash. But of course the root of the problem still lies with the dll itself which only ESRI can solve. Heres what I did: In App.xaml, the registration of the event handler is initialized <Application x:Class="UnhandledExceptionHandler.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" StartupUri="Window1.xaml" Startup="Application_Startup" DispatcherUnhandledException="Application_DispatcherUnhandledException"> <Application.Resources> </Application.Resources> </Application> A method is added to App.xaml.cs which will handle this event. This is where the exception handling logic will be added. private void Application_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e) { //do whatever handling you want here //must set e.handled = true so that application can resume execution e.Handled = true; } Hopefully this works for you (temporary solution until v3 comes along) So far my users have not complained yet. Thanks
... View more
03-15-2012
05:15 PM
|
0
|
0
|
443
|
POST
|
Hi, Thanks for the suggestion. But adding a point on the 2nd layer will also mean that when if i try to move any points of my polygon on the 1st layer during edit, I have to manually keep track of the point on the 2nd layer and manually move it right? Wouldnt it be very troublesome? Thanks!
... View more
03-14-2012
07:22 PM
|
0
|
0
|
261
|
POST
|
Hi, Just wondering is there an easier way of highlighting a particular vertex of a polygon? I need the first vertex of a polygon to be highlighted so that user knows that's the 1st index. Do I have the only choice of having to add an additional point symbol on the first vertex to mimic a highlight? Doing this will also mean if I want to edit the polygon, my point symbol will also need to be constantly checked to "move" along with the polygon = additional checking codes. Thanks
... View more
03-14-2012
01:46 AM
|
0
|
3
|
623
|
POST
|
I am using polygons. I just realised that propertychanged will only be triggered AFTER I end the edit. I want it to be triggered during edits. So looks like I cant use propertychanged event afterall. And although an event has been triggered at EditGeometry.Action.GeometryMoved, it does not tells me the delta moved. Thanks!
... View more
02-02-2012
02:50 PM
|
0
|
0
|
230
|
POST
|
Hi Jennifer, I tried using the sample codes you provided but I realised that the update event does not fire when I perform a geometry move (move entire graphic). Similarly when I move the geometry, the editgeometry event is triggered but it does not tell me the delta moved(olditems and newitems are null). Is there any way I can get this delta or at the very least get an update event when I move the geometry or am I back to square one again? Thanks so much again.
... View more
02-01-2012
03:03 PM
|
0
|
0
|
230
|
POST
|
Hi Jennifer! Thanks for the sample! It's not quite what I want but I guess I can start from there. what I observed is that doing a StopEdit() and StartEdit() within the editgeometry handler will cause the app to crash so I took it out entirely. Hopefully the next release will allow the graphics to be updated real time during edits (i.e something like OnEditGeometry?). Thanks a million for your help so far!
... View more
01-10-2012
06:49 PM
|
0
|
0
|
487
|
POST
|
ok, I see what you mean. You are right , I have 2 maps that can edit and any edit on one map, I want reflected on the other map. I need to save the edits. I tried commenting out most of the codes but keep the part where I try to find the vertex that was updated MapPoint selectPoint = polyCol[nSelectIndex]; double dMinDiff = Math.Pow((selectPoint.X - e.OldItems[0].X), 2.0) + Math.Pow((selectPoint.Y - e.OldItems[0].Y), 2.0); dMinDiff = Math.Pow(dMinDiff, 0.5); for (int idxPt = 1; idxPt < polyCol.Count; idxPt++) { selectPoint = polyCol[idxPt]; double dCurrDiff = Math.Pow((selectPoint.X - e.OldItems[0].X), 2.0) + Math.Pow((selectPoint.Y - e.OldItems[0].Y), 2.0); dCurrDiff = Math.Pow(dCurrDiff, 0.5); if (dMinDiff > dCurrDiff) { dMinDiff = dCurrDiff; if (dMinDiff < 2) { nSelectIndex = idxPt; } } } it also crashes. But if I comment out everything in the editgeometry event, my app is ok( but that's not what i want) So Im assuming when during an edit i cannot try to access the geometry being edited else I risk running into editcancel? Can the other map call layer.Update() to re-draw the graphics instead of detecting what vertex was added/moved/removed? Sorry but I do not understand how I can do this. If I call an update, how do I know which vertex was added/moved/removed and the delta? Thanks so much for trying to help me solve it. I'm open to any suggestions / workaround.
... View more
01-08-2012
02:45 PM
|
0
|
0
|
487
|
POST
|
Hi Jennifer, Yes you are right, I am trying to get intermediate data during editing so that I can apply the same edits to another map on the application that has a similar polygon. My app has two maps (i.e. with 2 graphics layers) These polygons are referenced by their attributes id. Any edits applied to graphics layer of map 0, will need to be applied to graphics layer of map 1 (vice versa) I put a switch case in the e.Actions, for eg, when MoveVertex polyEdited = e.Graphic.Geometry as ESRI.ArcGIS.Client.Geometry.Polygon; if (polyEdited != null) { polyCol = polyEdited.Rings[0]; int nSelectIndex = 0; //to get which vertex is currently being edited MapPoint selectPoint = polyCol[nSelectIndex]; double dMinDiff = Math.Pow((selectPoint.X - e.OldItems[0].X), 2.0) + Math.Pow((selectPoint.Y - e.OldItems[0].Y), 2.0); dMinDiff = Math.Pow(dMinDiff, 0.5); for (int idxPt = 1; idxPt < polyCol.Count; idxPt++) { selectPoint = polyCol[idxPt]; double dCurrDiff = Math.Pow((selectPoint.X - e.OldItems[0].X), 2.0) + Math.Pow((selectPoint.Y - e.OldItems[0].Y), 2.0); dCurrDiff = Math.Pow(dCurrDiff, 0.5); if (dMinDiff > dCurrDiff) { dMinDiff = dCurrDiff; if (dMinDiff < 2) { nSelectIndex = idxPt; } } } double dXMoveOffset = e.NewItems[0].X - e.OldItems[0].X; double dYMoveOffset = e.NewItems[0].Y - e.OldItems[0].Y; if (nSelectIndex != -1) { if (rightImgParams.currRightGraphic.Attributes["id"] != null) { //retrieve the graphic from graphic layer of another map Graphic grap0 = GetGraphic(0, (UInt64)rightImgParams.currRightGraphic.Attributes["id"]); if (grap0 != null) { ESRI.ArcGIS.Client.Geometry.Polygon correspEdited = grap0.Geometry as ESRI.ArcGIS.Client.Geometry.Polygon; if (correspEdited != null) { //update the graphic from the other map ESRI.ArcGIS.Client.Geometry.PointCollection correspCol = correspEdited.Rings[0]; correspCol[nSelectIndex].X += dXMoveOffset; correspCol[nSelectIndex].Y += dYMoveOffset; if (nSelectIndex == 0) // must update the last vertice also { correspCol[correspCol.Count - 1].X = correspCol[nSelectIndex].X; correspCol[correspCol.Count - 1].Y = correspCol[nSelectIndex].Y; } } } } } //save the edits and restart the editing process rightImgParams.EditGeometry.StopEdit(); Graphic grap1 = GetGraphic(1, (UInt64)e.Graphic.Attributes["id"]); if (grap1 != null) { rightImgParams.EditGeometry.StartEdit(grap1); Graphic leftGraphic = GetGraphic(0, (UInt64)grap1.Attributes["id"]); if (leftGraphic != null) { leftImgParams.EditGeometry.StartEdit(leftGraphic); } } }// if (polyEdited != null) Is it because I'm trying to update the polygon of another graphic layer of another map? How can I avoid EditCancel? It seems that EditCancel will surely appear just before it crashes. Is there a beta 3.0 version for WPF version to try? I'm getting a little desperate because I need to deliver this prototype to users soon and it'll be embarassing if my app crashes, so any help is appreciated! thanks so much!
... View more
01-05-2012
07:52 PM
|
0
|
0
|
487
|
POST
|
Hi Jennifer, Thanks for replying. What I am trying to do is 1. start edit the polygon 2. in EditGeometry event handler, if e.action == AddVertex or MoveVertex, retrieve the edits done and apply the same edits to another existing polygon 3. call StopEdit() to save any changes 4. call StartEdit() again to continue the editing process I really cant pin point when it will crash but it's normally AddVertex->StopEdit->StartEdit->CancelEdit->crash. I'm suspecting something to do with canceledit? I know it's hard to help me debug when you do not have the full code, but maybe you just give me suggestions on where to start and I'll try to debug it again. the call stack: Object reference not set to an instance of an object. at ESRI.ArcGIS.Client.EditGeometry.UpdateVertexPosition(MapPoint pnt, Boolean isTransformPoint) at ESRI.ArcGIS.Client.EditGeometry.HandleElementMove(Point screenPoint, MapPoint mapPoint) at ESRI.ArcGIS.Client.EditGeometry.Map_MouseMove(Object sender, MouseEventArgs e) at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target) at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args) at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args) at System.Windows.Input.InputManager.ProcessStagingArea() at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport) at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel) Thanks!!!
... View more
01-03-2012
07:20 PM
|
0
|
0
|
487
|
POST
|
Hi Jennifer, I tried and it works beautifully. Thanks!
... View more
01-03-2012
04:01 PM
|
0
|
0
|
113
|
POST
|
hi I posted this question under WPF forum but no luck finding any response so try my luck in silverlight forum. I am using esri for WPF v2.3. When I use the EditGeometry, sometimes I experience a NullReferenceException and my app will crash. I managed to catch the exception in my App.cs and I can see in the call stack that it crashes at the point of EditGeometry.UpdateVertexPosition and EditGeometry.HandleElementMove and normally occur after EditGeometry.Action == EditCanceled (but I did not explicitly call EditCancel()) The exception is random and occurs on and off which is a headache. Can Esri developers shed some light on when this exception will occur? Thks!
... View more
01-02-2012
09:17 PM
|
0
|
1
|
633
|
POST
|
Hi, i using esri for WPF v2.3. When I use the EditGeometry, sometimes I experience a NullReferenceException and my app will crash. I cant seem to catch the exception to let my app exit gracefully and I cant seem to debug it because it has something to do with the esri dll. The most I can see in the call stack is it crashes at the point of EditGeometry.UpdateVertexPosition (i think it's a private function in the dll?) and normally occur after EditGeometry.Action == EditCanceled (but I did not explicitly call EditCancel()) The exception is random and occurs on and off which is a headache. Please help. Thanks shweekia
... View more
12-28-2011
05:23 PM
|
0
|
14
|
2612
|
POST
|
I am experiencing a strange effect. I have graphics drawn on my graphics layer. I use EditGeometry to edit my graphics. When I move my vertices during edits, I capture the editgeometry event e.Action. Because I need to get the most updated coordinates, I need to do a StopEdit() in order to commit the changes. But I want the user to be able to continue editing so immediately after StopEdit() I do a StartEdit(e.graphic) again. By doing this, my graphic seem to disappear every time a double click on it. It will reappear if I zoom out and in again (like a map refresh) If I comment out the StopEdit and StartEdit it will not disappear but its not my intended behavior to omit these 2 statements. Is there anything wrong with what I am doing or is there a map refresh function for me to call? Thanks
... View more
12-20-2011
11:55 PM
|
0
|
2
|
533
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|