Page Index Toggle Pages: [1] 2  Send TopicPrint
Hot Topic (More than 10 Replies) Custom ShapeNode (Read 12657 times)
castefani
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 44
Joined: Feb 26th, 2009
Custom ShapeNode
Mar 1st, 2009 at 11:14pm
Print Post  
As a ShapeNode inherit and develop additional properties that can be serialized to save a diagram. I also want to create a visual difente: a rectangle with the design of an e-mail in the upper right corner and resize it to give the design is moved automatically.
Sorry my english
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Custom ShapeNode
Reply #1 - Mar 2nd, 2009 at 9:28am
Print Post  
Override the SaveToXml and LoadFromXml methods of ShapeNode and add code to serialize your properties. You must also use the RegisterItemClass method to define an XML element name for the objects from your class. You could check the IconNodes example from the Windows Forms version of the control for sample code that shows this:
https://www.mindfusion.eu/FCNetDemo.zip

We'll try to port this sample to Silverlight in the next few days.

The Flowchart.NET installer also installs a shape designer tool you could use to draw your custom shape. The tool generates code that you could paste into the Page_Load handler to define the custom shape.

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


I love YaBB 1G - SP1!

Posts: 44
Joined: Feb 26th, 2009
Re: Custom ShapeNode
Reply #2 - Mar 2nd, 2009 at 2:59pm
Print Post  
How to draw a RoundRect with a star inside?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Custom ShapeNode
Reply #3 - Mar 2nd, 2009 at 4:34pm
Print Post  
Add this to the page's Loaded handler. Later you can access the custom shape definition using the Shape.FromId() method.

Code
Select All
var rrs = new MindFusion.Diagramming.Silverlight.Shape(
	new ElementTemplate[]
	{
		new RoundRectangleTemplate(0, 0, 100, 100, 6)
	},
	new ElementTemplate[]
	{
		new LineTemplate(50, 0, 90, 100),
		new LineTemplate(10, 100, 50, 0),
		new LineTemplate(0, 30, 100, 30),
		new LineTemplate(0, 30, 90, 100),
		new LineTemplate(100, 30, 10, 100)
	},
	null, FillRule.Nonzero, "RoundRectStar");

ShapeNode node = new ShapeNode(diagram);
diagram.Nodes.Add(node);
node.Bounds = new Rect(80, 80, 80, 80);
node.Shape = rrs;
 



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


I love YaBB 1G - SP1!

Posts: 44
Joined: Feb 26th, 2009
Re: Custom ShapeNode
Reply #4 - Mar 3rd, 2009 at 11:32pm
Print Post  
I'm in trouble for drawing the shapes I need.
For example, the link http://www.bpmn.org/Samples/Elements/Events.htm
drawing the shapes as "Intermediate" / "Timer" or "Intermediate" / "Message"?



Stoyo, congratulations, your support is fantastic



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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Custom ShapeNode
Reply #5 - Mar 4th, 2009 at 9:49am
Print Post  
We'll add these two shapes to the predefined shape library now, and possibly the rest from that list for the 1.0.3 release.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Custom ShapeNode
Reply #6 - Mar 4th, 2009 at 12:00pm
Print Post  
Hi,

Here is the code for these shapes:

Code
Select All
var rrs = new MindFusion.Diagramming.Silverlight.Shape(
	new ElementTemplate[]
	{
		new ArcTemplate(0, 0, 100, 100, 0, 360)
	},
	new ElementTemplate[]
	{
		new ArcTemplate(10, 10, 80, 80, 0, 360),
		new LineTemplate(17, 30, 83, 30),
		new LineTemplate(83, 30, 83, 70),
		new LineTemplate(83, 70, 17, 70),
		new LineTemplate(17, 70, 17, 30),
		new LineTemplate(17, 30, 50, 50),
		new LineTemplate(50, 50, 83, 30)
	},
	null, FillRule.Nonzero, "bpmnIntermediateMessage");

ShapeNode node = new ShapeNode(diagram);
diagram.Nodes.Add(node);
node.Bounds = new Rect(180, 80, 80, 80);
node.Shape = rrs;

rrs = new MindFusion.Diagramming.Silverlight.Shape(
	new ElementTemplate[]
	{
		new ArcTemplate(0, 0, 100, 100, 0, 360)
	},
	new ElementTemplate[]
	{
		new ArcTemplate(10, 10, 80, 80, 0, 360),
		new ArcTemplate(20, 20, 60, 60, 0, 360),
		new LineTemplate(20, 50, 30, 50),
		new LineTemplate(24, 35, 30, 39),
		new LineTemplate(35, 24, 39, 30),
		new LineTemplate(50, 20, 50, 30),
		new LineTemplate(65, 24, 61, 30),
		new LineTemplate(76, 35, 70, 39),
		new LineTemplate(70, 50, 80, 50),
		new LineTemplate(76, 65, 70, 61),
		new LineTemplate(65, 76, 61, 70),
		new LineTemplate(50, 70, 50, 80),
		new LineTemplate(24, 65, 30, 61),
		new LineTemplate(35, 76, 39, 70),
		new LineTemplate(50, 50, 53, 24),
		new LineTemplate(50, 50, 67, 50)
	},
	null, FillRule.EvenOdd, "bpmnIntermediateTimer");

