Wednesday, August 26, 2015

How to read ArcObjects - Object Model Diagrams - 2


Reading Object Model Diagrams


In last post we learned about UML - Relationship symobls like Association, Multiplicity, Is Composed of, Creates a and Is a type of. If anyone missed please refer below link :

In this post we will continue (UML Classes, properties and methods).

Class Types :

Abstract Class - 
The Bird class is called an abstract class. Abstract class means that we cannot make any of these objects. In reality, they are no birds. They are type of birds. The abstract call is really just there for generalization and inheritance purposes. Common characteristics that are inherited by any subclass. 

CoClass -
The Chicken is a CoClass. A Coclass means you can create objects from these classes. Anytime we see a CoClass means we can write two lines of code to make one of these objects. 

These are ours starting point. If you are not sure where to start writing code, you can locate a CoClass on any diagram and, in two lines of code, you can make an object out of it.

Class - 
Classes cannot directly create objects, but objects of a class can be created as a property of another class or instantiated by objects from another class.

we cannot make Egg or Wings. Other objects have to do the creation for us.We can see it on the diagram here with the "creates" relationship symbol.Chicken creates eggs. If we want Egg object, we have to go to the chicken and have it make the Egg for us. If we don't have a Chicken, its a CoClass, we can make one with two lines of code and get it to make the Egg.

That's the end of classes. We will continue UML properties and methods in the next post.


Sunday, August 23, 2015

How to read ArcObjects - Object Model Diagrams - 1

Reading Object Model Diagrams

As a senior developer i got to know that who all are having hands on experience on ArcObject, are also not able to read the OMD diagrams and somebody really don't know what are OMD's are. This is the reason i created this post who really want to know the basics.

Here all the screenshot and some of the text i am using are copied from one of the ESRI seminar .

Object model diagrams are almost like road maps of ArcGIS system. Similar to the way you'd use a map to learn a new city, we use the object model diagrams to learn how the ArcObjects are organized. If we plan to go new place, we discuss with who familiar with that area or we search the root in google maps or other source to familiarize with the roads and landmarks before actually go there. You use the map to do that, first you understand the map and it's symbols based on the legend given in the map because its tells us what all the different colors and different symbols mean.

Where to find the OMD's :
Go to installation path ArcGIS -> DeveloperKitxx(version no) -> Diagrams. 
Ex:C:\Program Files (x86)\ArcGIS\DeveloperKit10.2\Diagrams

Once you open the folder you will find no.of different .pdf files in a will organized manner. 
Ex: EditorObjectModel.pdf, GeometryObjectModel.pdf, DotNetGeoprocessorObjectModel.pdf

When start reading the OMD, they look a little bit complex first too, but once start looking on that we will get lot of information.They are about 70+ diagrams to show all the thousands of classes.

The diagrams use, or are drawn with, the Unified Modeling Language. Its an industry standard when creating these diagrams. Before going to OMD we should know the below UML symbols.



What are all those UML symbols mean in the legend?

Lets discuss Relationship symbols in this post.

UML made of many symbols, but we really need to know about 12 of then to write some code.
The one - liner symbol called Association. These two classes or objects created out of these classes, are associated with each other. Here chicken has an associated nest. Relationship is one to one.

Association can be more than just a one to one relationship. It can be one to many. The star here signifies a many or multiplicity relationship. The class the star is closest to, that's many object.
The farm has many chickens.


The multiplicity reltionship can have an actual number. The number that has the closest to the object that has the multiplicity. Here a chicken as two wings.

The composed-of symbol has solid diamond. The object with the diamond is the composed-of object. Composed-of means that two objects go together all the time.You would not see one without of other.When we are moving chicken the composed-of object with go together, if we delete this object the composed-of object would get deleted. Here a chicken is composed of two wings.

The dashed line and the arrow indicates a creates relationship. Here one type of objects creates another one. Here a chicken create egg.

The last relationship Is a type of, here, is shown as triangle. When you see this symbol, you should think inheritance. Birds have some properties and methods that are inherited by chicken. Here we could say chicken is a type of bird.

That is the end of the relationship symbols.

UML class symbols and properties and method symbols, how to code using these object and using programmers interfaces we will see in the next post.


Migrating ArcGIS 9.3.x Desktop custom components to ArcGIS 10.x using .Net

  
     Migrating ArcGIS 9.3.x Desktop custom 
components to ArcGIS 10.x
   

                              Prepared by – Ravisankara Kumar
                             Sr.Software Engineer – GIS

Summary

This topic explains what's required to migrate custom components from ArcGIS 9.3.x to 
ArcGIS 10.x. Custom components created in 9.3.x require a recompile against the 10.x 
assemblies.

Before you can migrate ArcGIS 9.3 makes sure that

  1.       ArcGIS 10.x for Desktop (Basic, Standard, or Advanced) must be installed.
  2.     .     Make sure Visual Studio 2010 is installed on your machine. To build .NET applications       with ArcGIS for Desktop, the Microsoft .NET Framework 3.5.1 is required.
  3.      Must have the ArcObjects .NET SDK installed to develop .NET-based custom         components.
For ArcGIS Desktop custom components created using Visual Studio 2008, need to open the  projects in Visual Studio 2010 and run the Microsoft upgrade wizard.

To change the location of the external program, right-click the project and select properties.              In the project properties, select Debug and change the external program path to its new location.   The following screen shot shows the default setting of the Start external program option in      ArcGIS 10.x:



Starting at ArcGIS 10.x, the functionality of the ESRI.ArcGIS.ADF assembly was split into    multiple assemblies to separate development tasks performed by ArcGIS Server from ArcGIS Engine and ArcGIS for Desktop developers. To allow custom components that use this assembly created in ArcGIS 9.3.x to work in the 10.x architecture, perform the following steps:

·         Remove the reference to the original ESRI.ArcGIS.ADF assembly.
·         Add a reference to the ESRI.ArcGIS.ADF.Local assembly.



To have a successful compile of a migrated ArcGIS 9.3.x Visual Studio development project,  confirm that all Esri assemblies have the Specific Version property set to false.

Visual Studio automatically uses the new version of the assembly to compile. To do this,           follow these steps:
·         Select an Esri assembly in the Visual Studio Solution Explorer. Right-click the assembly and       select Properties. The Properties dialog box appears.
·         Set the Specific Version property to False as shown in the following screen shot:

Updating component category registration (9.3.x only)

Starting at ArcGIS 10, ArcGIS applications no longer read components from the registry.        Custom components still need to be registered as all COM components do; however, ArcGIS       now uses Extensible Markup Language (XML) tables to store component associations instead.     This more flexible and efficient pattern allows ArcGIS to map component activations to the     version appropriate application.

To properly register your custom component with ArcGIS, registration should be done using           the Esri-provided ESRIRegAsm.exe utility. This utility replaces the standard Microsoft     RegAsm.exe and RegSvr32.exe utilities. Call ESRIRegAsm.exe directly, supplying the      appropriate product target as an argument To use the ESRIRegAsm utility to register your      ArcGIS for Desktop custom components at compile time (to more easily debug and test your components),


Follow these steps:
1.     In Visual Studio, right-click the project name in the Solution Explorer and select       Unload Project as shown in the following screen shot:

2.     Right-click the project name in the Solution Explorer and select Edit <project name>                   as shown in the following screen shot:
3.    Add the following MSBuild code to your project. Place the code at the bottom of your           project file above the closing project tag.
[XML]
<Target Name="BeforeClean">
  <Exec
    WorkingDirectory="$(CommonProgramFiles)\ArcGIS\bin"
    Command="esriRegasm.exe &quot;$(TargetPath)&quot; /p:Desktop /u /s"
    Condition="Exists('$(TargetPath)')"/>
</Target>
<Target Name="AfterBuild">
  <Exec
    WorkingDirectory="$(CommonProgramFiles)\ArcGIS\bin"
    Command="esriRegasm.exe &quot;$(TargetPath)&quot; /p:Desktop /s"/>
</Target>
See the following screen shot that shows the code in the project file:

4.    Right-click the project name in the Solution Explorer, select Reload Project, then save the   project.

5.       Build and run the project to debug your application.

Good Luck :)