POST
|
If you have a valid locator instance you should iterate through the reference tables. Each reference table has a name property. This name instance should implement IDatasetName. Using IDatasetName you have the information of the dataset and its workspace and you can open the dataset if necessary. Keep in mind, this will throw an exception if the dataset is not accessible.
internal static void WriteReferenceTableNamesToConsole(ILocator locator)
{
var addressLocator = locator as IReferenceDataTables;
if (null == addressLocator)
return;
var referenceDataTables = addressLocator.Tables;
IReferenceDataTable referenceDataTable;
while (null != (referenceDataTable = referenceDataTables.Next()))
{
var tableName = (IDatasetName) referenceDataTable.Name;
Console.WriteLine(tableName.WorkspaceName.PathName + Environment.NewLine + tableName.Name);
try
{
var referenceTable = (IFeatureClass) ((IName) tableName).Open();
// ...
}
catch (COMException)
{
Console.Error.WriteLine(string.Format("Reference data '{0}' for locator '{1}' not accessible!", tableName, locator.Name));
}
}
}
Regards from Germany
... View more
01-11-2013
08:10 AM
|
0
|
0
|
228
|
POST
|
Regarding to How-to-use-dynamic-workspaces-correctly. Adding a shapefile should work with the next release. Happily announced here: Coming up in ArcGIS Runtime SDKs 10.1.1 a lot.
... View more
11-04-2012
11:25 PM
|
0
|
0
|
260
|
POST
|
No, I am not using a VM. But I was able to narrow this down. The behaviour is reproducible by using the same JOGL libs like the ArcGIS Runtime. The current release seems to use JOGL v2.0-rc5. If I download the necessary libs for linux 64 Bit (gluegen-rt, gluegen-all-natives, jogl-all, jogl-all-natives) from JOGAMP Deployment v2.0-rc5 from 19-Dec-2011 the sample JOGL application fails like mentioned above. If I am using the current deployment v2.0-rc10 or the deployment v2.0-rc6 from 25-April-2012 it just works. The real magic happens around christmas. 🙂 When using the sample JOGL application by referencing the "Patched ArcGIS Runtime libs" with the four JOGL v2.0-rc6 libs the sample works too. But, trying to start a map application with this self patched ArcGIS Runtime libs results in the following OpenGL Error: Shader language version 2.0 or greater is required. 😞 VERSION:2.1 Mesa 8.0.2 RENDERER:Mesa DRI Mobile Intel® GM45 Express Chipset VENDOR:Tungsten Graphics, Inc SHADER LANGUAGE:1.20 Maybe, this is the reason for the strange exception mentioned above. Is there any plan to upgrade to a newer version of JOGL?
... View more
08-22-2012
01:19 PM
|
0
|
0
|
324
|
POST
|
If I start a simple map application the Runtime tries to initialize the OpenGL routines by using JOGL. But JOGL fails with the following exception. Info: XInitThreads() called for concurrent Thread support javax.media.opengl.GLException: X11GLXDrawableFactory - Could not initialize shared resources for :0.0 See JOGL Bugzilla (Same exception) https://jogamp.org/bugzilla/show_bug.cgi?id=576 A simple JOGL sample by using only the Runtime delivered JOGL libraries misbehaves the same way. Is this a known issue?
... View more
08-21-2012
12:39 AM
|
0
|
2
|
2763
|
POST
|
I modified the "Dynamic Layers - Simple Renderer Sample" by using a LocalMapService and added a new WorkspaceInfo instance as dynamic workspace. After modifying the data source by using DynamicLayerInfo::setLayerSource and refreshing the layer by ArcGISDynamicMapServiceLayer::refresh, an EsriServiceException "Requested an image but received content type text. Either the token used to access this server has expired or the parameters of this request are invalid." occurs. The workspace is a copy of the unpacked usa.gdb from the package folder. It would be nice to have a sample showing how to use dynamic workspaces. Thanks in advance. Modifed code: private WorkspaceInfo workspaceInfo; private JMap createMap() { ... // Add a new workspace LocalMapService mapService = new LocalMapService(getPathSampleData() + "MPKs/USCitiesStates.mpk"); mapService.setEnableDynamicLayers(true); WorkspaceInfoSet dynamicWorkspaces = mapService.getDynamicWorkspaces(); workspaceInfo = new WorkspaceInfo("WORKSPACE", WorkspaceInfo.WorkspaceFactoryType.FILE_GDB, "DATABASE=C:/data/arcgis/USA/usa.gdb"); dynamicWorkspaces.add(workspaceInfo); mapService.start(); dynamicLayer = new ArcGISDynamicMapServiceLayer(mapService.getUrlMapService()); ... } private void render(Renderer<Graphic> renderer, int layerId) { // Create new drawing info from our renderer, with set transparency DrawingInfo drawingInfo = new DrawingInfo(renderer, TRANSPARENCY); // Get the layerInfo from the dynamic layer and set the drawing info DynamicLayerInfoCollection layerInfos = dynamicLayer.getDynamicLayerInfos(); DynamicLayerInfo layerInfo = layerInfos.get(layerId); layerInfo.setDrawingInfo(drawingInfo); TableDataSource tableDataSource = new TableDataSource(); tableDataSource.setWorkspaceId(workspaceInfo.getId()); tableDataSource.setDataSourceName("Cities"); LayerDataSource layerDataSource = new LayerDataSource(); layerDataSource.setDataSource(tableDataSource); layerInfo.setLayerSource(layerDataSource); // Refresh the layer dynamicLayer.refresh(); }
... View more
08-03-2012
11:10 AM
|
0
|
8
|
6050
|
POST
|
As far as I can judge it, you need to initialize (starts the local server and so on) the layer first. Otherwise the layer instance is useless. See code snippet below. @Test public void addLocalFeatureLayer() throws InterruptedException { final Lock lock = new ReentrantLock(); lock.lock(); try { final Condition condition = lock.newCondition(); final ArcGISLocalFeatureLayer layer = new ArcGISLocalFeatureLayer(mapPackagePath, "Germany"); layer.addLayerInitializeCompleteListener(new LayerInitializeCompleteListener() { @Override public void layerInitializeComplete(LayerInitializeCompleteEvent e) { lock.lock(); try { assertTrue("The local layer must have a valid URL!", null != layer.getUrl()); Type geometryType = layer.getGeometryType(); assertTrue("The geometry type is not valid!", Geometry.Type.Polygon == geometryType); } finally { condition.signal(); lock.unlock(); } } }); layer.initializeAsync(); condition.await(); } finally { lock.unlock(); } }
... View more
05-25-2012
04:56 AM
|
0
|
0
|
275
|
POST
|
Hi Ralf, Works like a charm with the Pre-Release version. [ATTACH=CONFIG]14631[/ATTACH] Thank you, Jan
... View more
05-25-2012
03:47 AM
|
0
|
0
|
503
|
POST
|
We do not really understand why the implemented geometries (Point, Envelope, Polygon and so on) do not have a spatial reference. For each spatial operation on geometries you have to know the spatial reference of each. So we come up with defining our on class wrapping the geometry implementation and offering the access to the corresponding spatial reference.
public class SpatialGeometry {
private final Geometry geometry;
private final SpatialReference spatialReference;
public SpatialGeometry(Geometry geometry, SpatialReference spatialReference) {
this.geometry = geometry;
this.spatialReference = spatialReference;
}
public static SpatialGeometry createWgs84Geometry(Geometry geometry) {
return new SpatialGeometry(geometry, SpatialReference.create(SpatialReferenceCode.Wgs84.getCode()));
}
.
.
.
public Geometry getGeometry() {
return geometry;
}
public SpatialReference getSpatialReference() {
return spatialReference;
}
}
It would be nice to get some feedback why the geometries are implemented without having a spatial reference.
... View more
04-09-2012
03:44 PM
|
0
|
0
|
935
|
POST
|
Is it possible to define the absolute and/or relative location of the runtime folder. For instance, we are deplyoing a bunch of ArcGIS Runtime for Java applications. ArcGISRuntime10.1 [INDENT]- LocalServer32[/INDENT] [INDENT]- LocalServer64[/INDENT] Applications [INDENT]- MapApplication[/INDENT] [INDENT][INDENT]- lib[/INDENT][/INDENT] [INDENT][INDENT]- icons[/INDENT][/INDENT] [INDENT][INDENT]- data[/INDENT][/INDENT] [INDENT][INDENT]MapApplication.jar[/INDENT][/INDENT] [INDENT]- GeocodeApplication[/INDENT] [INDENT][INDENT]- lib[/INDENT][/INDENT] [INDENT][INDENT]- icons[/INDENT][/INDENT] [INDENT][INDENT]- data[/INDENT][/INDENT] [INDENT][INDENT]GeocodeApplication.jar[/INDENT][/INDENT] Any application should use the same runtime folder. We do not want to copy the ArcGISRuntime10.1 folder to each application folder where the *Application.jar is located. How would you suggest to achieve (e.g. java/system environment variable) that? Thanks in advance.
... View more
04-09-2012
03:16 PM
|
0
|
1
|
721
|
POST
|
The easiest thing as far as I can judge it, is using a map overlay and only delegating the mouse events to the JComponent if no current tool is set.
// Create the map and add a map overlay
// which delegates to the current tool
map = new JMap();
map.addMapOverlay(new MapOverlay() {
@Override
public void onMouseClicked(MouseEvent event) {
if (currentTool == null)
super.onMouseClicked(event);
else
currentTool.onMouseClicked(event);
}
@Override
public void onMouseDragged(MouseEvent event) {
if (currentTool == null)
super.onMouseDragged(event);
else
currentTool.onMouseDragged(event);
}
@Override
public void onMouseEntered(MouseEvent event) {
if (currentTool == null)
super.onMouseEntered(event);
else
currentTool.onMouseEntered(event);
}
@Override
public void onMouseExited(MouseEvent event) {
if (currentTool == null)
super.onMouseExited(event);
else
currentTool.onMouseExited(event);
}
@Override
public void onMouseMoved(MouseEvent event) {
if (currentTool == null)
super.onMouseMoved(event);
else
currentTool.onMouseMoved(event);
}
@Override
public void onMousePressed(MouseEvent event) {
if (currentTool == null)
super.onMousePressed(event);
else
currentTool.onMousePressed(event);
}
@Override
public void onMouseReleased(MouseEvent event) {
if (currentTool == null)
super.onMouseReleased(event);
else
currentTool.onMouseReleased(event);
}
@Override
public void onMouseWheelMoved(MouseWheelEvent event) {
if (currentTool == null)
super.onMouseWheelMoved(event);
else
currentTool.onMouseWheelMoved(event);
}
});
... View more
04-09-2012
02:59 PM
|
0
|
0
|
438
|
POST
|
We are developing a simple ArcGIS Runtime file explorer application. For this kind of scenario it would be very helpful if the API is offering some "fail safe" method determining whether or not a file is a valid map/tile/locator- package. Right now, we are just doin a plain string comparison using the file extension (see below). It would be really nice to have the same functionality like IMapDocument.isMapDocument(String) from ArcObjects e.g. PackageUtils.isMapPackage(File), PackageUtils.isTilePackage(File), PackageUtils.isLocatorPackage(File). The method shown below is called by the label provider of the tree viewer whenever a node should be populated. The "fail safe" method should be fast, otherwise the UI could become unresponsive. File explorer application: [ATTACH=CONFIG]13357[/ATTACH] /** * Determines whether or not the specified element represents a map package. * * @param element * the element to validate * @return <code>true</code> only when this element represents a map package and has the type of {@link File}. */ public static boolean isMapPackage(Object element) { if (element instanceof File) { return ((File) element).getName().endsWith(".mpk"); } return false; } Is there any method providing this kind of "fail safe" access to packages? Thanks in advance.
... View more
04-09-2012
02:48 PM
|
0
|
1
|
2922
|
POST
|
We are developing a sample application which supports some basic functionality like navigating the map, zoom, identify with flashing and so on. We were not able to get any identify results by using an envelope nor a polygon geometry as spatial restriction. See the commented source code below. Sample map application: [ATTACH=CONFIG]13356[/ATTACH] IdentifyParameters identifyparam = new IdentifyParameters(); // Only works if location represents a point geometry identifyparam.setGeometry(location); . . The envelope geometry is created the same way as being used by the zoom in tool. The map is able to correctly set the new extent. The create envelope method is implemented as shown below. The MapView is just a custom class offering access to the JMap control. public static Envelope toEnvelope(MapView mapView, Rectangle2D rectangle) { Point topLeftPoint = mapView.getMap().toMapPoint((int) rectangle.getMinX(), (int) rectangle.getMinY()); Point bottomRightPoint = mapView.getMap().toMapPoint((int) rectangle.getMaxX(), (int) rectangle.getMaxY()); return new Envelope(topLeftPoint.getX(), topLeftPoint.getY(), bottomRightPoint.getX(), bottomRightPoint.getY()); } Would you be so kind and try to examine this? Thanks in advance.
... View more
04-09-2012
02:24 PM
|
0
|
2
|
2061
|
POST
|
Is it possible to deactivate the mouse motion and key events on the JMap by simple setting a flag? For instance, if someone tries to develop a custom tool which creates graphics on the map by clicking on it, the map still listen and reacts to the mouse motion events. If the user click on the map and drags the mouse a little bit the map extent changes unintentually. This is not a nice user experience. Right now, we are removing the mouse, mouse motion, mouse wheel listener and the action map from the JMap instance. Create for each instance a decorator (offering setActivated) and add these decorated listeners back to the JMap instance. If the custom tool is active the decorators are deactivated and the user can create graphics by clicking on the map. E.g. MouseMotionListenerDecorator
public class MouseMotionListenerDecorator implements MouseMotionListener {
private final MouseMotionListener mouseMotionListener;
private boolean activated = true;
public MouseMotionListenerDecorator(MouseMotionListener mouseMotionListener) {
this.mouseMotionListener = mouseMotionListener;
}
public boolean isActivated() {
return activated;
}
public void setActivated(boolean activated) {
this.activated = activated;
}
@Override
public void mouseDragged(MouseEvent e) {
if (!isActivated())
return;
mouseMotionListener.mouseDragged(e);
}
@Override
public void mouseMoved(MouseEvent e) {
if (!isActivated())
return;
mouseMotionListener.mouseMoved(e);
}
}
Is there any better way by using the API? Thank you
... View more
10-31-2011
12:51 PM
|
0
|
2
|
2933
|
POST
|
As far as I can judge it the .NET Wrapper is implemented using C++/CLI. This means that each "managed class" has a finalizer (e.g. Table::!Table) and from a C# perspective this class implements IDisposable. The finalizer is mainly used for releasing unmanaged resources. Taking a look at the core API the "valid state" of a Table is manged by using Geodatabase::OpenTable and Geodatabase::CloseTable. This means the managed Table instance must have a reference to the corresponding Geodatabase instance. I believe that the finalizer Table::!Table always tries to use this Geodatabase instance. This can lead to an ObjectDisposedException when the Geodatabase instance was already disposed by the developer or by the "Garbage Collector" (brain bug). I can reproduce this by using the follwing code snippet:
internal static void DisposeGeodatabase(string path, string tableName)
{
Geodatabase geodatabase = Geodatabase.Open(path);
try
{
Table table = geodatabase.OpenTable(tableName);
try
{
Console.WriteLine(table.RowCount);
}
finally
{
table.Close();
// Not disposing the table leads to an ObjectDisposedException in the finalizer (Table::!Table())
//table.Dispose();
}
}
finally
{
geodatabase.Close();
// The geodatabase must not be disposed!
geodatabase.Dispose();
}
}
If this is true, any developer have to take care about this fact. The easiest way could be a combination of the using directive and a kind of visitor implementation. Like the following snippet shows:
private static void Apply(string path, Action<Geodatabase> strategy)
{
using (Geodatabase geodatabase = Geodatabase.Open(path))
{
try
{
strategy(geodatabase);
}
finally
{
geodatabase.Close();
}
}
}
I put some effort in this kind of workaround and designed some "helper classes" which can be combined using lambdas. The following snippet shows how to iterate through all rows of a table. You can modify the RowCollectionStrategy to obtain a specific subset of the table.
internal static void IterateAllRows(string path, string tableName)
{
GeodatabaseStrategy geodatabaseStrategy = new GeodatabaseStrategy(path);
geodatabaseStrategy.Apply((geodatabase) =>
{
TableStrategy tableStrategy = new TableStrategy(geodatabase, tableName);
tableStrategy.Apply((table) =>
{
long count = DetermineAccessibleRows(table);
Console.WriteLine("{0} rows of table '{1}' processed", count, tableName);
});
});
}
private static long DetermineAccessibleRows(Table table)
{
RowCollectionStrategy rowCollectionStrategy = RowCollectionStrategy.CreateRecycleAll(table);
long count = 0;
rowCollectionStrategy.Apply((rows) =>
{
foreach (Row row in rows)
{
count++;
}
});
return count;
}
Would you be so kind and try to investigate if this unexpected "Dispose behaviour" is correct. This prototype workaround implementation (all the sample data is not included) can be obtained by: SourceForge
... View more
08-22-2011
08:37 AM
|
0
|
3
|
3765
|
POST
|
Using the Beta 3 version of the File Geodatabase API for Windows the IFields struct seems to be only forward declarated. Steps to reproduce: Include "Util.h" and try to compile. Compiler error: IFields missing identifier Could it be, that this header file is for internal use only? Thanks in advance
... View more
04-01-2011
01:33 AM
|
0
|
2
|
1596
|
Title | Kudos | Posted |
---|---|---|
1 | 03-13-2024 11:41 AM | |
1 | 03-13-2024 10:42 AM | |
1 | 03-13-2024 09:41 AM | |
1 | 03-13-2024 12:24 PM | |
2 | 03-07-2024 02:41 AM |
Online Status |
Offline
|
Date Last Visited |
6 hours ago
|