polygon/geomtry to points array

2 posts, 0 answers
  1. Benny
    Benny avatar
    1 posts
    Member since:
    Oct 2011

    Posted 25 Feb 2014 Link to this post

    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 ?

  2. Zarko
    Zarko avatar
    755 posts

    Posted 28 Feb 2014 Link to this post

    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.

Back to Top