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
 Save Annotations per layer to file
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

AndyColmes

USA
351 Posts

Posted - Jul 14 2014 :  15:29:39  Show Profile  Reply
I have a TImageEnVect with 2 layers and I am creating annotations per layer. I save the IEV file but it contains all the annotations. I need to be able to save the annotations to a file per layer so I can load it to create an image for each layer.

How would I do this?

Thanks in advance.

Andy

w2m

USA
1990 Posts

Posted - Jul 14 2014 :  15:40:40  Show Profile  Reply
Did you anchor the objects to a layer and set the ObjLayer property for the object when you create them?

TImageEnVect.ObjAnchorToLayers
Declaration

property ObjAnchorToLayers:boolean
Description

When true (default), all objects are anchored to a layer (using ObjLayer property). Otherwise the objects are just painted over all layers.


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

AndyColmes

USA
351 Posts

Posted - Jul 14 2014 :  16:29:21  Show Profile  Reply
Hi Bill,

Yes, I am aware of that. But is there a way to save the objects to a IEV file per layer? Right now calling SaveToFileIEV saves all the annotations from all layers to one file.
Go to Top of Page

w2m

USA
1990 Posts

Posted - Jul 15 2014 :  13:11:40  Show Profile  Reply
Hi Andy,

I do not see a method to create an image for each layer or even to access the bitmap or objects in a specific layer by specifying which layer you wish to load. I guess this is not yet possible.

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

39053 Posts

Posted - Jul 15 2014 :  13:51:13  Show Profile  Reply
Hi Andy

You should be able to do this as follows (untested):

procedure SaveObjectsOfLayer(sFilename: string; iLayerToSave : Integer);
var
  i: integer;
  ihobj: integer;
  fs: TFileStream;
begin
  fs := TFileStream.Create(sFilename, fmCreate);
  for i := 0 to ImageEnVect1.ObjectsCount - 1 do
  begin
    ihobj := ImageEnVect1.GetObjFromIndex(i);
    // if hobj is on the specified layer then save it
    iobjLayer := ImageEnVect1.ObjLayer[ihobj];
    if iobjLayer = iLayerToSave then
      ImageEnVect1.SaveToStreamIEV(fs, ihobj);
  end;
  fs.free;
end;



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

AndyColmes

USA
351 Posts

Posted - Jul 18 2014 :  07:26:58  Show Profile  Reply
Hi Nigel,

Unfortunately, the code does not work. It seems to lock up the sFilename and disallow any access to it after running the code. Can you help?

Thanks in advance.

Andy
Go to Top of Page

xequte

39053 Posts

Posted - Jul 18 2014 :  22:19:04  Show Profile  Reply
Hmmm, I can't see anything wrong with the code. I'll need to investigate when I get back into the office.



Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: