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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 ImageEnVect Region selection

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
rswyman@docuxplorer.com Posted - Sep 07 2018 : 20:56:08
Hi All,

How can I set a selected region and then delete all object within that region?

Thanks
Ron
10   L A T E S T    R E P L I E S    (Newest First)
rswyman@docuxplorer.com Posted - Sep 09 2018 : 16:16:59
ok, thx!
xequte Posted - Sep 09 2018 : 15:25:56
Nice Ronald,

Note that you can also just use the boolean result of IntersectRect:

If IntersectRect(resultRect,aRect1, aRect2) then...

Nigel
Xequte Software
www.imageen.com
rswyman@docuxplorer.com Posted - Sep 09 2018 : 08:22:48
Here is a sample of the final result.


aRect1.Left := x;
aRect1.Top := y;
aRect1.Right := x+width;
aRect1.Bottom := y+Height;
for ii := (fImageEnVect.ObjectsCount -1) downto 0 do begin
   hobj := fImageEnVect.GetObjFromIndex(ii);
   fImageEnVect.GetObjRect(hobj, aRect2);
   IntersectRect(resultRect,aRect1, aRect2);
   if (resultRect.Left <> 0) and (resultRect.Top <> 0) and
      (resultRect.Bottom <> 0) and (resultRect.Right <> 0) then begin
     fImageEnVect.RemoveObject(ii);
    end;
end;


Thank You.
xequte Posted - Sep 09 2018 : 00:55:59
Hi

There is no automated way to programmatically do this, but you can just iterate through all of your objects, getting there GetObjRect, and compare to your selection rect using IntersectRect. If they overlap then select the object.

https://www.imageen.com/help/TImageEnVect.GetObjRect.html
http://docwiki.embarcadero.com/Libraries/Tokyo/en/System.Types.IntersectRect


Nigel
Xequte Software
www.imageen.com
rswyman@docuxplorer.com Posted - Sep 08 2018 : 15:09:43
Thanks for the effort Bill!
w2m Posted - Sep 08 2018 : 14:13:23
fImageEnVect.Select(x, y, width, height);

I think this just makes a rectangular selection rubberband and probably does not operate like selection of objects with the mouse. Unfortunately I have never tried to select objects within rectangular coordinates but you might want to search the archives to see if this is described in some post. I do not see a method to select all the objects inside of a TRect and I do not know if such a method even exists.

Try taking a look at Group/UnGroup objects in the help file. This may help but I am not sure about it.

If not then Nigel may have some ideas on how to select objects inside of a TRect or maybe even adding a method to do so. For now I guess I can not be of assistance to achieve this programmatically.

Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development
rswyman@docuxplorer.com Posted - Sep 08 2018 : 13:16:23
Thanks Bill, but this process is being executed without the mouse / user interaction but programmatically. So the question still stands, how do I select a group of objects via (x, y, width and height) / region?

w2m Posted - Sep 08 2018 : 11:36:07
Set fImageEnVect.EnableRangeObjectsSelection to true before making a selection with the mouse. After you select objects with the mouse then call your procedure:
for ii := 0 to fImageEnVect.SelObjectsCount -1 do begin
  hObj := fImageEnVect.SelObjects[ii];
  fImageEnVect.RemoveObject(hObj);
end;

This works as expected here, meaning the selected objects are removed.

Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development
rswyman@docuxplorer.com Posted - Sep 08 2018 : 08:18:35
Hi Nigel,

I tried this but SelObjectsCount is always zero.


fImageEnVect.EnableRangeObjectsSelection := true;
fImageEnVect.Select(x, y, width, height);
for ii := 0 to fImageEnVect.SelObjectsCount -1 do begin
  hObj := fImageEnVect.SelObjects[ii];
  fImageEnVect.RemoveObject(hObj);
end;
xequte Posted - Sep 07 2018 : 22:47:47
Hi Ron

If EnableRangeObjectsSelection is enabled, then you can drag select objects. Iterate through the SelObjects array and remove them.



Nigel
Xequte Software
www.imageen.com