Size: 18717
Comment:
|
Size: 17693
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 56: | Line 56: |
[[attachment:vdrawm.png|{{attachment:vdrawm.png|vdrawm sample|width=100}}]] | |
Line 57: | Line 58: |
<a href="%ATTACHURLPATH%/vdrawm.png"><img src="%ATTACHURLPATH%/vdrawm.png" alt="" width="74" height="65"> </a><br> |
|
Line 62: | Line 59: |
Line 64: | Line 62: |
<a href="%ATTACHURLPATH%/vdraws.png"><img src="%ATTACHURLPATH%/vdraws.png" alt="" width="71" height="77"> </a><br> |
[[attachment:vdraws.png|{{attachment:vdraws.png|sample|width=100}}]] |
Line 71: | Line 68: |
<a href="%ATTACHURLPATH%/wires.png"><img src="%ATTACHURLPATH%/wires.png" alt="" width="71" height="77"> </a> <a href="%ATTACHURLPATH%/wires2.png"><img src="%ATTACHURLPATH%/wires2.png" alt="" width="71" height="77"> </a><br> <a href="%ATTACHURLPATH%/wires3.png"><img src="%ATTACHURLPATH%/wires3.png" alt="" width="71" height="77"> </a> <a href="%ATTACHURLPATH%/wires4.png"><img src="%ATTACHURLPATH%/wires4.png" alt="" width="71" height="77"> </a> |
[[attachment:wires.png|{{attachment:wires.png| sample|width=100}}]] [[attachment:wires2.png|{{attachment:wires2.png| sample|width=100}}]] [[attachment:wires3.png|{{attachment:wires3.png|sample|width=100}}]] [[attachment:wires4.png|{{attachment:wires4.png| sample|width=100}}]] |
Line 86: | Line 74: |
The basis for a multiple view and document drawing program is shown. You can create drawings with rectangles in a specific style using <br> the draw rectangle tool. After drawing you can edit and drag the rectangles around. You can save and open the drawings you create. The document used is not a default wxCanvasDocument, but a derived one with its own saving and loading methods. The same for the views new view connector are created, which are used to create application specific views for the documents. | The basis for a multiple view and document drawing program is shown. You can create drawings with rectangles in a specific style using the draw rectangle tool. After drawing you can edit and drag the rectangles around. You can save and open the drawings you create. The document used is not a default wxCanvasDocument, but a derived one with its own saving and loading methods. The same for the views new view connector are created, which are used to create application specific views for the documents. |
Line 90: | Line 78: |
A single window application, showing how to fill a derived wxCanvas its document with objects. The derived canvas class creates a stack based toolcontroller in order to have the default zoom and dragtools available. It aslo set the canvas to have the Yaxis pointing up. It shows you how to set up scroll bars and drawing size mapping. The canvas intercepts some events to automatically zoomout at startup and when resizing the canvas window,<br> the drawing fits the new size. The document contains the special wxCanvasXYDisplayGroup to contain some curve objects and markers on those curves. | A single window application, showing how to fill a derived wxCanvas its document with objects. The derived canvas class creates a stack based toolcontroller in order to have the default zoom and dragtools available. It aslo set the canvas to have the Yaxis pointing up. It shows you how to set up scroll bars and drawing size mapping. The canvas intercepts some events to automatically zoomout at startup and when resizing the canvas window, the drawing fits the new size. The document contains the special wxCanvasXYDisplayGroup to contain some curve objects and markers on those curves. |
Line 92: | Line 80: |
<a href="%ATTACHURLPATH%/tuto4.png"><img src="%ATTACHURLPATH%/tuto4.png" alt="" width="28" height="42"> </a> |
[[attachment:tuto4.png|{{attachment:tuto4.png|sample|width=100}}]] |
Line 97: | Line 84: |
This sample sets up a wxCanvas window with mapping and scrolling. And set a toolcontroller for zooming and dragging. Its fill the document with drawing objects in order to have the canvas display the sin(x)/x function plus a ticed y and x axis with text at each tic. You can zoom and in and out using the popup menu. And you can drag parts of the drawing around.<br> This sample uses plaind basic drawing primitives to fill a document, and to show this to the user in a flexible zoomable manner.<br> It does not create advanged objects from basic objects to achieve this, and also does not use advanged curve object to achieve the same more easily.<br> For use of advanged objects look at tuto4.<br> | This sample sets up a wxCanvas window with mapping and scrolling. And set a toolcontroller for zooming and dragging. Its fill the document with drawing objects in order to have the canvas display the sin(x)/x function plus a ticed y and x axis with text at each tic. You can zoom and in and out using the popup menu. And you can drag parts of the drawing around. This sample uses plaind basic drawing primitives to fill a document, and to show this to the user in a flexible zoomable manner. It does not create advanged objects from basic objects to achieve this, and also does not use advanged curve object to achieve the same more easily. For use of advanged objects look at tuto4. |
Line 99: | Line 86: |
<a href="%ATTACHURLPATH%/tuto3.png"><img src="%ATTACHURLPATH%/tuto3.png" alt="" width="33" height="33"> </a> |
[[attachment:tuto3.png|{{attachment:tuto3.png|vdraws sample|width=100}}]] |
Line 103: | Line 89: |
This sample sets up a wxCanvas window with mapping and scrolling. And set a toolcontroller for zooming and dragging.<br> It also creates a derived circle object, with special style and added text property and its property display object.<br> It intercepts wxCanvasObject events to display some properties, when the mouse hits the object. | This sample sets up a wxCanvas window with mapping and scrolling. And set a toolcontroller for zooming and dragging. It also creates a derived circle object, with special style and added text property and its property display object. It intercepts wxCanvasObject events to display some properties, when the mouse hits the object. |
Line 114: | Line 100: |
<a href="%ATTACHURLPATH%/editmdi.png"><img src="%ATTACHURLPATH%/editmdi.png" alt="" width="60" height="55"></a><br> |
[[attachment:editmdi.png|{{attachment:editmdi.png|vdraws sample|width=100}}]] |
Line 121: | Line 108: |
<a href="%ATTACHURLPATH%/simple.png"><img src="%ATTACHURLPATH%/simple.png" alt="" width="34" height="31"> </a> |
[[attachment:simple.png|{{attachment:simple.png|sample|width=100}}]] |
Line 126: | Line 113: |
<a href="file:///D:/notebook/wxartcvs/wxArt2D/%ATTACHURLPATH%/simple.png"></a><a href="%ATTACHURLPATH%/split.png"><img src="%ATTACHURLPATH%/split.png" alt="" width="34" height="31"> </a> |
[[attachment:split.png|{{attachment:split.png|vdraws sample|width=100}}]] |
Line 132: | Line 117: |
Mdi application using docview module. Like editmdi sample, but not using tools from the editor module.<br> | Mdi application using docview module. Like editmdi sample, but not using tools from the editor module. [[attachment:canmdi.png|{{attachment:canmdi.png|sample|width=100}}]] |
Line 138: | Line 126: |
Sample to demo the use of the boolean operation module kbool, and how to use the wxBooleanWalkerHandler and wxDocviewWalkerIOHandler<br> to perform boolean operation on a wxCanvasDocument its wxCanavsObjects. wxDocviewWalkerIOHandler is a base class for interating through a wxCanvasDocument, it allows you te write algorithms for wxCanvasDocument, without the need to extend the library itself. | Sample to demo the use of the boolean operation module kbool, and how to use the wxBooleanWalkerHandler and wxDocviewWalkerIOHandler to perform boolean operation on a wxCanvasDocument its wxCanavsObjects. wxDocviewWalkerIOHandler is a base class for interating through a wxCanvasDocument, it allows you te write algorithms for wxCanvasDocument, without the need to extend the library itself. |
Line 140: | Line 128: |
<a href="%ATTACHURLPATH%/boolop.png"><img src="%ATTACHURLPATH%/boolop.png" alt="" width="37" height="33"> </a><br> |
[[attachment:boolop.png|{{attachment:boolop.png|sample|width=100}}]] |
Line 149: | Line 137: |
<a href="%ATTACHURLPATH%/curveedit.png"><img src="%ATTACHURLPATH%/curveedit.png" alt="" width="62" height="79"></a> <a href="%ATTACHURLPATH%/allcurves.png"><img src="%ATTACHURLPATH%/allcurves.png" alt="" width="66" height="67"></a> <br> |
[[attachment:curveedit.png|{{attachment:curveedit.png|sample|width=100}}]] [[attachment:allcurves.png|{{attachment:allcurves.png|sample|width=100}}]] |
Line 158: | Line 145: |
<a href="%ATTACHURLPATH%/aggtuto.png"><img src="%ATTACHURLPATH%/aggtuto.png" alt="" width="50" height="80"></a><br> | [[attachment:aggtuto.png|{{attachment:aggtuto.png|sample|width=100}}]] |
Line 167: | Line 154: |
<a href="%ATTACHURLPATH%/multiframe.png"><img src="%ATTACHURLPATH%/multiframe.png" alt="" width="67" height="65"> </a> <br> |
[[attachment:multiframe.png|{{attachment:multiframe.png|sample|width=100}}]] |
Line 175: | Line 160: |
<a href="%ATTACHURLPATH%/singleframe.png"><img src="%ATTACHURLPATH%/singleframe.png" alt="" width="53" height="57"> </a> <br> |
[[attachment:singleframe.png|{{attachment:singleframe.png|sample|width=100}}]] |
Line 182: | Line 165: |
<a href="%ATTACHURLPATH%/splitframe.png"><img src="%ATTACHURLPATH%/splitframe.png" alt="" width="78" height="38"> </a> <br> |
[[attachment:splitframe.png|{{attachment:splitframe.png|sample|width=100}}]] |
Line 189: | Line 170: |
<a href="%ATTACHURLPATH%/tabframe1.png"><img src="%ATTACHURLPATH%/tabframe1.png" alt="" width="37" height="41"></a> <a href="%ATTACHURLPATH%/tabframe2.png"><img src="%ATTACHURLPATH%/tabframe2.png" alt="" width="38" height="42"> </a> <br> |
[[attachment:tabframe1.png|{{attachment:tabframe1.png|sample|width=100}}]] [[attachment:tabframe2.png|{{attachment:tabframe2.png|sample|width=100}}]] |
Line 196: | Line 176: |
<a href="%ATTACHURLPATH%/mdi.png"><img src="%ATTACHURLPATH%/mdi.png" alt="" width="75" height="61"> </a> <br> <br> |
[[attachment:mdi.png|{{attachment:mdi.png|sample|width=100}}]] |
Module Dependencies
Module Hierarchy
wxArt2D is set up in modules. A modules contains mainly files that form together a certain funtionality.
Modules do depend upon eachother, and a certain hierarchy is in them. The hierarchy is not strict, sometimes in modules other modules are used but when wanted they can be switched on or off. Special attention is payed to be able to remove higher order modules, without problem, So the docview module can be used without the canvas module. But also lower order modules like xmlparse are optional for the docview module.
General Module
The module general is used by all modules. It contains classes etc. that can be used in all other modules.<br> wxRefObject and its derived property classes are in this module. Another one is wxSmrtPtr, which is a smart pointer template class. It works for classes with a Release and Own mechanism, which are all wxRefObject derived classes.
xmlparse Module
This module contains the code for the Pullparser, it uses expat for parsing the xml for a file or string. <br> XML Pull parsing is ideal for parsing XML data from a file, but where the reading of this data is distributed through all classes in other modules, and those classes are deciding what needs to be read from the file. This is different from a parser that reads all XML data at once into a DOM tree. Next to reading XML data, this module also support you to easily write XML data from a file, and again in such a manner that the writing of the data is distributed through all classes in other modules.<br> The CVG format uses this module for saving a wxCanvasDocument to a file and/or load it from a file. wxDocviewIOHandlerXmlSer is the class used for that, and it is a general class for serialising class data.
artbase Module
This module contains basic geometric classes, and the abstract wxDrawer2D clas, classes derived from this are drawing context classes.<br> The drawing context is able to draw relative to a matrix that is set to the drawing context first.<br> The drawing contexts classes can be used standalone for wxWidgets, and that do not depend on the rest of wxArt2D.<br> That is, it uses the general module, and the xmlparse module is used inside the style classes, but it can be switched off.<br> There is one drawing context in this module which uses wxDc and wxMemoryDc to do normal drawing. <br> The module aggdrawer and libartdrawer, use this module to implement a drawing context which can do antialiased drawing.
aggdrawer libartdrawer Module
- Those modules define drawing context classes for anti aliased double buffer drawing. They only depend on the general and artbase module. The two modules are implementations of the wxDrawer2D class, and don't depend on the canvas module.
docview module
- The docview module contains the classes for the docview framework. It makes it easy to implement applications that open several documents, and display its data one or more windows using views. The canvas module and editor module depend on it. A base wrapping class for wrapping commands/functions to external scripting languages is also in here.
canvas module
The canvas module builds on top of the docview module a library for 2D drawing applications. A a2dCanvasDocument does contain a hierarchy of drawing objects (wxCanvasOject), and the document can be displayed on windows, using specialized view called a2dCanvasView. a2dCanvasView usues internal the a2dDrawer2D derived classes to really draw the objects in the a2dCanvasDocument. Each view can display a different part and level of the hierarchy in the a2dCanvasDocument. The module depends on the following modules: general, xmlparse (optional), artbase, docview.
io Modules
The modules svgio and gdsio are using the canvas module. But the canvas module can do without them, so this is the way to add extra IO formats. The classes parse a file and translates the contents to a a2dCanvasDocument containing the drawing in the form of a2dCanvasOjects. They can also write the a2dCanvasDocument back to a file, by traversing the document from the outside, and translating the contents of the document back to a the file format. The idea is to add more formats without extending the canvas module.
editor Module
The editor module is for editing 2d graphical data. Here are the tools, editor frame and the command wrappers.
curve Module
The curve module is on top of the canvas module, and so is canextobj. Both implement complicated non basic a2dCanvasObjects. Since the curve module has a tool inside, it also depend on the editor module. Very likely it is the best to combine higher order a2dCanvasObjects together with its tools to draw/manipulate them. So therefore they will depend on the editor module in general.
Samples overview
All samples are situated in the module of which it tries to demo certain features. This does not mean it only uses that module, but its main purpose is towards that module. For example in the sample of the aggdrawer, you will find it depends on the editor module, but it is located there because it demos the aggdrawer. Down here an overview of samples and what they are meant for. The more advanged ( and therefore more complex ) samples are in the higher order modules. To get a good overview what wxArt2D is capable of, try first the samples vdrawm, vdraws. But do not start with thse, since they are also the more complex.
editor module samples
vdrawm
Is the most advanged example. It sets up a multi document drawing program. And has a menu of screens which demo all drawing features<br> of the library. You can open files in SVG, CVG and GDSII format. You can draw and edit all kinds of primitives. Each new drawing gets its own drawing editor complete with undo redo. There are dialogs to set style for drawing primitives. For many features there is a menu to test it.<br> You can create multiple views on a document via the main window its file open icons, and see how all view are updated when drawing things.<br> The screen are all created by program code, so if you need to know how to fill a drawing document using program code, look at the specific screen<br> its code.
vdraws
Instead of a multiple view and document drawing program, this sample shows how to make a single view but multiple document drawing program.
wires
- Mdi type application to explain how to work with graphs and pins. Graphs are wxCanvasObject with wxCanvasPins as children which form the nodes of the graph, and other wxCanvasObject like wxCanvasWirePolylineL which connect the objects having pins. Pins can be of different class types, pins with pinclasses of compatible/connectable types can be connected to eachother or to specific wires types. This all makes it possible to have several independent graphs, or several flows within one graph. In the sample one can draw a schematic diagram using a simple build in library of resistor, capacitor and ground symbols. Next to that non schematic objects can be connected with a separate class of pins. Pins are e.g. automatically generated on rectangles. The routing used is based on a Lee algorithm, and result in manhattan like wires with minimal cost in terms of corners and length. There is even a simple netlist generator for a spice simulator.
viewmul
The basis for a multiple view and document drawing program is shown. You can create drawings with rectangles in a specific style using the draw rectangle tool. After drawing you can edit and drag the rectangles around. You can save and open the drawings you create. The document used is not a default wxCanvasDocument, but a derived one with its own saving and loading methods. The same for the views new view connector are created, which are used to create application specific views for the documents.
tuto4
A single window application, showing how to fill a derived wxCanvas its document with objects. The derived canvas class creates a stack based toolcontroller in order to have the default zoom and dragtools available. It aslo set the canvas to have the Yaxis pointing up. It shows you how to set up scroll bars and drawing size mapping. The canvas intercepts some events to automatically zoomout at startup and when resizing the canvas window, the drawing fits the new size. The document contains the special wxCanvasXYDisplayGroup to contain some curve objects and markers on those curves.
tuto3
This sample sets up a wxCanvas window with mapping and scrolling. And set a toolcontroller for zooming and dragging. Its fill the document with drawing objects in order to have the canvas display the sin(x)/x function plus a ticed y and x axis with text at each tic. You can zoom and in and out using the popup menu. And you can drag parts of the drawing around. This sample uses plaind basic drawing primitives to fill a document, and to show this to the user in a flexible zoomable manner. It does not create advanged objects from basic objects to achieve this, and also does not use advanged curve object to achieve the same more easily. For use of advanged objects look at tuto4.
tuto
This sample sets up a wxCanvas window with mapping and scrolling. And set a toolcontroller for zooming and dragging. It also creates a derived circle object, with special style and added text property and its property display object. It intercepts wxCanvasObject events to display some properties, when the mouse hits the object.
single2
This samples explains how to setup a canvas with your own created document, canvas and view object. In simple cases one makes the wxCanvas create and own its wxDrawer view and its wxCanvasDocument. Here this is not the case, creation and deletion of documents is under control of the global wxDocviewCommandProcessor to be reached via wxDocviewGlobals->GetDocviewCommandProcessor(). This is the first step to using a single canvas for multiple documents which can be switched. It also demos how to setup a polygon tools, which can be started via a menu, and used to draw polygons. The standard stack based toolcontroller will hold this tools next to the default zoom and drag tool.
single
- Shows three ways to setup a wxCanvas. One which creates a wxDrawer view and wxCanvasDocument internal. Second how to created an external wxDrawer and wxCanvasDocument. Third how to created a wxCanvasSim, which is based on wxScrolledWindow, and sets the mapping of a drawing to the canvas in a simpler manner, but less flexible too.
editmdi
An mdi based drawing application, which allows you to read and save CVG files. Two drawing tools are created to fill documents. The editor tools is used to edit the objects. It shows you how to push and pop those tools from the toolcontroller. It shows how to open the standard style and tool dialog from the editor module. The style dialog is used to change style of drawing objects. A derived wxCanvasDocument is used to show how to give it a default drawing, and how to intercept events when view is created or removed. A derived wxViewConnector, explains how to write connectors to connect new views on documents into the application, and to control its settings based on the document contents.
canvas module samples
simple
Two smilies walking across vertical lines using a times and a wxWidgets button on top.
split
Two smilies walking across vertical lines using a timer, and three wxCanvasWidgetButton's in a wxCanvasWidgetButtonGroup.<br>
canmdi
Mdi application using docview module. Like editmdi sample, but not using tools from the editor module.
cansim
- Sample to demo use of the wxCanvasSim class, this is directly based on the wxScrolledWindow, and that class takes care of scrolling. Making of the wxDrawer view is mapped to the canvas in any way wanted. But that mapping stays constant when scrolling in the window. So one actually maps a drawing to the whole scrollable area. In the wxCanavs class, the scrolling does modify the mapping of wxDrawer, and redrawing drawing is optimized when scrolling.
boolop
Sample to demo the use of the boolean operation module kbool, and how to use the wxBooleanWalkerHandler and wxDocviewWalkerIOHandler to perform boolean operation on a wxCanvasDocument its wxCanavsObjects. wxDocviewWalkerIOHandler is a base class for interating through a wxCanvasDocument, it allows you te write algorithms for wxCanvasDocument, without the need to extend the library itself.
curves module samples
curtuto1
Display different curves types in curve groups. Marker objects and marker show objects are used to display values at certain points on the curves. Deep edit can be used to edit the curves one by one, and one can zoom into a curve group. The Curve markers can be dragged along the curves.<br> The titles of the curve plot can be edited. The showmarker objects can be edited to move markers. Several tools can be pushed on the tools stack in order to draw on the curves/canvas and to add text. In that sence this sample is just a graphics editor that also displays some curve objects. The whole drawing can be saved and loaded back in CVG format.
aggdrawer module samples
tutoagg
- The antigrain library used to render a wxCanvasDocument and edit it. wxCanvas displays a view on a wxCanvasDocument, called wxDrawer. The last one has a wxDrawer2D internal which it uses for rendering. wxDarwer2D is abstract, and wxAggDrawer is an implemtation which is used here to render in anti aliased mode.
docview module samples
This samples do only use the docview module, and although they do draw something, the canvas and editor module are not involved. The examples multiframe, singleframe, splitwin, multiwin use one and the same editor class and 3 view classes. The singleframe is actually a combination of single switch views in one frame, and view generating new frames and window. Splitwin has a single frame with a splitter window which can have attached views.<br> MultiWin is an experiment, it has moveable window in a frame ( sort of MDI like thing ). The Nonmanaged example show how the docview classes can be used without a docmanager.
!MultiFrame
Multiframe demonstrates the use of wxViewConnector to generate frames with a view.
!SingleFrame
A single frame, meaning documents are opened in a single frame window, but still other frames can be generated. In principle there is no need for a single frame specific setting. It is just a matter of allowing the user to generate extra frames or not.
Splitwin
The use of a wxSplitterWindow to have seperate wxViewRef's in each wxWindow of the splitter.
TabFrame
- How to use a wxNoteBook as a container for wxView's plus its display Windows. One Tab contains the drawing and the other a statistics view of colors and objects used.
mdi
mdi application showing two open documents with several views.
nonmanaged
- Shows how to use a view and its display window in a standalone situation, without a central command controller ( which normally keeps track of open documents etc.) . It still can Do and Undo changes to the document of the view, since a document will have its own command stack.
Application overview
For the moment there is only one application called teto, which goal is a multi document drawing application.<br>