POST
|
I am looking for an event that would fire in a maptool if another tool is selected. In this case, I have a maptool that works with a dockpane to enter features, but if the user selects another tool, they will lose the features they put in (I'm not sure if the maptool disposes when you select another tool, or if the features remain, but when the maptool is selected again, it starts over). So I need an event that the custom tool is disposing, or something like that if they select another tool, then notify them that they need to save the features or discard them. Better yet, if there is a way that they can choose another tool, then come back to the custom maptool and pick up where they left off, that would be ideal, but I don't know if it's possible. Note: This is not being done in an edit operation, I want the user to be able to enter the points in, the app will calculate the point values, and when they click Save the edit operation will be created and all edits will be written to the database.
... View more
03-29-2021
10:06 AM
|
0
|
0
|
371
|
POST
|
I've double, even triple checked those names, even cut/paste from one to the other to make sure they were exact, still get the same thing. I also tried renaming the Pro settings file, so that a new one could be created, didn't help. Even restoring from yesterday's backup didn't help. However, from the backup I did have to fix the xaml that got messed up on me again, since that's something that I fixed this morning and was part of yesterday's version. I did that (both times) by adding a new dockpane, then changing all the IDs to the ID of the broken dockpane, replacing the xaml in the broken one with that xaml code, then pasting in the code for my controls. Maybe that had something to do with it, although it was working fine after I did that. I just went ahead and added a new dockpane, set it up in the tool, pasted my controls into the xaml and copied all my code, properties, etc. over from the other one, and it works OK now. I did notice on the Button class in the viewmodel, that there is a warning about on the line internal class dpIDTools_ShowButton : Button about a naming rule violation since it starts with lowercase. It's just a warning, and didn't seem to matter before, but I went ahead and made the new one starting with uppercase
... View more
02-25-2021
11:49 AM
|
0
|
0
|
1603
|
POST
|
Yeah I saw that right after I posted, that I forgot to include the button daml xml. <button id="CustomIDDockPane_dpIDTools_ShowButton" caption="Show ID Tools Pane" className="dpIDTools_ShowButton" loadOnClick="true" smallImage="pack://application:,,,/ArcGIS.Desktop.Resources;component/Images/GenericButtonPurple16.png" largeImage="pack://application:,,,/ArcGIS.Desktop.Resources;component/Images/GenericButtonPurple32.png"> <tooltip heading="Show Dockpane">Show Dockpane<disabledText /></tooltip> </button> </controls> <dockPanes> <dockPane id="CustomIDDockPane_dpIDTools" caption="dpIDTools" className="dpIDToolsViewModel" dock="float" dockWith="esri_core_projectDockPane"> <content className="dpIDToolsView" /> </dockPane> </dockPanes> Thanks for the suggestions, I'll give it a shot. While I am getting more used to the Pro programming stuff, at times I'm almost afraid to touch anything, because of stuff like this. I had to rebuild the xaml pretty much from scratch after removing a button from the xaml code and then got like 15 errors for malformed xml, I replaced the code and didn't fix it (in that case, I hadn't saved the file, so I went to the xaml file on my drive, opened it in notepad, and copied and pasted it into the xaml file, didn't fix it.) Thanks again for the quick reply, I'll try it and post back shortly.
... View more
02-25-2021
09:54 AM
|
0
|
2
|
1621
|
POST
|
I have a dockpane that was working pretty well, I was testing how it might come up if I docked it, so I set dock= to "group" in the config.daml file. The dockpane no longer shows up, when I click the button to show the dockpane it turns gray. I changed it back to "float" (i actually used ctrl-z to undo changing it to "group", in case I typed something wrong. It still just has the grayed out button, without opening the dockpane, so I guess I broke something? I tried debugging code but when I break it just shows that it's in "break mode". The code for the button is below, none of that has changed. I put a breakpoint on the onclick event and it never hit it, so for some reason it's not being called when I click the button? internal class dpIDTools_ShowButton : Button { protected override void OnClick() { dpIDToolsViewModel.Show(); } } This is in the config.daml: <dockPanes> <dockPane id="CustomIDDockPane_dpIDTools" caption="dpIDTools" className="dpIDToolsViewModel" dock="float" dockWith="esri_core_projectDockPane"> <content className="dpIDToolsView" /> </dockPane> </dockPanes> Thanks in advance for any suggestions that may help me resolve this. Jeff
... View more
02-25-2021
08:50 AM
|
0
|
7
|
1633
|
POST
|
Thanks Kirk, that worked. The sample that I was looking at didn't have it defined that way, it was using the definition in Module1. This was much simpler. I appreciate you looking at this, this will get me going on to the next challenge in this app. Thanks, Jeff
... View more
02-23-2021
02:37 PM
|
0
|
2
|
1141
|
POST
|
I am working on a tool that uses a dockpane to display results from features in a box from a maptool. I actually have already created this tool with a windows form and it works really well except for one issue that I don't think can be resolved, so I'm looking at the dockpane, which I believe is the only other way to get a form in Pro. However, I open the dockpane, then draw the box with the maptool, and when I call a function in the dockpane a null reference exception is returned. The data that I'm passing to the dockpane is not null, and I even tested it without passing any data and the dockpane still comes back null. I am using Esri sample "MapToolIdentifyWithDockpane" as a reference, and I have everything set up the same way as in that sample. The sample works, mine does not. I have this in the config.daml for the dockpane: <dockPanes> <dockPane id="CustomIDDockPane_dpIDTools" caption="dpIDTools" className="dpIDToolsViewModel" dock="float" dockWith="esri_core_projectDockPane"> <content className="dpIDToolsView" /> </dockPane> </dockPanes> This is what I have in Module1 to define the dockpane: internal class Module1 : Module { private static Module1 _this = null; private static dpIDToolsViewModel _dpIDToolsVM = null; public static Module1 Current { get { return _this ?? (_this = (Module1)FrameworkApplication.FindModule("CustomIDDockPane_Module")); } } internal static dpIDToolsViewModel dpIDToolsVM { get; set; } } I call this from the tool, this is where the error occurs: Module1.dpIDToolsVM.LoadIDResults(mapLayerNames, feat); This is the code in the viewmodel that the above line is calling: internal void LoadIDResults(List<string> layerNames, Dictionary<BasicFeatureLayer, List<long>> featureLayerList) { List<IDFeaturesInLayer> iList = new List<IDFeaturesInLayer>(); foreach (KeyValuePair<BasicFeatureLayer, List<long>> b in featureLayerList) { IDFeaturesInLayer i = new IDFeaturesInLayer(); i.Value = b.Key; i.Text = b.Key.ToString(); iList.Add(i); } } Thank you in advance for any assistance offered. Jeff
... View more
02-23-2021
09:50 AM
|
0
|
4
|
1200
|
POST
|
I had this same issue, I had changed a password on the account that is used for the layers in the project. I realized after searching for just about everything else, and looking at the not very helpful AGS Server logs, that I needed to remove the account from the registered DBs in AGS Server, and re-add the connection. After that it worked fine, I guess it had a conflict with the new password and the one that was stored in the registered connection on Server. I hope this saves someone a lot of frustration and searching...
... View more
10-29-2019
03:28 PM
|
4
|
1
|
8447
|
POST
|
I am working on creating an add-in for Pro that we use with ArcMap and is very popular, hence the need to get it working with Pro before we transition to using Pro exclusively. The issue is that retrieving data from our enterprise database is extremely slow, in the sample code below I am loading combo boxes with data from the geodb but it is going extremely slow, it takes around 90 seconds to bring all this data in (to compare with the ArcMap add-in the combo boxes are filled almost immediately). I don't consider it an immensely large amount of data (2036 N streets, 7391 S streets, 8416 E streets, 1208 W streets, and 1942 sudbivisions). Again, the ArcMap add-in has this data (and more, this is only about half of what I need to load for the completed project). Being new to the SDK for Pro, I may be doing all this in a less than efficient way? I thought about if I could have one "await" queuedtask that would run all the database queries at the same time, I don't even know if that's possible, but even if so, it would take at least 45 seconds. I appreciate any feedback provided. Thanks in advance for your assistance. Jeffrey Sauder GIS Administrator Town of Gilbert, Arizona using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; //using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; using ArcGIS.Core.CIM; using ArcGIS.Core.Data; using ArcGIS.Core.Geometry; using ArcGIS.Desktop.Catalog; using ArcGIS.Desktop.Core; using ArcGIS.Desktop.Editing; using ArcGIS.Desktop.Extensions; using ArcGIS.Desktop.Framework; using ArcGIS.Desktop.Framework.Contracts; using ArcGIS.Desktop.Framework.Dialogs; using ArcGIS.Desktop.Framework.Threading.Tasks; using ArcGIS.Desktop.Mapping; namespace ProAppModule1 { /// <summary> /// Interaction logic for Tools.xaml /// </summary> public partial class Tools : ArcGIS.Desktop.Framework.Controls.ProWindow { List<string> streetNamesN = new List<string>(); List<string> streetNamesS = new List<string>(); List<string> streetNamesE = new List<string>(); List<string> streetNamesW = new List<string>(); List<string> subdivNames = new List<string>(); DatabaseConnectionProperties connectionProperties = new DatabaseConnectionProperties(EnterpriseDatabaseType.SQLServer) { AuthenticationMode = AuthenticationMode.DBMS, Instance = @"gisdb", Database = "GBAGIS", User = "ixxxxxx", Password = "xxxxxx", Version = "sde.DEFAULT" }; public Tools() { InitializeComponent(); StartThis(); } private async void StartThis() { AddrDirCbo.Items.Add("N"); AddrDirCbo.Items.Add("S"); AddrDirCbo.Items.Add("E"); AddrDirCbo.Items.Add("W"); AddrDirCbo.SelectedIndex = 0; System.Windows.MessageBox.Show("Start"); streetNamesN = await GetDataForComboBoxes(0); streetNamesS = await GetDataForComboBoxes(1); streetNamesE = await GetDataForComboBoxes(2); streetNamesW = await GetDataForComboBoxes(3); subdivNames = await GetDataForComboBoxes(4); System.Windows.MessageBox.Show("Done With GEODB"); await LoadComboBoxes(0); await LoadComboBoxes(1); await LoadComboBoxes(2); await LoadComboBoxes(3); await LoadComboBoxes(4); System.Windows.MessageBox.Show("All Done"); } async Task<List<string>> GetDataForComboBoxes(int inLayer) { string dbField = ""; string dbTable = ""; string dbWhere = ""; string dbSubFields = ""; string dbPostClause = ""; List<string> dataFromDB=new List<string>(); await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() => { switch (inLayer) { case 0: //N streets dbField = "TOG_STNAME"; dbTable = "gbagis.dbo.stnetg"; dbWhere = "SNG_ST_DIR = 'N' and TOG_STNAME IS NOT NULL"; dbSubFields = "DISTINCT TOG_STNAME"; dbPostClause = "ORDER BY TOG_STNAME"; break; case 1: //S streets dbField = "TOG_STNAME"; dbTable = "gbagis.dbo.stnetg"; dbWhere = "SNG_ST_DIR = 'S' and TOG_STNAME IS NOT NULL"; dbSubFields = "DISTINCT TOG_STNAME"; dbPostClause = "ORDER BY TOG_STNAME"; break; case 2: //E streets dbField = "TOG_STNAME"; dbTable = "gbagis.dbo.stnetg"; dbWhere = "SNG_ST_DIR = 'E' and TOG_STNAME IS NOT NULL"; dbSubFields = "DISTINCT TOG_STNAME"; dbPostClause = "ORDER BY TOG_STNAME"; break; case 3: //W streets dbField = "TOG_STNAME"; dbTable = "gbagis.dbo.stnetg"; dbWhere = "SNG_ST_DIR = 'W' and TOG_STNAME IS NOT NULL"; dbSubFields = "DISTINCT TOG_STNAME"; dbPostClause = "ORDER BY TOG_STNAME"; break; case 4: //Subdivision dbField = "ENG_NAME"; dbTable = "gbagis.dbo.recorded_plats"; dbWhere = "ENG_NAME !='' AND ENG_NAME IS NOT NULL"; dbSubFields = "DISTINCT ENG_NAME"; dbPostClause = "ORDER BY ENG_NAME"; break; } using (Geodatabase geodatabase = new Geodatabase(connectionProperties)) { using (Table stTable = geodatabase.OpenDataset<Table>(dbTable)) { QueryFilter queryFilter = new QueryFilter { WhereClause = dbWhere, SubFields = dbSubFields, PostfixClause = dbPostClause }; using (RowCursor rowCursor = stTable.Search(queryFilter, false)) { while (rowCursor.MoveNext()) { using (Row row = rowCursor.Current) { dataFromDB.Add(Convert.ToString(row[dbField])); } } } } } }); return dataFromDB; } async Task LoadComboBoxes(int inTable) { //System.Windows.MessageBox.Show("Load"); switch(inTable) { case 0: foreach (string sName in streetNamesN) { AddrStreetCboN.Items.Add(sName); } AddrStreetCboN.SelectedIndex = 0; break; case 1: foreach (string sName in streetNamesS) { AddrStreetCboS.Items.Add(sName); } AddrStreetCboS.SelectedIndex = 0; break; case 2: foreach (string sName in streetNamesE) { AddrStreetCboE.Items.Add(sName); } AddrStreetCboE.SelectedIndex = 0; break; case 3: foreach(string sName in streetNamesW) { AddrStreetCboW.Items.Add(sName); } AddrStreetCboW.SelectedIndex = 0; break; case 4: foreach(string sName in subdivNames) { SubdivCbo.Items.Add(sName); } SubdivCbo.SelectedIndex = 0; break; } }
... View more
08-15-2019
07:54 AM
|
0
|
0
|
494
|
POST
|
Hi Robert, Rene commented about using one parameter instead of passing the x,y to the toMap function, I changed that and all works now. I hadn’t noticed that change in the code you sent me, which was correct, I apologize for overlooking that. Thanks Robert and Rene
... View more
04-24-2019
06:20 AM
|
0
|
0
|
1144
|
POST
|
Hi Robert, I tested that and sPoint is not null, it’s passing back the screen coordinates (I tested in both 4.10 and 4.11 and it’s the same).
... View more
04-24-2019
06:09 AM
|
0
|
2
|
1144
|
POST
|
Hi Robert, Thanks for the reply. The code you show is exactly what I have. Not sure if I’m missing something…
... View more
04-23-2019
01:27 PM
|
0
|
4
|
1144
|
POST
|
I have been having issues with the tools that I created for my javascript application, such as zoom in, measure, etc. I narrowed it down to the code that converts the screen point to x,y map point. This works in the 4.10 version, but not in the 4.11 version. The strange thing is that I have been using the 4.11 version since April 9 and this just broke 2 days ago. Switching back to 4.10 works fine. So for instance drawing the box polygon, I did a console.log for the variable values at the mouse points. The POINT = is the screen x,y and the second line is the x,y of the 2 envelope points (NW and SE). 4.11 version: POINT = 954,313 NaN,0,NaN,0 POINT = 958,317 NaN,0,NaN,0 ... In 4.10 I get these values: POINT = 976,312 746618.9368489848,850462.2705078744,746727.4440104435,850353.7633464157 POINT = 989,326 746618.9368489848,850462.2705078744,748138.0371094076,848834.6630859929 ... The code that converts screen point to map point is pretty straightforward: if(event.action=="update") { var sPoint = { x: event.x, y: event.y } ptUpdate=view.toMap(sPoint.x, sPoint.y); console.log("POINT = " + sPoint.x + "," + sPoint.y); //where view is the mapView and ptUpdate is the point to be calculated to map coordinates and passed to the boxpolygon function. I haven't seen any notices that this toMap function has changed. If there is something I am missing with the 4.11 upgrade and the ability to convert screen coordinates to map coordinates I haven't been able to find it. Thanks in advance for any assistance or guidance provided.
... View more
04-23-2019
12:52 PM
|
0
|
7
|
1331
|
POST
|
Hi Rene, Thanks for looking at this. The layers I am adding are from a REST service, the group layer itself is created in the arcmap project. This is how I am consuming that in my code: var testLayer=new MapImageLayer(); Then I add it to the map. The layer above will work in the 4.7 version but not 4.8. Thanks, Jeff
... View more
07-16-2018
09:30 AM
|
0
|
0
|
633
|
POST
|
After I upgraded to 4.8 I noticed that the group layers do not work anymore. They do not draw and can no longer be turned on/off individually. The layers are grouped in the REST service, and previous to 4.8 they always worked ok. I just went back to 4.7 for now, but wanted to report this issue, as I would like to be able to use the newer versions in the future. I attached screen shots of the layerlist for the 4.7 and 4.8. Thanks, Jeff
... View more
07-16-2018
06:47 AM
|
0
|
5
|
814
|
Title | Kudos | Posted |
---|---|---|
1 | 05-09-2017 06:08 AM | |
1 | 02-22-2018 08:23 AM | |
4 | 10-29-2019 03:28 PM |
Online Status |
Offline
|
Date Last Visited |
03-30-2021
12:12 PM
|