node = new ShapeNode(diagram);
diagram.Nodes.Add(node);
node.Bounds = new Rect(280, 80, 80, 80);
node.Shape = rrs;
 



They are also available as predefined ones now. Later today we'll upload a build of the control that has them as members of Shapes.

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


I love YaBB 1G - SP1!

Posts: 44
Joined: Feb 26th, 2009
Re: Custom ShapeNode
Reply #7 - Mar 4th, 2009 at 12:28pm
Print Post  
When you are ready to release 1.0.3?
You will only BPMN shapes of events or for all?
At the end of the page http://www.bpmn.org/index.htm on 'Complete BPMN Elements', shows all types of BPMN elements:
◦ Activities
◦ Events
◦ Gateways
◦ Connections
◦ Artifacts
◦ Swimlanes

This would be a gap in the product of you.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Custom ShapeNode
Reply #8 - Mar 4th, 2009 at 12:57pm
Print Post  
We'll try to add them all for v1.0.3. Thanks for the order Wink

Stoyan
  
Back to top
 
IP Logged
 
castefani
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 44
Joined: Feb 26th, 2009
Re: Custom ShapeNode
Reply #9 - Mar 4th, 2009 at 1:03pm
Print Post  
When you are ready to release 1.0.3?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Custom ShapeNode
Reply #10 - Mar 4th, 2009 at 1:12pm
Print Post  
We'll try to release 1.0.2 next week, and 1.0.3 in about 6-7 weeks. You don't need to wait for the official release though, we can send you our daily build when we add more shapes.

Stoyan
  
Back to top
 
IP Logged
 
castefani
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 44
Joined: Feb 26th, 2009
Re: Custom ShapeNode
Reply #11 - Mar 4th, 2009 at 2:12pm
Print Post  
I would, just because my software includes a small BPMN designer
  
Back to top
 
IP Logged
 
castefani
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 44
Joined: Feb 26th, 2009
Re: Custom ShapeNode
Reply #12 - Mar 5th, 2009 at 2:53pm
Print Post  
I bought the DiagramLite, but I am very worried.
- I see the look of shapes, where Width = Height = 30 appear with a very poor quality and truncated.
- Unable to display labels in shapes (within and below)
- Do not have a good designer shapes. I need to create the shapes of BPMN (http://www.bpmn.org/) and I succeeded.

I am creating a BPMN designer and I am worried that I can not deliver a preliminary version at the time, which is in 15 days.


I think you have to sell a product that should be in beta and not as an end product
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Custom ShapeNode
Reply #13 - Mar 5th, 2009 at 4:14pm
Print Post  
Features do not exist by default you know, we have to develop them first, and the current version already has a year's worth of work in it. We'll implement custom text area for Shape definitions tomorrow. Our developer created your timer shape for five minutes using the ShapeDesigner from the Windows Forms version of the control:
https://www.mindfusion.eu/FCNetDemo.zip

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Custom ShapeNode
Reply #14 - Mar 6th, 2009 at 2:43pm
Print Post  
https://mindfusion.eu/_beta/diaglite_textrect.zip

This version adds the public Shape(ElementTemplate[] elements, ElementTemplate[] decorations, Rect textRectangle, FillRule fillRule, string id) constructor, which lets you define a shape where the text is displayed below the outline. For example

Code
Select All
var shape = new MindFusion.Diagramming.Silverlight.Shape(
	new ElementTemplate[]
	{
		new LineTemplate(50, 0, 100, 50, Colors.Red, -1),
		new LineTemplate(100, 50, 50, 90, Colors.Green, 3),
		new LineTemplate(50, 90, 0, 50, Colors.Yellow, 1),
		new LineTemplate(0, 50, 50, 0, Colors.Blue, 5)
	},
	new ElementTemplate[]
	{
		new LineTemplate(40, 10, 60, 10, Colors.Cyan, 2),
		new LineTemplate(40, 90, 60, 90, Colors.Green, 1),
		new LineTemplate(10, 40, 10, 60, Colors.Black, 2),
		new LineTemplate(90, 40, 90, 60, Colors.Blue, 3)
	},
	new Rect(-30, 110, 160, 80),
	FillRule.Nonzero, "TextRect22");
 

  
Back to top
 
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send TopicPrint