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
 Out of Memory with CreatePolygonsFromSelection
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

AndyColmes

USA
351 Posts

Posted - Jul 17 2014 :  12:15:51  Show Profile  Reply
I am getting "Out of Memory" when trying to create a selection from Polygons. When I make a smaller Polygon area, the "Out of Memory" goes away. So, it has to do with the size. Is there a way to fix this?

Thanks in advance.

Andy

xequte

38598 Posts

Posted - Jul 17 2014 :  23:11:51  Show Profile  Reply
Hi Andy

Can you give us the details to reproduce this?



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

AndyColmes

USA
351 Posts

Posted - Jul 18 2014 :  04:46:44  Show Profile  Reply
I set to create a polygon:

ImageEnVect1.MouseInteract := [miSelectPolygon];

Once the polygon is drawn, I try to make a selection out of the polygon:

hobj := ImageEnVect1.CreatePolygonsFromSelection;
ImageEnVect1.DeSelect;
ImageEnVect1.UnSelAllObjects;
ImageEnVect1.Update;

ImageEnVect1.ObjPenColor[hobj] := clRed;
ImageEnVect1.ObjPenWidth[hobj] := 2;
ImageEnVect1.ObjPenStyle[hobj] := psSolid;
ImageEnVect1.ObjBrushStyle [hobj] := bsClear;
ImageEnVect1.ObjBrushColor [hobj] := clRed;

ImageEnVect1.ObjStyle[hobj] := xstyle;
ImageEnVect1.Update;

Where xstyle is of TIEVStyle and as follows:

xstyle := xstyle + [ievsVisible];
xstyle := xstyle + [ievsSelectable];
xstyle := xstyle + [ievsMoveable];
xstyle := xstyle + [ievsSizeable];

If the polygon is not very large, then everything is fine, but when I make it larger to what I want, then the "Out of Memory" comes up.

I look forward to hearing back from you on how to fix this.

Thanks in advance.

Andy

Go to Top of Page

xequte

38598 Posts

Posted - Jul 23 2014 :  08:26:29  Show Profile  Reply
Hi

I'm afraid does not return an hobj, but rather the number of polygons created. You would need to use a different method to determine the hobj, e.g. IEV_PREVIOUS_INSERTED_OBJECT for the last added or iterating through the objects to find those where ObjKind[hobj] = iekPOLYLINE.



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

AndyColmes

USA
351 Posts

Posted - Jul 23 2014 :  13:07:30  Show Profile  Reply
Hi Nigel,

So, if CreatePolygonsFromSelection creates an x number of polygons, is there a way to convert that closed polygon to a selection? I need to be able to "extract" that polygon area to a separate image.

Thanks Nigel.

Andy

Go to Top of Page

xequte

38598 Posts

Posted - Jul 24 2014 :  12:52:52  Show Profile  Reply
Hi Andy

Why not create an image object using:

http://www.imageen.com/help/TImageEnVect.CreateImageFromSelectedArea.html


Or just output the selection to a bitmap. There are a number of functions to this does, such as:

http://www.imageen.com/help/TImageEnView.CopySelectionToIEBitmap.html

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

AndyColmes

USA
351 Posts

Posted - Jul 24 2014 :  16:17:52  Show Profile  Reply
Hi Nigel,

The real intention of using CreatePolygonsFromSelection is so that I can have a way to save the selection because I am using it to "draw" the selection using Objects like iekBOX, but in this case it would be a polygon. I am trying to save those Objects to a .IEV file then which is needed from a later part of the program. How would I do this?

Thanks Nigel.
Go to Top of Page

AndyColmes

USA
351 Posts

Posted - Jul 25 2014 :  22:09:48  Show Profile  Reply
Hi Nigel,

Reverting back to version 5.05 which was the version that the application was created eliminates the "Out of memory" for the same code. So, the latest version is the issue.
Go to Top of Page

xequte

38598 Posts

Posted - Jul 26 2014 :  07:56:30  Show Profile  Reply
But are you still using the result of CreatePolygonsFromSelection as an hobj?


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

AndyColmes

USA
351 Posts

Posted - Jul 28 2014 :  12:36:46  Show Profile  Reply
Yes I am. The function in version 5.05 has a return value which I think is really the number of polygons. But the function in the latest version does not have a return value.
Go to Top of Page

AndyColmes

USA
351 Posts

Posted - Jul 28 2014 :  17:33:15  Show Profile  Reply
I want to confirm that compiling that same application with the latest 5.1.1 gives the Out of Memory issue but compiling it with 5.05 works as expected. Can you please verify and advise?

Thanks.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: