Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Need to draw a State Diagram using Diagramming

    Hello Support Team,
    I am using SmartGWT5.1 Trial version to use Diagramming. My requirement is something like, I have to draw or display a State diagram based on some DB value. Suppose, one rounded rectangular shows a state and a arrow line represents as connector of next state and first state holds reference of next state through connector. but my doubt is arrow line doesn't lock with rectangular blocks . So, how would I know that which arrow connector is headed and ended to which states . Is there any way to know next state information in first state that is block connected to to any connector?

    #2
    We're not sure we follow your question. It actually sounds like, rather than any issue using our APIs, you're not sure what the data in your data model means. We can help with that, but obviously using forums to help you with your requirements analysis is not a good approach. Instead, please make use of our Consulting and possibly Training services.

    Comment


      #3
      Let me re-phrase it, I wasn't discuss my requirement, I was make you understand with some example :). When I used smartGWT diagramming API, I faced below issue.
      1. How to get to know that below shapes (state1 and trigger) are connecting or intersecting through code ? And state2 & trigger shapes are interconnected? is there any flag exist when other shapes intersect or connect, it is set to true? or only through by getting shapes co-ordinates values, we would be able to get to know , any connection or intersection?

      <DrawRect>
      <left>4</left>
      <top>14</top>
      <width>72</width>
      <height>62</height>
      <rounding>0.25</rounding>
      <lineWidth>1</lineWidth>
      <fillGradient ref="rect"/>
      <shadow>
      <color>#333333</color>
      <blur>2</blur>
      <offset x="1" y="1"/>
      </shadow>
      <shapeData><m00>1</m00><m01>0</m01><m02>23.5</m02><m10>0</m10><m11>1</m11><m12>6.5</m12></shapeData>
      <title>state1</title>
      <keepInParentRect>true</keepInParentRect>
      <ID>DrawRect10</ID>

      </DrawRect>


      <DrawRect>
      <left>4</left>
      <top>14</top>
      <width>72</width>
      <height>62</height>
      <rounding>0.25</rounding>
      <lineWidth>1</lineWidth>
      <fillGradient ref="rect"/>
      <shadow>
      <color>#333333</color>
      <blur>2</blur>
      <offset x="1" y="1"/>
      </shadow>
      <shapeData><m00>1</m00><m01>0</m01><m02>180.5</m02><m10>0</m10><m11>1</m11><m12>12.5</m12></shapeData>
      <title>state2</title>
      <keepInParentRect>true</keepInParentRect>
      <ID>DrawRect11</ID>

      </DrawRect>


      <DrawLine>
      <startPoint x="98" y="62"/>
      <endPoint x="188" y="61"/>
      <lineWidth>1</lineWidth>
      <shapeData><m00>1</m00><m01>0</m01><m02>0</m02><m10>0</m10><m11>1</m11><m12>0</m12></shapeData>
      <endArrow>block</endArrow>
      <title>trigger</title>
      <keepInParentRect>true</keepInParentRect>
      <ID>DrawLine27</ID>

      </DrawLine>


      <DrawPane ID="DrawPane2" width="100%" height="100%" autoDraw="false">
      <drawItems><DrawItem ref="DrawRect10"/><DrawItem ref="DrawRect11"/><DrawItem ref="DrawLine27"/>
      </drawItems>
      <gradients>
      <SimpleGradient>
      <direction>90</direction>
      <startColor>#ffffff</startColor>
      <endColor>#99ccff</endColor>
      <id>oval</id>
      </SimpleGradient>
      <SimpleGradient>
      <direction>90</direction>
      <startColor>#d3d3d3</startColor>
      <endColor>#666699</endColor>
      <id>diamond</id>
      </SimpleGradient>
      <SimpleGradient>
      <direction>90</direction>
      <startColor>#f5f5f5</startColor>
      <endColor>#a9b3b8</endColor>
      <id>rect</id>
      </SimpleGradient>
      <SimpleGradient>
      <direction>90</direction>
      <startColor>#f5f5f5</startColor>
      <endColor>#667766</endColor>
      <id>triangle</id>
      </SimpleGradient>
      </gradients>
      <canFocus>true</canFocus>

      </DrawPane>

      Comment


        #4
        We're not sure how you've ended up in the situation that you are trying to derive the data model from the drawing - usually you would draw the diagram based on the data model. However, yes, you would need to do math on the coordinates to try to figure out whether lines connect to shapes.

        In previous applications we've built for customers based on the Drawing module, we've created classes that represent logical connectors, which when serialized to XML, will store the IDs of the two shapes they connect. This is a good way to do it if you are using Component XML as your sole way of storing the diagram (that is, you have no separate format with logical connection information rather than just coordinates). If you'd like us to do something like that for you, that's again Consulting, and some parts of it could end up as Feature Sponsorships.

        Comment

        Working...
        X