This is a migrated thread and some comments may be shown as answers.

polygon/geomtry to points array

1 Answer 111 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Benny
Top achievements
Rank 1
Benny asked on 26 Feb 2014, 04:47 AM
hi,
we are trying to extract points array(vertex) from a rad polygon shape.
once the shape is resized the points remain the same.
any one know how to extrcat/calculate the new points based on resize/move ?

regards,
b.

1 Answer, 1 is accepted

Sort by
0
Zarko
Telerik team
answered on 28 Feb 2014, 04:13 PM
Hello Benny,
I'll paste part of my support thread answer here so that customers with similar questions may read it:
 "As far as I understand you have a custom diagram shape (which inherits our RadDiagramShape) and you're using the VertexPoints collection to create its geometry. This all works fine initially but after resize you'd like to update the VertexPoints collection with the new absolute point values. Can you please confirm if this is indeed your scenario? 

If it is, then you need to have in mind that WPF doesn't change a geometry after a resize. Instead it scales it accordingly based on the Stretch property of its Shape presenter, e.g. Path. By default the RadDiagramShapes are defined with Stretch=Fill and therefore the points in their Geometries are not absolute but relative to the current size and you'll have to manually calculate the new points after resize. To do this you'll need the initial relative positions and the new width:

foreach (var relativePoint in this.relativePoints)
{
    this.vertexPoints.Add(new Point(relativePoint.X * newWidth, relativePoint.Y * newHeight));
}
I've attached a sample project demonstrating approach this so could you please examine it and tell us if this is what you need?"
We're looking forward to hearing from you again.

Regards,
Zarko
Telerik
Tags
Diagram
Asked by
Benny
Top achievements
Rank 1
Answers by
Zarko
Telerik team
Share this question
or