Page Index Toggle Pages: [1] 2  Send TopicPrint
Hot Topic (More than 10 Replies) Help using Shape Designer (Read 10777 times)
saad
Full Member
***
Offline


I Love MindFusion!

Posts: 117
Joined: Oct 8th, 2012
Help using Shape Designer
Oct 23rd, 2012 at 3:13am
Print Post  
I'm having a bit of trouble using the shape designer.

All I want to do is create a round rectangle, along with a little graphic on top right corner. On lines of the photo I've attached.

Moreover the little graphic on top right corner, I wish it would appear in the list of shapes in the shapelistbox instead of the whole shape.

Moreover it seems it stores everything in a .shl file, but none seems to exist initially but still the shapes show, how come?
  

Capture_014.PNG (Attachment deleted)
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Help using Shape Designer
Reply #1 - Oct 23rd, 2012 at 6:34am
Print Post  
Quote:
Moreover the little graphic on top right corner, I wish it would appear in the list of shapes in the shapelistbox instead of the whole shape.


You will have to crate two different shapes, one showing only the graphic to show in the listbox, and the second being the actual shape to use in the diagram. Then you can handle the NodeCreated event or script to change node.Shape from the icon shape to the actual shape after drag and drop.

Quote:
Moreover it seems it stores everything in a .shl file, but none seems to exist initially but still the shapes show, how come?


If you mean you need to remove the standard shapes from your library, you can either click File -> New to remove them all, or select ones you don't need in the list on the right and press Del to delete them.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
saad
Full Member
***
Offline


I Love MindFusion!

Posts: 117
Joined: Oct 8th, 2012
Re: Help using Shape Designer
Reply #2 - Oct 23rd, 2012 at 1:27pm
Print Post  
If you could go into a bit more detail on how to show only the graphic in the shapelistbox . In the Shape Designer it just creates a thumbnail of what I create.

Regarding the other question what I meant to ask was that shapelistbox by default loads some shapes however there is no .shl file present. How does it pick up the shapes by default?

I really need some help starting up with the shape designer. All that I see is a big square to start with, I want it to change to a rounded rectangle and put a little image as shown in my attachment on top of it.

Is there any other method to do this?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Help using Shape Designer
Reply #3 - Oct 23rd, 2012 at 4:36pm
Print Post  
Hi,

You could create two different shape library files, assign the one with only icon shapes to the listbox, and load the other one into the view.

I think the shape designer doesn't let you associate images with shapes at this time, but only lets you load them as  background to align your shape drawing to the bitmap graphics. If you need to show a bitmap image as part of the shape, you can add an image element manually as shown in http://mindfusion.eu/Forum/YaBB.pl?num=1346357048/1#1.

What you see by default when running the ShapeListBox without setting a filter or loading a shape library is all available shapes - both added by your code and the near 100 predefined shapes. You can find the predefined ones exposed as members of the Shapes class.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
saad
Full Member
***
Offline


I Love MindFusion!

Posts: 117
Joined: Oct 8th, 2012
Re: Help using Shape Designer
Reply #4 - Oct 23rd, 2012 at 4:43pm
Print Post  
Cheers, going to check it out right now.
  
Back to top
 
IP Logged
 
saad
Full Member
***
Offline


I Love MindFusion!

Posts: 117
Joined: Oct 8th, 2012
Re: Help using Shape Designer
Reply #5 - Oct 23rd, 2012 at 4:55pm
Print Post  
Ok we are are onto something but check out the attachment for the problem still persisting.
  

Capture_017.PNG (Attachment deleted)
Back to top
 
IP Logged
 
saad
Full Member
***
Offline


I Love MindFusion!

Posts: 117
Joined: Oct 8th, 2012
Re: Help using Shape Designer
Reply #6 - Oct 23rd, 2012 at 4:58pm
Print Post  
Here is the SHL file by the way to accompany my last reply:

Code
Select All
<?xml version="1.0" encoding="utf-8"?>
<shapes version="2">
  <shape id="newShape2" fill-mode="Winding" display-name="">
    <outline>
      <round-rectangle dash-style="Custom" width="-1" x="5" y="17" w="90" h="80" r="5" />
    </outline>
    <decorations />
    <shape-decorations />
	<image x="0" y="0" width="100" height="100" src="iconFactory.jpg" />
    <enable-outline>True</enable-outline>
  </shape>
</shapes> 

  
Back to top
 
IP Logged
 
saad
Full Member
***
Offline


I Love MindFusion!

Posts: 117
Joined: Oct 8th, 2012
Re: Help using Shape Designer
Reply #7 - Oct 23rd, 2012 at 6:44pm
Print Post  
Played around with it more, it seems to do the job but see attachment, when resized the image in the shape sort of becomes detached from it.

One way I can think of is to restrict the resizing by handles by proportion or percentage. Can that be done? What I mean is if width is increased, so should height, proportionately when dragged using handles.

SHL code is:

