WebReference.com logo
tip archive  •   about  •   sitemap  •   contact  •   jobs  •   write for us  •   subscribe


[next]

Doodle - Part 4: More Power to the User

By Guyon Roche

Digg This Add to del.icio.us

Subject Matter Expert - Managed Services (PA)
Next Step Systems
US-PA-Wayne

Justtechjobs.com Post A Job | Post A Resume

Introduction

In previous issues in this series, I deliberately kept the user experience somewhat spartan with line being the only shape available to be added to the canvas. This allowed the application design to be modified with a mimimum of effort. Now we will spice up the application a little by adding points, ellipses and bezier curves. As a natural consequence, there needs to be some way for users to tell the Doodle application what shape they want to draw next. This task will be handled by a new application class called Control.

Demonstration

A demonstration of the technique can be seen here.

Start With the Document, Again

Once again, the best place to begin when making changes to the application tends to be the document. The rudimentary object heirarchy that was put in place in Part 3 may now be used to differentiate between the different shape types that need to be stored.

The enumeration of shape types looks more sensible now with more than one type. Let's take a look at the new shape types.

The Point class constructor calls the Shape constructor explicitly since this isn't handled automatically. Although nothing is done yet in the Shape constructor, that may change and it will be important for anything derived from the Shape class to benefit.

The document classes all follow a fairly simple pattern; after construction, the shape can be initialized and modified using accessors. Later, when we consider persistence, each document shape will need to learn how to serialize itself into a form that can be saved.


[next]

Recent Articles

WebReference.com site name
Building a Banking Application Home Page with OOP
Mixing Scripting Languages
Review: phpFox, a Social Networking CMS with all the Bells and Whistles
internet.com site name
Enterprise 2.0: Social Networking in the Cloud
BroadSoft Marketplace Hastens Pace of Telephony Innovation
Review: HTC Hero for Sprint


internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs