其他语言

本类阅读TOP10

·基于Solaris 开发环境的整体构思
·使用AutoMake轻松生成Makefile
·BCB数据库图像保存技术
·GNU中的Makefile
·射频芯片nRF401天线设计的分析
·iframe 的自适应高度
·BCB之Socket通信
·软件企业如何实施CMM
·入门系列--OpenGL最简单的入门
·WIN95中日志钩子(JournalRecord Hook)的使用

分类导航
VC语言Delphi
VB语言ASP
PerlJava
Script数据库
其他语言游戏开发
文件格式网站制作
软件工程.NET开发
h3

作者:未知 来源:月光软件站 加入时间:2005-2-28 月光软件站

Homework Assignment #3  - Enhanced version of SimpleDraw
 
SimpleDraw is a 2D graphics drawing product.  In homework assignment #2, we already wrote the core engine of the graphics system
to implements the abstraction of a drawing, this time we need work out the enhanced core engine of and add more features.
 
drawing is defined as a 2D space (canvas) that contains an unlimited number of drawing primitives. 
Canvas has initial size, use a unified x,y coordinate system ( left corner is 0.0, 0.0 ) to define
Canvas can set backgroud color (black, white, grey, red, green, blue, yellow) and border type  (thin, heavy, none)
Each drawing primitives (element) in canvas must has his center within the range of canvas.
 
There are 4 drawing primitives (element) defined:
 
1. dot
2. ellipse (width, height)
3. rectangle (width, height)
4. polygon (diameter, vertex)
 
Element use centre point to represent its location (x,y)
Element can be set different foreground color (black, white, grey, red, green, blue, yellow )
Element can use different kind of line type (solid, dash, dot) to display
 
Canvas can support zoom in/out operation, at same time, elements in drawing also support zoom in/out with the same ratio
as canvas. (zoom in/out base on its centre point)
 
Your software need to support draw function to out the result of drawing, but it not means you really need use DC to draw
the canvas and those elements on screen, just display the drawing in the following format:
 
Drawing Name: Drawing 1                     <-- drawing info
Background color: White
Border type: none
Zoom level: 2.5
Total number of elements: 59
Canvas Size: 1020, 768
 
Element1: Ellipse                                <-- here begin the elements info
Location: 0, 10
Color: red
Width: 100
Heigh: 400
 
Element2: Rectangle
Location: 30, 78
Color: black
Width: 500
Height:800
 
Element3: Dot
Location: 500, 600
Color: yellow
 
.....
 
Primitive59: Polygon
Location 100, 600
Color: green
diameter: 250
vertex: 6
 
 
Note:
1) coordinate system use double value to represent
2) zoom level use double value to represent
3) vertex in polygon means the number of vertex (>=3, <=32)
4) each element has same format in displaying their information, but the content is different, some feature only available in given element
   e.g. Dot without width and height, Polygon has diameter and vertex


#ifndef CANVAS_H
#define CANVAS_H
typedef double Coordinate;
typedef enum Colors{black, white, grey, red, green, blue ,yellow}Colors;
class Canvas{
    public:
        Canvas();
        ~Canvas(); 
    private:
        Coordinate x_, y_;
        Colors backgroudColor_;
       
};
#endif //CANVAS_H



相关文章

相关软件