Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic change node's shape in ShapListBox (Read 1852 times)
chieh
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 64
Joined: Aug 18th, 2010
change node's shape in ShapListBox
Oct 4th, 2011 at 1:10pm
Print Post  
Dear Sir/Madam,
We defined our shapes in shl file by using shape designer. Due to customer needs, some shapes have to be refined/ modified (e.g. add more lines/ change its colour/ change shape from triangle to rectangle, and so on), in addition more new shapes need to be added in the shl file.
In terms of compatibility, is there any way to use new shl file on existed nodes defined by original shl file in DiagramView?
For an example,
If we want to change node’s shape from red triangle to blue rectangle, How to transfer all existed node data with red triangle shape to new shape in the system? Each node has one unique id, which set on node.setTag.

Question1:
Is there any structure or method can be used to transfer existed node’s shape to new shape by node’s unique value or other parameters?
Because it’s hard to ask users to delete all diagrams and draw it again, especially each node has more info saved in database. Each diagram contains 50+ nodes and links in average.

Question 2:
There is a way to define shape’s library in shapelibrarylocation in DiagramView, can we define more shl files to DiagramView?
In this case lots of shapes can be located in different ShapListBox by category or mode; user can drag from different shape list box to the same diagram view.
Is it possible or is there any way to use multi ShapeListBoxs to one DiagramView?
Or is there any structure or method that shape can be categorized/ separated by split line or panel bar?

Environment is in the following,
Web service is built by Net Diagram (MindFusion.Diagramming for ASP.NET, version 4)
JavaApplet mode
IIS 6.0
ASP.NET 2.0

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: change node's shape in ShapListBox
Reply #1 - Oct 4th, 2011 at 2:44pm
Print Post  
Dear Chieh,

1. Shape objects are shared between nodes and are loaded by id. So, if you'd like all instances of a shape to be replaced with another shape, you could just load a Shape definition with the same id as the original trough ShapeLibraryLocation.

If you need to change the shape after the diagram has been loaded, or if the edited shape should have a different id, you will have to loop over the existing nodes and replace the old shape:

for (var i = 0; i < diagram.getNodes().size(); ++i)
{
     var node = diagram.getNodes().get(i);
     if (node.getShape().getId().equals(originalId))
           node.setShape(newShape);
}

2. ShapeLibraryLocation can load a single shape library file. In order to load more libraries, call ShapeLibrary.LoadFrom on the server, or ScriptHelper.loadShapeLibrary on the client side (in Java mode).

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint