Title: Object Oriented Programming And GIS
1Object Oriented Programming And GIS
- Introduction To Computer Programming
- Object Oriented Programming (OOP)
- OLE Automation VBA
- ActiveX COM Technology
- Visual basic For Application(VBA)
- Application Of ESRI OOP Environments
-
2Object Oriented Programming In GIS
- Introduction Basic Concepts
- Computer
- Computer is a device that accepts information in
the form of digital data and manipulates it for
some result based on a sequence of instructions
on how data is to be processed. - Computer Programming
- Logic Development
- A question is said to be logical if it has the
possibility of only two answers. The answer can
either be Yes(1) or No(0), True(1) or False(0).
Computer is composed of built in electrical
circuits which either ALLOW(1) the flow of
electric current or NOT(0). The circuit remains
INACTIVE when NEITHER 0 NOR 1 condition is TRUE. - 2 2 5 ???????
- In mathematics 22 is always 4 but through
specific LOGIC Development we can obtain desired
results from our computer program - IF ab 4 THEN
- PRINT 5.
3Representing Program Algorithm
The term algorithm (pronounced AL-go-rith-um) is
a procedure or formula for solving a problem. The
word derives from the name of the mathematician,
Mohammed ibn-Musa Al-Khowarizmi, who was part of
the royal court in Baghdad and who lived from
about 780 to 850. His work is the likely source
of Algebra.
- Pseudo Code
- Plain text language like English. Used for
representation of Program Logic that can be
transformed into any programming language. - Flow Chart
- Graphical representation of algorithm of the
computer program.
4Example Of Pseudo Code
- PseudoCode Determine the class average for
the first exam - Â Initialize variables
- -Â Â Â Â Â Â Â Â Â total to zero
- -Â Â Â Â Â Â Â Â Â counter to zero
- Â
- Capture input, Sum up, and count the exam grades
- -Â Â Â Â Â Â Â Â Â Input the first grade using sentinel
value - -Â Â Â Â Â Â Â Â Â While the user has not as yet entered
the sentinel - o       Add entered grade into the total
- o       Add one to the grade counter
- o       Input the next grade
- Â
- Calculate and print the average score
- -Â Â Â Â Â Â Â Â Â If the counter is not equal to zero
- Set the average to the total divided by the
counter - Print average
- Else
- Print No grades were entered
5 Example Of Flow Chart
- A program is required that will accept the cost
of an order based upon a shipping option. And
then a program will calculate a total cost. To
do so, a customer must enter valid numbers.
Also, a customer can select one of the shipping
options, such as priority (14.95), express
(11.95), and standard deliver (if the order is
more than 75, then standard shipping is free
otherwise it is 3.95).
6 Application vs Programming Languages
- Application Software
- Â Application software perform specific tasks
- Examples
- MS World, MS Excel, P Point
- ArcView, IDRISI ArcInfo
- Programming Languages
- Provides a solution developing environment
- Examples
- Java, VB, C, VC, MS Access, Oracle
- Two Paradigms Governs Program Construction
Process Oriented Model Object Oriented
Model Program is series of linear steps Splits
program into objects Code is applied on
data Data control access to Code Goto statement
control pointer Sets well defined interface to
Data
7- OOPS
- C, JAVA, VC, VB, Access, Oracle
- OOP Elements Code Data
- What is happening around ???
- Who is affected ???
- Code acts upon data
Object Oriented Programming
What Is Object ???
Object Inheritance
Object Properties
Object Instances
Object Methods
8 Characteristics Of Object Oriented
Programming
- Abstraction
- Encapsulation
- Inheritance
- Polymorphism
9Abstraction
- Is Important Element OF OOP Concept
- Abstraction is Natural Concept.
- Human being manage complex problems through
abstaraction. - Example
- CAR is made of millions parts but we use it
without considering its complex transmission
systems. - The concept of abstraction can be applied to
computer programming. The data from a sequential
or process oriented program can be transformed
t he process of abstraction into its component
objects. - The sequence of each process step can become
a collection of messages from these objects. - ArcInfo Arcview fully implements the
principle of abstraction while handling - the spatial and non spatial data.
- Â
10 Encapsulation
- Encapsulation binds the Data and Code together in
a wrapper - Prevents it from external interference
- Eexcept a well defined interface
- Example
- The transmission and acceleration system of a car
- Can only be accessed through a well defined
interface - i.e the gear lever and the accelerator.
11 Inheritance
- Inheritence is the process by which one object
acquires the properties of the other
keeping the hierarchical classification intact. - Examples
- Toyota Corola car is an object of Toyota Cars.
Toyota Cars belong to Car type of objects and
cars belong to an automobile class. Thus each
Corolla car implements the properties and methods
of Car hierarchy and all cars implements the
properties of automobiles CLASS. - Arc View and ArcInfo implements graphics
capabilities as properties and methods of CAD
Software while its Database handling properties
are inherited from DBMS. - Inheritence makes programming easy.
- All Objects derives their common properties
from their parent CLASS.
12 Polymorphism
- Polymarphism facilitaes the use of one interface
for a general class of objects. - Examples
-
- In ArcView when you need to connect to the data
base, you click a button and create an instance
of an interface. Within the same interface you
can connect to SQL, MS Access or execute ESRI
standard data query. Thus you do not require
separate instance for each or a separate
interface for same type of operation. -
- Example of Dogs
- They smell. The smell is an interface. But if
the smell or interface is a cat , it will run
after it immediately. However, if the smell or
interface is of food it will move towards the
bowl. -
- Thus each interface is for a specific task to
perform. -
- In OOP an instance of an interface occurs for
each type of task to perform.
13 Object Linking Embedment(OLE)
- Visual Basic
- Visual Basic is highly successful object based
programming Language. - Its Integrated Development Environment is unique
in facilitating programming operations. - OLE in Visual Basic
- OLE lets Visual Basic(container) use the
functionality of other applications (server). - Other Applications include, MS Word, MS Excel, MS
Outlook Express, MS Access, MS PPoint, Autodesk
Autocad, AutoCad Map 2000 etc. - Applications extends their functionality as set
of CLASSES OBJECTS - VB Programmers only make reference to CLASSES and
OBJECTS. - Examples
- Excel Worksheet object performs complex
calculations within an application. - Office Management application use Outlook object
for communication. - Autocad Drawing Design functionalities can be
used within application. - Advantages
- Complex Programming tasks are simplified by OLE.
- Multiple functionalities can be integrated into
one application. - OLE applications become part of the Operating
System. - One Window Operation.
- Linking Vs Embedment
14 OLE Automation
- Visual Basic For Application(VBA)
- Microsoft Common Language and Programming
environment for applications. - VBA customizes applications, add capabilities to
suit specific user environment. - VBA does not develop applications
- But provides only the basic control structure,
mathematical operators, string functions and
variable manipulation power of Visual Basic to
partner applications. - Adds customization power to applications.
- VBA only facilitates customization and almost no
analytical capabilities. - The main power of development comes from the
applications which uses VBA as programming
environment - Examples
- MS Word, MS Excell, ArcInfo, IDRISI, AutoCad etc.
15 ActiveX Controls
- An OLE Object that Support customizable or
programming interface - Expose Properties, Methods and Events that are
heart of OOP - User cannot access or modify the code but can
extend and combine - Can manipulate data, customize application and
enhance programs - Usually developed in MS Visual C, MS Visual
Basic and Java - Platform Independent only need COM compliance
- Best suitable for distributed multi user
environment - Equally useful for stand alone desktop
environment - Can be a Textbox, Command Button, Audio Player,
Video Player, Graphics Tool - Advantages
- Reusability Of Software
- Platform Independence (To a larger extent
requires COM compliance) - Plug In functionality
- Data Security
- Data Integrity by transaction monitoring through
- Client Server Environment
- Basic ActiveX Control
16 COMPONENT OBJECT MODEL or COM ?
- COM refers to both standard specifications and
implementations. COM is a binary compatibility
specification. Since runtime code is in binary
format, therefore, COM component is compatible
with binary system. - COM defines binary specifications that are not
reliant on any programming language. - COM standards developed by Microsoft Corporation
for adding interoperability and reusability of
distributed Objects. - Enables developers to build SYSTEMS by assembling
reusable components from different vendors which
communicate via COM Interfaces. - COM is same to Developer as Protocol is to System
Engineer. - COM defines common APIs for diverse components to
interact. - DCOM and COM are COM extensions. DCOM allows
networked based object interaction. COM
integrates MTS and message queuing into COM. - COM and DCOM represent "low-level" technology
that allows components to interact, OLE, ActiveX
and MTS represent higher-level application
services that are built on top of COM and DCOM. - Out Of Process Servers In Process Servers.
-
17 Object Oriented Programming Using ESRI GIS
- GIS Application Development Using ArcInfo
- ArcInfo Uses 03 Levels Of Customization
- Level 1 Programming
- The simplest Level of ArcInfo Cutomization
- Involves no programming. Users can change the
look and feel of ArcInfo applications - For example Toolbars can be turned ON OFF using
Customize Dialog. - Map Printing Saving Facility can be turned ON
and OFF. - Level 2 Programming
- Uses built in Visual Basic For Application (OLE
Automation) - Developer can add new Menus and Tools and Work
Flows to ArcInfo - ArcMap and ArcCatalog includes built in VBA with
Full fledge IDE debugging - VBA Allows Addition of VB like Modules, Class
Module user Forms to ArcInfo project files. - Using VBA it is possible to create custom
sophisticated application based on ArcObject
frameworks. - VBA is useful for small to medium sized
applications. - Applications cannot be deployed for use outside
outside parent software - Level 3 Programming
- Favorite development platform for experienced
OOProgrammers - Create reusable software building blocks Or new
Applications - Use Geo-spatial database Object Model
18 What Is ArcObject Structure
- ArcMap ArcCatalog
- COM Based Technology
- ArcObjects can be customized with VB C
- Arc Object Offers about 1200 objects
- Basic Arc Object Structure
- MXDocument Represent a single Document i.e.
IAcativeView - SDI(ArcMap)
- MDI(Arc View)
- In Geographic View
- Active View Object is MAP
- In Layout View
- Active View Object is Page layout
19What ArObject Can Do?
- Extending ArcMap Arc Catalog
- Extending the Data model
- Embedding Within An Application
- Creating New Applications
20 Extending ArcMap ArcCatalog
- ArcMap Arc Catalogue provides application
framework which can be easily extended using
ArcObject. - Extemsions range from simple commands and tools
to industry focused soloutions i.e. - Customized Tools and
- User Interfaces
- Specific behavior of object class to data model
e.g - Polygon behave differently with attribute data
i.e. - If constructed on mud or marsh or water body
- Polygon will be hatch according to an
appropriate symbol - And appropriate shape
- How this modular extension is Possible?????
- implementing drawing method
- checking the feature attributes
- running a logical loop
- arriving at a decision
- automatically re-drawing the polygon
21 Creating New Applications
- Embedding Within An Application
- ArcObject being a COM compliant
- Any COM compliant application can embed
ArcObjects - Use of ArcObjects is Unlimited in the context of
OLE technology - Thus its uses are more than customizing ArcMap
ArcCatalog - Example
- Like ArcMap, MS Word comes with VBA (Native
development environment) - ArcViewer can be Linked and Embedded in MS World
- ArcObject being a COM compliant
- Beyond customization is creating new independent
GIS applications - Use ArcObjects in Visual Basic
- Can build dedicated GIS applications
- After deployment application lies over O.S
- Who can do it ???
- Visual Basic Developer or simply GIS specialist
- Developer decides aspects of
- Application Frame Work, Graphic User
Interface(GUI) Program Control - Dsitributed or Desktop Application ??
- Specific Cliental Focus and so
on--------------------------------------?gtgtgtgtgt
22Where Next ???
- The goal of this presentation is to address
- The openness of OOP and ArcObjects
- Recommendations
- Start Learning Visual Basic for development
- Start Oracle for DBMS
- Java for Web based programming
- Conclusions
- The wealth of GIS functionality lies in OOP
- One do not need to study computer science for
Programming - Explore logic of existing programs
- Build your own simple Programs and debug
- You are surely a programmer of the future
- But Computer Programming !!!!
- has its own Psychology
- Some one said it is by default
23Questions