Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic How to construct a Inductor node in the diagram (Read 5997 times)
padmavathi
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 23
Joined: Jun 29th, 2010
How to construct a Inductor node in the diagram
Jul 7th, 2010 at 7:43am
Print Post  
Can anyone give me some insight to create an Inductor Node in Diagram Lite.


Thanks & Regards
Padma
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: How to construct a Inductor node in the diagra
Reply #1 - Jul 7th, 2010 at 8:29am
Print Post  
Do you mean you need the Inductor electrical symbol?
  
Back to top
 
IP Logged
 
padmavathi
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 23
Joined: Jun 29th, 2010
Re: How to construct a Inductor node in the diagra
Reply #2 - Jul 7th, 2010 at 10:28am
Print Post  
Yes. and it should not be as image.
  
Back to top
 
IP Logged
 
Lyubo
God Member
*****
Offline


MindFusion team

Posts: 511
Joined: Jun 17th, 2010
Re: How to construct a Inductor node in the diagra
Reply #3 - Jul 7th, 2010 at 12:50pm
Print Post  
Hi Padma,

This path defines an Inductor Shape in xaml:

Code
Select All
<Path Stroke="#FF000000" StrokeThickness="4"
    Data="M2,23.5 L22,23.5 C22,23.5 12,0 27,0 C41.5,0 41,23.5 35.5,23.5 C30,23.5 31,0 43,0 C55,0 57,23.5 50,23.5 C43,23.5 46,0 58,0 C69,0 72,23.5 64,23.5 C57,23.5 61,0 73,0 C84,0 79,23.5 79,23.5 L98,23.5">
</Path>
 



The shape looks like this: .

Regards,
Lyubo
  
Back to top
 
IP Logged
 
padmavathi
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 23
Joined: Jun 29th, 2010
Re: How to construct a Inductor node in the diagra
Reply #4 - Jul 8th, 2010 at 9:03am
Print Post  
Thanks a ton. That helped us a lot.


Thanks & Regards
Padma
  
Back to top
 
IP Logged
 
Naganathan
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 22
Joined: Jun 14th, 2010
Re: How to construct a Inductor node in the diagra
Reply #5 - Dec 17th, 2010 at 10:42am
Print Post  
Hi,
The shape generated by the given path is not expanded when the node is expanded.Is there a way to expand the shape also? (like the built-in shapes).

We want to create some custom shapes and it should be re-sizable..Please give your comments..

Thanks,
Naganathan NS.
  
Back to top
 
IP Logged
 
Lyubo
God Member
*****
Offline


MindFusion team

Posts: 511
Joined: Jun 17th, 2010
Re: How to construct a Inductor node in the diagra
Reply #6 - Dec 17th, 2010 at 12:02pm
Print Post  
Hi,

After deriving from ShapeNode and supplying a ControlTemplate that uses this (or any other for that matter) Path for shape, you can override the UpdateVisuals method and apply a ScaleTransform to the shape. For example:
Code
Select All
protected override void UpdateVisuals()
{
    base.UpdateVisuals();

    if (shape == null || shapeTransform == null)
        return;

    Rect nodeBounds = GetBounds();
    Rect shapeBounds = shape.Data.Bounds;

    double ratioX = nodeBounds.Width / shapeBounds.Width;
    double ratioY = nodeBounds.Height / shapeBounds.Height;

    shapeTransform.ScaleX = ratioX;
    shapeTransform.ScaleY = ratioY;
}
 



where shape is the Path object in the template and shapeTransform is its ScaleTransform instance.

Alternatively, you can wrap the Path in a Viewbox control http://msdn.microsoft.com/en-us/library/system.windows.controls.viewbox%28VS.95%.... Note that it's supported out of the box in SL4. For earlier versions it was included in the Silverlight Toolkit.

I hope this helps.

Regards,
Lyubo
  
Back to top
 
IP Logged
 
Naganathan
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 22
Joined: Jun 14th, 2010
Re: How to construct a Inductor node in the diagra
Reply #7 - Dec 17th, 2010 at 1:50pm
Print Post  
Hi,
Thanks for the idea...
I am not able to get the Path reference from template and so the Scale transform instance..can u provide some sample code?
Thanks in advance..


Thanks,
Naganathan NS.
  
Back to top
 
IP Logged
 
Lyubo
God Member
*****
Offline


MindFusion team

Posts: 511
Joined: Jun 17th, 2010
Re: How to construct a Inductor node in the diagra
Reply #8 - Dec 17th, 2010 at 2:04pm
Print Post  
Hi,

You can get these references by overriding the OnApplyTemplate method and then store the values in local variables. Something like this:

Code
Select All
        private Path shape;
        private ScaleTransform shapeTransform;
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            shape = GetTemplateChild("Shape") as Path;
            shapeTransform = GetTemplateChild("ShapeTransform") as ScaleTransform;

            UpdateVisuals();
        }
 



Make sure that the template parts use the names, passed as arguments to the GetTemplateChild method. The relevant parts in xaml should look like this:
Code
Select All
        <Path x:Name="Shape" ......... >
            <Path.RenderTransform>
                <ScaleTransform x:Name="ShapeTransform" />
            <Path.RenderTransform>
        </Path>
 



If you need anything else, please let me know.

Regards,
Lyubo
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint