Author Topic: jArchi: Attribute "Viewpoint" on diagram?  (Read 712 times)

cr0que

  • Member
  • **
  • Posts: 11
jArchi: Attribute "Viewpoint" on diagram?
« on: September 11, 2018, 08:26:10 AM »
Hi!
I've just found out the strength of jArchi and started to automate some of the work I do with my models.

However, I just can figure it out how to read the attribute or property on a diagram that shows the viewpoint. I've tried with both attributes and properties or "natural syntax" (.someAttribute) but can in no way understand how to access information about the viewpoint.

Can someone here help me?

/ cr0que

Phil Beauvoir

  • Administrator
  • Hero Member
  • *****
  • Posts: 1619
  • Code Punk
    • Archi
Re: jArchi: Attribute "Viewpoint" on diagram?
« Reply #1 on: September 11, 2018, 10:09:25 AM »
Hi,

we haven't implemented setting and getting viewpoint names or info yet. Not sure how this would be achieved, if a viewpoint name is a standard thing as per the exchange format.

Phil
If you value and use Archi please consider making a donation! https://www.archimatetool.com/donate

cr0que

  • Member
  • **
  • Posts: 11
Re: jArchi: Attribute "Viewpoint" on diagram?
« Reply #2 on: September 11, 2018, 10:43:44 AM »
Then I have to re-think my design. =)

Thank you for your quick response.

Phil Beauvoir

  • Administrator
  • Hero Member
  • *****
  • Posts: 1619
  • Code Punk
    • Archi
Re: jArchi: Attribute "Viewpoint" on diagram?
« Reply #3 on: September 11, 2018, 12:14:45 PM »
It depends what is required for a "viewpoint".

Is it the internal Archi id name, such as "implementation_deployment"?
Is it the external English name, such as "Implementation and Deployment"?
Is it required to know the concept types that are permitted in the viewpoint?
Is it a JS object type that returns all of the above? For example:

id : "implementation_deployment"
name : "Implementation and Deployment"
concepts : <list of permitted concept names>
If you value and use Archi please consider making a donation! https://www.archimatetool.com/donate

Phil Beauvoir

  • Administrator
  • Hero Member
  • *****
  • Posts: 1619
  • Code Punk
    • Archi
Re: jArchi: Attribute "Viewpoint" on diagram?
« Reply #4 on: September 11, 2018, 12:17:46 PM »
More...

Or should there be methods added to the jArchi Diagram object pertaining to its viewpoint such as:

var view = ...;
var isAllowed = view.isAllowedConcept(conceptName);
If you value and use Archi please consider making a donation! https://www.archimatetool.com/donate

cr0que

  • Member
  • **
  • Posts: 11
Re: jArchi: Attribute "Viewpoint" on diagram?
« Reply #5 on: September 11, 2018, 12:36:17 PM »
 
More...

Or should there be methods added to the jArchi Diagram object pertaining to its viewpoint such as:

var view = ...;
var isAllowed = view.isAllowedConcept(conceptName);

For my use case either id or name will do the work. Complete information will probably cover more use cases and the methods is imho an elegant solution.

cr0que

  • Member
  • **
  • Posts: 11
Re: jArchi: Attribute "Viewpoint" on diagram?
« Reply #6 on: September 11, 2018, 13:13:09 PM »
Another jArchi-related question, I have experimented with multiple selectors in a find-statement e.g.

$('selector').find('fo, bar')

with no luck of finding a working syntax (based on different examples from jQuery). Do you have a thought of how to achieve a selection like that?

My use case is based on a selection of an archimate-diagram-model and then I want to find two or more concepts in that view.

/ cr0que

Phil Beauvoir

  • Administrator
  • Hero Member
  • *****
  • Posts: 1619
  • Code Punk
    • Archi
Re: jArchi: Attribute "Viewpoint" on diagram?
« Reply #7 on: September 11, 2018, 13:48:50 PM »
Have you tried using the filter(predicate) function?

collection.filter(function(object) {return someBoolean})

For example:

Code: [Select]
var selected = $("element").filter(function(object) {
    return object.name === "foo" || object.name === "bar";
});
If you value and use Archi please consider making a donation! https://www.archimatetool.com/donate

Jean-Baptiste Sarrodie

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 716
  • Archi Evangelist and Contributor. Visionary.
    • About me...
Re: jArchi: Attribute "Viewpoint" on diagram?
« Reply #8 on: September 11, 2018, 19:30:26 PM »
Hi,

Another jArchi-related question, I have experimented with multiple selectors in a find-statement e.g.

$('selector').find('fo, bar')

with no luck of finding a working syntax (based on different examples from jQuery). Do you have a thought of how to achieve a selection like that?

You have to do it in two steps:

Code: [Select]
$('selector').find('fo').add($('selector').find('bar'))
Regards,

JB
If you value and use Archi please consider making a donation! https://www.archimatetool.com/donate

cr0que

  • Member
  • **
  • Posts: 11
Re: jArchi: Attribute "Viewpoint" on diagram?
« Reply #9 on: September 12, 2018, 07:26:19 AM »
Thank you!

I found that the filter function is best suited for my needs. But since filter works on the currently matched elements I first had to find everything (get e new set of matched elements) with

$(selector).find.().filter(function...

It's because my first selection is a diagram and not a collection of concepts or visuals. Since the expression

$(selector).find().add(...

will need a constant number of find selectors the filter seems a lot more flexible.

/ cr0que