Archive for the ‘ArcObjects’ Category

HowTo: Implement IPersistStream in a .NET class

April 22, 2008

When writing customized objects, many cases need to support serialization. For example, a custom symbol or element needs to be saved with the map document and load when the map document is opened. This functionality is available by implementing the interface IPersistVariant.

To support cloning through serialization, temporarily save the object to an ObjectSteam and then duplicate the object by creating a new instance of the class and loading its properties from the temporary ObjectStream. use an ObjectCopy class, which uses ObjectStream internally. This class requires that the cloned object, or clonee, support IPersistStream.

IPersistStream is a Microsoft interface which provides methods for saving and loading objects that use a simple serial stream for their storage needs. In order to use the structured stream given by these methods using .NET, the objects must be converted into a byte array.

There are several ways to convert objects into byte arrays in .NET, however each method is object type specific. For objects that only have managed class members, use MemoryStream in conjunction with a BinaryFormatter, assuming that all of these members support serialization. The reality is that the object has different types of class members, including both managed and unmanaged types, i.e., ArcObjects components. This makes it a challenge to implement the IPersistStream .Save() and IPersistStream.Load() methods. Writing this code as a part of the custom object can also be cumbersome and difficult to read and maintain.

The solution is to write a helper static class with helper methods Save() and Load () to delegate the calls when implementing IPersistStream in an object.

Further reading…

Sample for  ’Serialization ArcObjects to memory ’

FAQ: What are the build numbers for all the recent releases of ArcGIS?

April 4, 2008

Question

What are the build numbers for all the recent releases of ArcGIS?

Answer (from ESRI Support )

Build 535 = ArcGIS Desktop 9.0 final
Build 550 = ArcGIS Desktop 9.0 Service Pack 1
Build 560 = ArcGIS Desktop 9.0 Service Pack 2
Build 580 = ArcGIS Desktop 9.0 Service Pack 3
Build 589 = ArcGIS Desktop 9.0 Service Pack 3 + ArcGIS Desktop 9.0 Map Document Performance Patch

Build 722 = ArcGIS Desktop 9.1 final
Build 750 = ArcGIS Desktop 9.1 Service Pack 1
Build 780 = ArcGIS Desktop 9.1 Service Pack 2

 ArcGIS Desktop 9.1 Service Pack 2 displays as build 766 from ArcMap Help > About ArcMap.

Build 1324 = ArcGIS Desktop 9.2 final
Build 1332 = ArcGIS Desktop 9.2 Service Pack 1

 ArcGIS Desktop 9.2 Service Pack 1 displays as build 1324 from ArcMap and ArcCatalog Help > About ArcMap/ArcCatalog.

Build 1350 = ArcGIS 9.2 Service Pack 2

 ArcGIS Desktop 9.2 Service Pack 2 displays as build 1324 from ArcCatalog Help > About ArcCatalog.

Build 1380 = ArcGIS Desktop 9.2 Service Pack 3
Build 1420 = ArcGIS Desktop 9.2 Service Pack 4
Build 1450 = ArcGIS Desktop 9.2 Service Pack 5

 ArcGIS Desktop 9.2 Service Pack 5 still displays as build 1420 from ArcCatalog Help > About ArcCatalog.

ArcGIS 9.2 Service Pack 5 is available

March 27, 2008
ESRI released Service Pack 5 for the below products. Install and enjoy the fullest!
ArcGIS 9.2 Service Pack 5
ArcSDE 9.2 Service Pack 5
ArcIMS 9.2 Service Pack 5
ArcGIS Image Server Service Pack 5

Eclipse plug-in for debugging ArcObjects code

March 27, 2008

 Intro

Finally ESRI has made Eclipse plug-in for debugging ArcObjects Code. This is great news for java devlopers who uses print line statements.  One of the most important aspect of any tool is debugging.I strongly feel that Mircosoft products brings great developer productivity.  This is also one of  reasons why many huge fans for MS products than java.  Its better late than never, ESRI shown some concern to java developers!. Kudos ESRI :)

About the plug-in

One of the most valuable tools that developers have at their disposal is a debugger through which they can step through code one statement at a time and inspect objects in the application. As many of you may already know, Java classes in the ArcObjects API are really only proxies to underlying COM ArcObjects. As a result, examining these proxies in the debugger only reveals their internal details and not the state of the ArcObjects. This makes it difficult to find out information such as the coordinates of a geometry, or the layers in a map service. Consequently, developers have to sprinkle their code with System.out.printlns and analyze traces on the console to get this information. This approach can be inconvenient and time consuming.

