Select to view content in your preferred language

IRouteEventSource and RouteEventSource

598
2
Jump to solution
09-25-2013 07:11 AM
ShaningYu
Honored Contributor
From this ArcObjects diagram at: http://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/index.html#//003100000138000000, it can be seen that the RouteEventSource class has 2 interfaces, and one of the interfaces is the  IRouteEventSource.  However, in VS 2010 Object Browser, I can see that the IRouteEventSource contains dozens of methods and properties, but none of the methods and properties of the IRouteEventSource is displayed in the RouteEventSource class.  Can someone explain this? 
Besides, I want to create a RouteEventSource object, how can it implement the IRouteEventSource?
Thanks.
0 Kudos
1 Solution

Accepted Solutions
ShaningYu
Honored Contributor
Should see the RouteEventSourceClass rather than the RouteEventSource in VS Object Browser.  Thread is to be closed.

View solution in original post

0 Kudos
2 Replies
ShaningYu
Honored Contributor
I need to make a correction here - In VS 2010 Object Browser, it shows that Both the IRouteEventSource and RouteEventSource are interfaces.  However, in ESRI's Exploring ArcObjects (Vol. 1, p967), it states that RouteEventSource is s sub-class of a feature class, which means it can be used anywhere a feature class can be.  I have created another thread to mention this issue (http://forums.arcgis.com/threads/93431-Subclass-RouteEventSource?p=331925#post331925).
The  RouteEventSource has 2 interfaces, one of which is the IRouteEventSource.   The IRouteEventSource has the Property: RouteLocator. 
To get the RouteLocator property, I tried this piece of code below,
            ESRI.ArcGIS.Location.RouteEventSource rteEventSource;   // RouteEventSource - an interface, contains IDataset only
            rteEventSource = (ESRI.ArcGIS.Location.RouteEventSource)fClass;  // fClass is a FeatureClass
            ESRI.ArcGIS.Location.IRouteEventSource rteEventSource2 = (ESRI.ArcGIS.Location.IRouteEventSource)rteEventSource;
but got error on the last line of the code with InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to interface type 'ESRI.ArcGIS.Location.IRouteEventSource'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{641755F0-B7DE-11D3-9F7C-00C04F6BDF06}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
0 Kudos
ShaningYu
Honored Contributor
Should see the RouteEventSourceClass rather than the RouteEventSource in VS Object Browser.  Thread is to be closed.
0 Kudos