More servicesWindows Live
HomeHotmailSpacesOneCare
 
MSN
Sign in
 
 
Spaces home  The Sandpit - "We hack s...ProfileFriendsBlogMore Tools Explore the Spaces community

Richie

View spaceSend a message
Site disclaimer: The views and opinions expressed in this website are solely mine. The contents of this website have not been reviewed or approved by my employer.

Xbox Live GamerCard

KiwiAddict
Xbox Live GamerCard
Rep:
Reputation:Reputation:Reputation:Reputation:Reputation:
Score:
3411
Zone:
Pro
Mass EffectCall of Duty 4Assassin's CreedGears of WarUNO

The Sandpit - "We hack so that you don't have to!"

June 05

Copy & Paste in ArcGIS Desktop - A Summary

This is just a small addition to the previous article on drag & drop in ArcGIS Desktop.

The following table summarizes the copy and paste capabilities between ArcGIS Desktop applications and window explorer.

From\To

ArcCatalog

ArcMap3

ArcScene3

ArcGlobe3

Windows Explorer

ArcCatalog1

ü

û

û

û

ü

ArcMap2 

û

ü

ü

ü

û

ArcScene2 

û

ü

ü

ü

û

ArcGlobe2

û

ü

ü

ü

û

Windows Explorer

û

û

û

û

ü

Notes:

1.    Copy simple single file objects like mxd, 3dd, lyr or prj.

2.    Copy a layer in the display tab of the table of contents using the layer right click menu.

3.    Paste as a layer by selecting “Paste Layer(s)” in the data frame right click menu.

Drag and drop in ArcGIS Desktop - An Explanation

Introduction

Drag & drop and copy & paste are convenient and intuitive methods of exchanging data between applications.  The ESRI ArcGIS Desktop applications ArcCatalog, ArcMap, ArcScene and ArcGlobe have limited support for data exchange with each other and windows explorer.

This table below summarizes the drag and drop capabilities between ArcGIS Desktop applications and windows explorer.

From\To

ArcCatalog

ArcMap

ArcScene

ArcGlobe

Windows Explorer

ArcCatalog1

ü

ü

ü

ü

ü

ArcMap2

û

ü

û

û

û

ArcScene2

û

û

û

û

û

ArcGlobe2

û

û

û

û

û

Windows Explorer3

û

ü

ü

û

ü

Notes:

  1. Any dataset or layer file or target specific document (ie mxd, sxd or 3dd).
  2. Drag a layer from the display tab in the table of contents.
  3. Drag a geographic file such as a image (eg jpg, png, tiff), layer file (lyr) or target specific document (ie mxd, sxd or 3dd).

ArcGIS Desktop applications use standard windows behavior for drag/drop and copy/paste operations.  This means, to a limited extent, that developers can build applications that interact with ArcGIS Desktop applications.

From a developer's perspective, drag/drop and copy/paste operations are very similar.  Both operations require the construction of a DataObject.  The distinction is how a DataObject is exchanged between the source and target.  In the case of drag/drop, the source control must use the DoDragDrop method against the DataObject and a target must "listen" for DragDrop events.  Copy/paste is much simpler as the DataObject is simply added and retrieved from the clipboard by the source and target respectively.

With regard to drag/drop and copy/paste operations, ArcGIS Desktop applications create one of two flavors of DataObjects.  When an operation starts from ArcCatalog, a DataObject is created containing data in the "ESRI Names" format.  When an operation starts from ArcMap, a DataObjects is created containing data in the "ESRI Layers" format.  These clipboard formats are registered with the computer when ArcGIS Desktop is installed.

The "ESRI Names" clipboard format is used to represent data containing a collection of ESRI named objects, namely, NamesEnumerator class.

The "ESRI Layers" clipboard format is used to represent data containing a collection of ESRI layers and tables.

ArcGIS Desktop developers have a choice of customizing a desktop application (e.g. ArcMap) or creating a standalone application (e.g. ArcGIS Diagrammer).  Both types of customizations can present windows for users to interact with and, optionally, participate in drag/drop or copy/paste operations with desktop applications.

The following sections will provide specific information on how to develop either a drag/drop source or target.

Creating a drop target for an "ESRI Names" DataObject

This is probably the easy operation to implement.  In the control that is designated to be the drop target listen for the DragDrop event, use the INameFactory::UpackageNames method to convert the DataObject into a collection of objects that implement the IName interface.  This EDN example is useful but please ensure that use "ESRI Names" as the clipboard format.

An alternative approach is to use the DataObjectHelper.

http://edndoc.esri.com/arcobjects/9.2/ComponentHelp/esriSystemUI/IDataObjectHelper.htm

****  ****

Creating a drop source for an "ESRI Names" DataObject

The ESRI Prototype Lab has recently published a sample on ArcScripts called DataObject Helper for ArcGIS Desktop that demonstrates this.  The sample includes a small C++ DLL called "BnchMrkDragDropNames.dll" that can be used to convert a collection of IName objects into an "ESRI Names" DataObject.

Creating a drop target for an "ESRI Layers" DataObject

Fortunately this topic is already covered in a detail here.

Creating a drop source for an "ESRI Layers" DataObject

Unfortunately, there is no solution to provide this capability at this time.

Example

This following screenshot demonstrates a sample application available from ArcScripts.  The sample allows the user to build a list of datasets using the Add and Remove buttons.  One or more of the selected datasets in the list can then be added to ArcMap (or ArcGlobe) using a standard drop/drop operation as shown below.

Drag and drop to ArcMap

The application references a small DLL called "BnchMrkDragDropNames.dll".  This DLL creates an ArcMap/ArcGlobe friendly DataObject that can be used drop/drop or copy/paste operations.  Here is how is a code snippet. 

private void ListView_ItemDrag(object sender, ItemDragEventArgs e) {
  
// Exit if nothing selected
  
if(this.listViewNames.SelectedItems.Count == 0) { return; }

  
// Create New ESRI Name Enumeration
  
IEnumName enumName = new NamesEnumeratorClass();

  
// Cast to IEnumNameEdit to allow addition of IName objects
  
IEnumNameEdit enumNameEdit = (IEnumNameEdit)enumName;

  
// Add IName objects to the enumertion
  
IName name1 = <...>;
   IName name2 = <...>;
   enumNameEdit.Add(name1);
   enumNameEdit.Add(name2);

  
// Create Prototype Lab's DragDropNames class
  
IDragDropNames dragDropNames = new DragDropNamesClass();

  
// Assign the IName Enumeration to the Names property
  
dragDropNames.Names = enumName;

  
// Perform a Control::DoDragDrop using the Prototype Lab's DragDropNames class
  
this.listViewNames.DoDragDrop(dragDropNames, DragDropEffects.All);
}

Other References:
May 23

P2P Geocollaboration in ArcGIS Explorer

Last week the ESRI Prototype Lab published a P2P geocollaboration extension for ArcGIS Desktop called G2G.  This capability is now available for ArcGIS Explorer users.  The custom task can be downloaded here from ArcScripts (full source code is included).

After the installation wizard is complete, the "Collaborate" task can be added using the Manage Tasks dialog (Tools > Manage Tasks...).  Please read the previous post on how to connect to the peer-to-peer mesh.

Collaboration behavior in ArcGIS Explorer is a little different from that in ArcMap.  G2G for ArcGIS Explorer currently only supports text chatting and the exchange of results such as addresses, notes and driving directions.  Results can be sent to any peer simply by dragging a result from the Results window and dropping it on to peer in the Collaborate task (as shown below).  To send a result to ALL peers drop the result on the Users node.

Snap5

Note, that only text chatting is currently interoperable between ArcMap and ArcGIS Explorer.

May 15

P2P Geocollaboration in ArcGIS Desktop

Most collaboration technologies require a central server to manager communication.  Email, web browsing and instant messaging all require a server to handle communication between clients.  This post introduces a new prototype that allows collaboration without the need of an intermediate server.

The ESRI Prototype Lab have developed a peer-to-peer (or P2P) extension to ArcGIS Desktop called G2G.  G2G is currently supported in ArcMap as an extra tab in the table of contents as shown below.

G2G for ArcGIS Desktop

Before you can collaborate with other peers you must first connect to a mesh (or peer cloud).  A mesh is virtual network comprising of two or more peers.  When the user clicks Connect in the Collaboration tab the following dialog is displayed.

