POST
|
The Wait() method on the Task returned by QueuedTask.Run hangs when I try to use LayerFactory. If I use await, it works as expected. Am I doing something wrong? This works: protected override async void OnClick()
{
await QueuedTask.Run(()=> {
LayerFactory.CreateGroupLayer(MapView.Active.Map, 0, "group layer");
Debug.Print("layer created");
});
Debug.Print("done");
} But this hangs: protected override void OnClick()
{
QueuedTask.Run(()=> {
LayerFactory.CreateGroupLayer(MapView.Active.Map, 0, "group layer");
Debug.Print("layer created");
}).Wait();
Debug.Print("done");
} This works (suggesting LayerFactory is clogging the plumbing): protected override void OnClick()
{
QueuedTask.Run(() => {
for (int i = 0; i < 5; i++)
{
Debug.Print("Sleeping " + i);
System.Threading.Thread.Sleep(1000);
}
Debug.Print("waking");
}).Wait();
Debug.Print("done");
}
... View more
03-08-2017
03:50 PM
|
0
|
1
|
1683
|
POST
|
Doc, I've got pain. I would expect to see a link here: ProGuide DockPanes · Esri/arcgis-pro-sdk Wiki · GitHub But I don't. I thought I'd list by looping through all the dockpanes using FrameworkApplication.DockPaneManager.DockPanes, but the dockpane class exposes no ID property.
... View more
02-24-2017
06:24 AM
|
0
|
1
|
1320
|
POST
|
The documentation for ILayerContainerEdit.MoveLayer says: The position specified by the 0-based index. If the index is invalid, the layer is moved to the bottom. However this code doesn't move the layer to the bottom: Dim srcLayer = MapView.Active.GetSelectedLayers()(0)
MapView.Active.Map.MoveLayer(srcLayer, 999) Only 3 layers are in the map.
... View more
02-23-2017
05:41 PM
|
0
|
1
|
1407
|
POST
|
When I have 2 or more layers in the map, the grouplayer is always added at the top. Am I doing something wrong? LayerFactory.CreateGroupLayer(MapView.Active.Map, 2) Also happens when adding a grouplayer as a last child of a parent grouplayer. This works with other layer types, but not with grouplayers. Running Arc Pro 1.4.1
... View more
02-23-2017
11:52 AM
|
0
|
1
|
760
|
POST
|
I think I resolved this by setting the URI of the definition to that of the newly created layer before applying. Any known ill side-effects from doing this? def.URI = fLayer.GetDefinition().URI;
fLayer.SetDefinintion(def);
... View more
02-23-2017
11:46 AM
|
0
|
0
|
886
|
POST
|
Thanks for replying Charles. When I open a .lyrx file in a text editor, I see that it contains a CIMLayerDocument, which has a list of CIMLayers (e.g. CIMFeatureLayer etc.) When I choose to add data and select a .lyrx file behind the scenes Pro is turning definitions into layers. I want to be able to do something similar. Is this functionality exposed by the API? If not, I think Esri really needs to add another overload to LayerFactory.CreateLayer which accepts a CIMLayer definition. Otherwise, if there is a bug in SetDefinition, perhaps I could accomplish this once the bug is fixed.
... View more
02-23-2017
07:18 AM
|
0
|
1
|
886
|
POST
|
Here's a simpler example. SetDefinition doesn't do anything from what I can tell. private void Test()
{
var def = MapView.Active.Map.Layers[0].GetDefinition() as CIMFeatureLayer;
var fLayer = LayerFactory.CreateLayer(def.FeatureTable.DataConnection,MapView.Active.Map) as FeatureLayer;
fLayer.SetName("my layer");
// name remains "my layer" Setdefinition has no discernable effect
fLayer.SetDefinition(def);
}
... View more
02-21-2017
08:32 PM
|
0
|
4
|
886
|
POST
|
I would expect the following code to essentially clone the top layer in the map. It does create a new featurelayer that points to the Uri, but calling SetDefinition has no discernible effect. private void Test()
{
var def = MapView.Active.Map.Layers[0].GetDefinition() as CIMFeatureLayer;
var conn = def.FeatureTable.DataConnection as CIMStandardDataConnection;
var folder = conn.WorkspaceConnectionString.Split('=')[1];
if (conn.WorkspaceFactory != WorkspaceFactory.Shapefile)
throw new Exception("test only works with shapefile layers");
var url = Path.Combine(folder, conn.Dataset + ".shp");
var fLayer = LayerFactory.CreateFeatureLayer(new Uri(url), MapView.Active.Map, 1);
fLayer.SetName("my layer");
// name remains "my layer" Setdefinition has no discernible effect
fLayer.SetDefinition(def);
}
... View more
02-21-2017
06:04 PM
|
0
|
6
|
1520
|
POST
|
I'm developing a WAB widget and testing it in a time-aware map. The OOTB timeslider widget is also being used. I add a time-aware featurelayer to the map with ONDEMAND mode. The maxFeatures is 1000. I would expect when query-limit-exceeded fires, that the subsequent firing of query-features-complete would show exactly 1000 features in the set. This is not the case. Here's the log as I increment the time slider, the first few times the features update as expected, until query-limit-exceeded fires: Sometime query-limit-exceeded will fire, even when the featset has fewer than 1000 features. I suspect I'm misunderstanding how time-awareness works. var fLayer = FeatureLayer(url, { mode: FeatureLayer.MODE_ONDEMAND, outFields: ["mag"] }); var exceeded = false; fLayer.on("query-limit-exceeded",function(){ console.log("query-limit-exceeded"); exceeded = true; }); fLayer.on("update-start",function(){ console.log("update-start") exceeded = false; }); fLayer.on("query-features-complete",function(featset){ var cnt = featset.featureSet.features.length; if(exceeded){ console.log("only showing first " + fLayer.maxRecordCount + " features, " + cnt); }else{ console.log("retrieved ", cnt); } });
... View more
03-10-2016
09:47 AM
|
0
|
0
|
1555
|