BaseCustomLayer Draw() use of IProjectedCoordinateSystem5

687
1
04-11-2012 11:11 AM
ScottMcNeil
New Contributor
Using Arc 9.3.1 & VS2008.

Having trouble with converting spatial reference to PCS on a new development system only.  This worked fine on my previous development system (XP), and works fine on a production system (Win7).  But on the new system the conversion to PCS below always returns a null object reference.

    public override void Draw(ESRI.ArcGIS.esriSystem.esriDrawPhase drawPhase, IDisplay Display, ESRI.ArcGIS.esriSystem.ITrackCancel trackCancel)
    {
      if (!m_bValid || !m_visible)
        return;
      if (drawPhase != ESRI.ArcGIS.esriSystem.esriDrawPhase.esriDPGeography)
        return;
 
       IProjectedCoordinateSystem5 pcs5 = Display.DisplayTransformation.SpatialReference as IProjectedCoordinateSystem5;

      // then the work is done which just puts markers on the map
      ...
   }

Any ideas on why this is broken on my new development system?  

Thank you if you can help!
0 Kudos
1 Reply
ScottMcNeil
New Contributor
Additional Note:  In the debugger, the Display.DisplayTransformation.SpatialReference member does not seem have the correct value.  The debugger shows the reference as that of "System.__ComObject".  On the working system the debugger correctly shows the object is an ESRI.ArcGIS.Geometry.ProjectedCoordinateSystemClass.
0 Kudos