POST
|
I'd like to try and integrate more java for addins and engine, but I always run into strange problems - the last engine app I tried to write in Java gave me 'cannot find main class' errors (I was using jre1.6, but have java 1.8 installed, perhaps that is an issue). Also, I have problems where my buttons don't show up in the Java Commands or any other category I enter. Have you experienced anything like this with Java?
... View more
10-21-2014
10:21 AM
|
0
|
0
|
362
|
POST
|
Hello, I'm looking for a way to bulk-update the alias of fields that contain a specific existing alias. Right now, I'm using IClassSchemaEdit method AlterAliasName(string name), but the alias doesn't look to be saving. Is there a way to programatically update aliases of fields with arcobjects?
... View more
06-30-2014
06:47 AM
|
0
|
0
|
1061
|
POST
|
Hello, I am in the process of creating a toolbar containing nested menus with buttons and other menus for access of some custom functionality for end users. For whatever reason, since the ArcMap addin templates do not seem to allow a toolbar contained menus with nested submenus, I turned to the non-addin approach of creating a BaseToolbar which has the ability to add commands (menus, buttons, etc.):
public MyToolbar()
{
this.AddItem(typeof(ButtonItem));
}
where ButtonItem is a class which inherits BaseCommand:
[Guid("2b3041ff-482c-4c36-aef3-2bf79546fb82")]
[ClassInterface(ClassInterfaceType.None)]
[ProgId("TestLib.ButtonItem")]
public class ButtonItem : BaseCommand
{
// ...
}
What I really want these buttons to do is have some non-ESRI functionality (which none of the examples provide), for example, when clicked, retrieves some id, name, or caption of this button, and traverses a directory on the file system to add a new layer to the map, or create a config .xml file somewhere on the file system. However, there seems to be no room to add any custom methods or properties to ButtonItem, since the method AddItem() of the base toolbar does not take an instantiated object, but either a progid, or class type. How can I handle the onClick method of this specific button to access class properties? There does not seem to be a clear indication of how/when the constructor and onCreate methods are executed. Does anyone have experience utilizing this toolbar/menu style, or know how to dynamically add nested menu items to an add-in toolbar (loop over a directory, and add a menu item for a folder, or a button item for a file)?
... View more
06-09-2014
05:06 AM
|
0
|
3
|
899
|
POST
|
Hi everyone, I have a script that checks the percentage of overlap between two polygons. The code below was working fine in 9.3 but now in 10.1 it crashes every time on the pTopologicalOperator.Intersect line with an error of "Exception from HRESULT: 0x80040215." I looked this code up on the Web but only found a few results and none of them matched my problem. I also followed the ESRI instructions to convert the hexidecimal number but I got no results when using ErrorLookup. Any help is greatly appreciated. Thanks, Carlos private static bool DetermineOverlapArea(IFeature pFeature1, IFeature pFeature2)
{
ITopologicalOperator2 pTopologicalOperator = null;
IGeometry pGeometry1 = null;
IGeometry pGeometry2 = null;
IGeometry pIntersectGeometry = null;
IArea pIntersectArea = null;
IArea pFeature1Area = null;
IArea pFeature2Area = null;
try
{
pGeometry1 = pFeature1.Shape;
pGeometry2 = pFeature2.Shape;
//Simplify geometries.
pTopologicalOperator = pGeometry1 as ITopologicalOperator2;
pTopologicalOperator.IsKnownSimple_2 = false;
pTopologicalOperator.Simplify();
pTopologicalOperator = pGeometry2 as ITopologicalOperator2;
pTopologicalOperator.IsKnownSimple_2 = false;
pTopologicalOperator.Simplify();
pGeometry1.SnapToSpatialReference();
pGeometry2.SnapToSpatialReference();
//Get intersection area.
pTopologicalOperator = pGeometry1 as ITopologicalOperator2;
pIntersectGeometry = pTopologicalOperator.Intersect(pGeometry2, esriGeometryDimension.esriGeometry2Dimension) as IGeometry;
pIntersectArea = pIntersectGeometry as IArea;
pFeature1Area = pGeometry1 as IArea;
pFeature2Area = pGeometry2 as IArea;
//Get overlap area.
int appOverlap = Convert.ToInt32((pIntersectArea.Area / pFeature1Area.Area) * 100);
int ensOverlap = Convert.ToInt32((pIntersectArea.Area / pFeature2Area.Area) * 100);
if (appOverlap > 5 || ensOverlap > 5)
return true;
else
return false;
}
catch (Exception ex)
{
return true;
}
} Ah yes, the HRESULT error. Give this a look: http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#//0001000002zz000000 find out what the code is representing, and that may narrow down what exactly is happening... also migrating from 9.3 to 10 has caused some bad/weird problems for me in the past.
... View more
04-14-2014
10:45 AM
|
0
|
0
|
376
|
POST
|
I'm using Java with arcobjects. Prints "Trying to create a gp object...", but never gets to "..Done!". Any suggestions? Have lots of other arcobjects code that works. For some reason can't get this one line to work! Its a drag as its kinda an important one!
...
public createGp() {
try{
dealWithLics();
System.out.println("Trying to create a gp object...");
GeoProcessor gp = new GeoProcessor();
System.out.println("..Done!");
} catch (Exception e) {
e.printStackTrace();
}
}
...
I often avoid the GeoProcessor object at all costs, and stick to pure ArcObjects. I've had issues with it in the past where it does the same thing randomly. What are you doing with the GeoProcessor object?
... View more
04-14-2014
06:15 AM
|
0
|
0
|
229
|
POST
|
Thanks for your effect kyanuk1. Ur searching layer level but its better feature level... For example I am having 20 layers but point intersecting 2 or 3 layer ..so I need point intersecting objects Not sure I understand... do you want to find all features intersecting an area (buffer) around a single point? From specific layers?
... View more
04-14-2014
06:13 AM
|
0
|
0
|
534
|
POST
|
Ok, you solved it. The class name in the config.xml needs to include your package name, which I said before. In the config.xml gui or the source, change the class value to: my.pkg.Button1.java Updated the config, and exported and reinstalled the addin... still nothing.
... View more
04-09-2014
08:22 AM
|
0
|
0
|
1608
|
POST
|
Also, the thing that is not the same in your environment is you have a value of "default" for the <AddInID> tag, whereas I have a value that looks like this: <AddInID>473e3189-0145-1000-5000-0a09186f0000</AddInID> The Add-in project wizzard places that value there for me, I don't do anything to generate it. Why is that? Good question... doesn't look like mine is being generated... not sure why? Perhaps that may be an issue, however, the addin itself is being recognized in ArcMap, just not the button. EDIT: It has something to do with the fact that the template being autogenerated is for 10.0 ... [ATTACH=CONFIG]32963[/ATTACH]
... View more
04-09-2014
08:12 AM
|
0
|
0
|
1608
|
POST
|
A screenshot of your project expanded would help. Your java source files are in a folder called: src or java ? Did you place the Button1 class in a package of your own? Such as: My Project[INDENT]java (or src)[/INDENT] [INDENT=2]your.package.name[/INDENT] [INDENT=3]Button1.java [/INDENT] Expanded project: [ATTACH=CONFIG]32958[/ATTACH]
... View more
04-09-2014
08:11 AM
|
0
|
0
|
1608
|
POST
|
Look at the source of your config.xml. <ArcMap> <Commands> <Button ... in here is where you want to check the following: </Commands> 1. The category value is correct. 2. The class value contains the full package name of the class, if you put your Button1 class in a package. 3. If you used an image for your button, make sure the path is correct. Here is what is created: [ATTACH=CONFIG]32955[/ATTACH] [ATTACH=CONFIG]32956[/ATTACH] I've noticed that even with the SDK for 10.1, the version it creates is 10.0 ... I've tried changing that to 10.1 before and after exporting the addin, but the Java Commands category still is not showing up.
... View more
04-09-2014
07:58 AM
|
0
|
0
|
1608
|
POST
|
Thanks for your reply.... Your searching Single feature layer.. I need to find intersecting features(all layers features) around a point feature. So use that method when iterating a list of IFeatureLayers from the map: if you want to get the layers in a map:
List<IFeatureLayer> myLayers = new List<IFeatureLayer>();
var layerUID = new UID();
layerUID.Value = "{40A9E885-5533-11D0-98BE-00805F7CED21}";
var eLayer = _ArcMap.Document.FocusMap.get_Layers(layerUID, true);
var layer = eLayer.Next();
while (layer != null)
{
var featureLayer = (IFeatureLayer)layer;
myLayers.Add(featureLayer);
layer = eLayer.Next();
}
then use the method I posted before on this list on your feature:
List<IFeature> intersectedFeatures = null;
foreach(var featureLayer in myList)
{
intersectedFeatures.AddRange(myFeature.SelectByGeometry(featureLayer, 10)); // 10 is an arbitrary buffer size.. you would use whatever you want here
}
... View more
04-09-2014
05:41 AM
|
0
|
0
|
534
|
POST
|
Thanks for your Reply.... I tired but it select only one feature. please send any sample code... If I'm understanding you correctly, you could use a SpatialFilter with a search distance to get all intersecting features from that point, i.e.:
public static List<IFeature> SelectByGeometry(this IFeature feature, IFeatureLayer fc, double searchDist) {
IFeatureCursor curs = null;
List<IFeature> features = new List<IFeature>();
try {
SpatialFilter sf = new SpatialFilterClass();
sf.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects;
ITopologicalOperator top = (ITopologicalOperator)feature.ShapeCopy;
sf.Geometry = top.Buffer(Convert.ToDouble(searchDist));
curs = fc.Search(sf, false);
var boundFeat = curs.NextFeature();
while (boundFeat != null)
{
features.Add(boundFeat);
boundFeat = curs.NextFeature();
}
return features;
}
finally
{
if (curs != null) Marshal.ReleaseComObject(curs);
}
}
... View more
04-09-2014
05:06 AM
|
0
|
0
|
534
|
POST
|
bump... looking for some more technical assistance with this issue
... View more
04-09-2014
04:58 AM
|
0
|
0
|
1608
|
POST
|
Hello, I am playing with the idea of an ArcEngine application with a custom toolbar I can add to the map control, but I am a bit stuck. I have added a new item -> Base Toolbar, where I can add esri commands:
[Guid("bf252637-ecde-48c3-9464-238bae6f800e")]
[ClassInterface(ClassInterfaceType.None)]
[ProgId("MyProject.MyCustomToolbar")]
public sealed class MyToolbar: BaseToolbar
{
public MyToolbar()
{
this.AddItem("{380FB31E-6C24-4F5C-B1DF-47F33586B885}"); //undo command
this.AddItem(new Guid("B0675372-0271-4680-9A2C-269B3F0C01E8")); //redo command
}
}
Is it possible to add buttons to a toolbar like this? In Arcmap, I have done it through the XML config with classes that inherit from esri addin control classes:
<AddIn language="CLR">
<ArcMap>
<Commands>
<Button class="ButtonClass"
Where the class:
public class ButtonClass : Esri.ArcGIS.Desktop.AddIns.Button
{
}
Has anyone done this with ArcEngine applications?
... View more
04-03-2014
11:29 AM
|
0
|
1
|
1568
|
POST
|
I can't guarantee that the connection method will be OSA; it might be database. I'm relying on clients of my code to provide a valid connection string, so it might be a passage from Finnegans Wake for all I know. I could write a bunch of code to validate the connection string passed, but my thinking is that this is something that Esri should be checking and returning an error for. Since it doesn't seem that Esri does this, I was hoping to find a way to timeout and throw an exception, rather than having to write and maintain a whole bunch of string validation code. Yeah... such is often the case with ArcObjects... sorry I can't be of more help. I'll often find writing my own solution for these things work out better in the end, anyway. I'm still struggling to get a Java ArcMap addin to even show up in the commands window after its been installed!
... View more
04-03-2014
05:12 AM
|
0
|
0
|
708
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|