ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Adding multiple objects at once
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

spetric

Croatia
308 Posts

Posted - Mar 03 2017 :  17:10:32  Show Profile  Reply
Hi,

I'm currently using standard AddNewObject method to add objects in a loop:


for (int i = 0; i < _keyPoints->Count; i++)
   {
   key = &(_keyPoints->Data[i]);
   hobj = _paint->AddNewObject();
   radius = ceil(key->scale * SiftParams.InitSigma);  // initial sigma
   _paint->ObjPenColor[hobj] = clAqua;
   _paint->ObjKind[hobj] = iekELLIPSE;
   _paint->ObjTop[hobj]  =  key->y - radius + addY;
   _paint->ObjLeft[hobj] =  key->x - radius + addX;
   _paint->ObjWidth[hobj] =  radius*2;
   _paint->ObjHeight[hobj] = radius*2;
   }

If there are 5000 objects, it can take a while for a loop to finish.
Is it possible somehow to add a bunch off objects at once?

If not, any suggestion to speed up object addition would be highly appreciated.
Objects are only visible and can not be selected, resized or moved.

Maybe to draw them on a bitmap and then add bitmap as object!?

TIA,
Siniša




w2m

USA
1990 Posts

Posted - Mar 04 2017 :  12:13:24  Show Profile  Reply
I have not tried to add 5000 objects at one time, but I suspect you should try your idea of using a bitmap. It may take quite a while to draw using a bitmap canvas with that many "objects", so you may need to use a threaded procedure to achieve this.

Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development
Go to Top of Page

xequte

38198 Posts

Posted - Mar 04 2017 :  19:56:02  Show Profile  Reply
Hi Sinisa

Yes, I'm afraid you are likely to see performance issues with that many objects. If the objects don't need to be interactive you should simply draw them directly to the bitmap canvas.




Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

spetric

Croatia
308 Posts

Posted - Mar 08 2017 :  09:36:16  Show Profile  Reply
Thanks Bill and Nigel.

I'll probably draw objects to bitmap, or add a warning when number of objects exceeds 1000.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: