I am trying to write a network visualization software based on an existing framework (GraphX). For a grouping algorithm I have had to draw my nodes based on a manually assigned location (assigned to the data object they are based on), which causes dragging to be disabled. However, there is still an invisible control which is dragged so I would like to use the initial offset in drawing the nodes so that they respond to dragging of the invisible nodes.
To do so I need to get a static variable at the time of drawing the nodes. I have been trying for a while now to get it but I can only seem to get pointers. I tried my hand shallow copies and unsafe code but no luck..
public Point GetStartPosition(bool final = true, bool round = false)
{
DataVertexControlWFA copy = (DataVertexControlWFA)this.MemberwiseClone();
return copy.GetPosition();
}
is a method I hoped would be the current position of the object (unalterable)
and
algPosition = GetPosition();
double x = algPosition.X;
double y = algPosition.Y;
double* StartX;
double* StartY;
StartX = &x;
StartY = &y;
double offset_SourceX = _vertex.Point.X - *StartX;
double offset_SourceY = _vertex.Point.Y - *StartY;
Point position = new Point(algPosition.X + offset_SourceX, algPosition.Y + offset_SourceY);
Is a block of code I hoped would result in an unchangeable value of StartX and StartY but no luck.