Problem with IPluginCursorHelper in ArcGIS10

Discussion created by mbellhydro on Mar 9, 2011
I've successfully implemented several plugin feature classes in ArcGIS 9.3. Now i'm trying to update them to ArcGIS 10 and ran into a strange problem.

This is the code I use to get the geometry in the IPlugCursorHelper function. I have all geometries collected in an array buffer "m_featureBuffer" and use the IClone interface to copy them to the pGeometry parameter. This is working in ArcGIS 9.3

        public void QueryShape(IGeometry pGeometry)
            if ((pGeometry == null) || IsFinished() || !m_IsFeatureClass)

                // Wert der Shapespalte zuweisen
                ((IMAware)pGeometry).MAware = m_bM;
                ((IZAware)pGeometry).ZAware = m_bZ;
            catch (Exception ex)
                System.Diagnostics.Debug.WriteLine(" Error: " + ex.Message);

In ArcGIS10 all geometries are drawn to the map, but: if I use the table view, select a feature and choose "Zoom To Selected" nothing happens. It's like the geometry is empty.

Trying to get the feature by ID is indeed returning a null value as geometry!
  IEnumIDs qpEnumIDs = (pFLFeatureLayer as IFeatureSelection).SelectionSet.IDs;
  int aFeatureID = qpEnumIDs.Next();
  IFeature flFeature = pFLFeatureClass.GetFeature(aFeatureID);
  IPolyline flShape = flFeature.Shape as IPolyline; // flFeature.Shape is null.......

I also tested a feature cursor to iterate through the feature class. The cursor delivers the correct geometry! Problem only shows up, if using GetFeature by ID.

You can reproduce the problem by slightly modifying the SimplePointPlugin example. If you create a temporary geometry and use the IClone interface to fill the geometry.
Change in "SimplePointCursor.cs":
// in method QueryShape
               else if (pGeometry is IPolyline)
                    // old:
                    //buildPolyline((IPointCollection)pGeometry, x, y);
                    // new:
                    IPolyline newPolyline = new PolylineClass();
                    buildPolyline((IPointCollection)newPolyline, x, y);

Then load a Polyline class from the example. The class draws correctly, but "Zoom To Selected" doesn't work anymore....

I'm really stuck here. Any idea to fix this would be highly appreciated!!!


Using ArcGIS 10 with SP1 and Visual Studio 2008 with SP