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 layer creation

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 - Apr 18 2021 : 13:34:52
I think i am trying too hard but cannot figure out this one.
I have a background picture and want to draw a polyline on another layer on top of my background.

I am missing something. every time i draw, it had the polyline on the same layer as the background.
Here's my code.
ActiveImageEnView().MouseInteractGeneral := [];
ActiveImageEnView().LayerOptions := ActiveImageEnView().LayerOptions +
[loAllowMultiSelect, loAutoSelectMask, loShowRotationGrip];


ActiveImageEnView().LayersAdd(TIELayerKind(ielkPolyline));
ActiveImageEnView().LayersAutoClosePolylines := iecmOnNearFinish;
ActiveImageEnView().MouseInteractLayers := [mlMoveLayers, mlEditLayerPoints,
mlRotateLayers, mlResizeLayers, mlDrawCreatePolylineLayers];
ActiveImageEnView().CurrentLayer.FillColor := clNone;
ActiveImageEnView().CurrentLayer.BorderWidth := 3;
ActiveImageEnView().CurrentLayer.BorderColor := clred;
ActiveImageEnView().Update;

Thank you
Pierre
11   L A T E S T    R E P L I E S    (Newest First)
pierrotsc Posted - Apr 20 2021 : 14:36:44
Nigel, i found my coding error. Thanks for finding the auto_merge culprit.
Best
pierrotsc Posted - Apr 20 2021 : 08:15:54
Nigel, you are correct. did not look at that because every kind of other layer i add, it did not behave live that. i wonder why. this is my onlayer event

procedure TMainForm.ImageEnViewLayerNotifyEx(Sender: TObject; layer: Integer;
  Event: TIELayerEvent);
const
  Auto_Merge_Layers = true;
begin
  if Auto_Merge_Layers and (layer > 0) then
  begin
    // For text layers with automatic text editing (loAutoTextEditing in LayerOptions) don't merge till we complete editing
    if ((TImageEnView(Sender).Layers[layer].Kind = ielkText) and
      (Event = ielEdited)) or
      ((TImageEnView(Sender).Layers[layer].Kind <> ielkText) and
      (Event = ielCreated)) then
      TImageEnView(Sender).LayersMerge(0, layer);
  end;
end;


The thing is, would it not merge text layers only ?
Best
xequte Posted - Apr 20 2021 : 01:54:22
Hi

You must have some auto-merge code in this unit. In your OnLayerNotify event perhaps??? Please email me the source for this demo.

Nigel
Xequte Software
www.imageen.com
pierrotsc Posted - Apr 19 2021 : 18:25:04
So i drew a polyline on top of my image background. the brush color filled it.

xequte Posted - Apr 19 2021 : 17:39:38
Hi

Please attach some screenshots so I can better understand what is happening.



Nigel
Xequte Software
www.imageen.com
pierrotsc Posted - Apr 19 2021 : 17:33:32
Ok, when I draw a poly line on top of my image background, the layer view only show the layer background with the poly line inside. So I get one layer and not 2. I have a timageenmview layer connected to my imageenview.
xequte Posted - Apr 19 2021 : 17:31:27
Also, you have looked at the wrong demo. Please look at this one:

\Demos\LayerEditing\Layers_Lines\Layers.dpr

Which shows freehand polyline drawing.

Nigel
Xequte Software
www.imageen.com
xequte Posted - Apr 19 2021 : 17:29:06
Hi

I think there might be some confusion. mlDrawCreatePolylineLayers cannot "draw" onto an image layer (background is image layer) so a new layer must be being created in this situation.

Did you change LayersCount?

Please add a TImageEnLayerMView, connect it to the TImageEnView and observe what happens when you draw a polyline (a new polyline layer should appear).



Nigel
Xequte Software
www.imageen.com
pierrotsc Posted - Apr 19 2021 : 11:43:16
Just looked at the layer demo. it uses the
ImageEnView1.LayersAdd( TIELayerKind( cmbAddLayer.ItemIndex ));

So when i do that, it works too.
It does not use the mlDrawCreatePolylineLayers
On the newlayer event, it makes an explosion. Not really what i am looking for.
case LayerKind of
ielkPolyline : if mlCreatePolylineLayers in ImageEnView1.MouseInteractLayers then // This ensures we don't fill the points when drawing our own polyline using mlClickCreatePolylineLayer
TIEPolylineLayer( ImageEnView1.CurrentLayer ).SetPoints( iesExplosion, True );

So, for me using :
ActiveImageEnView().MouseInteractLayers := [mlMoveLayers, mlEditLayerPoints,
mlRotateLayers, mlResizeLayers, mlDrawCreatePolylineLayers];

do draw a polyline but not on a new layer.

Best
pierrotsc Posted - Apr 19 2021 : 08:01:01
Originally the line
ActiveImageEnView().LayersAdd(TIELayerKind(ielkPolyline));

was commented.
when i draw, the polyline is showing on my background layer in the TImageEnLayerMView window. it does not add another layer.

I will look at the layer demo.

Thanks
Pierre
xequte Posted - Apr 19 2021 : 00:56:45
Hi Pierre

Have you tried the demo:

\Demos\LayerEditing\Layers_Lines\Layers.dpr

Looking at your code you add a blank polyline layer, that is not needed:

ActiveImageEnView().LayersAdd(TIELayerKind(ielkPolyline));

As mlDrawCreatePolylineLayers will automatically create a polyline layer as the user draws.

If you check ActiveImageEnView().LayersCount (or a TImageEnLayerMView to your project), you will see it will increase as each polyline is drawn.





Nigel
Xequte Software
www.imageen.com