Dialog to connect to the G2G Peer Mesh

The Username is a friendly name that you want to be identified on the mesh as.  By default, a password is not used.  If you specify a password then you will ONLY be able to "see" other peers that used the same password.  Using a password is a good method of excluding unwanted peers.

Most P2P applications are considered to be examples of hybrid P2P technology.  This is because most rely on some sort of server interaction, such as a DNS server.  In the case of G2G, a centralized resource is required to for peers to find other peers.  This central resource is called a peer resolver.

G2G supports two resolver types:

  1. PNRP
    Peer Name Resolution Protocol (or PNRP) is a proprietary technology by Microsoft.  G2G supports PNRP 2.0 which is installed by default on computers running Microsoft Windows Vista and an optional install for Microsoft Windows XP SP2.  Unfortunately PNRP is not supported on Microsoft Windows 2003/2008.
  2. Custom
    This is the address of a G2G peer resolver running on your network.  Details on how to start a G2G peer resolver are detailed below.  The purpose of the resolver is to exchange IP addresses (and ports) of other peers.  All subsequent communication is done on a peer-to-peer basis.

Within a few seconds on connecting you should see the names of other peers appearing in the list.  The user in bold is you.

G2G for ArcGIS Desktop - Connected to the Mesh

There are five ways you can collaborate with other peers:

  1. Chatting
    To chat click the Chat tab and start typing.  It is important to note that chatting is communal, that is, all peers see all text messages.

    Chatting with peers

    Note: Click the Enter key will not send the text.  Please click on the Send button on the chat toolbar.
  2. Publishing geo-referenced screenshots
    Returning to the Users tab, if you right click on another peer's name you will see the following context menu appear.  Clicking on Publish Map will send your current map display to the selected user.  The selected user (ie Bob) will automatically receive a new raster layer in his map document.

    How to publish your map to another peer 
  3. Requesting geo-referenced screenshots
    In the example above, Jim sent a screenshot to Bob.  This would have required Bob to make an explicit request to Jim.  G2G has the capability of requesting a screenshots from other peers without them knowing.  To covertly request a screenshot, select Request Map in the context menu.  To stop other peers from harvesting screenshots (or "maps") from your computer, unchecked the Map > Share option from the main menu.

    How to enable/disable map sharing
  4. Add, removing, editing shared graphics and ink
    Shared graphics is probably the most useful feature of G2G.  All peers can add, remove, edit graphics collectively.  A line or box added by one peer can be moved or deleted by another peer.  Any graphic from the Drawing toolbar and ink from the Tablet toolbar is supported.

    Example of map collaboration with callout labels 

    By default, all graphics/ink that is added to the map are shared with all other peers.  If you want to add graphics/ink to your map without it being shared then you can disable sharing by clicking Graphics > Share.

    How to enable/disable sharing of graphics and ink
  5. Share navigation
    From a screenshot above you may have noticed a entry in the peer context menu called Zoom to Map.  This will change your map extent to be same as the peer you selected.  Essentially you can see what areas other people are looking at.  However there is a significantly more advanced feature called shared navigation that allows one peer to control the map display of other peers.  The controlling peer (aka the master) must first enable extent sharing from the main menu (Extents > Share).

    How to share your extents with other users 

    Other peers (aka slaves) must then subscribe to the master peers map extent.  To subscribe to another peers extents click Follow in the peer context menu as shown below.

    Following another user

If you choose to use PNRP as your organizations peer resolver then please remember that this is only supported on Microsoft Windows Vista and Microsoft Window XP SP2+.  Another disadvantage of PNRP is that requires partial support for IPv6.  If you network and routes do not support this protocol then PNRP may not function correctly.  On Vista, PNRP 2.0 is already installed and running.  However, PNRP by default is not installed on Microsoft Windows XP.  To install PNRP on Microsoft Windows XP follow these steps:

  1. In the Control Panel, double-click Add or Remove Programs.
  2. In the Add or Remove Programs dialog box, click Add/Remove Windows Components.
  3. In the Windows Components Wizard, select the "Networking Services" check box and click "Details".
  4. Check the "Peer-to-Peer" check box and c