POST
|
Hi Uma, So I got it working, but was wondering if there is a better way. Is there a way to do what I want to do with just one event, or do I need to use all three to monitor the layers in the map?? This is in the Module1.cs of my MapTool code. protected override bool Initialize() { LayersAddedEvent.Subscribe((args) => { // Get the layers and also any selected OIDs for the AsBuilt and the SitePlan layers var asBuiltLayer = MapView.Active.Map.FindLayers("GISWRKS1.WORKS.Drawings_AsBuilts").FirstOrDefault() as BasicFeatureLayer; var sitePlanLayer = MapView.Active.Map.FindLayers("GISWRKS1.WORKS.Drawings_SitePlans").FirstOrDefault() as BasicFeatureLayer; // Check that the required layers are in the map. if (asBuiltLayer == null && sitePlanLayer == null) FrameworkApplication.State.Deactivate(StateID); else FrameworkApplication.State.Activate(StateID); } ); DrawCompleteEvent.Subscribe((args) => { // Get the layers and also any selected OIDs for the AsBuilt and the SitePlan layers var asBuiltLayer = MapView.Active.Map.FindLayers("GISWRKS1.WORKS.Drawings_AsBuilts").FirstOrDefault() as BasicFeatureLayer; var sitePlanLayer = MapView.Active.Map.FindLayers("GISWRKS1.WORKS.Drawings_SitePlans").FirstOrDefault() as BasicFeatureLayer; // Check that the required layers are in the map. if (asBuiltLayer == null && sitePlanLayer == null) FrameworkApplication.State.Deactivate(StateID); else FrameworkApplication.State.Activate(StateID); } ); LayersRemovedEvent.Subscribe((args) => { // Get the layers and also any selected OIDs for the AsBuilt and the SitePlan layers var asBuiltLayer = MapView.Active.Map.FindLayers("GISWRKS1.WORKS.Drawings_AsBuilts").FirstOrDefault() as BasicFeatureLayer; var sitePlanLayer = MapView.Active.Map.FindLayers("GISWRKS1.WORKS.Drawings_SitePlans").FirstOrDefault() as BasicFeatureLayer; // Check that the required layers are in the map. if (asBuiltLayer == null && sitePlanLayer == null) FrameworkApplication.State.Deactivate(StateID); else FrameworkApplication.State.Activate(StateID); } ); return base.Initialize(); }
... View more
09-07-2017
01:05 PM
|
0
|
1
|
357
|
POST
|
Yes, I am actually looking through the WorkingWithDAML example right now, but will check out the ConstructMarkerFromFont sample too. Thanks!
... View more
09-07-2017
12:30 PM
|
0
|
0
|
357
|
POST
|
Hi Charles, Yes, I was doing some copy/paste without really realizing what the MapPointBuilder was doing. Anyways.....just using the geometry parameter is working: modifyAsBuilts.Modify(asBuiltLayer, oid, geometry); One thing I am noticing is that the points in the map don't actually move until I click on 'OK' for the message box that pops up after I run modifyAsBuilts.Execute().....see below: modifyAsBuilts.Execute(); ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show(abCount.ToString() + " As-Builts moved.", "Points moved"); I am guessing that I need some sort of a delay in there for the moving of the points to catch up to the processing of the code.....right?? Now on to the next phase; figuring out how to enable/disable this tool based on certain layers being in the map or not....and also changing the mouse cursor to the 'Explore' tool after the points have been moved. Any advice??
... View more
09-07-2017
10:48 AM
|
0
|
2
|
1443
|
POST
|
See this thread for some solutions to this: https://community.esri.com/thread/200266-moving-selected-features
... View more
09-07-2017
08:43 AM
|
0
|
0
|
398
|
POST
|
Thanks again Uma. You have been a great help! I tweaked yours to work with a selection of features. Here is my final solution for anyone else who may be following this thread: // Get the layers and also any selected OIDs for the AsBuilt and the SitePlan layers var asBuiltLayer = MapView.Active.Map.FindLayers("GISWRKS1.WORKS.Drawings_AsBuilts").FirstOrDefault() as BasicFeatureLayer; // 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); // create counter for showing final results int abCount = 0; // start the EditOperation var modifyAsBuilts = new EditOperation(); modifyAsBuilts.Name = "Move As-Builts and Site Plans"; // Get any selected OIDs for the layer, and move each point to the mouse click point. if (asBuiltLayer != null) { var selectedAB = asBuiltLayer.GetSelection(); IReadOnlyList<long> selectedAsbuiltOIDs = selectedAB.GetObjectIDs(); foreach (var oid in selectedAsbuiltOIDs) { modifyAsBuilts.Modify(asBuiltLayer, oid, moveToPoint.ToGeometry()); abCount++; } } modifyAsBuilts.Execute();
... View more
09-07-2017
08:40 AM
|
3
|
4
|
1443
|
POST
|
I used to use FeaturePoint.PutCoords(pPoint.X, pPoint.Y) to change the coordinates of a point with ArcObjects. Does anyone know the ArcPro method for doing the same thing?? Thanks,
... View more
09-05-2017
12:31 PM
|
0
|
1
|
490
|
POST
|
Thanks Uma. That is working now. Do you know if there is a similar method that will move the feature to a specific coordinate?? Or is there a built-in method for calculating the offset between two coordinates??
... View more
09-05-2017
11:26 AM
|
0
|
7
|
1443
|
POST
|
Hi, i'm having some trouble trying to figure out how to move a bunch of selected features from a specific point layer in the map. This is what I have so far: //****Get all of the selected ObjectIDs from the VLS layer. var abLayer = MapView.Active.Map.FindLayers("GISWRKS1.WORKS.AsBuilts").First() as BasicFeatureLayer; var selection = abLayer.GetSelection(); IReadOnlyList<long> selectedOIDs = selection.GetObjectIDs(); //save the selected OBJECTIDs to a list. var insp = new ArcGIS.Desktop.Editing.Attributes.Inspector(); //create the Inspector var moveFeature = new EditOperation(); moveFeature.Name = "Move AsBuilts"; //Loop through each selected OBJECTID foreach (var oid in selectedOIDs) { insp.Load(abLayer, oid); moveFeature.Move(..............); //**** This is where I get stuck....I don't know what to do } I think my approach is all wrong, but I'm not sure what to do. I'm not exactly sure how to interpret this: ArcGIS Pro 2.0 API Reference Guide Thanks
... View more
08-22-2017
12:49 PM
|
1
|
13
|
2197
|
POST
|
Hi, For anyone interested, this seems to work. If you know of another way, please post it below. IEnumerable<Layer> layerCheck = MapView.Active.Map.GetLayersAsFlattenedList().Where(l => l.Name.IndexOf("GISWRKS1.WORKS.VLS_Points", StringComparison.CurrentCultureIgnoreCase) >= 0); int count = layerCheck.OrderBy(l => l).Count(); if (count < 1) { ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("Please add the VLS Layer to the map.", "Missing Layer"); return; }
... View more
08-21-2017
12:30 PM
|
1
|
0
|
1443
|
POST
|
Hi, What is the best way to determine if a layer exists or not? I have some code that runs on a specific layer, but I don't want Arc to crash if the layer doesn't exist when the user presses the button. Can anyone suggest a check to go through before the code below runs that will check for the layers existence? I would think evaluating MapView.Active.Map.FindLayers("GISWRKS1.WORKS.VLS_Points") to a boolean would work, but I can't seem to get it to. var vlsLayer = MapView.Active.Map.FindLayers("GISWRKS1.WORKS.VLS_Points").First() as BasicFeatureLayer; var selection = vlsLayer.GetSelection(); IReadOnlyList<long> selectedOIDs = selection.GetObjectIDs(); //save the selected OBJECTIDs to a list. Thanks!
... View more
08-21-2017
11:02 AM
|
0
|
2
|
2119
|
POST
|
Hi Uma, Thanks so much!! After reading through the articles, I now understand how things are working and was able to get it fixed.
... View more
08-21-2017
07:34 AM
|
0
|
0
|
618
|
POST
|
So I'm trying to get a MapTool and a Button (compiled in different projects) onto the same Ribbon (not the generic 'Add-In' ribbon. I have read through the post here, but still need some guidance. I seem to be able to create either tool on it's own ribbon, but to have both appear on the same one is more challenging. Here is my Config.daml code for each one. First One: <ArcGIS defaultAssembly="StreetView_ArcPro.dll" defaultNamespace="StreetView_ArcPro" xmlns="http://schemas.esri.com/DADF/Registry" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.esri.com/DADF/Registry file:///C:/Program%20Files/ArcGIS/Pro/bin/ArcGIS.Desktop.Framework.xsd"> <AddInInfo id="{5c21165c-68de-45d3-ab9d-ee7174380d4f}" version="1.0" desktopVersion="2.0.8933"> <Name>StreetView_ArcPro</Name> <Description>StreetView_ArcPro description</Description> <Image>Images\AddinDesktop32.png</Image> <Author>bulla_b</Author> <Company>Region of Durham</Company> <Date>31/7/2017 9:43:01 AM, 2017</Date> <Subject>Framework</Subject> <!-- Note subject can be one or more of these topics: Content, Framework, Editing, Geodatabase, Geometry, Geoprocessing, Layouts, Map Authoring, Map Exploration --> </AddInInfo> <modules> <insertModule id="StreetView_ArcPro_Module" className="Module1" autoLoad="false" caption="Module1"> <!-- uncomment to have the control hosted on a separate tab--> <tabs> <tab id="StreetView_ArcPro_Tab1" caption="Google Street View" keytip="T1"> <group refID="Google_Streetview_Group" /> </tab> </tabs> <groups> <!-- comment this out if you have no controls on the Addin tab to avoid an empty group--> <group id="Google_Streetview_Group" caption="Google Street View" keytip="G1"> <!-- host controls within groups --> <button refID="StreetView_ArcPro_Dockpane_ShowButton" size="large" /> <tool refID="StreetView_ArcPro_StreetView_Tool" size="large" /> </group> </groups> <controls> <!-- add your controls here --> <tool id="StreetView_ArcPro_StreetView_Tool" caption="Google Street View" className="StreetView_Tool" loadOnClick="true" smallImage="Images\Google-Earth-icon 16.png" largeImage="Images\Google-Earth-icon 32.png" condition="esri_mapping_mapPane" keytip="B1"> <tooltip heading="Google Street View Tool">Click on map to show Google Street View location in side panel.<disabledText /></tooltip> </tool> <button id="StreetView_ArcPro_Dockpane_ShowButton" caption="Open Street View Pane" className="Dockpane_ShowButton" loadOnClick="true" smallImage="Images\open_in_new_window.png" largeImage="Images\open_in_new_window.png" keytip="B2"> <tooltip heading="Show Side Panel">Click to open/activate Google Street View side panel.<disabledText /></tooltip> </button> </controls> <dockPanes> <dockPane id="StreetView_ArcPro_Dockpane" caption="Google Street View" className="DockpaneViewModel" dock="group" dockWith="esri_core_contentsDockPane"> <content className="DockpaneView" /> </dockPane> </dockPanes> </insertModule> </modules> </ArcGIS> and the Second One: <ArcGIS defaultAssembly="CardIndex_ArcPro.dll" defaultNamespace="CardIndex_ArcPro" xmlns="http://schemas.esri.com/DADF/Registry" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.esri.com/DADF/Registry file:///C:/Program%20Files/ArcGIS/Pro/bin/ArcGIS.Desktop.Framework.xsd"> <AddInInfo id="{30619449-054e-498f-9d2f-4bdb06959d30}" version="1.0" desktopVersion="2.0.8933"> <Name>CardIndex_ArcPro</Name> <Description>CardIndex_ArcPro description</Description> <Image>Images\AddinDesktop32.png</Image> <Author>bulla_b</Author> <Company>Region of Durham</Company> <Date>17/8/2017 1:24:34 PM, 2017</Date> <Subject>Framework</Subject> <!-- Note subject can be one or more of these topics: Content, Framework, Editing, Geodatabase, Geometry, Geoprocessing, Layouts, Map Authoring, Map Exploration --> </AddInInfo> <modules> <insertModule id="CardIndex_ArcPro_Module" className="Module1" autoLoad="false" caption="Module1"> <!-- uncomment to have the control hosted on a separate tab--> <tabs> <!--<tab id="CardIndex_ArcPro_Tab1" caption="New Tab"> <group refID="CardIndex_ArcPro_Group1"/> </tab>--> </tabs> <groups> <!-- comment this out if you have no controls on the Addin tab to avoid an empty group *** CardIndex_ArcPro_Group1--> <group id="CardIndex_ArcPro_Group1" caption="Map Tools" appearsOnAddInTab="true"> <!-- host controls within groups --> <button refID="CardIndex_ArcPro_CardIndex_Button" size="large" /> </group> </groups> <controls> <!-- add your controls here --> <button id="CardIndex_ArcPro_CardIndex_Button" caption="Card Index" className="CardIndex_Button" loadOnClick="true" smallImage="Images\ace-logo2.png" largeImage="Images\ace-logo2.png"> <tooltip heading="Card Index Tool:">Opens scanned drawing for selected WaterMain and Sewer Pipes.<disabledText /></tooltip> </button> </controls> </insertModule> </modules> </ArcGIS> I don't really care if the first one goes on the second one, or the second one goes on the first one. If someone could please explain the logic behind this is supposed to work, and some code hints/fixes I would appreciate it. Thanks!
... View more
08-18-2017
11:46 AM
|
0
|
2
|
936
|
POST
|
Hmmmm.....and it seems like the WebBrowser control is not capable of handling Google Streetview. I can get it to Navigate to other pages, but a link to Google Streetview causes nothing but problems. Oh well....at least I know how a DockPane works now!!
... View more
08-08-2017
07:26 AM
|
0
|
0
|
1851
|
POST
|
Thanks for the help. I'm a bit confused by your explanation of DockpaneView and DockpaneViewModel, but I'm trying to work with what you have posted. Things are definitely closer to working. I had some troubles getting your code to work, but once I added the _this = this; in the DockpaneView:UserControl I was good. I no longer get errors, but the WebControl is not refreshing with the new URL based on the Lat/Long of the mouse click.
... View more
08-08-2017
06:35 AM
|
0
|
0
|
1851
|
Title | Kudos | Posted |
---|---|---|
2 | 05-13-2024 07:06 AM | |
1 | 03-21-2024 07:55 AM | |
1 | 12-04-2023 11:28 AM | |
1 | 11-03-2023 05:25 AM | |
1 | 09-28-2023 11:31 AM |
Online Status |
Offline
|
Date Last Visited |
06-26-2024
06:46 PM
|