With this new Eclipse plug-in, Java developers can examine the state of the underlying ArcObjects right in Eclipse IDE’s Debug Perspective by enabling the “Show Logical Structure” option on the Expression and Variables window. Here’s an example of a Point object without the “Show Logical Structure” option enabled.

untitled.jpg

This information provides little insight into the underlying ArcObject and is not helpful in reasoning through a workflow while debugging. Now here’s the logical representation of the same object with the “Show Logical Structure” option enabled.

untitled1.jpg

The logical representation presents more comprehensible information about the underlying ArcObject’s state. This state is defined by the no-argument getter methods on it. You might sometimes see exception messages like “Exception Occurred: com.sun.jdi.InvocationException occurred invoking method” in the logical representation. This is normal and happens when some property of the ArcObject is not valid in the current context of the application.

The underlying ArcObjects could be running remotely in a separate process as in the case of ArcGIS Server web applications, or in the same process like in ArcGIS Engine applications. Thus, both Engine and Server developers can take advantage of this plug-in to debug their applications.

How to get the plug-in

Follow these steps to download and install the plug-in from the EDN Website:

  1. In the Eclipse workbench, go to Help > Software Updates > Find and Install
  2. Select Search for new features to install, and click Next
  3. Create a New Remote Site for the URL “http://downloads.esri.com/EDN/java/plugins/eclipse”
  4. Enable this remote site and click Finish.
  5. Expand the EDN tree in Search Results, and select the ArcGIS Debug feature.
  6. Proceed to install the plug-in, and restart the workbench when prompted.

ArcGIS Server on ICEFaces Technology

March 3, 2008

Hello,

Here is latest development on developing ArcGIS Server Applications on Java by integrating ICEFaces Technology. My friend (see photo below) is working on this new model and details can be found here.

 Guide : http://www2.pch.etat.lu/pchViewer/guide.pdf

Download Script : Script submitted to code Challenge contest

URL : http://www2.pch.etat.lu/pchViewer/

I wish him all the very best for this efforts!.

 dsc03334.jpg

 Tom Cruise :)-

Cheers

Effective Geodatabase Programming : ESRI Podcasts

February 22, 2008

Here is a new podcast from ESRI on ‘Effective Geodatabase Programming’. Erik Hoel and Mike Muller discuss about the Geodatabase enhancements and what is upcoming in Geodatabase. This gives overall idea on Geodatabase. Hope this is useful.

Check out and listen

Threading in ArcObjects - A Reading

February 20, 2008

Multithreading allows an application to do more than one thing at a time within a single process. This topic details what multithreading means in the context of the ArcObjects .NET Software Developer Kit (SDK) as well as the rules that must be followed to properly integrate threading into ArcObjects applications, Cick here to read fully on writing multithread on Arcobjects.

Rotate Geometry without Editing-ITrasnform2D Interface

February 20, 2008

If you would like rotate/move set of features to certain degree/distance, you can easily make use of ITransform2D Interface(esriGeometry).  Methods in this interface, helps to rotate/move/transform the elements and geometries .

ITransform2D is a generic interface implemented by most elements and geometries (i.e., CircleElement, FrameElement, Point, Line, Polygon, etc.).  Use this interface when you want to update the position of the element or geometry through some type of Euclidan 2D transformation opertion (move, rotate, scale, or transform).

Once you did the necessary operations, you can store the geometry using IFeature:Store method. There is difference between using ‘Store’ method within edit session and outside. Calling Store within an edit session caches the edit until the edit session is ended. If a save is done, then the cached edits are written to the datasource. If no save is done, the cached edits are discarded. If you call Store outside of an edit session,  then the edit is committed immediately to the database. There is no way to rollback or discarded the changes. Hence it would be advised to use this with proper care. If you want to temporarily rotate/move ,then suits you well.

ITransform2D Interface Tutorial VBA Read the ‘Note’ carefully before using this sample.

Interface available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server

Initialize ArcObjects in standalone applications

February 15, 2008

Very often, we forget to intialise product license when we develop standalone apps using Arcobjects. Here is link to understand license model and IAOInitialize interface usage.

AoInitialize Interace

ArcGIS License Mode

Finding :Workspace- Connected Database

February 14, 2008

Many of us wants to know the underlying database of workspace connected.  Use IDatabaseConnectionInfo2: when you want to know the type of DBMS the workspace is connected to. For example, when connected to a SQLServer database ConnectionDBMS will return the enumeration value corresponding to a SQLServer database. GeodatabaseServerClass Property of this interface lists Server class types. i.e  Personal /Workgroup/Enterprise ArcSDE server.

Here is an sample in C#.NET