|
POST
|
Try this: https://stackoverflow.com/questions/12050415/set-default-proxy-programmatically-instead-of-using-app-config
... View more
11-29-2017
10:16 AM
|
0
|
1
|
1592
|
|
POST
|
When I'm trying to figure out a CIM thing like this I like to replicate the action (if I can) in the UI and then look at the resulting XML in the debugger. var def = renderer.ToXml(); like so. You can even copy/paste the xml into an xml editor with colorization if the debugger xml viewer is not adequate. From the xml I look at what changed to tell me what to replicate in the code. Try fiddling with the renderer, for example, and examining the change in the debugger. There is also a utility here: https://github.com/Esri/arcgis-pro-sdk-cim-viewer that allows you to do just that. Anyway, the bit you really care about 😉 CIMUniqueValueRenderer renderer = ....;
foreach (var group in renderer.Groups)
{
//let's make half the number of classes...
List<CIMUniqueValueClass> classes = group.Classes.ToList();
List<CIMUniqueValueClass> groupedClasses = new List<CIMUniqueValueClass>();
CIMUniqueValueClass currentClass = null;
var count = 0;
while (count < classes.Count)
{
//even or odd?
if ((count % 2) == 0) {
currentClass = classes[count++];
}
else {
var odd_class = classes[count++];
currentClass.Label = $"{currentClass.Label};{odd_class.Label}";
//this is the key bit - consolidate the array of unique values for the class
var values = currentClass.Values.ToList();
values.AddRange(odd_class.Values);
currentClass.Values = values.ToArray();
groupedClasses.Add(currentClass);
currentClass = null;
}
}
//one left over?
if (currentClass != null)
groupedClasses.Add(currentClass);
//re-assign
group.Classes = groupedClasses.ToArray();
}
layer.SetRenderer(renderer);
... View more
11-09-2017
03:14 PM
|
1
|
0
|
1442
|
|
POST
|
Try this. var renderer = layer.CreateRenderer(uvr_def) as CIMUniqueValueRenderer;
foreach (var group in renderer.Groups)
{
foreach(var valueClass in group.Classes)
{
var symbol = valueClass.Symbol.Symbol as CIMPolygonSymbol;
foreach (var symLayer in symbol.SymbolLayers.OfType<CIMSolidFill>())
{
((CIMSolidFill)symLayer).Color.Values[3] = 0;//set the alpha channel to 0
}
}
}
layer.SetRenderer(renderer);
... View more
11-09-2017
09:51 AM
|
0
|
2
|
1442
|
|
POST
|
At 2.1, call portal.GetUserContentAsync var owner = portal.GetSignOnUsername(); var userContent = await portal.GetUserContentAsync(owner); foreach (var pf in userContent.PortalFolders) System.Diagnostics.Debug.WriteLine($"{pf.Name},{pf.FolderID}"); At 2.0, you have to execute the rest query directly for user content (via EsriHttpClient). The url would look like this: var owner = portal.GetSignOnUsername(); var url = $"{portal.PortalUri.AbsoluteUri}/content/users/{owner}"; var response = new EsriHttpClient().Get(url); var json = await response.Content.ReadAsStringAsync(); The returned json will contain your folders. See Rest API User Content
... View more
10-17-2017
01:12 PM
|
1
|
0
|
1091
|
|
POST
|
Thomas, can I ask that you try your post in the Imagery forum? I realize that you are executing a tool with the API but the Esri staff experts in those tools will probably be more readily accessible on that forum than this one. That said, I will alert the raster team staff that you have questions pertaining to their GP tools in the SDK forum.
... View more
10-16-2017
02:55 PM
|
0
|
2
|
848
|
|
POST
|
If you have this: QueuedTask.Run(() => { op.Execute(); MessageBox.Show("..."); } you probably won't see the move (until after). Instead, do this: await QueuedTask.Run(() => { op.Execute(); }; MessageBox.Show("..."); and you will. Note, if you add "await", you must also add "async" to the method declaration (eg SketchComplete or whichever it is).
... View more
09-07-2017
11:15 AM
|
0
|
1
|
3692
|
|
POST
|
Brian, thanks for taking the time on this. FYI: on: // variable for the coordinate of the mouse click in the whatever the SpatialReference of the map is var coord = GeometryEngine.Instance.Project(geometry, MapView.Active.Map.SpatialReference) as MapPoint; var moveToPoint = new MapPointBuilder(coord.X, coord.Y, MapView.Active.Map.SpatialReference);<-- not needed coord is a MapPoint already (reading your code). So this: modifyAsBuilts.Modify(asBuiltLayer, oid, moveToPoint.ToGeometry()); can become this: modifyAsBuilts.Modify(asBuiltLayer, oid, coord); I think you may have some copy/paste inheritance from Uma's code where she used a MapPointBuilder because she built the point from scratch. One other point (no pun intended ;-). I noticed this: var coord = GeometryEngine.Instance.Project(geometry, MapView.Active.Map.SpatialReference) as MapPoint; I don't now what the overall context of the "surrounding" code is but I suspect that your digitized geometry may already be in the map spatial reference. Can you just try: modifyAsBuilts.Modify(asBuiltLayer, oid, geometry); using the geometry directly and see if that works?
... View more
09-07-2017
10:05 AM
|
2
|
3
|
3692
|
|
POST
|
Hi Matthew, the simplest way, and recommended way, is to use EditOperation.Create. https://github.com/esri/arcgis-pro-sdk/wiki/ProSnippets-Editing#edit-operation-create-features. This assumes you have a layer or standalone table sourcing your feature class or table. If you have a mix of GIS and non-GIS data, you must use EditOperation.Callback. https://github.com/esri/arcgis-pro-sdk/wiki/ProSnippets-Geodatabase#creating-a-row. This would also work for a scenario where you do not have a layer (or standalone table). [If you cannot use EditOperation (eg you are writing a console program) you should use Geodatabase.ApplyEdits. http://pro.arcgis.com/en/pro-app/sdk/api-reference/#topic7093.html]
... View more
09-06-2017
09:53 AM
|
2
|
0
|
3299
|
|
POST
|
Make sure the build action is set to "AddInContent"
... View more
08-04-2017
05:02 PM
|
2
|
1
|
4917
|
|
POST
|
Looks like DockpaneSimple and DockPaneBookmarkAdvanced have logic in OnUIThread for unit testing. For your uses you can ignore the "FrameworkApplication.TestMode" bit. RunOnUIThread ensures that the action you specify (as the parameter) will always be executed on the UI thread. Samples are written by different authors so one is using Application.Current.Dispatcher, the other System Task (and UIScheduler) but they both accomplish the same thing. If you share some code where OnUIThread returns true (when it should return false) we can look into it. Here is a little test I wrote and it looks ok: internal class Button1 : Button
{
public static bool IsOnUiThread =>
ArcGIS.Desktop.Framework.FrameworkApplication.TestMode ||
System.Windows.Application.Current.Dispatcher.CheckAccess();
protected async override void OnClick()
{
bool fromUI = Button1.IsOnUiThread;
bool fromQTR = await QueuedTask.Run(() => Button1.IsOnUiThread);
bool fromSystemTask = await System.Threading.Tasks.Task.Run(() =>
Button1.IsOnUiThread);
MessageBox.Show(
$"On UI?: {fromUI} (called from UI)\r\n" +
$"On UI?: {fromQTR} (called from QTR)\r\n" +
$"On UI?: {fromSystemTask} (called from System Task)");
}
} Note, there is an API property you can use if you prefer called QueuedTask.OnGUI (also QueuedTask.OnWorker) QueuedTask.OnGUI topic14880.html
... View more
07-27-2017
10:19 AM
|
0
|
1
|
2136
|
|
POST
|
Any ideas when that will be released?<< December Is there any other alternatives for sending the coordinate to the active sketch? How is the Absolute XYZ tool doing it?<< I assume you are asking about alternatives for getting the point that was digitized as the first vertex of a single point polyline? Modifying the sketch polyline and reapplying to the sketch using SetCurrentSketchAsync is the correct approach when the returned polyline is valid. If snapping is not an issue, you can retrieve the point that was digitized for the vertex via OnToolMouseDown(MapViewMouseButtonEventArgs e). The e.ClientPoint can be converted via mapView.ClientToMap. If snapping is an issue there is no suitable workaround (to getting the initial point for a single point polyline/line sketch type). Absolute XYZ is using an internal (native) API call.
... View more
07-14-2017
01:46 PM
|
0
|
1
|
2164
|
|
POST
|
Hi Mauricio, thanks for that, this is a bug. If I create the polyline from scratch (with the builder) with a single point it works (I get a polyline with a PointCount of 1). However, the sketch from the viewer has a point count of 0 after I have digitized the first vertex. We will fix for 2.1.
... View more
07-14-2017
01:17 PM
|
1
|
3
|
2164
|
|
POST
|
Mauricio, can you take a look at these samples and see if they are doing what you want to do: https://github.com/esri/arcgis-pro-sdk-community-samples/tree/master/Editing/SketchToolDemo - implements a MapTool that shows use of the "OnSketchModifiedAsync" event to retrieve the sketch using GetCurrentSketchAsync. There is also a corresponding set method to alter the geometry of the sketch(which I think is what you are after). https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Editing/ReplaceSketch shows modifying the sketch by accessing the sketch directly off the MapView itself in a button click (rather than implementing a map tool and using its protected methods as above) - see http://pro.arcgis.com/en/pro-app/sdk/api-reference/#topic11944.html and scroll down to the extension methods section.
... View more
07-14-2017
10:13 AM
|
0
|
5
|
2164
|
|
POST
|
Jeff, there is a known issue and we are working on it for 2.1 and it is probably the same as we determined for this post here: https://community.esri.com/thread/196147-poor-performance-when-creating-polylines That said, this same performance issue will exist at 1.4 and 2.0 and I cannot reproduce your scenario where you have a drastic change in performance between 1.4 and 2.0. Can you post your code please so we can investigate further? Using this sample on a dataset that comes with the Pro SDK samples (Interacting with Maps.gdb), It averages around 14 to 15 seconds on my laptop, running v2.0. internal class TestEditOperation : Button
{
protected async override void OnClick()
{
var layer = MapView.Active.Map.GetLayersAsFlattenedList().First(l => l.Name == "Fire_Stations_1") as FeatureLayer;
int limit = 3000;
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
await DoIt(layer, limit);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
string elapsedTime = String.Format("{0:00}:{1:00}.{2:00}",
ts.Minutes, ts.Seconds,
ts.Milliseconds / 10);
MessageBox.Show($"{limit} features = {elapsedTime}");
}
private Task<bool> DoIt(FeatureLayer layer, int limit)
{
return QueuedTask.Run(() =>
{
var sr = layer.GetSpatialReference();
var qf = new QueryFilter();
qf.WhereClause = "OBJECTID = 1";
var rc = layer.Search(qf);
rc.MoveNext();
var shp = ((Feature)rc.Current).GetShape() as MapPoint;
var station = Int32.Parse(rc.Current[2].ToString());
station += 1000;
var address = rc.Current[3];
var city = rc.Current[4];
var district = rc.Current[5];
double d = 20.0;
var op = new EditOperation();
for (int i = 0; i < limit; i++, d += 10.0) {
var attrib = new Dictionary<string, object>();
attrib["SHAPE"] = MapPointBuilder.CreateMapPoint(shp.X + d, shp.Y, sr);
attrib["STATION"] = $"{station++}";
attrib["ADDRESS"] = address;
attrib["CITY"] = city;
attrib["DISTRICT"] = district;
op.Create(layer, attrib);
}
return op.Execute();
});
}
}
... View more
07-13-2017
09:47 AM
|
0
|
0
|
1182
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 05-19-2026 10:29 AM | |
| 1 | 04-29-2026 02:06 PM | |
| 1 | 01-08-2026 02:03 PM | |
| 1 | 01-08-2026 02:15 PM | |
| 3 | 12-17-2025 11:33 AM |
| Online Status |
Offline
|
| Date Last Visited |
3 weeks ago
|