Deleting Entity

Today we implemented the delete command in the UndoStack. This was also quite mandatory to do. Now the user can delete any selected entity(s) with ‘Delete” key on the keyboard.

Also we have changed the color of entities when they are selected. Earlier there was no distinction whenever the entity was selected.

Now the points selected will be shown in “red” color while the rest of the entities will be shown in dashed line.

There will be lot of issues that we are going to face as a user which we’ll be handling while Testing phase. Any other immediate issues that we detect we are solving them as we go.

Undo/Redo FrameWork

Before going with operations for the entities we have decided to implement Undo/Redo Framework to our eCAD.

This is a vital feature for any software and pretty handy for any graphics application. We have created a CadCommandAdd and CadCommandDelete classes to add and delete a command to add entities respectively.

This makes the use of QUndoFramework. So undo/redo are working for adding entites along with their shortcuts (key-bindings).

Now moving entities is going to be done as well for the same. It would have been quite hectic if we have saved this implementation(undo/redo) for later.

Specific QGraphicsItems

We have changed the QGraphicsItem class with specific classes for all the entities.

With QGraphicsLineItem and QGrpahicsEllipseItem we now have much more simpler implementation for every entity. But this might limit the customization as opposed to the QGraphicsItem.

On the other hand, we are working on the overlapping bounding rect issue for the items. And after this we’d be moving on to the operations that must be available in our eCAD like cut, copy, paste, delete, etc.

Unique Identification and Grouping

Like I wrote yesterday we had some pretty pressing issue of assigning Id’s to all the entities which we successfully implemented today.

All the entities are now having an Id associated which will be saved in the XML format as well.

We noticed that line, circle and ellipse entities have points drawn with them and these points were being assigned new id which was not the correct behavior we expect. This was resolved by giving the same id as that of parent entity to them.

On the note of unexpected behavior we also found that while making these QGraphicsItems selectable and movable, all entities except point were being correctly working in case of a line item, only the line was being translated and the corresponding end points were not.

Using QGraphicsItemGroup, we managed to correct this as we made groups for each entities as lineGroup, circleGroup and ellipseGroup. These groups are being added to the QList for storage.

Improving eCAD

We have implemented the code for saving the entities in xml format. Now every entity is being saved in our defined format in xml, we can tweak it as we wish but that’s for later discussions.

And we changed the states of the actions defined in the menu items. Now most of the menu items get enabled only when a new file has been created.

We also need to have unique identity for all the entities as this would be helpful in performing operations on them.

So after implementing this, we’d be moving onto the general operations for these entities.

2D CAD week

This week has been all about the 2D CAD. We have implemented the following entities:

These entities are now drawn/painted with QPainterPath class as a QGraphicsItems.
Their bounding rectangles have been corrected as well.

Now we are looking into their storage in the memory (vector).
Then these items/entities will be saved in the XML format as well.