Port in Line


Author
Message
Volvick Derose
Volvick Derose
Forum Guru (71 reputation)Forum Guru (71 reputation)Forum Guru (71 reputation)Forum Guru (71 reputation)Forum Guru (71 reputation)Forum Guru (71 reputation)Forum Guru (71 reputation)Forum Guru (71 reputation)Forum Guru (71 reputation)
Group: Forum Members
Posts: 71, Visits: 1
Assume that I have a vertical or a horizontal line, I try to add couple of ports to it, but when I rotate the line or change the direction of the line, I want the ports to remain steady. Currently, the ports keep moving, I couldn't find a way to prevent them from moving.

I try something like this

NLineShape myLine = new NLineShape(0, 0, 1000, 0);

//add the ports to the line
myLine .CreateShapeElements(ShapeElementsMask.Ports);

NDynamicPort midPoint = new NDynamicPort(entityLine.UniqueId, ContentAlignment.TopCenter, DynamicPortGlueMode.GlueToContour);
myLine .Ports.AddChild(midPoint);
myLine .Ports.DefaultInwardPortUniqueId = midPoint.UniqueId;

I try both the logical line, but still gives the same problem.

I try to put a series of points on a line like this picture, but when the line is rotated or moved, I want the ports to remain on the lines without moving or changing location
Attachments
pict2.png (120 views, 13.00 KB)
Reply
Volvick Derose
Volvick Derose
Forum Guru (71 reputation)Forum Guru (71 reputation)Forum Guru (71 reputation)Forum Guru (71 reputation)Forum Guru (71 reputation)Forum Guru (71 reputation)Forum Guru (71 reputation)Forum Guru (71 reputation)Forum Guru (71 reputation)
Group: Forum Members
Posts: 71, Visits: 1
Your solution should works, but there is something wrong with it. It looks like it only works for shape that are not added to the library.

Try this for instance

NLineShape lineShape = new NLineShape (0, 0, 500, 0);

this create an horizontal line.

Now try to add one port to it like

NPointPort port = new NPointPort();
line.Ports.AddChild(port);
port.Location = new NPointF(0, 0);
port.Tag = new NPointF(0, 0);

It does not matter you can put it anywhere one the line (presumably)

Now add it to the library, then when you drag it from the library, you can see that the point stays fix at location (0,0), as you move the line, the point does not move. So it looks like is not a part ofthe line. I spend times on it and I couldn't get it right. I try an example from the digram designer by using the logicalpoint line, it seems to work fine in the digram designer, but not outside the digram designer.

Hope you make it work

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search