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
 PolyLines

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
pierrotsc Posted - Nov 28 2018 : 16:10:01
I am trying to see if i can convert my vector objects to the new layer kind. Does the code is supposed to work only with imageenview and not imageenvect ?

I created a blank new project and added that
procedure TForm1.FormShow(Sender: TObject);
begin
// Draw a triangle polygon
With TIEPolylineLayer( ImageEnVect1.CurrentLayer ) do
begin
  ClearAllPoints();
  AddPoint( 500, 0 );
  AddPoint( 1000, 1000 );
  AddPoint( 0, 1000 );
  PolylineClosed := True;
end;
ImageEnVect1.Update();
end;


That creates a crash when closing and i do not see anything drawn.
Best
8   L A T E S T    R E P L I E S    (Newest First)
pierrotsc Posted - Nov 29 2018 : 14:56:30
Got it..Thanks
xequte Posted - Nov 29 2018 : 14:54:38
Hi

Also, ensure that when you do a type cast, you check its type, e.g.

if ImageEnView1.CurrentLayer is TIEPolylineLayer then
TIEPolylineLayer( ImageEnView1.CurrentLayer ).SetPoints(...);


Your code above gives an A/V because ImageEnView1.CurrentLayer will be a TIEImageLayer (background layer of TImageEnView).

Nigel
Xequte Software
www.imageen.com
pierrotsc Posted - Nov 29 2018 : 12:02:52
thanks bill. it works..no error
w2m Posted - Nov 29 2018 : 11:59:53
procedure TForm1.Button1Click(Sender: TObject);
var
  iShapePoints: array of TPoint;
begin
  SetLength( iShapePoints, 3 );
  iShapePoints[0] := Point( 500, 0 );
  iShapePoints[1] := Point( 1000, 1000 );
  iShapePoints[2] := Point( 0, 1000 ); 
  iLayer := ImageEnView1.LayersAdd(ielkPolyline);
  TIEPolylineLayer(ImageEnView1.Layers[iLayer]).SetPoints(iShapePoints, True);
  ImageEnView1.Update();
end;

Add the layer first then SetPoints.

I do not get any errors with this.

Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development
pierrotsc Posted - Nov 29 2018 : 11:29:01
Thank you. it now shows the triangle but i get a violation error when i close the program. I have only an imageenview and a button with this code
procedure TForm1.Button1Click(Sender: TObject);
var
shapePoints: array of TPoint;
begin
SetLength( shapePoints, 3 );
shapePoints[0] := Point( 500, 0 );
shapePoints[1] := Point( 1000, 1000 );
shapePoints[2] := Point( 0, 1000 );
TIEPolylineLayer( ImageEnView1.CurrentLayer ).SetPoints( shapePoints, True );
ImageEnView1.LayersAdd( ielkPolyline );
ImageEnView1.Update();
end;

What am i doing wrong ?
xequte Posted - Nov 28 2018 : 21:50:14
Oh, you forgot to add a polyline layer:

ImageEnVect1.LayersAdd( ielkPolyline );

Nigel
Xequte Software
www.imageen.com
pierrotsc Posted - Nov 28 2018 : 18:54:00
Thanks, i replaced imageenvect with imageenview but i get the same behavior. nothing is drawn and i get an error when i close the program. the demo project i created just has one imageenview and the formshow event.
thanks
xequte Posted - Nov 28 2018 : 18:13:13
Hi

Layers are TImageEnView code (Objects are TImageEnVect), so really this should only be one in a TImageEnView.

Technically TImageEnVect descends from TImageEnView, so it should work, but we don't test layers under TImageEnVect (which has been deprecated).

Nigel
Xequte Software
www.imageen.com