POST
|
Hello. I'm trying to figure out some strange behavior I'm seeing with the old WPF API (not the new Engine), when initializing an ArcGISDynamicMapServiceLayer with an invalid URL. As part of my tests, I tried configuring an invalid GIS Server URI for my layer, while handling the InitializationFailed event to catch the exception:
_dynamicBaseLayer = new ArcGISDynamicMapServiceLayer();
_dynamicBaseLayer.InitializationFailed += (sender, args) =>
{
var baseLayer = sender as ArcGISDynamicMapServiceLayer;
if (_items.Contains(baseLayer)) // this is my LayerCollection
_items.Remove(baseLayer);
_notificationService.ShowDialog("Error loading layer");
_logger.Error("Error loading base map layer, baseLayer.InitializationFailure);
};
_dynamicBaseLayer.Url = BaseLayerUrl;
_items.Add(_dynamicBaseLayer);
When I run, the InitializationFailed event is indeed raised and caught, and my error logged and my dialog displayed. But there is also another thread running that throws an exception which goes unhandled, and reaches my application root and crashes, with this stacktrace: System.Net.WebException: The remote name could not be resolved: 'my_invalid_server_url' at ESRI.ArcGIS.Client.Layer.OnInitializationFailed(EventArgs e) at ESRI.ArcGIS.Client.Layer.Initialize() at ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer.<>n__FabricatedMethod19() at ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer.<>c__DisplayClass17.<MapServiceInfoInitFailed>b__15() at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler) This is annoying, since this occurs in a background thread, in an anonymous method, where I can't catch and handle it except as part of the whole application's UnhandledExceptionHandler. I found this old thread that seems to be very similar, and it's the reason I tried to remove the layer from the LayerCollection on error, but it still doesn't seem to help, and I get my own dialog in addition to the unhandled exception.
... View more
05-17-2012
12:16 AM
|
0
|
1
|
2733
|
POST
|
I have a esri map with a basic ArcGISTiledMapServiceLayer and a graphics layer. I want to change the size of picturesymbols in my graphics layer based on zoom level. So how do i go about capturing the Zoom event of the map either by using mouse or the navigation control ? Do i just handle ExtentChanged on the map and check if scale is different than previous value? Is it even the right approach? Or is there a better way I searched for quite some time, but all examples I see are Web or Flex or SilverLight and the events / methods mentioned therein are not exactly applicable to me since I am on strictly a WPF app. Hence asking. Appreciate your help. I don't know what the official way is, but that's what I did when I wanted to implement an undo mechanism for zoom/pan. I caught the ExtentChanged event and stored the Extendenvelope for each change. I think that's the best way to do what you're trying to do.
... View more
04-19-2012
04:05 AM
|
0
|
0
|
288
|
POST
|
Hi there. I'm trying to understand the way the WPF Map control accesses the server data, and see why I'm getting hangs and timeouts on access. Here's the scenario: I have a Map control linked to an ArcGisDynamicMapLayer and several FeatureLayers, all set to Load On Demand from an ArcGis server. When I scroll, pan, or zoom, there's I can see the map rendering the new extent every time. That's fine. I also have some codebehind code that handles right-clicks and right-click-drags on the map. If the user right-clicks, I run a QueryTask against the geometry to see what entities are in the given area. This is run against the same layers as are displayed on the map (I often have overlapping entities, and sometimes I want them all). Now, I hit a race condition. If, when I call my QueryTask, the Map control hasn't finished rendering yet, it will usually hang for 10-20 seconds, then give me a timeout error/communication failure. The whole UI is frozen for the duration, but after it's over I can keep working. If I wait for the rendering to complete before right-clicking, it works fine. Does this scenario make sense? Is there a way to ensure the QueryTask runs concurrently with the Map control's rendering? Is this a client-side or server-side issue? Thanks for your help, Avner Shahar-Kashtan
... View more
04-18-2012
06:38 AM
|
0
|
0
|
470
|
POST
|
Hey there. I've a button on my map that invokes a MeasureAction in PolyLine mode - each click starts a new line starting from the current position, with the line length displayed alongside. One problem, though: if I click on the map to start a new line, but don't move the mouse, the MeasureAction shows "NaN" for the line length (you'll have to trust me that the screenshot is showing the Hebrew for "Not a Number". :)). While it's true that a line I haven't extended yet doesn't have a length, I think NaN is a really unclear thing to show a user. I would like to change it to a 0, or even not show the length at all until there's a valid value for it. [ATTACH=CONFIG]13093[/ATTACH] I poked around in the MeasureAction documentation, but couldn't find any extensibility/templating hooks like there are in other controls, to allow me to control the presentation. Is there a way to do so with today's 2.4 API release?
... View more
03-29-2012
12:56 AM
|
0
|
0
|
1425
|
POST
|
We ran into the same problems building ArcGIS Explorer Online with the ArcGIS Silverlight API, and most recently with the ArcGIS Viewer for Windows and the WPF API. I'm at the DevSummit this week (and actually doing a session on MVVM) so if you're around I'd love to talk with you about it. When I have some spare cycles I'll put together some thoughts on how we've approached MVVM and the Map control and post it back to this thread. -Jeff That would be wonderful. I've been going through the same problems that others here have trying to force the WPF API into the MVVM mindset, and I have to admit that my solution was to be more flexible with my MVVMness - my MapView class has rather a lot of logic in it, unfortunately, with all of the map-specific functionality (selection, zoom/pan, etc) handled in the View, while the MapViewModel mostly handles bringing in the Layers and interacting with other parts of the system. It's not ideal, but it works. I'd love to hear a good write-up of the ups and downs of MVVM with the ArcGIS APIs.
... View more
03-27-2012
12:38 AM
|
0
|
0
|
790
|
POST
|
I'm pretty sure your example is missing some parts - you have the LabelText property defined, but not the rest of them, from Symbol to Size to LabelStyle. This is what I did... public class PlotObjectSymbol : ESRI.ArcGIS.Client.Symbols.MarkerSymbol
{
public PlotObjectSymbol()
{
string template =
@"<ControlTemplate xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation""
xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml"" >
<Canvas>
<Rectangle Fill=""{Binding Symbol.Symbol}"" Width=""{Binding Symbol.Size}"" Height=""{Binding Symbol.Size}"" />
<TextBlock
Canvas.Top=""{Binding Symbol.Size}""
Text=""{Binding Symbol.LabelText}""
Style=""{Binding Symbol.LabelStyle}"" />
</Canvas>
</ControlTemplate>";
System.IO.MemoryStream templateStream = new System.IO.MemoryStream(System.Text.UTF8Encoding.Default.GetBytes(template));
ControlTemplate = System.Windows.Markup.XamlReader.Load(templateStream) as ControlTemplate;
}
#region LabelText Property
public string LabelText
{
get { return (string)base.GetValue(LabelTextProperty); }
set { base.SetValue(LabelTextProperty, value); }
}
public static DependencyProperty LabelTextProperty = DependencyProperty.Register("LabelText", typeof(string), typeof(PlotObjectSymbol), new UIPropertyMetadata(""));
#endregion
...
I just could not figure out how to center the text. I'm not a WPF guru.
... View more
02-27-2012
04:07 AM
|
0
|
1
|
717
|
POST
|
You can use a GraphicsLayer on top of your FeatureLayer to hold the label. I think that's a rather cumbersome method. If I want to control visibility of specific layers, it means I need to add a GraphicsLayer for each layer separately, each with that layers' labels. If I want to hide a layer, I need to hide its complementary GraphicsLayer as well. If I move a symbol around, I need to locate its corresponding TextSymbol label on a different layer and move that too. This seems to be a lot less elegant than just adding the label as part of the symbol itself. Ideally, I'd want to have the label rendered automatically, but it seems FeatureLayers don't support that. 😞
... View more
02-23-2012
03:39 AM
|
0
|
0
|
717
|
POST
|
I'm trying to develop a CompositeSymbol to display on the WPF map control, to add a text label to a PictureMarkerSymbol. I'm using a FeatureLayer, so my server-defined labels aren't defined (the layer is stored in an MXD on an ArcGIS 10 server). Since I couldn't find a preexisting Symbol that can do that, I'm thinking of writing a custom class - LabeledMarkerSymbol (derived from MarkerSymbol) which receives a MarkerSymbol in its constructor, then edits its ControlTemplate to add a new text label. My question is: is there a better way to do this? Is there a CompositeSymbol object that can receive a MarkerSymbol and a TextSymbol and render them together? Or do I just tear into the ControlTemplate myself?
... View more
02-14-2012
10:45 PM
|
1
|
6
|
3925
|
POST
|
Good morning. I have an ArcGIS 10.0 server that defines several feature layers. In my WPF application, I want to add labels on the map for the feature layers, the same way I can in the ArcClient. From previous topics such as this I gather than the WPF control doesn't support this out of the box, so I tried to implement it myself: I catch each layer's UpdateComplete event, after the graphics are all loaded. I then send the list of graphics to the GeometryServer using the GeometryTask's LabelPoint service, receiving a list of points. I then create a new TextSymbol for each point, settings its text to the original graphic's DisplayField's content. I then add the LabelPoint I received into the layer's Graphics collection. For some reason, though, nothing comes up. No text. No symbols. No errors either, just nothing on the map. I tried calling Refresh() on the FeatureLayer, but that didn't work either. Am I going about this wrong? Is there a simpler method that I missed?
... View more
09-01-2011
05:20 AM
|
0
|
1
|
1595
|
POST
|
Hello, I'm trying to replicate the behavior of ArcClient, where layers are automatically hidden or shown based on the current zoom level/map scale. I'm getting the layers via the SOAP web service, and get the MinScale and MaxScale values. The WPF FeatureLayer objects, though, only contain MinimumResolution/MaximumResolution properties, which aren't directly mappable to MinScale/MaxScale. Some googling led me to try adding the current display DPI into the equation, but even if I do, I can't figure out how to map between Scale and Resolution. Can anyone help me out here? Thanks, Avner
... View more
08-30-2011
01:59 AM
|
0
|
2
|
3219
|
POST
|
There is GraphicsLayer/FeatureLayer.MouseLeftButtonDown and Map.MouseClick. So the FeatureLayer gives me only MouseDown events. The Map can give me a Click, but then I have to manually check the feature layers to see which one was clicked. And neither give me a DoubleClick event, since the Map's DoubleClick is a generic WPF event, not an ESRI event, so I don't get the MapPoint's real location, and so I have to massage these different events together to get the functionality I want, which is a shame. It'd be great if this functionality was added to newer versions of the API. Thanks, Avner
... View more
08-30-2011
12:15 AM
|
0
|
0
|
364
|
POST
|
Good morning. Is there an established, well-tested way to capture double-click events on Feature Layers on an esri:Map instance? The FeatureLayer object exposes ButtonDown and ButtonUp events, but no Click event, and certainly no DoubleClick. Is there a better way to handle click events other than catching both MouseDown and MouseUp events and making sure the pointer didn't move much, and a better way of handling doubleclicks than keeping a click counter? Thanks, Avner
... View more
08-28-2011
02:22 AM
|
0
|
3
|
4108
|
Title | Kudos | Posted |
---|---|---|
1 | 02-14-2012 10:45 PM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|