Code
Select All
<?xml version="1.0" encoding="utf-8"?>
<shapes version="2">
  <shape id="newShape3" fill-mode="Winding" display-name="">
    <outline>
      <round-rectangle dash-style="Custom" width="-1" x="4" y="28" w="87" h="67" r="5" />
      <round-rectangle dash-style="Custom" width="-1" x="65" y="3" w="26" h="24" r="5" />
    </outline>
    <decorations />
    <shape-decorations />
    <image x="60" y="0" width="30" height="30" src="iconFactory.jpg" />
    <enable-outline>True</enable-outline>
  </shape>
</shapes> 

  

Capture_018.PNG (Attachment deleted)
Back to top
 
IP Logged
 
saad
Full Member
***
Offline


I Love MindFusion!

Posts: 117
Joined: Oct 8th, 2012
Re: Help using Shape Designer
Reply #8 - Oct 23rd, 2012 at 7:19pm
Print Post  
I solved this momentarily by:

Code
Select All
 protected void diagramView_NodeCreated(object sender, NodeEventArgs e)
    {
        // setting constraint on aspect ratio
        e.Node.Constraints.KeepRatio = true;
    } 



  
Back to top
 
IP Logged
 
saad
Full Member
***
Offline


I Love MindFusion!

Posts: 117
Joined: Oct 8th, 2012
Re: Help using Shape Designer
Reply #9 - Oct 23rd, 2012 at 7:47pm
Print Post  
However I'm still wondering how to change the icon shown in the ShapeListBox to something other than a mere preview of the shape.

Plus I'm wondering why its cut from the bottom.
  

Capture_020.PNG (Attachment deleted)
Back to top
 
IP Logged
 
saad
Full Member
***
Offline


I Love MindFusion!

Posts: 117
Joined: Oct 8th, 2012
Re: Help using Shape Designer
Reply #10 - Oct 23rd, 2012 at 7:57pm
Print Post  
Solved (Problem of wanting the thumbnail to be different from shape)

See attached photo.
  

Capture_021.PNG (Attachment deleted)
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Help using Shape Designer
Reply #11 - Oct 24th, 2012 at 7:57am
Print Post  
Quote:
Ok we are are onto something but check out the attachment for the problem still persisting.


My idea was replacing the shape once the node is created, not keeping the one from the listbox. E.g. you load only the thumbnail shapes in the listbox, the actual shapes in the view, and handle NodeCreated like this:

Code
Select All
if (node.Shape.Id = "Thumbnail_MyShape")
    node.Shape = Shape.FromId("Actual_MyShape"); 



Quote:
Played around with it more, it seems to do the job but see attachment, when resized the image in the shape sort of becomes detached from it.


Shape coordinates are specified as percents of node's size, and if you have a distance of 1 between the two rectangles, it might get larger than a pixel when the node is large.

Quote:
One way I can think of is to restrict the resizing by handles by proportion or percentage. Can that be done? What I mean is if width is increased, so should height, proportionately when dragged using handles.


Yes, using NodeCosntraints as you found out. Another option might be to use a simple RoundRect shape for all nodes, and attach a locked node to show the thumbnail image to the main node's top-right corner (see DiagramNode.AttachTo method). That will allow resizing the node in all directions without resizing the attached image.

Quote:
Plus I'm wondering why its cut from the bottom.


Check if there aren't any Y coordinates getting larger than 100%.

Quote:
Solved (Problem of wanting the thumbnail to be different from shape)


Just keep in mind that changing some ShapeListBox properties will generate these images again - such as icon size or color.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
saad
Full Member
***
Offline


I Love MindFusion!

Posts: 117
Joined: Oct 8th, 2012
Re: Help using Shape Designer
Reply #12 - Oct 25th, 2012 at 12:37am
Print Post  
Your method seems better but .. just wondering.. when you do this:

node.Shape = Shape.FromId("Actual_MyShape");

where is Actual_MyShape comng from? Is it from another SHL file?

Do you mean I should create two SHL files?

In any case I'll consider this solved for now as my method, although not ideal, works.
  
Back to top
 
IP Logged
 
saad
Full Member
***
Offline


I Love MindFusion!

Posts: 117
Joined: Oct 8th, 2012
Re: Help using Shape Designer
Reply #13 - Oct 25th, 2012 at 3:16am
Print Post  
If you could elaborate on how to use DiagramNode.AttachTo to attach an image to a shapenode that would be great cause as you rightly pointed out, the graphic does get enlarged as well (which might be a problem).
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Help using Shape Designer
Reply #14 - Oct 25th, 2012 at 4:40pm
Print Post  
Try this:
Code
Select All
protected void diag_OnNodeCreated(object sender, NodeEventArgs e)
{
	ShapeNode newNode = (ShapeNode)e.Node;
	RectangleF r = newNode.Bounds;
	ShapeNode mainNode = diagramView.Diagram.Factory.CreateShapeNode(
		r.X, r.Y, 60, 40, Shapes.RoundRect);
	newNode.Bounds = new RectangleF(mainNode.Bounds.Right - 20, r.Y - 20, 20, 20);
	newNode.AttachTo(mainNode, AttachToNode.TopRight);
} 



and resize the master node after that - the attached node will follow its top-right corner but won't get resized together with the master.

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