Title: Chapter 11 Navigating Object Model Diagrams
1Chapter 11 Navigating Object Model Diagrams
2Getting 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 (layers legend)
- Symbol class
- Color class
MxDocument is associated with the Map class, but
not with Color class. Associated means that
MxDocuments object has objects in the connected
class. Each map document have data
frames. Symbols class is connected to Color
class, -gt symbols have colors.
3(No Transcript)
4Association (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
5From Map to Layer
- Dim pMxDoc As IMxDocument
- Set pMxDoc ThisDocument QI
- Dim pMap As IMap
- Set pMap pMxDoc.FocusMap hop from MxDocument
class to Map class - To access Layer Layer class is associated with
Map - Dim pLayer As ILayer
- Set pLayer pMap.Layer(1)
6Instantiation (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.
7Inheritance (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 trianglee.g. Layer with ILayer
and other connected classes inherit all of
layers interfaces - To create a new FeatureLayer and set its Name
property - Dim pLayer As ILayer
- Set pLayer New FeatureLayer
- pLayer.Name USA
8Three 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
cant 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 classs property
or methods.
9(No Transcript)
10(No Transcript)
11(No Transcript)
12(No Transcript)
13(No Transcript)
14(No Transcript)
15(No Transcript)
16(No Transcript)
17(No Transcript)
18(No Transcript)
19(No Transcript)
20(No Transcript)
21(No Transcript)
22This only updates TOC, not map.
Dim pActiveView As IActiveView Set pActiveView
pMxDoc.ActiveView pActiveView.Refresh
23Color 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
IRgbColor
To make a sandy yellow pRgbColor.Red
255 pRgbColor.Green 255 pRgbColor.Blue 190
RgbColor
Blue Long Green Long Red Long
24Access Color (p. 189)
- Application ?--
- MxDocument ?--
- PageLayout ?--
- Page ----
- Color on the Display diagram
25RgbColor in Color