1 / 76
文档名称:

lexi设计案例分析.ppt

格式:ppt   大小:964KB   页数:76页
下载后只包含 1 个 PPT 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

lexi设计案例分析.ppt

上传人:用户头像没有 2017/8/23 文件大小:964 KB

下载得到文件列表

lexi设计案例分析.ppt

相关文档

文档介绍

文档介绍:1
第2章实例研究:Lexi 文档编辑器
A WYSIWYG document editor.
Mix text and graphics freely in various formatting styles.
The usual
Pull-down menus
Scroll bars
Page icons for jumping around the document.
通过本实例设计,学习设计模式的实际应用
2
设计问题
Lexi设计的7个问题
1 文档结构:对文档内部表示的选择几乎影响Lexi设计的每个方面。
2 格式化
3 修饰用户界面
4 支持多种视感标准
5 支持多种窗口系统
6 用户操作
7 拼写检查
上述每个问题都有一组相关联的目标集合和限制条件集合。
3
文档结构
目标
保持文档的物理结构。即将文本和图形安排到行、列和表等。
可视化生成和显示文档。
根据显示位置来映射文档内部表示的元素。
限制条件
应该一致地对待文本和图形。
应该一致地对待简单元素和复合元素。
但文本分析依赖于被分析对象的类型。
4
解决方案:递归组合
递归组合:Building plex elements out of simpler ones.
行——列(段落)——页
(P24 第2段第2行)第5行第2列的第10个元素 The tenth element in line five of column two,
隐含:
Each object type needs a corresponding class
All must patible interfaces (inheritance)
图2 包含正文和图形的递归组合
图3 递归组合的对象结构
5
Glyph (图元类)
Base class posable graphical objects
An Abstract class for all objects that can appear in a document.
Both primitive posed.
void insert(Glyph) void remove(Glyph) Glyph child(int) Glyph parent()
管理子图元的接口
boolean intersects(Coord, Coord)
判断一个指定的点是否与图元相交
void draw(Window*)
Void Bounds(Rect)
在窗口上表示自己
返回图元占用的矩形面积
操作
任务
基本接口:
子类: Character, Image, Space, Row, Column
6
图元类层次
Note the inherent recursion in this hierarchy
., a Row is a Glyph & a Row also has Glyphs!
7
Glyph Interface and responsibilities
Glyphs know how to draw themselves
Glyphs know what space they occupy
Glyphs know their children and parents
public abstract class Glyph {
// appearance
public abstract void draw(Window w);
public abstract Rect getBounds();
// hit detection
public abstract boolean intersects(Point);
// structure
public abstract void insert(Glyph g, int i);
public abstract void remove(Glyph g);
public abstract Glyph child(int i);
public abstract Glyph parent();
}
8
COMPOSITE 模式 object structural
意图
treat individual objects & multiple, posed objects uniformly
适用
objects must posed recursively,
and no distinction between individual & composed elements,
and objects in structure can be treated uniformly
Struc