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
 How to dynamically generate elliptical seats?
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

hifly

China
6 Posts

Posted - Jun 30 2019 :  11:03:49  Show Profile  Reply
@xequte
HI.
How to dynamically generate elliptical seats and sign names by row and column?Is there a code reference for related examples?



xequte

38182 Posts

Posted - Jun 30 2019 :  23:43:41  Show Profile  Reply
The following code will create a 2x3 set of numbered ellipses:

  for I := 1 to 6 do
  begin
    // Add a text object
    ImageEnView1.LayersAdd( 'A' + IntToStr( I ), 14, clBlack, 'Arial', [fsBold]);
    txtLayer := TIETextLayer( ImageEnView1.CurrentLayer );

    if I mod 2 = 0 then
      txtLayer.PosX := 500  // even number
    else
      txtLayer.PosX := 100;  // Odd number;
    txtLayer.PosY := ( I + 1 ) div 2 * 300 + 100;
    txtLayer.Width  := 200;
    txtLayer.Height := 200;
    txtLayer.BorderColor := clRed;
    txtLayer.BorderWidth := 5;
    txtLayer.FillColor   := clYellow;
    txtLayer.BorderShape := iesEllipse;
    txtLayer.Alignment   := iejCenter;
    txtLayer.Layout      := ielCenter;
  end;
  ImageEnView1.Update();



However drawing the text outside the circle (Name* labels in your image) is much harder. You would need to create individual text layers and position them independently.

As a starting point to calculate the PosX and PosY for each label, use the OffsetPoint method in hyieutils.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

hifly

China
6 Posts

Posted - Jul 01 2019 :  04:19:01  Show Profile  Reply
Outside Drawing Text Data Fixed must have 10 names, so you see how to solve it? Provide the following example code, thank you.
Go to Top of Page

xequte

38182 Posts

Posted - Jul 01 2019 :  17:23:19  Show Profile  Reply
Hi

Please show me the code that you have so far to dynamically create the labels.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

hifly

China
6 Posts

Posted - Jul 01 2019 :  20:58:33  Show Profile  Reply
I don't have any code here. How to generate 10 name tags out of a circle with both X and Y axes accurate is a difficult problem for me.
Go to Top of Page

hifly

China
6 Posts

Posted - Jul 05 2019 :  22:46:30  Show Profile  Reply
@Xequte
How to mark the angle of 0, 30, 60, 90, 120, 150, 180, 210 degrees and coordinates of the circle?
Go to Top of Page

xequte

38182 Posts

Posted - Jul 07 2019 :  00:57:47  Show Profile  Reply
The width and height of the circle will be ImageEnView1.Layers[i].Width/Height.

So to find a point on the edge of the circle at 30 deg. would be something like:

lyr := ImageEnView1.Layers[i];
centerPt.X := lyr.PosX + lyr.Width div 2;
centerPt.Y := lyr.PosY + lyr.Height div 2;
ptOnEdge := OffsetPoint( centerPt, lyr.Width div 2, lyr.Height div 2, 30 );


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