Click here to Skip to main content
11,642,381 members (67,519 online)
Click here to Skip to main content

A Simple Vector Editor

, 5 Jun 2002 101.2K 1.1K 28
Rate this:
Please Sign up or sign in to vote.
A simeple editor to make my polygon class a bit more usable.
<!-- Download Links --> <!-- Add the rest of your HTML here -->

Introduction

This is a little toy project I did because we had an application that required a number of simple images described as vectors. This was the editor I created to allow me to create and modify these simple images. The output files can be included as resources and used by my Polygon Drawing Class. (Actually, the polygon class is not used in this application, because I created it before I created the polygon class).

I thought it would provide an interesting example of programming techniques, and in any case it makes my polygon class a bit more usable.

The idea is that there is a 100 ×100 grid, with origin in the center at 0,0 and coordinates ranging ±50, and all images are drawn within this grid. They may be scaled later. There are controls for scaling and rotating the image. 

The use is fairly obvious for the most part. The standard file menu allows you to create, save, or open vector files. The vector is stored as a vertex list. There are two arrow keys next to the image list that allow you to rearrange the points.

The points are editable; clicking twice (not double-clicking) on a point makes it directly editable. The effects will be seen when you hit Enter or select out of the item.

There are four arrows that modify the list by adding or subtracting 1 from the x or y axis to move the image left, right, up, or down.

You can type in a new point and click the Add button, and it will be added following the current selection (if there is no selection, it is added at the end of the list).

Clicking the mouse in the drawing will transfer the mouse coordinates to the input box. Double-clicking the mouse in the drawing will also perform an Add operation. What I do is click in the approximate areas I want, then clean it up doing hand-editing. Nothing deep, but it greatly simplified the creation of a number of scalable "icons" for a graphical representation of moving objects.

Selecting a point in the point list will highlight that point in the drawing with a small red circle. The Delete button deletes the currently selected point. File | New deletes all the points.

Here's a little submarine icon I drew in about seven minutes. It is shown rotated 20°. Note the small red circle at the bottom that represents the highlighted point. I turned the grid off to get a clearer image.

The views expressed in these essays are those of the author, and in no way represent, nor are they endorsed by, Microsoft.

Send mail to newcomer@flounder.com with questions or comments about this web site.
Copyright © 2001 All Rights Reserved

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Joseph M. Newcomer
Retired
United States United States
PhD, Computer Science, Carnegie Mellon University, 1975
Certificate in Forensic Science and the Law, Duquesne University, 2008

Co-Author, [i]Win32 Programming[/i]

You may also be interested in...

Comments and Discussions

 
GeneralVery cool toy project when someone else paid you to do it!!! Pin
WREY7-Jun-02 23:09
memberWREY7-Jun-02 23:09 
GeneralRe: Very cool toy project when someone else paid you to do it!!! Pin
Jörgen Sigvardsson10-Jun-02 0:54
memberJörgen Sigvardsson10-Jun-02 0:54 
GeneralRe: Very cool toy project when someone else paid you to do it!!! Pin
WREY10-Jun-02 7:53
memberWREY10-Jun-02 7:53 
GeneralRe: Very cool toy project when someone else paid you to do it!!! Pin
Jim A. Johnson10-Jun-02 8:15
memberJim A. Johnson10-Jun-02 8:15 
GeneralRe: Very cool toy project when someone else paid you to do it!!! Pin
WREY10-Jun-02 15:59
memberWREY10-Jun-02 15:59 
GeneralRe: Very cool toy project when someone else paid you to do it!!! Pin
R10-Jun-02 21:47
memberR10-Jun-02 21:47 
GeneralRe: Very cool toy project when someone else paid you to do it!!! Pin
WREY10-Jun-02 22:16
memberWREY10-Jun-02 22:16 
GeneralRe: Very cool toy project when someone else paid you to do it!!! Pin
R10-Jun-02 23:05
memberR10-Jun-02 23:05 
GeneralRe: Very cool toy project when someone else paid you to do it!!! Pin
WREY11-Jun-02 0:54
memberWREY11-Jun-02 0:54 
GeneralRe: Very cool toy project when someone else paid you to do it!!! Pin
Jim A. Johnson11-Jun-02 4:17
memberJim A. Johnson11-Jun-02 4:17 
GeneralRe: Very cool toy project when someone else paid you to do it!!! Pin
WREY11-Jun-02 10:49
memberWREY11-Jun-02 10:49 
GeneralRe: Very cool toy project when someone else paid you to do it!!! Pin
Emmanuel Deloget12-Jun-02 3:28
memberEmmanuel Deloget12-Jun-02 3:28 
GeneralRe: Very cool toy project when someone else paid you to do it!!! Pin
WREY12-Jun-02 10:22
memberWREY12-Jun-02 10:22 
GeneralRe: Very cool toy project when someone else paid you to do it!!! Pin
Mark_VC27-Jul-07 5:44
memberMark_VC27-Jul-07 5:44 
GeneralExcellent! Pin
Stefan Spenz6-Jun-02 4:36
memberStefan Spenz6-Jun-02 4:36 
GeneralNicely Done Pin
Ed Gadziemski6-Jun-02 3:41
memberEd Gadziemski6-Jun-02 3:41 
GeneralVery cool! Pin
Alexander Wiseman6-Jun-02 2:16
memberAlexander Wiseman6-Jun-02 2:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.150731.1 | Last Updated 6 Jun 2002
Article Copyright 2002 by Joseph M. Newcomer
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid