We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

handle drawing around the nodes


I would like to accomplish the following:

User selects polyline and draw line arround several nodes. After user releases the mouse button - polygon should appear in drawn area, it should be sent to back (behind the nodes) so that all nodes within drawn area (how to get all these nodes?) and certain polygon are groupped in one shape. Is that possible?

Thanks a lot,
Bork


4 Replies

AD Administrator Syncfusion Team December 1, 2008 02:57 PM UTC

Hi Bork,

I wanted to know, whether Grouping the nodes inside the Polygon and Polygon was sufficient or you also want their location to be intact after grouping?

- Ajeet [ Syncfusion ]



MA MagicXtr December 2, 2008 09:18 AM UTC

Actually when user releases mouse button, system creates new polygon (polyline points are served as polygon points). However I do not know how to get the nodes which are located within that polygon or inside the polyline. If I will be able to get these nodes I will group them together with a polygon or whatever and accomplish what I wanted

Attached you will find a few screenshots which demonstrate what exactly I wanted



CustomArea_208d280c.zip


AD Administrator Syncfusion Team December 2, 2008 02:07 PM UTC

Hi Bork,

The following Code snippet will help you in getting the nodes inside the "Defined Polygon" to be at front and the Polygon will be set back.

Inside the NodeCollectionChanged event handler, please type the below code snippet:

******

void EventSink_NodeCollectionChanged(CollectionExEventArgs evtArgs)
{
if (evtArgs.ChangeType == CollectionExChangeType.Insert)
{
if (evtArgs.Element is Polygon)
{
Polygon t_polygon = (Polygon)evtArgs.Element;
this.diagramComponent.Model.SendToBack(t_polygon);
this.diagramComponent.Controller.SelectionList.Add(t_polygon);
foreach (Node node in this.diagramComponent.Model.Nodes)
{
if ((node.BoundingRectangle.X >= t_polygon.BoundingRectangle.X) && (t_polygon.BoundingRectangle.Bottom >= node.BoundingRectangle.Bottom))
{
this.diagramComponent.Model.BringForward(node);
this.diagramComponent.Controller.SelectionList.Add(node);
}
}
}
this.diagramComponent.Refresh();
}
}

******

Let me know if you shall need any further clarifications in this regard.

Happy Coding!

- Ajeet




>Actually when user releases mouse button, system creates new polygon (polyline points are served as polygon points). However I do not know how to get the nodes which are located within that polygon or inside the polyline. If I will be able to get these nodes I will group them together with a polygon or whatever and accomplish what I wanted

Attached you will find a few screenshots which demonstrate what exactly I wanted



CustomArea_208d280c.zip



MA MagicXtr December 3, 2008 12:50 PM UTC

Thank you for your reply. As far as I understand there is no capability to get such nodes. The solution which you provide is not comprehensive. Say all nodes whith coordinate x >= Polygon.BoundingRectangle.X will be treated as selected. However it is not true

In any case, thanks for your response and your help

Kind regards,
Bork


Loader.
Live Chat Icon For mobile
Up arrow icon