Profile Picture

Regarding Ports on a shape

Posted By Pramod Sreekanthan 14 Years Ago
Author
Message
Pramod Sreekanthan
Posted 13 Years Ago
View Quick Profile
Junior Member

Junior Member (17 reputation)Junior Member (17 reputation)Junior Member (17 reputation)Junior Member (17 reputation)Junior Member (17 reputation)Junior Member (17 reputation)Junior Member (17 reputation)Junior Member (17 reputation)Junior Member (17 reputation)

Group: Forum Members
Last Active: 13 Years Ago
Posts: 17, Visits: 1

Hi,

Actually iam increasing the width of a shape having ports.

When the width increases, the ports are not fixed and move along with the shape's width

I want the location of the ports to be same and according to the diagram co-ordiantes.

They should not change according to the diagram co-ordinates.

 

Thanks

Pramod



Nevron Support
Posted 13 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: 2 days ago @ 1:54 AM
Posts: 3,054, Visits: 4,009
Hi Pramod,

Different port types use different strategies to determine their location in document scene coordinates.

The NRotatedBoundsPort for example computes its location by first generating a point defined in percents of the anchor model - model bounds and transforming this point to scene coordinates using the anchor model SceneTransform. The following code snippet is the implementation of the NRotatedBoundsPort GetLocation method override:

///
/// Overiden to obtain an aligned point relative to the anchor model rotated bounds
/// and apply the current offset to it.
///

///
protected override NPointF GetLocation()
{
if (Shape != null && Shape.IsCollapsed())
return Shape.GetRootCollapsedShape().GetCollapsedPortLocation(this);

NModel model = GetAnchorModel(AnchorUniqueId);
if (model == null)
return NPointF.Empty;

NPointF point = Alignment.GetAlignPoint(model.ModelBounds);
point = model.SceneTransform.TransformPoint(point);

point.X += Offset.Width;
point.Y += Offset.Height;

return point;
}

So naturally when the anchor model model bounds have changed, the location of the port also changes, because it is defined relatively to the anchor model bounds.
In general any custom port location can be achieved by creating a custom port. What is the behavior that you want to achieve?




Best Regards,
Nevron Support Team



Pramod Sreekanthan
Posted 14 Years Ago
View Quick Profile
Junior Member

Junior Member (17 reputation)Junior Member (17 reputation)Junior Member (17 reputation)Junior Member (17 reputation)Junior Member (17 reputation)Junior Member (17 reputation)Junior Member (17 reputation)Junior Member (17 reputation)Junior Member (17 reputation)

Group: Forum Members
Last Active: 13 Years Ago
Posts: 17, Visits: 1

Hi,
I have an issue. When i try to increase the width of a shape on the diagram. the ports location also change.
I want the ports to remain static and not move with the shape width.

Thanks,

Pramod





Similar Topics


Reading This Topic