As best as I can determine this may be a bug. My test application shows that the ImagingAnnot.ObjectsCount is indeed 0 despite the fact that the objects are visible in the thumbnail for the selected image and ImageEnAnnot.IsEmpty is not True and ImageEnAnnot.CopyToTImageEnVect successfully copies all the objects from ImageEnMView to ImageEnVect. The only work-around that I can find is to get the object count from ImageEnVect instead of ImageEnMView.
procedure TForm1.ImageEnMView1ImageSelect(Sender: TObject; idx: Integer);
begin
if ImageEnMView1.SelectedImage > -1 then
begin
{ Clear }
ImageEnVect1.RemoveAllObjects;
ImageEnVect1.Clear;
{ Copy the selected IEBitmap to the background of ImageEnVect }
ImageEnMView1.CopyToIEBitmap(idx, ImageEnVect1.IEBitmap);
{ Copy the annotations from ImageEnMView to ImageEnVect }
if ImageEnMView1.MIO.Params[idx].ImageEnAnnot.IsEmpty = False then
begin
ImageEnMView1.MIO.Params[idx].ImageEnAnnot.CopyToTImageEnVect
(ImageEnVect1);
{ Display the object count in the statusbar. If ImagingAnnot.ObjectsCount is 0 then
get the object count from ImageEnVect }
if ImageEnMView1.MIO.Params[idx].ImagingAnnot.ObjectsCount <> 0 then
StatusBar1.Panels[5].Text := 'Objects: ' +
IntToStr(ImageEnMView1.MIO.Params[idx].ImagingAnnot.ObjectsCount)
else if ImageEnMView1.MIO.Params[idx].ImagingAnnot.ObjectsCount = 0 then
begin
MessageDlg
(PChar('ImageEnMView1.MIO.Params[idx].ImagingAnnot.ObjectsCount is 0. '
+ 'Getting the object count from ImageEnVect instead.'), mtWarning,
[mbOK], 0);
StatusBar1.Panels[5].Text := 'Objects: ' +
IntToStr(ImageEnVect1.ObjectsCount);
end;
end;
{ Refresh the TImageEnVect }
ImageEnVect1.Update;
StatusBar1.Panels[3].Text := 'Frame: ' +
IntToStr(ImageEnMView1.SelectedImage + 1);
end;
end;
A simple demo that reveals the problem has been posted in the user demos here: http://www.xecute.com/ieforum/topic.asp?whichpage=3&TOPIC_ID=1446#8003
Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development