Book a Demo

Author Topic: How to make connectors invisible based on a tagged value  (Read 5050 times)

Jayson

  • EA User
  • **
  • Posts: 363
  • Karma: +1/-0
    • View Profile
How to make connectors invisible based on a tagged value
« on: November 05, 2019, 07:41:56 am »
Hi all

I am looking to make connectors visible based on a tagged value.
For an element, this is of course easy by using a diagram filter.

However, filtering on a tagged value seems to have no effect on connectors despite the connectors having the same "Status" tagged value as the elements.
If the connector is joined to an element (or elements) that are disappear due to the filter, then the connector disappears BUT I have some connectors that I want to filter out that are connected to elements that I do not want to filter out.

Having exhausted the capabilities of diagram filters, I then switched attention to using diagram legends to "filter" out the connectors by setting their colour to the same as the background.

I set the noShadow = true option, but even then the arrow head still shows up.

I then wondered if I set the colour of the connector to a reserved colour, whether I could then detect that colour in my shape script.

For example:

If linecolour = "HotPink" Then
// I would then put nothing in here so that the shape script would draw nothing whenever the line colour is set to Hot Pink.
End If

However, I cannot find anywhere that states that I can use the line colour in an If statement in this manner.

So now I have ended up where I have exhausted all the ideas I could muster and am wondering if you good people are able to offer any further suggestions.

Cheers

Jays :-)

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: How to make connectors invisible based on a tagged value
« Reply #1 on: November 05, 2019, 08:46:52 am »
Add shape main, source and target and draw (or don't) what your tag says. No draw, no visible. Mimicking  the original shape might be tricky, though.

q.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: How to make connectors invisible based on a tagged value
« Reply #2 on: November 05, 2019, 10:12:32 am »
Add shape main, source and target and draw (or don't) what your tag says. No draw, no visible. Mimicking  the original shape might be tricky, though.

q.
Won't work. The main script only runs for the center segment.

Jayson

  • EA User
  • **
  • Posts: 363
  • Karma: +1/-0
    • View Profile
Re: How to make connectors invisible based on a tagged value
« Reply #3 on: November 05, 2019, 10:41:29 am »
My backup plan is to detect #Diagram.Stereotype# in the shape script and then draw (or don't) the connector based on that combined with the value of the tagged value.
The the user can select a set of pre-canned diagram stereotypes.

Hardly elegant, but presumably will work.

Honestly Sparx peeps, your shape script functionality has sucked for the looooongest time.
Isn't high time you add in variables, loops, expressions such as equals etc?

Not wanting to bash you, just trying to articulate how weak this functionality is and how much of a difference it would make.
And while we are on it, how about fixing the diagram filter so I am NOT asking you this question in the first place?


Phew! #RantOver.

Cheers

Jays :-)

Jayson

  • EA User
  • **
  • Posts: 363
  • Karma: +1/-0
    • View Profile
Re: How to make connectors invisible based on a tagged value
« Reply #4 on: November 05, 2019, 10:59:39 am »
Having said that I can do the whole stereotype thing, for some reason I can't get it to work.

Code is:

If(HasTag("#Diagram.Stereotype#","Deprecated"))
   {
      If(HasTag("Status","Deprecated"))
      {
         DrawNativeShape();
         Print("Deprecated");
      }   
   }

However when I set the diagram stereotype to Deprecated, it doesn't evaluate to true.

Any clue what particular for of brain damage I am suffering this time?

Cheers :-)

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: How to make connectors invisible based on a tagged value
« Reply #5 on: November 05, 2019, 11:03:50 am »
My backup plan is to detect #Diagram.Stereotype# in the shape script and then draw (or don't) the connector based on that combined with the value of the tagged value.
The the user can select a set of pre-canned diagram stereotypes.

Hardly elegant, but presumably will work.

Honestly Sparx peeps, your shape script functionality has sucked for the looooongest time.
Isn't high time you add in variables, loops, expressions such as equals etc?

Not wanting to bash you, just trying to articulate how weak this functionality is and how much of a difference it would make.
And while we are on it, how about fixing the diagram filter so I am NOT asking you this question in the first place?


Phew! #RantOver.

Cheers

Jays :-)
To quote that iconic Ozzie film, The Castle...  "tell'im 'es dreamin!"

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: How to make connectors invisible based on a tagged value
« Reply #6 on: November 05, 2019, 11:06:08 am »
Having said that I can do the whole stereotype thing, for some reason I can't get it to work.

Code is:

If(HasTag("#Diagram.Stereotype#","Deprecated"))
   {
      If(HasTag("Status","Deprecated"))
      {
         DrawNativeShape();
         Print("Deprecated");
      }   
   }

However, when I set the diagram stereotype to Deprecated, it doesn't evaluate to true.

Any clue what particular form of brain damage I am suffering this time?

Cheers :-)
Jays,

IIRC it should be If(HasProperty("#Diagram.Stereotype#","Deprecated"))

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Jayson

  • EA User
  • **
  • Posts: 363
  • Karma: +1/-0
    • View Profile
Re: How to make connectors invisible based on a tagged value
« Reply #7 on: November 05, 2019, 02:28:08 pm »
LOL! Thanks Paolo!
I knew it would be my own stupidity at the root of the problem.
I will have a crack at this tomorrow when i get into the office.

Cheers

Jays :-)

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: How to make connectors invisible based on a tagged value
« Reply #8 on: November 05, 2019, 06:29:38 pm »
...

Phew! #RantOver.

Cheers

Jays :-)

Sure. Not the only thing to be improved. Anyhow, a shape script is interpreted (!!!) for each element being rendered. Having a complex syntax here will eventually cook any CPU you feed it with that task. That would imply a complete new approach. Looking at what came up in the past: I'll never see that in my remaining life time.

q.