POST
|
Max, sorry for the response delay. This has been fixed for 2.3.1. 2.3.1 will be available at the end of March (2019)
... View more
02-19-2019
09:20 AM
|
2
|
2
|
443
|
POST
|
Hi Brad, so here are some possibilities: Option 1: Make the table and return the table from the QueuedTask and show it internal class OpenTableButton : Button
{
protected async override void OnClick()
{
//capture the active map
var theMap = MapView.Active.Map;
//option 1 - return the table from the QueuedTask
var table = await QueuedTask.Run(() =>
{
return StandaloneTableFactory.Instance.CreateStandaloneTable(
new Uri(@"Path_To_File_GDB.gdb\EarthquakeDamage_Table",
UriKind.Absolute),
theMap);
});
FrameworkApplication.Panes.OpenTablePane(table);
}
} Option 2: Make the table and show it from the QueuedTask (the syntax to do that is a bit gnarly I must confess)...still...it is here if you need it internal class OpenTableButton : Button
{
protected async override void OnClick()
{
//capture the active map
var theMap = MapView.Active.Map;
//option 2 - invoke the OpenTablePane on the UI thread from
//~within~ the QueuedTask
await QueuedTask.Run(() =>
{
var table2 = StandaloneTableFactory.Instance.CreateStandaloneTable(
new Uri(@"Path_to_File_GDB.gdb\Meteorites_UK_Table",
UriKind.Absolute),
theMap);
//now put us on the UI thread to open the table pane
FrameworkApplication.Current.Dispatcher.BeginInvoke((Action)(() =>
{
FrameworkApplication.Panes.OpenTablePane(table2);
}));
});
}
} Option 3: Make the table on the QueuedTask. Return from the QueuedTask. Retrieve the table from the Map (on the UI) and show it. This would be akin to how you would retrieve a table from the TOC that had previously been added. internal class OpenTableButton : Button
{
protected async override void OnClick()
{
//capture the active map
var theMap = MapView.Active.Map;
//Create the table from the QueuedTask
await QueuedTask.Run(() =>
{
StandaloneTableFactory.Instance.CreateStandaloneTable(
new Uri(@"Path_To_File_GDB.gdb\EarthquakeDamage_Table",
UriKind.Absolute),
theMap);
});
//option 3...get the table from the map after it has been added...
var table3 = theMap.FindStandaloneTables("EarthquakeDamage_Table").First();
FrameworkApplication.Panes.OpenTablePane(table3);
}
}
... View more
01-29-2019
05:41 PM
|
2
|
1
|
854
|
POST
|
Hi Max Max, yes you can. Add the control into your user control in the XAML. Bind its visibility to a property on your view model. Whenever you want to show the control, flip the property true or "Visible". For an example look here:DockPaneBookmarkAdvanced - Bookmark.xaml (There is also a WaitingCursorControl which acts identically but has a slightly different look is all)
... View more
01-25-2019
09:34 AM
|
0
|
0
|
1049
|
POST
|
1) The main issue is that you cannot run a CoreHost exe without installing Pro. You can, however, configure a license for Pro via the installer command line so you never have to actually "run" Pro. Refer to ArcGIS Pro installation command line parameters 2) You could probably get away with using QueuedWorker.Run in your unit test harness for utility methods and the like that use only Geodatabase (and Geometry) code. For example, you have a helper library that you include in add-ins and a CoreHost app and you want to test that. However, you cannot use QueuedWorker in an Add-in nor QueuedTask in CoreHost. To the outside world they seem to perform a v. similar purpose but internally what they have to accomplish is completely different. [note: ArcGIS.Desktop.Framework.dll is not supported for use in CoreHost so QueuedTask's use in CoreHost is actually moot].
... View more
01-24-2019
02:48 PM
|
0
|
0
|
690
|
POST
|
Hi Karen, So somewhere along the line I am thinking you saw "Map.GetSelection()" - perhaps in a sample - and decided on that as "the" way to go. In your case, I would suggest selecting directly off the layer - "parcels" - instead. Similar to arcobjects, feature layers support both a Select and a Search method - the select will highlight the features on the map whereas search does not and applies the selection to the underlying feature class (with no visible highlight). To retrieve the list of layers from a Pro map or scene use the method "GetLayersAsFlattenedList" which I show below. I also encourage you to google "LINQ expressions" and read a few tutorials on it - the syntax can be a little intimidating at first - a lot of the Pro SDK samples use LINQ as it is the preferred technique for selecting items from a .NET collection. The most common LINQ methods are "Where", "FirstOrDefault", and "OfType". In the code below, I use the Pro SDK method "GetlayersAsFlattenedList()" on the Map, which I mentioned above, to return the collection of the map's layers. I then use a LINQ expression "FirstOrDefault" and that funky "lambda" syntax "lyr => lyr.Name ..." to select, from the returned list, either the first layer with a matching name of "parcels" or null (that is the purpose of "FirstOrDefault"). The final code looks like this: var parcels = MapView.Active.Map.GetLayersAsFlattenedList().FirstOrDefault(lyr => lyr.Name == "parcels") as FeatureLayer;
if (parcels == null)
return; //parcels not found
await QueuedTask.Run(() =>
{
var sf = new SpatialQueryFilter()
{
FilterGeometry = geometry,
SpatialRelationship = SpatialRelationship.Intersects,
SubFields = "*"
};
var select = parcels.Select(sf);
var rc = ((FeatureLayer)parcels).GetSelection().Search();
while(rc.MoveNext())
{
var feature = rc.Current as Feature;
var pin = feature["PIN"];
//etc
...
To help you answer these questions: //NEED: Populate form with "InVillage" value from Village Boundary layer
...
//NEED: Populate form with "StreetID" from closest street segement from Streets layer I suggest the following sample to help you with understanding how to populate a form: DockpaneSimple sample It will introduce you to something called MVVM and how to add properties to your dock pane view model that get displayed on your dock pane view. Finding the nearest feature can be quite complicated. Geoprocessing has Proximity tools and spatial joins are also possible. You could also use a brute force approach progressively selecting on the street layer with an incrementally increased buffer applied to your selection geometry and then filter the "hits" for the closest feature (see ProSnippets Geometry#nearest-point-versus-nearest-vertex)
... View more
01-21-2019
08:57 PM
|
1
|
1
|
1886
|
POST
|
As your tool is using point as its sketch type then cast the Geometry input parameter in the OnSketchCompleteAsync callback to MapPoint and you have it. MapPoint mp = (MapPoint)geometry;
... View more
01-17-2019
10:23 AM
|
1
|
3
|
660
|
POST
|
This is a great question. Generally speaking, if you are developing a re-usable User Control then the properties should go on the UserControl itself and, if needed, have it bind its DataContext to itself rather than using a separate (non-visual) view model. If you do need to bind the user control to itself you must be careful NOT to break the binding "chain" or hierarchy....I know this sounds a little convoluted but their are some great articles out there on the web that discuss this issue- here are a couple of examples: Walkthrough: Two-way binding inside a XAML User Control and WPF - Custom UserControl datacontext binding gotcha What it boils down to is this: If you need to set content on the User Control from its own properties AND from dependency properties which are bound to some other property on the parent (eg your dockpane View Model) then don't do this: public partial class StatusRuler : UserControl {
public StatusRuler() {
InitializeComponent();
this.DataContext = this;//breaks the chain....dependecy properties
//bound to the dockpane won't work Instead, do this: public partial class StatusRuler : User Control {
public StatusRuler() {
InitializeComponent();
(this.Content as FrameworkElement).DataContext = this;//Do this. Bind to inherited
//"Content" property. You can also give your root element in the User Control, typically a Grid, an "x:Name", and bind its data context to accomplish the same thing - this.TheNameOfMyGrid.DataContext = this;
... View more
01-13-2019
07:11 PM
|
0
|
0
|
1116
|
POST
|
Mody, to answer the question of how to use a user control "within" a user control I recommend doing a google on "WPF DataTemplate" and "WPF ContentPresenter" and going on stackoverflow- You will find lots of examples there. To help you get going here are three options I put together but there many different permutations and possibilities in WPF...you will need to evaluate which is best for your situation. Alright, so, that said, assume this is your control (xaml not shown) public partial class ModyView : UserControl { Option 1. Simply add a reference to it in your dockpane. This is the easiest: <!-- this is your dockpane -->
<UserControl x:Class="ModyAddin.TheDockpaneView"
...
xmlns:local="clr-namespace:ModyAddin">
<Grid>
<Border Background="..... >
<!-- In the dockpane xaml (i.e. the view) reference your user control -->
<local:ModyView x:Name="ModyViewControl" Margin="3,4,3,4" /> Option 2: Use something called a content presenter. A content presenter is basically a placeholder into which you can put any content - in this case your user control. Bind it to a property of type UserControl or FrameworkElement (or even "ModyView" - our specific custom UserControl type if you prefer)... <!-- this is your dockpane -->
<UserControl x:Class="ModyAddin.TheDockpaneView"
...
xmlns:local="clr-namespace:ModyAddin">
<Grid>
<Border Background="..... >
<!-- In the dockpane xaml (i.e. the view) add a content presenter -->
<ContentPresenter Content="{Binding UserControlContent, Mode=OneWay}" />
and in the dockpane view model....when we set the property, the content will be shown. internal class TheDockPaneViewModel : DockPane {
//the property in the binding - can also use FrameworkElement as the type
private UserControl _content = null;
public UserControl UserControlContent {
get { return _content; }
internal set { SetProperty(ref _content, value, () => UserControlContent); }
}
//usage...set the property during runtime...
_myDockPane.UserControlContent = new ModyView(); Option 3 Assume you have a non-visual class that you want to set as the content and you will be using your user control to render it. For example, a non-visual class called "StatusRuler"... public class StatusRuler {
public string Title { ...
public int Step { ....
public bool Completed { ...
The dockpane has a content presenter the same as option 2 but we now bind it to a property of type of "StatusRuler" (see the bottom code window)....the non-visual class....rather than a user control directly. This is our updated dockpane. internal class TheDockPaneViewModel : DockPane {
//the property in the binding - set to a non-visual type
private StatusRuler _ruler = null;
public StatusRuler StatusRuler {
get { return _ruler; }
internal set { SetProperty(ref _ruler, value, () => StatusRuler); }
}
//usage...set the property during runtime...
_myDockPane.StatusRuler = new StatusRuler(); Next we add a data template to the dockpane view - a data template links or associates our user control "ModyView" with the non-visual type "StatusRuler". Usually, the data template goes in your dockpane resources but it can go in a separate resource dictionary or even the resources of the ContentPresenter itself. It just depends on whether the data template is something you want to re-use on multiple dockpanes (without copy/pasting) or not. When you set the ContentPresenter to be an instance of the non-visual type "StatusRuler", the data template kicks in to tell the ContentPresenter to use an instance of the user control "ModyView" to show it. Et voila. <!-- this is your dockpane -->
<UserControl x:Class="ModyAddin.TheDockpaneView"
...
xmlns:local="clr-namespace:ModyAddin">
<UserControl.Resources>
<ResourceDictionary>
<DataTemplate DataType="{x:Type local:StatusRuler}">
<local:ModyView />
</DataTemplate>
...
<Grid>
<Border Background="..... >
<!-- In the dockpane xaml (i.e. the view) add a content presenter -->
<ContentPresenter Content="{Binding StatusRuler, Mode=OneWay}" />
... View more
01-10-2019
11:52 AM
|
3
|
2
|
1116
|
POST
|
Ed, I think this is what you are after: UtilityNetwork.CreateElement so, it might look something like this: var layer = map.GetLayersAsFlattenedList().OfType<UtilityNetworkLayer>().FirstOrDefault();
if (layer != null)
{
var utilityNetwork = layer.GetUtilityNetwork();
//the feature class being a network source...
var rowCursor = featureClass.Search(queryFilter);
while (rowCursor.MoveNext())
{
var currentRow = rowCursor.Current;
var currentElement = utilityNetwork.CreateElement(currentRow);
... View more
12-28-2018
09:43 AM
|
1
|
8
|
1129
|
POST
|
I cannot reproduce your issue in either 2.2 or our next release (not yet available) 2.3. The placement of your context.Invalidate statements are correct. Please work with ESRI tech support to resolve your issue. They will most likely need a copy of your data as well.
... View more
12-03-2018
11:23 AM
|
0
|
0
|
973
|
POST
|
Flag your page as "dirty" - this.IsModified = true - this tells the property sheet that you have changes to commit. This guide might help - it does a step-by-step implementation: https://github.com/esri/arcgis-pro-sdk/wiki/ProGuide-Custom-settings
... View more
11-09-2018
08:57 AM
|
1
|
0
|
327
|
POST
|
The issue may also be that you are not using a non-recycling cursor. To test, access a non-recycling cursor off the feature class, not the layer.
... View more
10-29-2018
01:26 PM
|
2
|
1
|
316
|
POST
|
unless you use a Condition, you must set Autoload=true in your Config.daml. Otherwise, your add-in is not loaded until your button is clicked.
... View more
10-11-2018
01:10 PM
|
0
|
2
|
272
|
POST
|
Use a condition: ProConcepts-Framework#conditions-and-state sample: WorkingWithDAML Use a command filter: ProConcepts-Configurations#onexecutecommand
... View more
10-11-2018
09:23 AM
|
1
|
0
|
540
|
Title | Kudos | Posted |
---|---|---|
2 | Wednesday | |
1 | 03-18-2024 06:28 PM | |
1 | 03-19-2024 10:15 AM | |
1 | 03-18-2024 03:46 PM | |
2 | 03-14-2024 08:37 AM |
Online Status |
Offline
|
Date Last Visited |
Thursday
|