We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Electric shapes

Hi, I am exploring Eval version of Essential Diagram . I am facing few problems.
 Basically I need for a user to create a electric state diagram with nodes and links. Which I have sent  .These are electric figures For creation of these

figures I used Symbol Designer Actually each figure should be object with properties and the list another objects(shapes)
And i need to run on all diagramme and to find all objects and who with whom is connected  and save objects to Database .
I am at a loss in realisation of the given problem you could not help to send an example .
Any info would be greatly appreciated. Thank you.





ToForum.zip

7 Replies

AD Administrator Syncfusion Team May 14, 2008 09:30 AM UTC

Hi Bit85,

Thank you for evaluating Syncfusion products.

To find which node is connected to other nodes.

You can retrieve the subnodes of a parent node using EdgesLeaving property. Please find the code snippet that retrieves the sub nodes of a particular parent node.

[C#]

ICollection edgesLeaving = rec1.EdgesLeaving;
if (edgesLeaving != null)
{
foreach (IGraphEdge e1 in edgesLeaving)
{
Node toNode = e1.ToNode as Syncfusion.Windows.Forms.Diagram.Rectangle;
Node fromNode = e1.FromNode as Syncfusion.Windows.Forms.Diagram.Rectangle;
}
}


Please refer the below sample in the following link that traverses all the nodes from root to bottom.

http://websamples.syncfusion.com/samples/Diagram.Windows/F73652/main.htm

[Note : I am unable to open your attachment in this post.]

Saving diagram objects into database.

You can save the diagram objects into database. Please follow the steps below for this.

1) First save the diagram in EDD format.
1) Convert diagram(EDD) into bytes using Stream.
2) Insert bytes into table column.

You can use varbinary(max) datatype for inserting diagram since diagram file size will be large to access.

Please refer the below thread that discusses the same.

http://www.syncfusion.com/support/forums/message.aspx?MessageID=64301

Please let me know if this helps you.

Regards,
Jaya




SE Segey May 14, 2008 11:04 AM UTC

 

Many thanks

At me it is some more questions

1) To what event it is necessary to subscribe that when we connect two objects

a line what to forbid connection or to resolve

2) What to add a difficult symbol I did ето with help Symbol Designer

electroPaletteGroupView. LoadPalette ("C:\Electro.edp"); you have an example with Diagramm builder in tab Electric shapes to me it is necessary to make same electric objects only with additional properties as Mysimbol:Group

{

}

After I will collect from figures object I should use it on other scheme as whole object as to me to transfer it in other scheme better? How drawing like bitmap or how Control?Any info would be greatly appreciated. Thank you.






SE Segey May 14, 2008 07:00 PM UTC

Hello !I very much like your product .But I have faced some problems.

1. I should create the difficult electric figures
Whether I do it by means of Symbol Designer and I load ElectroNew.edp a palette It is possible to take a code what to create a class from a palette and to inherit from Group To me What variant better for this purpose is necessary difficult object with the properties approaches?

2 At connection of two objects a line the line should connect only those обьекты which I has specified For example a square can incorporate only to a square but cannot with a circle

3 How to create not grouped objects?

4 How to be in such situation from several objectsto me it is necessary to make one object and use it on other diagramme it is better to keep it as a picture? If that how to keep only grouped objects without a canvas?
Or there is other variant you can to see it in drawing Two.jpg in a file which I has attached! Or can group objects in one and keep it as one object on a disk or in base and then load it on other diagramm?

Below I have attached file
I am at a loss in realisation of the given problem you could not help to send an example .


Any info would be greatly appreciated. Thank you.



MyExsample.zip


AD Administrator Syncfusion Team May 15, 2008 12:57 PM UTC

Hi,

Thanks for the update.

1) Event to subscribe when connecting shapes using connector

The event EventSink.ConnectionChanged will be raised when trying to connect the diagram shapes using line connector. The following code snippet illustrates this.

[C#]

this.Diagram1.Model.EventSink.ConnectionsChanged += new CollectionExEventHandler(EventSink_ConnectionsChanged);

2) Creating difficult electric shapes.

You can use Symbol designer utility to create custom shapes using the Electric Shapes palette which will be the easier one. Please refer the following Online tutorial link on using SymbolDesignerUtility for creating custom shapes.

http://www2.syncfusion.com/ug_62/diagram/SymbolDesigner.html

If you want to create custom shapes programmatically using Electric Shapes palette, then you need to get the shape from the palatte file and add it to the diagram. For implementation details, please refer the sample that shipped with Essential Studo in the below location that demonstrates on adding shapes from the palette file to the diagram.

..\My Documents\Syncfusion\EssentialStudio\ 6.2.0.40\Windows\Diagram.Windows\Samples\2.0\Designing Symbols\PaletteLoad

3) Using diagram objects in another diagram.

Essential diagram allow you to save the diagram in .EDD format and you can use that edd file to display it in another diagram. You can also save the diagram as an image using ExportDiagramAsImage property of diagram.


4) Restricting line connector to connect to particular diagram shape.

You can restrict the lineconnector to connect to particular diagram shape using ToNode property of LineConnector. The following code snippet will allow the connector to connect to all diagram shapes except Rectangle3.

[C#]

void EventSink_ConnectionsChanged(CollectionExEventArgs evtArgs)
{
if (evtArgs.ChangeType == CollectionExChangeType.Insert)
{
if (evtArgs.Element is HeadEndPoint)
{
HeadEndPoint headpt = evtArgs.Element as HeadEndPoint;
if (headpt.Container is LineConnector)
{
LineConnector line = headpt.Container as LineConnector;
toNode = line.ToNode as Node;

if (toNode.Name == "Rectangle3")
{
MessageBox.Show("Connection not allowed for Rectangel3");
this.myDiagram1.Model.RemoveChild(line);
}

}
}
else if (evtArgs.Element is TailEndPoint)
{
TailEndPoint tailpt = evtArgs.Element as TailEndPoint;
if (tailpt.Container is LineConnector)
{
LineConnector line = tailpt.Container as LineConnector;

}

}
}
}

Creating ungrouped objects.

If you want to ungroup the grouped objects then you can use diagram1.Controller.UnGroup() method.

Sample reference

Please refer the following sample that demonstartes on restricting connection for particular shape , saving the diagram as an image and loading new diagram.

http://websamples.syncfusion.com/samples/Diagram.Windows/F73652/Connection/main.htm

Please let me know if this helps you.

Regards,
Jaya




SE Segey May 16, 2008 08:36 AM UTC

1) whether I have found as to do difficult objects with the help symbol Designer but the matter is that I then cannot add additional properties to created difficult object ?
Whether it is possible it is possible to take a code which generates Symbol Designer?

2) whether As it is possible to learn to be one component on other? I should run on mydiagram and if on line to be another object(cross another shape) or other line that I should fix it


Any info would be greatly appreciated. Thank you.



SE Segey May 16, 2008 08:58 AM UTC

1)Whether also it is possible to load into the diagramme from several edd files?
And to manipulate them as separate objects?
Any info would be greatly appreciated. Thank you.




AD Administrator Syncfusion Team May 22, 2008 06:17 AM UTC

Hi,

Sorry for the delayed response.

1) Adding custom properties to the new symbol created in the Symbol designer.

Currently it is not possible to create custom properties for the custom symbol created in the Symbol designer utility.

2) Loading several edd files in the diagram.

At a time you can load single edd file in the diagram. You cannot load multiple edd files in the same diagram. Please let me know if I understood your requirement.

Regards,
Jaya



Loader.
Live Chat Icon For mobile
Up arrow icon