chapter 11 navigating object model diagrams

25
Chapter 11 Navigating Object Model Diagrams Week 6, 2008 Spring

Upload: keith-norris

Post on 31-Dec-2015

36 views

Category:

Documents


5 download

DESCRIPTION

Chapter 11 Navigating Object Model Diagrams. Week 6, 2008 Spring. Getting Layers/Assigning Colors. Which layer/dataframe change will be made? Start from MxDocument class (currently opened .mxd file) Map class (refers to a data frame) FeatureLayer class - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Chapter 11  Navigating Object Model Diagrams

Chapter 11 Navigating Object Model

Diagrams

Week 6, 2008 Spring

Page 2: Chapter 11  Navigating Object Model Diagrams

Getting Layers/Assigning Colors• Which layer/dataframe change will be made?• Start from MxDocument class (currently opened .mxd file)• Map class (refers to a data frame)• FeatureLayer class • Renderer class (layer’s legend)• Symbol class• Color class

MxDocument is associated with the Map class,but not with Color class.Associated – means that MxDocument’s object has objects in the connected class. Each map document have data frames.Symbols class is connected to Color class, -> symbols have colors.

Page 3: Chapter 11  Navigating Object Model Diagrams
Page 4: Chapter 11  Navigating Object Model Diagrams

Association (Class to Class)

• * Asterisk means multiplicity – many maps in one map documents (*asterisk not in Mxd to Application)

• Properties of Classes– In ILayer, Name returns string and Visible returns

boolean values– Some return interfaces, such as FocusMap in

IMxDocument returns IMap. FocusMap tells you which dataframe is active. If you want to hop from the MxDocument class to the Map class, you get the FocusMap property.

– ThisDocument (predefined object of MxDocument) is an object from IDocument (not IMxDocument), but FocusMap property is with IMxDocument, so that we have to use QI to get to IMxDocument

– See next slide for code

Page 5: Chapter 11  Navigating Object Model Diagrams

From Map to LayerDim pMxDoc As IMxDocumentSet pMxDoc = ThisDocument ‘ QIDim pMap As IMapSet pMap = pMxDoc.FocusMap

‘hop from MxDocument class to Map class

‘To access Layer ‘Layer class is associated with Map

Dim pLayer As ILayerSet pLayer = pMap.Layer(1)

Page 6: Chapter 11  Navigating Object Model Diagrams

Instantiation (class to class)

• Also called “Creates” relationship

• Where method in class creates object from another class.

• Dashed line with an arrow that points to the created object.

Page 7: Chapter 11  Navigating Object Model Diagrams

Inheritance (class to class)• When a particular class uses an interface (“Implement”)

from a more general class.• Abstract class (Such as Layer) – no objects, once

interface is implemented, then objects can be created, (page 176)

• Solid lines with triangle:e.g. Layer with ILayer and other connected classes inherit all of layer’s interfaces

• To create a new FeatureLayer and set its Name property:

• Dim pLayer As ILayer• Set pLayer = New FeatureLayer• pLayer.Name = “USA”

Page 8: Chapter 11  Navigating Object Model Diagrams

Three different Class Types

• Abstract Classes: 2-D gray boxes, no object, parking spots for common interfaces, you need to implement them.

• Classes (regular classes): 3-D white boxes. You can’t create from the New keyword, need to use methods/property of other class to get this.

• Coclasses: 3-D gray boxes. You can create object with New keyword or from other class’s property or methods.

Page 9: Chapter 11  Navigating Object Model Diagrams
Page 10: Chapter 11  Navigating Object Model Diagrams
Page 11: Chapter 11  Navigating Object Model Diagrams
Page 12: Chapter 11  Navigating Object Model Diagrams
Page 13: Chapter 11  Navigating Object Model Diagrams
Page 14: Chapter 11  Navigating Object Model Diagrams
Page 15: Chapter 11  Navigating Object Model Diagrams
Page 16: Chapter 11  Navigating Object Model Diagrams
Page 17: Chapter 11  Navigating Object Model Diagrams
Page 18: Chapter 11  Navigating Object Model Diagrams
Page 19: Chapter 11  Navigating Object Model Diagrams
Page 20: Chapter 11  Navigating Object Model Diagrams
Page 21: Chapter 11  Navigating Object Model Diagrams
Page 22: Chapter 11  Navigating Object Model Diagrams

This only updates TOC, not map.

Dim pActiveView As IActiveViewSet pActiveView = pMxDoc.ActiveViewpActiveView.Refresh

Page 23: Chapter 11  Navigating Object Model Diagrams

Color Objects

• Each color is an object, following diagram show Color abstract and five coclasses: ICmykColor, IRgbColor, IHIsColor, IGrayColor, IHsvColor

• Monitor use RGB and printer use CMYK

IRgbColorRgbColor

Blue: LongGreen: LongRed: Long

To make a sandy yellow:

pRgbColor.Red = 255pRgbColor.Green= 255pRgbColor.Blue = 190

Page 24: Chapter 11  Navigating Object Model Diagrams

Access Color (p. 189)

• Application --

• MxDocument --

• PageLayout --

• Page ----

• Color on the Display diagram

Page 25: Chapter 11  Navigating Object Model Diagrams

RgbColor in Color