Navigator Refresh Issue

Discuss and ask questions about CAD VCL (Delphi and C++ Builder).

Moderators: admin, support, SDS

Post Reply
sanket
Posts: 1
Joined: 03 Dec 2018, 13:22

Navigator Refresh Issue

Post by sanket » 05 Dec 2018, 14:18

Hi,

I am using CAD-VCL library and importing a CAD drawing into my application. After importing I use a line tool and click on first point. Then while I move the mouse to draw the second point the drawing keeps on refreshing thus making it impossible for the user to click and provide the second point.

I use TsgDrawingNavigator to display the drawing and the mouse move code is mentioned below

procedure NavMouseMove(Sender: TObject; Shift: TShiftState;
X, Y: Integer);
var
vUnits: string;
lpt1, lpt2, lpt3, lpt4, lMidPoint: TFPoint;
begin
case FNavState of
nsMove:
begin
if Form1.Img <> nil then
begin
if not IsEqualPoints(FPrevPoint, Point(X, Y)) then
begin
FForm.sgPaintBox.BeginUpdate;
FLine.Point1 := FForm.sgPaintBox.GetDrawingCoords(X, Y, vUnits);
FForm.Img.Converter.Loads(FLine);
FForm.sgPaintBox.EndUpdate;
end;
end;
end;
end;
end;

I have added a sample project in attachment along with and video showing the described issue.

Using the attached project please compile and run the viewer exe, you can open some heavy cad drawing file like one with blueprints of an appartment (I am not able to upload the file as its size isn't accept in the post attachment) and click on the Line button next to the open drawing button and do a measurement on the drawing. Once you have clicked the first point and then move your mouse to next point, you'll see the drawing keeps on refreshing and its not possible to get a preview of the measurement.

I have tried following methods till now:

1) FForm.sgPaintBox.Invalidate also and that seems to work well when drawing isn't heavy, once a heavy cad drawing file is opened invalidate actually takes more time then BeginUpdate - EndUpdate combination.

2) By default doublebuffered is set to false and this gives me a realtime preview of my measurement but once i set DoubleBuffered = true; to have performance gains, it actually disables the real time preview.
Attachments
Viewer.zip
(56.73 KiB) Downloaded 3 times

Post Reply