Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Rotary Stroke after the erase will split object not in the relative position of Diagram (Read 4269 times)
Joe
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 21
Joined: Jun 6th, 2012
Rotary Stroke after the erase will split object not in the relative position of Diagram
Mar 27th, 2013 at 3:51am
Print Post  
Rotary Stroke  after the erase will split object not in the relative position of the object in the Diagram

code:

eraseResult = line.GetEraseResult( rectEraser );
                    Diagram.Nodes.Remove(line);
                    foreach ( Stroke stroke in eraseResult )
                    {
                        PenNode pen = new PenNode( stroke );
                        pen.PenColor = line.PenColor;
                        pen.PenWidth = line.PenWidth ;
                        Rect newPosition = stroke.GetBounds( );
                      
                        pen.SetBounds( newPosition , false , false );
                        pen.Opacity = line.Opacity;
                        pen.HandlesStyle = HandlesStyle.Custom;
                        Diagram.Nodes.Add( pen );
                        //pen.ZIndex = line.ZIndex;
                    }
  

___.PNG (Attachment deleted)
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Rotary Stroke after the erase will split object not in the relative position of Diagram
Reply #1 - Mar 27th, 2013 at 6:51am
Print Post  
You might have to offset the Stroke's bounds as in http://mindfusion.eu/Forum/YaBB.pl?num=1320391922/11#11.
  
Back to top
 
IP Logged
 
Joe
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 21
Joined: Jun 6th, 2012
Re: Rotary Stroke after the erase will split object not in the relative position of Diagram
Reply #2 - Mar 27th, 2013 at 7:09am
Print Post  
thanks,but  I don't know how to calculate the offset value
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Rotary Stroke after the erase will split object not in the relative position of Diagram
Reply #3 - Mar 28th, 2013 at 7:05am
Print Post  
Check the FreeLine.Draw code in the post linked above. I assume the Stroke class you are using is from the InkCanvas API, right? And your PenNode class draws that stroke from its Draw override?
  
Back to top
 
IP Logged
 
Joe
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 21
Joined: Jun 6th, 2012
Re: Rotary Stroke after the erase will split object not in the relative position of Diagram
Reply #4 - Mar 28th, 2013 at 7:32am
Print Post  
Smiley yes , you are right.
code:
    public override void Draw(DrawingContext graphics, MindFusion.Diagramming.Wpf.RenderOptions options) {
            if (this.PenStroke == null)
                return;

            DrawingAttributes da = new DrawingAttributes();
            da.Height = this.PenWidth;
            da.Width = this.PenWidth;
            da.Color = this.PenColor;
            this.PenStroke.Draw(graphics, da);}

public StrokeCollection GetEraseResult(Rect rc) {
            return this.PenStrokeOrigin == null ? new StrokeCollection() : this.PenStrokeOrigin.GetEraseResult(rc);
        }

eraseResult = line.GetEraseResult( rectEraser ); that it is used System.Windows.Ink,Do you have any solutions?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Rotary Stroke after the erase will split object not in the relative position of Diagram
Reply #5 - Mar 28th, 2013 at 8:11am
Print Post  
So you can see how the FreeLine.Draw code offsets the stroke by applying a TranslateTransform in Draw:

Code
Select All
graphics.PushTransform(new TranslateTransform(
	- strokeBounds.X, - strokeBounds.Y)); 



That code assumes the stroke points coordinates match the diagram coordinate system - check how the points are collected in the FreeLine.UpdateCreate override. If you are copying the stroke object from a separate InkCanvas control, you might also have to offset by diagram.Bounds.X/Y, and apply some scale if using a MeasureUnit different than WpfPoint.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Joe
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 21
Joined: Jun 6th, 2012
Re: Rotary Stroke after the erase will split object not in the relative position of Diagram
Reply #6 - Apr 12th, 2013 at 12:55am
Print Post  
when i set the RotationAngle of object, erase the stroke that it will Deviations from the original position,not  the RotationAngle it work well,Where is the problem? Shocked
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Rotary Stroke after the erase will split object not in the relative position of Diagram
Reply #7 - Apr 12th, 2013 at 7:08am
Print Post  
What do you mean by erasing the stroke? Could you attach a test project showing the problem?
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint