chapter 11 navigating object model diagrams
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 PresentationTRANSCRIPT
![Page 1: Chapter 11 Navigating Object Model Diagrams](https://reader035.vdocuments.mx/reader035/viewer/2022081515/56812f90550346895d950cc6/html5/thumbnails/1.jpg)
Chapter 11 Navigating Object Model
Diagrams
Week 6, 2008 Spring
![Page 2: Chapter 11 Navigating Object Model Diagrams](https://reader035.vdocuments.mx/reader035/viewer/2022081515/56812f90550346895d950cc6/html5/thumbnails/2.jpg)
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](https://reader035.vdocuments.mx/reader035/viewer/2022081515/56812f90550346895d950cc6/html5/thumbnails/3.jpg)
![Page 4: Chapter 11 Navigating Object Model Diagrams](https://reader035.vdocuments.mx/reader035/viewer/2022081515/56812f90550346895d950cc6/html5/thumbnails/4.jpg)
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](https://reader035.vdocuments.mx/reader035/viewer/2022081515/56812f90550346895d950cc6/html5/thumbnails/5.jpg)
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](https://reader035.vdocuments.mx/reader035/viewer/2022081515/56812f90550346895d950cc6/html5/thumbnails/6.jpg)
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](https://reader035.vdocuments.mx/reader035/viewer/2022081515/56812f90550346895d950cc6/html5/thumbnails/7.jpg)
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](https://reader035.vdocuments.mx/reader035/viewer/2022081515/56812f90550346895d950cc6/html5/thumbnails/8.jpg)
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](https://reader035.vdocuments.mx/reader035/viewer/2022081515/56812f90550346895d950cc6/html5/thumbnails/9.jpg)
![Page 10: Chapter 11 Navigating Object Model Diagrams](https://reader035.vdocuments.mx/reader035/viewer/2022081515/56812f90550346895d950cc6/html5/thumbnails/10.jpg)
![Page 11: Chapter 11 Navigating Object Model Diagrams](https://reader035.vdocuments.mx/reader035/viewer/2022081515/56812f90550346895d950cc6/html5/thumbnails/11.jpg)
![Page 12: Chapter 11 Navigating Object Model Diagrams](https://reader035.vdocuments.mx/reader035/viewer/2022081515/56812f90550346895d950cc6/html5/thumbnails/12.jpg)
![Page 13: Chapter 11 Navigating Object Model Diagrams](https://reader035.vdocuments.mx/reader035/viewer/2022081515/56812f90550346895d950cc6/html5/thumbnails/13.jpg)
![Page 14: Chapter 11 Navigating Object Model Diagrams](https://reader035.vdocuments.mx/reader035/viewer/2022081515/56812f90550346895d950cc6/html5/thumbnails/14.jpg)
![Page 15: Chapter 11 Navigating Object Model Diagrams](https://reader035.vdocuments.mx/reader035/viewer/2022081515/56812f90550346895d950cc6/html5/thumbnails/15.jpg)
![Page 16: Chapter 11 Navigating Object Model Diagrams](https://reader035.vdocuments.mx/reader035/viewer/2022081515/56812f90550346895d950cc6/html5/thumbnails/16.jpg)
![Page 17: Chapter 11 Navigating Object Model Diagrams](https://reader035.vdocuments.mx/reader035/viewer/2022081515/56812f90550346895d950cc6/html5/thumbnails/17.jpg)
![Page 18: Chapter 11 Navigating Object Model Diagrams](https://reader035.vdocuments.mx/reader035/viewer/2022081515/56812f90550346895d950cc6/html5/thumbnails/18.jpg)
![Page 19: Chapter 11 Navigating Object Model Diagrams](https://reader035.vdocuments.mx/reader035/viewer/2022081515/56812f90550346895d950cc6/html5/thumbnails/19.jpg)
![Page 20: Chapter 11 Navigating Object Model Diagrams](https://reader035.vdocuments.mx/reader035/viewer/2022081515/56812f90550346895d950cc6/html5/thumbnails/20.jpg)
![Page 21: Chapter 11 Navigating Object Model Diagrams](https://reader035.vdocuments.mx/reader035/viewer/2022081515/56812f90550346895d950cc6/html5/thumbnails/21.jpg)
![Page 22: Chapter 11 Navigating Object Model Diagrams](https://reader035.vdocuments.mx/reader035/viewer/2022081515/56812f90550346895d950cc6/html5/thumbnails/22.jpg)
This only updates TOC, not map.
Dim pActiveView As IActiveViewSet pActiveView = pMxDoc.ActiveViewpActiveView.Refresh
![Page 23: Chapter 11 Navigating Object Model Diagrams](https://reader035.vdocuments.mx/reader035/viewer/2022081515/56812f90550346895d950cc6/html5/thumbnails/23.jpg)
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](https://reader035.vdocuments.mx/reader035/viewer/2022081515/56812f90550346895d950cc6/html5/thumbnails/24.jpg)
Access Color (p. 189)
• Application --
• MxDocument --
• PageLayout --
• Page ----
• Color on the Display diagram
![Page 25: Chapter 11 Navigating Object Model Diagrams](https://reader035.vdocuments.mx/reader035/viewer/2022081515/56812f90550346895d950cc6/html5/thumbnails/25.jpg)
RgbColor in Color