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.
Unfortunately, activation email could not send to your email. Please try again.

Can we create all dynamic symbol using one class only??

Thread ID:

Created:

Updated:

Platform:

Replies:

34753 Sep 15,2005 07:48 AM Oct 7,2005 06:18 AM Windows Forms 7
loading
Tags: Diagram
Ratan
Asked On September 15, 2005 07:48 AM

Hello, my requirement is to create all the symbols dynammically based on the parameter i got runtime. Like type of symbol, no of input ports, no of output ports etc. so i dont know how many symbols may required. but current architecture of syncfusion dont alow this, because it require a seperate class for each and ever symbol and whole logic of drawing should be written into class constructor. Again when you want to add these symbols to symbol pallet then you have to specify each and every class and its assambly name, thats look very odd way. Can''t i do this using a single class and just based on the parameter i pass runtime, it will create required shape and then can be added to symbol pallet using single class only. Or is there any other alternative way?? /Ratan

Administrator [Syncfusion]
Replied On September 15, 2005 04:07 PM

Hi Ratan, You can do this by using your dynamically sourced data to define a SymbolModel that adequately describes the Symbol. The SymbolModel that you create can retain the default null values for the PlugIn Assembly/Class members, but should have its AutoHidePorts, CenterPortsEnabled, Labels and Layers properties suitably initialized to represent the Symbol that will be instantiated. While most of these properties are self-explanatory, it is the Layers collection that is particularly important and to the default 0 layer to which you will create and add instances of the child nodes that you want the symbol to be composed of. The shapes, ports, textnodes etc., that will make up the symbol will be added to the SymbolModel''s default layer accessible through the SymbolModel.Layers[0] indexer. Once you have the SymbolModel suitably initialized you can directly add it the PaletteGroupView control, where it can be used for creating symbols. Please let me know if you have trouble with the implementation. Thanks, Prakash Surendra Syncfusion Inc.,

Ratan
Replied On September 16, 2005 02:45 AM

Sorry i am not able to understand.. ok i give you the example.. currently i creating the symbols like this.. public class MySymbol1 : Symbol { private Rectangle outerRect = null; public MySymbol1() { this.outerRect = new Rectangle(0,0,80, 180); this.outerRect.Name = "Symbol1"; this.outerRect.FillStyle.Color = Color.Cyan; this.AppendChild(outerRect); } } public class MySymbol2 : Symbol { private Rectangle outerRect = null; public MySymbol2() { this.outerRect = new Rectangle(0, 0, 50, 150); this.outerRect.Name = "Symbol2"; this.outerRect.FillStyle.Color = Color.Red; this.AppendChild(outerRect); } } Now to add these two symbols into symbol pallet SymbolPalette mypalette = new SymbolPalette(); SymbolModel MySymbolModel1 = new SymbolModel(); MySymbolModel1 = mypalette.AddSymbol("MySymbol1"); MySymbolModel1.PlugInAssembly = "TestSync"; MySymbolModel1.PlugInClass = "TestSync.MySymbol1"; SymbolModel MySymbolModel2 = new SymbolModel(); MySymbolModel2 = mypalette.AddSymbol("MySymbol2"); MySymbolModel2.PlugInAssembly = "TestSync"; MySymbolModel2.PlugInClass = "TestSync.MySymbol2"; this.paletteGroupBar1.AddPalette(mypalette); Ok here is the problem now... if you know how many symbols u need then the above solution works fine but in my case i m getting data dynamically and no of shapes also. So cant create that no of class run time and then again adding the same to the symbol pallet because there also u need to specify PlugInClass for each symbol. I need some kind of solution where i just use only one class irrespective of the no of symbols and pass the shape type, its width, height etc at run time and then PlugInClass that class to my symbol model. I hope you got the idea of my prob and will suggest me some kind of solution, if possible then give one example. /Ratan

Administrator [Syncfusion]
Replied On September 19, 2005 06:01 PM

Hello Ratan, SymbolModels serve as the design-time representation of Symbols, and can be used for creating new instances of a symbol. Thus using your runtime data to synthesize SymbolModels that best represent the Symbol that you want to create, will let you implement the equivalent of a symbol factory for each symbol type. We will try to provide you with the implementation for a SymbolModel representing a simple Symbol class. This should help clear things up a bit. Regards, Prakash Surendra Syncfusion Inc.,

Ratan
Replied On September 20, 2005 02:08 AM

thx for reply but but i still did''t got what i want.. my simple requirement is, Can i use only one class to create all the dynamic symbols instead of one class per symbol??

Administrator [Syncfusion]
Replied On September 20, 2005 10:20 AM

Hi Ratan, Yes, I understand your requirement. This can be done, and my previous posts point out exactly how to go about it. To create custom Symbol types at runtime, you will have to generate a SymbolModel for each of the Symbol types that your application requires. We will try to provide a SymbolModel definition for a simple Symbol class within the next few days. This sample will make it clearer for you as to how you would go about the implementation required for generating the different SymbolModels at runtime based on your data. Thanks, Prakash Surendra Syncfusion Inc.,

Administrator [Syncfusion]
Replied On October 4, 2005 03:53 PM

Hello Ratan, My apologies for the delay in getting back to you on this issue. The attached sample shows how to synthesize SymbolModels programmatically for creating different types of Symbols on the fly. You can select a combination of shapes from the provided comboboxes, and the sample will generate a SymbolModel for a Symbol composed of the selected shapes and add it to the SymbolPalette. This should help get you started on the approach required for creating Symbol types based on dynamically sourced descriptors. The SymbolFactory sample will ship with future versions of the product. Thanks, Prakash Surendra Syncfusion Inc., SymbolFactory_3250.zip

Ratan
Replied On October 7, 2005 06:18 AM

thx a lot boss.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;