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
 Polyline point editing

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
chaenam choe Posted - Dec 23 2020 : 00:06:07
after drawing polyline as attached image I would like to move one of the polyline point with text layer following to that point.
I created as below...

procedure TfmAnalyzer.ImageEnView2LayerNotify(Sender: TObject; layer: Integer;
  event: TIELayerEvent);
var
  i, cnt, idx : Integer;
  pt : TPoint;
  X,Y : Integer;
begin
  if event = ielCreated then begin
    with TIEPolylineLayer(ImageEnView2.CurrentLayer) do begin
      cnt := PointCount;
      for i := 0 to cnt - 1 do begin
        X := GetPoint(i, iepbBitmap).X;
        Y := GetPoint(i, iepbBitmap).Y;
        ImageEnView2.LayersAdd(ielkText, X+30, Y, 300, 70);
        TIETextLayer(ImageEnView2.CurrentLayer).Name := 'TXTL_' + IntToStr(i);
        TIETextLayer(ImageEnView2.CurrentLayer).Text := IntToStr(i+1) + ': ' + IntToStr(X) + '/' + IntToStr(Y);
        TIETextLayer(ImageEnView2.CurrentLayer).BorderColor := clBlack;
        TIETextLayer(ImageEnView2.CurrentLayer).BorderWidth := 2;
        TIETextLayer(ImageEnView2.CurrentLayer).FillColor := clWhite;
        TIETextLayer(ImageEnView2.CurrentLayer).Alignment := iejCenter;
        TIETextLayer(ImageEnView2.CurrentLayer).Layout := ielCenter;
        TIETextLayer(ImageEnView2.CurrentLayer).Font.Size := 30;
      end;
    end;
    ImageEnView2.Update();
    POLY_DONE := True;
  end;
end;

I tried with OnLayerNotify event, OnLayerNotifyEx, OnLayerMoveSize...but I get errors...
My code is ...

    if (ImageEnView2.Layers[layer].Kind = ielkPolyline) and (event = ielMovedPoint) then begin
      ShowMessage('point moved...');
        cnt := TIEPolylineLayer(ImageEnView2.CurrentLayer).PointCount;
        ShowMessage(IntToStr(cnt));
        for i := 0 to cnt - 1 do begin
          X := TIEPolylineLayer(ImageEnView2.CurrentLayer).GetPoint(i, iepbBitmap).X;
          X := TIEPolylineLayer(ImageEnView2.CurrentLayer).GetPoint(i, iepbBitmap).Y;
          idx := ImageEnView2.LayersNameToIndex('TXTL_' + IntToStr(i), False);
          ImageEnView2.Layers[idx].PosX := X + 30;
          ImageEnView2.Layers[idx].PosY := Y;
          TIETextLayer(ImageEnView2.Layers[idx]).Text := IntToStr(i+1) + ': ' + IntToStr(X) + '/' + IntToStr(Y);
        end;
        ImageEnView2.Update();
    end;


what am I wrong? what should I do?
Any idea will be happy...
thanks.



1   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Dec 28 2020 : 18:34:56
Hi

Your code works fine here, except the line:

X := TIEPolylineLayer(ImageEnView2.CurrentLayer).GetPoint(i, iepbBitmap).Y;

Should read:

Y := TIEPolylineLayer(ImageEnView2.CurrentLayer).GetPoint(i, iepbBitmap).Y;


Note: Also, for safety, you should always check that layer >=0 if you use LayerNotifyEx

Nigel
Xequte Software
www.imageen.com