Been a few days since I wrote down my progress here.
The issue with scripting widget has been resolved. Earlier, each drawing area had a connection with same script widget though multiple script widgets got appended but the scope was lost while switching among different drawings. It was a significant issue since otherwise user would have experienced trouble with issuing commands in different drawings.
Next we have implemented auto save feature for drawings too. It has been implemented earlier for scripting files only.
Yet there are trivial things like appending suffix to file name while saving, exporting files in xml, jpg or pdf formats if none is typed by the user while doing so. It was done using append() but something wrong went at the back till we noticed it yesterday. A blank file (text) got saved along with a file with file name provided while saving with the extension appended. So there were two files. This is solved now too. A little trouble with filter jpg is left.
Oh! I missed the main thing. 😛 I corrected the last issue while I was correcting export of files in PDF and images. The export got tricked while scaling the drawing area during the transformation process in order to provide first quadrant to the user by default.
Not many but a few more issues have been fixed.
We have been fixing bugs these days and making eCAD finer. The drawing area had origin at top left corner of the drawing area. Coming to general implementation of coordinate systems, it was expected to be at bottom left. Did this today.
The adding of text after this got mirrored and text was upside down and similarly for image, the point expected to be top left of the image was coming to be bottom left of the image.
So transformations had to be done appropriately in these cases. The issue arose since bounding rect of all other entities gets updated but not for these two. At last, everything is working fine now. It was a significant task to set up the coordinate system.
Trivial things keep bugging us. The laboring of two days to decipher the shape of ellipse for selection finally resulted in the legitimate glow of happiness when #49 got solved.
A further impediment was the rendering of grid in the print preview of the drawing and in the PDF generated after print. Both the print and print preview necessitated only entities to be rendered, not embracing the grid along with. Fixed it.
Figuring out more issues and cracking them.
The approach for live preview has been almost same but we figured out a way to remove the entities that got added in the scene before an entity was finally added in the drawing area. Incorporating another list for entities that were added to the drawing area helped us accomplish this since this was cleared at right moments.
So now live preview is in action for all the entities. The solution was quite simple. Live preview has invigorated the eCAD.
où il ya une volonté , il ya un moyen
We had been encountering issues in selection of entities especially in the case of overlapping entities. The entity’s bounding rect was deployed for selection. If two entities overlapped, the one underneath could not be selected unless the one above was moved away completely. But the selection in correct manner was if the entity got selected by its shape.
Recalling the initial days of development of eCAD, selecting entities in LC made us say to each other: “How did they do this?” And today we did it and realized it was not tough at all. The QPainterPath is used to work this out. Maybe some things fit in mind with experience. 😉
For now line and circle are selected exactly according to their shapes with a minimal tolerance from their respective shapes. These are smart features with simple implementation.
eCAD has Multiple Document Interface (MDI). But its implementation did not engender the unerring working. Working in new documents stemmed up with the loss of scope in former documents. Switching to previous documents made basic functions like enabling/disabling grid inert.
Though the implementation of grid’s enabling has been done lately but the prior deployment had the primary bug. We could draw entities in a new document but this could not be accomplished in the documents created former to the one that is active at the ongoing instant.
Endeavoring through the sundry segmentation faults, we finally resolved this bug today. The implementation was finished decently by setting the pointer of the view class in the sub-window and making this view active. Subsequently, the window and view associated at an instant were appended to a list as a pair. The subWindowActivated() signal on emission was connected to a slot which returned the appropriate pointer of the view.
The actions in the menu bar and addition of script widget and command widget need an analogous connection to the current view in the active sub-window. This is the next thing to be fixed.
The functionality of a few things seemed ambiguous. An entity could be copy/cut even if it was not in selected state but this should betide only in an entity’s selection state.
Another one was, a position changed state i.e. a move command was pushed to the undo stack though the position of entity remained same. Just selecting the entity did this hitch.
I fixed these two issues today.
There have been issues while pasting entities after cut/copy. The pasted entities retained the id of the id being copied/cut. We fixed this issue.
The implementation of the same has not been done for line. So I did it for line too.
Also live preview was seen just twice in my yesterday’s implementation but now I get only: The program has finished unexpectedly. This is significant to be a part of the eCAD. So I will focus on this now.
Almost all the options under different menus have been implemented. Today I implemented Grid actions which on checking/un-checking shows/hides the grid. Zoom-in/out were associated to the corresponding scale factors from the view class.
The panning feature has also been implemented. Currently De-select window cannot be implemented since the entities get de-selected on clicking anywhere on the drawing area, except on the entity itself.
Scripting is over today. We are left with issues. I am looking onto live preview issue along with.
Ever tried on LibreCAD or AutoCAD? And then played with the selection using mouse drag in the drawing area. This feature is agile and it requires a little attention to catch the difference when selecting in increasing and decreasing values of x-axis.
The logic of this feature’s implementation in eCAD was clearly associated with the intersection of bounding rectangles of items being selected and the rubber band drag window/widget. The two different cases that had to be deployed included:
- With increase in values of x, an entity is selected if the entity lies completely inside the selection area. See figure 1 below.
Entity not selected when a portion of it is in selection rectangle
Mouse is dragged from top left to bottom right to select and it is selected since it lies entirely in the selection box.
- With decrease in values of x, an entity is selected if a portion of the entity lies inside the selection area,
Mouse is dragged from bottomright to topleft corner and item is selected even when a portion of entity lies inside the selection box.
Now I will be moving onto Deselect Window and selection of intersected entities.