Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Text of shape is not displayed at correct position (Read 3682 times)
rajesh_patil74
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 220
Joined: Sep 3rd, 2009
Text of shape is not displayed at correct position
May 13th, 2011 at 12:57pm
Print Post  
Hi Stoyo

I created following shape. In shape desinger I get text displayed at correct position ( the area defined for text) but the text doesn't get displayed at correct position when I use this shape in the application.

Code
Select All
shape = new MindFusion.Diagramming.Silverlight.Shape(
                            new ElementTemplate[]
                        {
                        new LineTemplate(0, 0, 50, 0),
                        new LineTemplate(50, 0, 50, 20),
                        new LineTemplate(50, 20, 0, 20),
                        new LineTemplate(0, 20, 100, 20),
                        new LineTemplate(100, 20, 100, 100),
                        new LineTemplate(100, 100, 0, 100),
                        new LineTemplate(0, 100, 0, 0)
                        },
                            null,
                            new ElementTemplate[]
                        {
                        new LineTemplate(0, 0, 50, 0),
                        new LineTemplate(50, 0, 50, 20),
                        new LineTemplate(50, 20, 0, 20),
                        new LineTemplate(0, 20, 0, 0)
                        }, FillRule.Nonzero);
                    shape.Id = "Group";
 

  
Back to top
WWW  
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Text of shape is not displayed at correct posi
Reply #1 - May 14th, 2011 at 7:06am
Print Post  
Hi Rajesh,

We don't have support for irregular text regions yet in the Silverlight control. Use the Shape constructor that takes a "Rect textRectangle" parameter instead, e.g. pass new Rect(0, 0, 50, 20) in this case.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
rajesh_patil74
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 220
Joined: Sep 3rd, 2009
Re: Text of shape is not displayed at correct posi
Reply #2 - Jun 15th, 2011 at 7:52am
Print Post  
Hi Stoyo

Using above patten for shape, there is a small line (3-4 pixel in length) is drawn out of the bounds of the shape.

Is anything wrong with this shape element patten  ?

-Rajesh
  
Back to top
WWW  
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Text of shape is not displayed at correct posi
Reply #3 - Jun 15th, 2011 at 8:38am
Print Post  
Hi Rajesh,

This comes from the line-join effect applied when two line segments from a path meet at a common point, and the very sharp angle here (0) makes the join very long. You could set e.Node.StrokeMiterLimit = 0 to fix that.

Another possibility is to reorder the line segments from the shape a bit so that no segments meet at (0,20) at a sharp angle. You could also remove the horizontal segment at y = 20 from the outline, and add it to the decorations list.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
rajesh_patil74
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 220
Joined: Sep 3rd, 2009
Re: Text of shape is not displayed at correct posi
Reply #4 - Jun 15th, 2011 at 9:56am
Print Post  
Hi Stoyo

Thanks for the reply.

I changed the shapenode with following element template and the line is extra line is no more visible.

[code]
shape = new MindFusion.Diagramming.Silverlight.Shape(
new ElementTemplate[]

{
new LineTemplate(0,20, 0, 0),
new LineTemplate(0,0,50,0),
new LineTemplate(50,0,50,20),
new LineTemplate(50,20,100,20),
new LineTemplate(100,20,100,100),
new LineTemplate(100,100,0,100),
new LineTemplate(0,100,0,20),
new LineTemplate(0,20,50,20)

},
null,
new Rect(0,0,50,20), FillRule.Nonzero);
shape.Id = "Group";
[/code]

Now I am applying the different line style and color.
Sometimes the line which is in the middle becomes solid line. Resizing the nodes makes the solid line re-appear with valid line.

[img]http://4nic6g.bay.livefilestore.com/y1p6m8VoUp8opOJibf1-mXyafUcdq4N-SAFowuL_oy-r2PFBfgxO1jkJ-fTwciDr2VHnkcwNt-o7Zfcj4Zt0vgrzHbwJAzhNhnt/group.png?psid=1[/img]

Any suggestion to resolve this ?

-Rajesh
  
Back to top
WWW  
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Text of shape is not displayed at correct posi
Reply #5 - Jun 15th, 2011 at 10:27am
Print Post  
Hi Rajesh,

Since paths are automatically closed, you are getting another segment from 50,20 to 0,20 which overlaps with one of the outline segments but comes from a different direction. In that case the dashes do not always coincide and sometime lead to a solid line, because you do not have control over the dash start position when the segments comes from opposing directions.

You will have to modify the outline further to avoid having overlapping segments, or otherwise follow the last suggestion and set that segment as a decoration:

Code
Select All
new MindFusion.Diagramming.Silverlight.Shape(
new ElementTemplate[]
{
	new LineTemplate(0,0,50,0),
	new LineTemplate(50,0,50,20),
	new LineTemplate(50,20,100,20),
	new LineTemplate(100,20,100,100),
	new LineTemplate(100,100,0,100),
	new LineTemplate(0,100,0,0)
},
new ElementTemplate[]
{
	new LineTemplate(0,20,50,20)
},
new Rect(0, 0, 50, 20), FillRule.Nonzero);
 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
rajesh_patil74
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 220
Joined: Sep 3rd, 2009
Re: Text of shape is not displayed at correct posi
Reply #6 - Jun 15th, 2011 at 1:02pm
Print Post  
Hi Stoyo

Thanks very much Smiley

-Rajesh
  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint