Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

What is the difference between IEditSketch and IEditSketch2? Also why there are same interfaces with the same name only with a difference "2" at the end of the interface's name ?

share|improve this question
add comment

4 Answers

up vote 5 down vote accepted

I think the doc for IEditsketch2 is wrong - it should say supreseded by IEditSketch3.

Provides access to members that access and manipulate the edit sketch. Note: the IEditSketch2 interface has been superseded by IEditSketch2 (sic). Please consider using the more recent version.

It's a violation of COM best practice to change an interface once it has been published. Instead, a new interface is published that inherits all the methods from the existing interface. When Esri does this, they add (or increment) a suffix number on the interface's name. enter image description here

share|improve this answer
    
+1 While it is generally good practice, from COM viewpoint it's not strictly necessary for a new version of the interface to inherit from the existing one. Actually in ArcObjects, sometimes new versions do not inherit from the older one - this is especially true for many outbound event interfaces, e.g. IEditEvents, IEditEvents2, IEditEvents3, IEditEvents4 etc. do not maintain any static inheritance relationship. –  Petr Krebs May 23 '11 at 16:03
add comment

This seems to be a pretty common thing for ESRI to do. I counted a dozen or so interfaces with numbers at the end just looking through the ArcObjects SDK (ITopologyGraph4, IEditSketch2, etc.).

One thing to be aware of with the different version of the interfaces is that they're not always implemented by the same classes. I ran into this when working with the IPointCollection5 interface. The documentation states that the previous version of the IPointCollection interface have been superseded by IPointCollection5. However, IPointCollection5 is only implemented by Multipoint, which was the reason I was getting an error with the statement

Dim pOutCollection As ESRI.ArcGIS.Geometry.IPointCollection5 = New ESRI.ArcGIS.Geometry.Polygon

Instead, I had to use the IPointCollection4 interface for the Point and Polygon classes. When using the new versions of the interfaces, always look at the list of classes that implement the interface.

share|improve this answer
    
+1 Good catch, although this is very, very rare in ArcObjects. –  Petr Krebs May 23 '11 at 15:58
add comment

Looks like they added more members (CurrentZ, EditSketchExtension, etc.) to the IEditSketch interface.

As for why, it's likely that they realized that new functionality was necessary for that interface. Since changing the original interface breaks the "contract" for all applications that use that interface, they had to rename it. To ensure that programmers understand that the new interface is related to the old one in some way, i.e. that more functionality has been added but that the fundamental idea of the interface is unchanged, they merely tacked a "2" onto the end of the original name.

This seems to be a pretty common thing for ESRI to do. I counted a dozen or so interfaces with numbers at the end just looking through the ArcObjects SDK (ITopologyGraph4, IEditSketch2, etc.).

share|improve this answer
add comment

You can read the descriptions of all the EditSketch interfaces below. It seems that both versions are being superseded by IEditSketch3. You may also want to read up on "Working with the edit sketch" link below.

IEditSketch

IEditSketch2

IEditSketch3

Working with the edit sketch

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.