|
POST
|
Miri, I think you forgot to attach the error message :eek: As for question 2, from what I can see (thanks to .net reflecter) all the Action does is populate the Graphics layer in the ExecuteComplete handler of the QueryTask. It does not seem to throw off any other notification. I think you are probably just as well off doing your own Query, you could even write it as a TriggerAction that fires an event on completion. As strange as this sounds, in many ways I think they most complicated aspect to writing a large application with an ESRI Web Client API (flex also) is handling interactions of tools and buttons with features and the map. I have spent considerable amounts of time developing infrastructure that manages this interaction with notifications between tools so everything knows how the next mouse click should be handled. In this case one quick and dirty way (as opposed to simple and elegant ;)) might be to add a CollectionChanged handler to your GraphicsLayer:Graphics collection. So when the points are added to the GraphicsLayer as a result of the query you will catch it and can flip the tool back on. Of course if the query returns nada well then.....? Good luck -Joe
... View more
06-26-2012
06:42 AM
|
0
|
0
|
1901
|
|
POST
|
Have you tried layer.UpdateCompleted += (snd, evt) => { Map.Extent = layer.FullExtent; }; Good Luck
... View more
06-26-2012
12:48 AM
|
0
|
0
|
1509
|
|
POST
|
In order to use the 'Updated' FeatureLayer you need to add a handler for the UpdateComplete Event and than have your code run inside that handler Something along these lines
layer.UpdateComplete += (s,e) => {
Map.Extent = layer.Geometry.Extent;
};
layer.Update();
... View more
06-25-2012
11:29 PM
|
0
|
0
|
1509
|
|
POST
|
Hello i am adding Graphics on my map.And adding tooltip on it.Tooltip is dispaying properly when the graphic type is PictureMarkerSymbol.But for polygon tooltip is giving me the errr like as follows Can anybdy help me to solve this? Unable to cast object of type 'ESRI.ArcGIS.Client.Geometry.Polygon' to type 'ESRI.ArcGIS.Client.Geometry.MapPoint'. Private Sub Graphic_MouseEnter(ByVal sender As System.Object, ByVal e As System.Windows.Input.MouseEventArgs) Dim theGraphic As ESRI.ArcGIS.Client.Graphic = CType(sender, ESRI.ArcGIS.Client.Graphic) MyInfoWindow.Anchor = theGraphic.Geometry MyInfoWindow.IsOpen = True MyInfoWindow.Content = theGraphic.Attributes End Sub In the MouseEnter handler you set Anchor to the geometry of the Graphic itself. Anchor is a MapPoint so if the Graphic has Polygon geometry you would receive that error. If you want the InfoWindow to display over a polygon (or polyline) you need to pick the anchor point. For a polygon the simplest would be to cast the Geometry to a Polygon and use MyInfoWindow.Anchor = polygon.Extent.GetCenter(); Hope that helps
... View more
06-25-2012
11:08 PM
|
0
|
0
|
681
|
|
POST
|
You cast the geometry to a Polygon, which has a collection of Rings. Each Ring is a PointCollection, for a user drawn polygon with the standard tools the polygon will only have one Ring. In C# something like this if ( args.Geometry is Polygon ) { PointCollection points = ((Polygon)geometry).Rings[0]; foreach ( MapPoint mapPoint in points ) { //Save the points } } Hope that helps
... View more
06-25-2012
07:50 PM
|
0
|
0
|
1934
|
|
POST
|
One way would be to bind Tag to the SubLayerID
<TextBlock Text="{Binding Label}" VerticalAlignment="Center" Margin="2,0,0,0" MouseLeftButtonDown="TextBlock_MouseLeftButtonDown" Tag="{Binding SubLayerID}"/>
... View more
06-24-2012
10:14 PM
|
0
|
0
|
732
|
|
POST
|
Metro Apps and the Windows 8 interface are going to be about as popular as New Coke when it is rolled out. Microsoft does not grasp that the vast majority of people using their OS are sitting at a desktop and are primarily running Word and Excel, not on a touch screen device and windows 8 is a terrible mouse click user experience (in my opinion). Microsoft will be back tracking (yet again) when Windows 8 is released because the CEO who has to approve the decsion to upgrade is still going to think XP is better. The javascript API will work anywhere you can use html, so if you believe the hype about html 5 than make the jump (backwards) to javascript.
... View more
06-22-2012
09:21 PM
|
0
|
0
|
585
|
|
POST
|
The toolkit source code can be downloaded from Codeplex, so you can do that and see what the paths to the images are.
... View more
06-21-2012
08:48 PM
|
0
|
0
|
656
|
|
POST
|
Dominique, I am having some problem with the SDK. On all the pages for the Actions I get an error such as this: A value of type 'ToggleLayerAction' cannot be added to a collection or dictionary of type 'TriggerActionCollection'. When I try to open one of those pages when the application is running it crashes on the line for downloading the xaml page It seems like something related to the Blend library, but not really sure. Any thoughts? Thanks -Joe
... View more
06-21-2012
08:59 AM
|
0
|
0
|
601
|
|
POST
|
Hi, Is there a way to show a DataGrid of the selected features using SpatialQueryAction. There is a sample called: http://resourcesbeta.arcgis.com/en/help/silverlight-api/samples/start.htm#GraphicsActions I want to extend this sample to show also the dataGrid of the selection's result. Thanks a lot, Miri Have you looked at the FeatureDataGrid sample http://resourcesbeta.arcgis.com/en/help/silverlight-api/samples/start.htm#FeatureDataGrid? With the SpatialQueryAction you are passing in the LayerId of the graphics layer that you want the results to be displayed on. I think that if you bind a FeatureDataGrid to that Graphics layer it should display the results like you want (disclaimer: I have not tried this yet :))
<esri:FeatureDataGrid Grid.Row="2" x:Name="MyDataGrid" Map="{Binding ElementName=MyMap}"
GraphicsLayer="{Binding ElementName=MyMap, Path=Layers[LayerIDPassedToAction]}" />
Good Luck
... View more
06-21-2012
07:08 AM
|
0
|
0
|
1901
|
|
POST
|
Yes it is possible, it is certainly not simple and requires understanding how asynchronous calls work. What I would do (not saying that is the best way) is setup some timers to run things and help synch up at the end. Something along these lines (this code is in no way tested, just an idea of an approach)
FeatureSet[] _featureSet = new FeatureSet[2];
private void Button_Click(object sender, RoutedEventArgs e)
{
Query query1 = new Query();
Query query2 = new Query();
QueryTask queryTask = new QueryTask();
queryTask.ExecuteCompleted += QueryCompleted;
// Setup your querys
DispatcherTimer timer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(500)};
timer.Tick += (s, arg) =>
{
if ( queryTask.IsBusy ) return;
timer.Stop();
queryTask.ExecuteAsync(query2, "QUERY2");
};
queryTask.ExecuteAsync(query1, "QUERY1");
timer.Start();
}
private void QueryCompleted(object sender, QueryEventArgs e)
{
if ( (string)e.UserState == "QUERY1")
{
_featureSet[0] = e.FeatureSet;
}
if ( (string)e.UserState == "QUERY2" )
{
_featureSet[1] = e.FeatureSet;
}
DispatcherTimer timer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(500) };
timer.Tick += (s, arg) =>
{
if ( _featureSet[0] == null || _featureSet[1] == null ) return;
timer.Stop();
//do the create intersection stuff
//make sure to reset _featureSet[] when done with FeatureSet[] _featureSet = new FeatureSet[2];
};
timer.Start();
}
What a DispatcherTimer does is run the .Tick handler over and over until Stop() is called, but will wait between each time it calls the event handler, the pause amount is the Interval property. DispatcherTimer is nice for this purpose because it runs on the primary thread, so no need to synch threads when it is used. In the button click event handler the Tick method checks if the QueryTask is busy every 1/2 second. Once it is no longer busy it runs the second query. When the Queries are run the userToken variable is included in the Execute call so in the Complete handler it can be determined which query result it is. The Timer in the Execute handler keeps checking if both of the queries are done, and once they are it moves onto executing the code that uses the intersction. Again there are different ways this could be accomplished, this is just the general approach I would take Hope that helps
... View more
06-20-2012
10:02 PM
|
0
|
0
|
654
|
|
POST
|
haha, it's not really working, because it returns the values of the first row, in the attribute table. I just want the values of the selected feature. In this line of code that 'works' you are searching the entire FeatureClass not the SelectionSet
cursor = featureLayer.Search(Nothing, False)
I think what you are missing in your previous code is explicitly initializing the ICursor. I am not a VB guy in C# it would be
ICursor cursor = null;
featureSelection.SelectionSet.Search(null, false, cursor)
Something like this in VB
Dim cursor as ICursor
cursor = Nothing
featureSelection.SelectionSet.Search(Nothing, False, cursor)
Hope that helps
... View more
06-20-2012
07:49 AM
|
0
|
0
|
1613
|
|
POST
|
I am just throwing this out there, I don't know if it will work.... You could try to use the GraphicsLayerMouseLeftButtonDown event. That will give you the graphic the user clicked and using the GetPosition method on the EventArgs you could get the point the clicked. Then loop through the point collection in Rings[0] of the polygon to find the vertex closest to where the mouse click occurred and remove it from the point collection. Good Luck
... View more
06-20-2012
03:03 AM
|
0
|
0
|
475
|
|
POST
|
Thanks for the reply .. well i'll still a newbie in arcgis api so i might need a little more help .. my map wkid is 4326 102100 You map is either 4326 or 102100 those are two different SpatialReferences. 4326 is WGS84 which uses Lat and Long. So if your coordinates are Latitude and Longitude then the SpatialRefernce for those points is 4326. Your map may be in 102100 (Web Mercator), if you are using ArcGIS On-Line or Bing for a basemap this is the SpatialReference of the Map. When you set the SpatialReference or the point it needs to be the based on the coordinates of the point not of the Map. Also you have the coordinates flipped, X=Longitude, Y=Latitude like I mentioned in the previous post, which is probably the issue because it seems like you are projecting. You may want to explicitly set the SpatialReference of the point before you convert
// lat,lng values
var mp:MapPoint = new MapPoint(lat,lng);
mp.SpatialReference = new SpatialReference(4326) //Set explicitly
var mp2:MapPoint = (WebMercatorUtil.geographicToWebMercator(mp) as MapPoint);
//I don't think this next line is necessary, if you look in the debugger I think you will see SpatialReference is already set - but not 100% sure
mp2.spatialReference = new SpatialReference(102100);
Hope that helps
... View more
06-20-2012
02:24 AM
|
0
|
0
|
712
|
|
POST
|
Depends on the SpatialReference of your map. If your map is in WGS84 then it is simply: X = Longitude Y = Latitude Otherwise use the WebMercatorMapPoint class.
... View more
06-20-2012
01:18 AM
|
0
|
0
|
712
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | a week ago | |
| 1 | 10-23-2025 12:16 PM | |
| 1 | 10-19-2022 01:08 PM | |
| 1 | 09-03-2025 09:25 AM | |
| 1 | 04-16-2025 12:37 PM |
| Online Status |
Offline
|
| Date Last Visited |
Thursday
|