Avenue Programming Getting Started

1 / 27
About This Presentation
Title:

Avenue Programming Getting Started

Description:

Procedural programs ( FORTAN, BASIC) OOP or Object Orientated programming ... Procedural Progams: Basic. Need a program to add two numbers and print the result ... – PowerPoint PPT presentation

Number of Views:22
Avg rating:3.0/5.0
Slides: 28
Provided by: leeherr

less

Transcript and Presenter's Notes

Title: Avenue Programming Getting Started


1
Avenue ProgrammingGetting Started
  • FOR 558

2
WHAT is a computer program?
  • A sequence of steps that tell the computer to do
    something
  • Procedural programs ( FORTAN, BASIC)
  • OOP or Object Orientated programming

3
Procedural Progams Basic
  • Need a program to add two numbers and print the
    result

First 12 lt- assignment Second 10 first
first Second Print Answer , first
4
Procedural Programs Basic
  • Need a program to add two numbers and print the
    result

First 12 lt- assignment Second first2 first
first Second Print Answer , first
5
What is Avenue programming?
  • We have said it is
  • an OOP language for tailoring AV
  • OK, but what is it?
  • A list of objects and requests
  • That are sequentially executed
  • What?

6
OOP
  • Based on Objects
  • Objects contain both computer code and data
  • Could call it smart code since objects know how
    to do things
  • And they can be morphed into new objects that do
    something slightly different

7
Classes of Objects
  • A Class is a blueprint (or DNA) for creating a
    functioning object. It cant do much itself.
  • So the DNA for a cow is the blueprint for a cow
    but it is the actual cow that produces milk
  • A real cow (object) is an instance of the cow
    class.
  • A bull class can be derived from the cow class
    and will have all the properties of the cow class
    plus others

8
Methods
  • Objects have properties (see windows) which can
    be set or changed in the right environments
    (customize, windows)
  • From an Avenue point of view Objects have Methods
    or Requests

9
List of Objects Requests
The Basic Line
Object Object.Request(parameters)
Object Object.Request(parameters)
Object Object.Request(parameters)
Object Object.Request(parameters)
Always there
Variable Only there if the Obj.Req pair returns
something
There if Request requires it AKA arguments
10
List of Objects Requests
The Basic Line
Object Object.Request(parameters)
Object Object.Request(parameters)
Object Object.Request(parameters)
Object Object.Request(parameters)
Always there
Variable Only there if the Obj.Req pair returns
something
There if Request requires it AKA arguments
Important point some O.Rs DONT return anything
11
The Basic Program
12
Variations on a theme
Object Object.Request.Request(parameters).reques
t.request
Object Object.Request.Request(parameters).reques
t.request
Object Object.Request.Request(parameters).reques
t.request
ObjectObject.Request
This line returns something. Just what depends
on Request.
Object.Request
Object
This one DOES something
Makes no sense
13
Some examples
Suppose I want to work with a View called
Syracuse
This returns a pointer to the active
project-usually the first line
myProj av.GetProject
Now I need to send a request to myTown to find
Syracuse
myTown myProj.FindDoc(Syracuse)
This returns an object of whatever Class
Syracuse is.
So what Class is it?
14
Lets make a program
myProj av.GetProject
myTown myProject.FindDoc(Syracuse)
Now I want to print the TOC for future reference
No Obj returned!
myTown.PrintTOC
and I need a record of the extent
myTownExtentmyTown.ReturnExtent
Or I want to find the string DeWitt in the
attribute data
dewittTheremyTown.Find(Dewitt)
15
Variables
  • Not declared or typed
  • must start with letter or underscore
  • NOT case sensitive
  • but convention is that
  • sys vars objects start with caps -- GetProject
  • your vars objects start with lc -- myProject
  • Reserved words (used by system)

16
Local and Global Variables
  • What are Local and Global???
  • Local means known only to the current script
  • Global means known to all scripts in app
  • aLocalVariable 33-10 local
  • _aGlobal someValue 32 global

17
Assignment Statements
  • A request sent to an object returns another
    object (sometimes!)
  • Assign the returned object toa variable
  • anumber 4 35
  • aDoc theProject.FindDoc(world)
  • aString theDoc.GetName
  • aTheme theView.FindTheme(Canada)

18
Direct Assignment
  • X 7 a number
  • companyTitle ABC GIS CO string
  • aConsant 1.5 number

19
Enumerations
  • What in the world are these???????
  • Predefined choices which can be used as requests
  • Begin with a
  • CHARTDISPLAY_AREA
  • CHARTDISPLAY_LINE
  • CHARTDISPLAY_XYSCATTER

20
For Example
  • theChart av.GetProject.FindDoc(Chart1)
  • theChart.GetChartDisplay.SetType(.)
  • theChart.GetWin.Open

21
Numbers
  • Numeric evaluation is left to right
  • x 233
  • evaluates to 15
  • x 2 (3 3)
  • evaluates to 11
  • Operations
  • posNumvber -33.Abs
  • wholeNum 12.456.Round
  • Formatting
  • number.SetDefFormat(d.ddd) all in app
  • aNumber.SetFormat()
  • aScript.SetNumberFormat()

22
Strings
space
  • Concating
  • theNewString Hi George
  • Hi George
  • theNewString OKJane
  • OKJane
  • NL is the New Line object
  • CR is the carriage return
  • TAB is tab

No space
OK NL Jane produces OK Jane
23
More String Stuff
  • Conversions
  • someString someNumber.AsString
  • someNumber numberString.AsNumber
  • today dateString.AsDate

24
Message Boxes
File obj
Number obj
  • Display messages
  • MsgBox.Banner(file,seconds,title)
  • MsgBox.Info(message, title)
  • Get Input
  • MsgBox.Input(aMessage, Title, DefaultString)

String obj
25
Chaining
  • This script
  • theProject.av.GetProject
  • theView theProject.FindDoc(world)
  • theTheme theView.FindTheme(usa)
  • is the same as
  • theThemeav.GetProject.FindDoc(world).
  • FindTheme(usa)
  • Makes for shorter but harder to read scripts
  • Only works if you do not need intermediate vars

26
Requests can have parameters
  • MsgBox.Info(The price is
    price.AsString,)
  • discount 0.2 (price.AsNumber)

27
Summary
  • Object object.request(parameters)
  • Types must match!

USE HELP!!!!!
Write a Comment
User Comments (0)