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
 After polyline layer created event
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

w2m

USA
1990 Posts

Posted - Aug 16 2018 :  11:46:37  Show Profile  Reply
I am using ImageEnView.MouseInteract := [miDrawCreatePolylineLayers] to create a polyline layer. After the polylinelayer is created what event should I use to set ImageEnView.MouseInteract := [miMoveLayers, miResizeLayers] to select the polylinelayer?

I tried setting the newly created layer as the selected layer in the ImageEnViewLayerNotify event by capturing the ielCreated event and then selecting the newly created polyline layer, but when the mouse button is released the newly drawn polyline layer is not selected, and actually disappears.

What event or code should I use to select a new polyline layer?

procedure TForm1.ImageEnViewLayerNotify(Sender: TObject; layer: Integer;
  event: TIELayerEvent);
var
  iIELayerKind: TIELayerKind;
begin
  iIELayerKind := ImageEnView.CurrentLayer.Kind;
  if (event = ielCreated) and (iIELayerKind = ielkPolyline) then
  begin
    SelectLayers1.Down := True;
    ImageEnView.LayersCurrent := layer;
    ImageEnView.MouseInteract := [miMoveLayers, miResizeLayers];
  end
  else if (event = ielSelected) or (event = ielLeftClicked) then
  begin
    Layers1.ItemIndex := layer;
    if (iIELayerKind = ielkImage) and (layer <> 0) then
      GetImageLayerParameters
    else if iIELayerKind = ielkShape then
      GetShapeLayerParameters
    else if iIELayerKind = ielkLine then
      GetLineLayerParameters
    else if iIELayerKind = ielkText then
      GetTextLayerParameters
    else if iIELayerKind = ielkPolyline then
      GetPolylineLayerParameters;
    UpdateStatusBar;
  end
  else if (event = ielMoving) or (event = ielResizing) or (event = ielMoved) or
    (event = ielResized) or (event = ielRemoved) then
  begin
    DrawLayers;
    RefreshLayer;
  end;
end;

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

xequte

38180 Posts

Posted - Aug 16 2018 :  21:07:07  Show Profile  Reply
Hi Bill

With polyline (and line layers) you can add miEditLayerPoints to make a layer selectable (and editable after insertion).

ImageEnView1.MouseInteract := [ miClickCreatePolylineLayers, miEditLayerPoint ];

Alternatively, you can add [miEditLayerPoint, miResizeLayers] to allow moving and resizing like normal layers (by corner dragging).

ImageEnView1.MouseInteract := [ miClickCreatePolylineLayers, miEditLayerPoint, miResizeLayers ];


After inserting a polyline it will be automatically selected.

Please also see the new demo:

Demos\LayerEditing\Layer_Lines\

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

w2m

USA
1990 Posts

Posted - Aug 17 2018 :  09:32:26  Show Profile  Reply
I can now have the layer selected so it can be moved, but the layer selection grips do not appear because the miEditLayerPoint is still in effect.
If miEditLayerPoint is removed after the layer is created, the layer selection grips appear as expected. I suspect a OnAfterPolylineCreated event may be needed so that ImageEnView1.MouseInteract := [miMoveLayers, miResizeLayers] can be set.


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

38180 Posts

Posted - Aug 19 2018 :  16:56:11  Show Profile  Reply
Hi Bill

You can use the ieiLayerPointsEdited of the LayersNotifyEx event to detect when line insertion completes, but that should not be necessary.

Setting either of the following:

ImageEnView1.MouseInteract := [ miDrawCreatePolylineLayers, miEditLayerPoints];
ImageEnView1.MouseInteract := [ miDrawCreatePolylineLayers, miMoveLayers, miResizeLayers];

Should allow you to draw a line that is selected when you complete drawing. Are you able to reproduce this issue in the Layers_Lines demo?



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