Advanced Hyperlink Functionality

2104
1
11-24-2011 12:46 AM
AlexandraFairbarns
New Contributor III
Hello All,

I realise that this subject has come up on this forum more than once, but it still seems to never have been answered. This theory worked in previous version, but not now since the change hyperlink scripting:

1. Feature field contain URL to an geo raster(.tiff) geotiff.
2. On hyperlink click find path of raster from field sx8 for clicked feature.
3. Open raster to arcmap.
4. Display raster in the active view in the location determined by the geotiff

This is almost like a raster catalog in which we show the bounding boxes of each image before click, and on click the hyperlink is found and it displays the actual image on top of the bounding box.

I noticed that the only way to do this would be to use what the esri help says:

<esri help >
You can create a dispatch object within your script code to call functions from a custom library.  This allows you to access ArcObjects through your hyperlink script via the dispatch object.  In addition you can pass IFeature and/or IFeatureLayer down to the dispatch object so that you launch the hyperlink for the appropriate feature. 
An example of a hyperlink script that creates a dispatch object:

Function OpenLink ( {IFEATURE}, {IFEATURELAYER} )
  Dim hlauncher
  Set hlauncher = CreateObject("Hyperlink_Lib.Launcher")
  hlauncher.Launch {IFEATURE}, {IFEATURELAYER}
End Function

This example will call the function Launch from a Hyperlink_Lib library that you have created.
<esri help >



Forgive me for being dense but this is not explained very well as to how to actually do it - please can someone jargon bust this for me. I am using visual studio .net - so how to link the two is what im looking for.

Thankyou in advance

Alex
0 Kudos
1 Reply
NileshShinolikar
New Contributor
Hi Alex,

Create the ArcMap  Class Library Project in Visual Studio
Before the declaration of the Class and the methods write [ComVisible(true)]
Create the Method having two parameters as Object
First parameter will use as IFeature and Second will be IFeatureLayer
Create the Object of IFature and IFeatureLayer
Cast the respective object
For testing purpose display a message box  and display Object id of the feature
Build the Project.
Open the ArcMap add FeatureCLass in it
Go to Layer Properties->Display Tab->Hyperlink
Check the Support Hyperlinks Using Field and select the script and click Edit
Copy and paste the following code in the text area
Function OpenLink ( {IFEATURE}, {IFEATURELAYER} )
  Dim hlauncher
  Set hlauncher = CreateObject("Hyperlink_Lib.Launcher")
  hlauncher.Launch {IFEATURE}, {IFEATURELAYER}
End Function

Hyperlink_lib.Launcher would the ProgID of your class(Namespace.ClassName)
Launch will be your method which we have created in the ClassLibrary

Now click on the Verify Button and it will call the Method from the Library and will display the message Box  having featureID  which we written inside the Method.


Here is the sample ArcMap Class Library Class

namespace Map
{
    [Guid("2526af52-e7ae-400d-a080-000ee8998910")]
    [ClassInterface(ClassInterfaceType.None)]
    [ProgId("Map.Class1")]
    [ComVisible(true ) ]
    public class Class1
    {
        [ComVisible(true ) ]
        public void   Test(object  pFeature, object  pFLayer)
        {
               IFeature Pf = (IFeature)pFeature;
            MessageBox.Show(Pf.Class.AliasName.ToString()+"Feature");
            MessageBox.Show(((IFeatureLayer )pFLayer).Name.ToString()+"Layer Name");
                       
        }

     }



I Hope this Helps.


Nilesh
GIS SDK Analyst
0 Kudos