Migrating. Net code from ArcGIS 8.3 to 9.0

Source: Internet
Author: User
Migrating. Net code from ArcGIS 8.3 to 9.0

ArcGIS 9.0 introduces a change in the structure of the type libraries that define the ArcObjects classes and interfaces. these changes may require you to make changes in turn to your existing ArcObjects developments, regardless of the development language you are using.

You can find out information about the reasons for these changes and also the details of the changes in the topic migrating from 8.3 to 9.0.

In addition, you may encounter issues which are special ly relevant to the. NET environment.

  1. Non-OLE Automation compliant types
  2. Changes to members on class interfaces
  3. Changes to utility and base classes
  4. Capitalization changes

 

  1. Non-OLE Automation compliant types

    The interfaces in ArcObjects contain a few members which are not ole-compliant, for example the C-style array parameters used in many ry members. as COM InterOP relies on data types being ole-compliant, these members are unfortunately not useable in. net.

    At ArcGIS 8.3, ESRI manipulated the intermediate language (IL) of the InterOP assemblies in order to perform data type conversion and allow the members to be used in. net successfully. however, at 9.0, with the introduction of other supported environments such as Java, a more reliable and pervasive solution was required to allow access to non-ole-compliant members.

    In most cases, supplemental interfaces have been added which have members rewritten to use OLE-compliant data types. for example, for Members which used C-style arrays, alternative members have been added which use the OLE Automation safearray data type to handle the arrays. if you have used these members in your. net code with ArcGIS 8.3, you should change your code to use the new OLE Automation compatible interfaces when working against ArcGIS 9.0. this subject is discussed, with an example of ienvelope: definefrompoints, In the interoperating with COM topic in. NET Programming Techniques section of the developer help.

    These supplemental interfaces use the naming convention I <Interfacename> Gen. one exception to this naming convention is the igeometrybridge interface. in order to avoid the 'bloating 'of geometry classes with new interfaces, Ole-compliant versions of specified geometry members can be found grouped together on the igeometrybridge interface of the geometryenvironment class.

    The table below gives a listing of the ole-compliant interfaces and members, and their compliant equivalents.

     

    Interface Non-compliant Member Interface of equivalent compliant Member 9.0 ESRI. ArcGIS namespace
    Iaffinetransformation2d Definefromcontrolpoints Iaffinetransformation2d3gen Geometry
    Iaffinetransformation2d3 Defineconformalfromcontrolpoints Iaffinetransformation2d3gen Geometry
    Iaffinetransformation2d3 Querylinearcoefficients Iaffinetransformation2d3gen Geometry
    Iaffinetransformation2d3 Setlinearcoefficients Iaffinetransformation2d3gen Geometry
    Ibeziercurve Querycoords Ibeziercurvegen Geometry
    Ibeziercurve Putcoords Ibeziercurvegen Geometry
    Iclassify Classbreaks Iclassifygen: classify Esrisystem
    Iclassify Sethistogramdata Iclassifygen: classify Esrisystem
    Ienvelope Definefrompoints Ienvelopegen Geometry
    Ienvelope Definefromwkspoints Ienvelopegen Geometry
    Iforwardstar Queryadjacentedges Iforwardstargen Geodatabase
    Iforwardstar Queryadjacentjunctions Iforwardstargen Geodatabase
    Igeometrycollection Addgeometries Igeometrybridge Geometry
    Igeometrycollection Insertgeometries Igeometrybridge Geometry
    Igeometrycollection Querygeometries Igeometrybridge Geometry
    Igeometrycollection Setgeometries Igeometrybridge Geometry
    Imultipatch Querybeginningrings Igeometrybridge Geometry
    Imultipatch Queryfollowingrings Igeometrybridge Geometry
    Inetelementbarriers Setbarriers Inetelementbarriersgen Networkanalysis
    Inetelementbarriers2 Setbarriersbyeid Inetelementbarriersgen Networkanalysis
    Inetsolverweights Setfilterranges Inetsolverweightsgen Networkanalysis
    Ipiecewisetransformation Definefromcontrolpoints Ipiecewisetransformationgen Editorext
    Ipointcollection Addpoints Igeometrybridge Geometry
    Ipointcollection Insertpoints Igeometrybridge Geometry
    Ipointcollection Querypoints Igeometrybridge Geometry
    Ipointcollection Replacepoints Igeometrybridge Geometry
    Ipointcollection Setpoints Igeometrybridge Geometry
    Ipointcollection2 Getpoints Igeometrybridge Geometry
    Ipointcollection4 Addwkspointzs Igeometrybridge Geometry
    Ipointcollection4 Querywkspointzs Igeometrybridge Geometry
    Ipointcollection4 Setwkspointzs Igeometrybridge Geometry
    Iprojectedcoordinatesystem Forward Iprojectedcoordinatesystem4gen Geometry
    Iprojectedcoordinatesystem Getparameters Iprojectedcoordinatesystem4gen Geometry
    Iprojectedcoordinatesystem Inverse Iprojectedcoordinatesystem4gen Geometry
    Iprojectedcoordinatesystem2 Inversewithshift Iprojectedcoordinatesystem4gen Geometry
    Iprojection Getdefaparameparameters Iprojectiongen Geometry
    Iprojectivetransformation2d Definefromcontrolpoints Iprojectivetransformation2dgen Geometry
    Iprojectivetransformation2d Settransformationparameters Iprojectivetransformation2dgen Geometry
    Iprojectivetransformation2d Querytransformationparameters Iprojectivetransformation2dgen Geometry
    Isegment Densify Igeometrybridge Geometry
    Isegmentcollection Addsegments Igeometrybridge Geometry
    Isegmentcollection Insertsegments Igeometrybridge Geometry
    Isegmentcollection Querysegments Igeometrybridge Geometry
    Isegmentcollection Replacesegments Igeometrybridge Geometry
    Isegmentcollection Setsegments Igeometrybridge Geometry
    Ispatialreference2 Applyprecision Ispatialreference2gen Geometry
    Ispatialreference2 Applyxyprecision Ispatialreference2gen Geometry
    Itopologicaloperator2 Constructbuffers Igeometrybridge Geometry
    Itraceflowsolver Findpath Itraceflowsolvergen Networkanalysis
    Itraceflowsolver Putedgeorigins Itraceflowsolvergen Networkanalysis
    Itraceflowsolver Putjunctionorigins Itraceflowsolvergen Networkanalysis
    Itraceflowsolver2 Findsource Itraceflowsolvergen Networkanalysis
    Itransformation Transformmeasuresff Itransformationgen Geometry
    Itransformation Transformmeasuresfi Itransformationgen Geometry
    Itransformation Transformmeasuresif Itransformationgen Geometry
    Itransformation Transformmeasureⅱ Itransformationgen Geometry
    Itransformation Transformpointsff Itransformationgen Geometry
    Itransformation Transformpointsfi Itransformationgen Geometry
    Itransformation Transformpointsif Itransformationgen Geometry
    Itransformation Transformpointⅱ Itransformationgen Geometry
    Itransformation3d Transform Itransformation3dgen Geometry
    Itransformationmethod Definefromcontrolpoints Itransformationmethodgen Editorext
    Iutilitynetwork Establishflowdirection Iutilitynetworkgen Geodatabase
    Iutilitynetwork2 Partialestablishflowdirection Iutilitynetworkgen Geodatabase

    NoteThe iactiveviewgen interface provides generic versions of the exportframe and output members; these members are essential for use from the Java API, but you will find the original iactiveview members are useable from. net.

    The wkspointsmap2pixeltransform member of irastergeometryproc2 is not suitable for use from. Net; however, this method is superseded by irastergeometryproc3: pointsmap2pixeltransform.

    The numbers and numbers members of ipolympus Gon, and also the getconnectedcomponents, numbers, numbers, and numbers members of ipolympus gon2 have no safearray alternative in ArcGIS 9.0; future releases may include generic versions of these members.

  2. Changes to members on class interfaces

    This issue affects C # code which declares variables as a class interface rather than a class or interface type, for example envelope versus envelopeclass or ienvelope. at ArcGIS 9.0, the inherited types of the class interface may have changed. the details of why this change occurred are described below the table.

    The list below details which class interfaces are affected by this issue. When recompiling code using these class interfaces you may need to make changes to your code.

     

    Class Interface 9.0 ESRI. ArcGIS namespace
    Abridgedmolodenskytransformation Geometry
    Affinetransformation2d Geometry
    Affinetransformation3d Geometry
    Beziercurve Geometry
    Compositegeotransformation Geometry
    Coordinatetransformation Surveyext
    Coordinateframetransformation Geometry
    Definedinterval Esrisystem
    Displaytransformation Display
    Envelope Geometry
    Equalinterval Esrisystem
    Forwardstar Geodatabase
    Geocentrictranslation Geometry
    Geographiccoordinatesystem Geometry
    Harntransformation Geometry
    Helmerttransformation2d Surveyext
    Longituderotationtransformation Geometry
    Molodenskybadekastransformation Geometry
    Molodenskytransformation Geometry
    Nadcontransformation Geometry
    Naturalbreaks Esrisystem
    Netelementbarriers Networkanalysis
    Ntv2transformation Geometry
    Piecewisetransformation Editorext
    Piecewisetransformationmethod Editorext
    Positionvectortransformation Geometry
    Projectedcoordinatesystem Geometry
    Projection Geometry
    Projectivetransformation2d Geometry
    Quantile Esrisystem
    Simpletransformation2d Surveyext
    Standarddeviation Esrisystem
    Traceflowsolver Networkanalysis
    Unknowncoordinatesystem Geometry
    Utilitynetwork Geodatabase

    As explained in the class interfaces topic, the default Interface of a COM class is automatically added to each RCW class interface. however, ArcGIS classes generally have the iunknown interface as the default interface, and this interface is not exposed via COM InterOP. if the default Interface is iunknown or idispatch, the next listed interface on the com class is implemented by the class interface instead. for example, at ArcGIS 8.3 you cocould use code like that below to instantiate a new envelopeclass using ienvelope, as ienvelope is the first listed interface (after the default, iunknown) on the envelope com class, and is therefore implemented by the class interface envelope.

    [C #]

    IEnvelope env = new Envelope();

    However at ArcGIS 9.0, in order to allow the Java API to function correctly, some com classes had interfaces added to the top of the interface list. for example, the envelope com class gained as it implements first listed interface (after the default iunknown), ienvelopegen. this means that at ArcGIS 9.0, the envelope class interface implements ienvelopegen rather than ienvelope, and the above Code will no longer be legal. however, it can be replaced with either of the alternatives below:

    [C #]

    IEnvelope env = new EnvelopeClass();IEnvelope env = new Envelope() as IEnvelope;

    (To complicate matters, the equivalent VB. net code wocould not cause a compile error. this is because the VB. net compiler interprets the code as a command to Qi at runtime for the ienvelope interface, which of course is a successful call as the envelopeclass does implement ienvelope. C # does not allow these 'implicit casts ').

  3. Changes to Utility Classes

    The ESRI. arcGIS. utility. catids namespace provides classes representing each of the ArcGIS component categories. each class knows its catid and exposes static methods (register and unregister) which allow you to add and remove a class from the component category.

    At ArcGIS 8.3, the catids namespace and contents were provided as a developer sample. at ArcGIS 9.0, this was converted to a core assembly, present in the/DOTNET subfolder of your ArcGIS installation along with the InterOP assemblies. in addition to this, some classes were renamed for consistency with the underlying catid name. for example, at 8.3, you may have used the mxcommand class; at 9.0 this class is called mxcommands. in addition to these changes, new classes were added to represent the new 9.0 categories.

    The migrating from 8.3 to 9.0 topic lists all the classes affected.

  4. Capitalization changes

    Certain structure definitions are originally defined outside of the ESRI libraries; for example, the tagrect structure is originally defined in the Windows API. the change in the structure of ESRI's libraries between 8.3 and 9.0, the original location of such definitions, and the fact that the midl compiler used to compile the libraries is case-insensitive, has resulted in certain structures changing capitalization.

    As C # is a case-sensitive language, any changes in the capitalization if class, interface, Member, parameter or structure names will need to be reflected in C # source code. visual Basic. net is not case-sensitive, and will automatically correct any such case changes.

    The table below gives details of such changes.

     

    8.3 Name 9.0 name 9.0 ESRI. ArcGIS namespace
    Tagpoint. x Tagpoint. x Display
    Tagpoint. Y Tagpoint. Y Display
    Tagproppageinfo. Size Tagproppageinfo. Size Framework
    Tagrect. Left Tagrect. Left Display
    Tagrect. Right Tagrect. Right Display
    Tagrect. Top Tagrect. Top Display
    Tagstatstg. Type Tagstatstg. Type Esrisystem
    Tagstatstg. CLSID Tagstatstg. CLSID Esrisystem

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.