Sparx EA Templates & Template fragment Document Generation approach questions - templates

Trying to build template (with possibly included template fragments, but anyway) in Sparx EA.
Struggled to find answers in Internet (but I tought it would be popular thou)
First:
Is there are way to output(or even prevent output), as example, packadge properties in different styles depends on packadge level (root, first level packs, second level etc)?
Let say I don't want to ouput name of root packadge, but I want to output name of child packadges.
If I remove tag {Pkg.Name} inside child packdages it will proceed each child packadge data as described in template above, but if I leave it like in this picture - it will output only names of child packadges
Second:
Is there a way, for template fragment scripting, to get currently processing object data (lets say Diagram.Note) and construct table from it?
(lets say I got some html markup or wiki markup inside and I want to render it as table)
P.S.
I know that I can achieve all this by writing my own document generation addin, only fetching data from Sparx Ea project and render it by some third-party library, but still wondering, maybe built-in features could replace that type of solution
UPD
Well, article by mr. Geert Bellekens (link in his answer) & this article helped me to find solution of first problem!

You can do almost anything with the current built-in document generator and fragments.
Just don't try to make one big template for your complete document. Instead make small manageable templates and use virtual documents to tie all to the pieces together.
With Custom Script template fragments, Custom SQL template fragments and Document Script template fragments you really have all the freedom you need to make professional document using only standard document generation features.
I used to build my own generators in the past, and loved it, but I can't honestly defend the business case anymore with the current state and flexibility of the built-in document generator.
For an example template and model see Tutorial: Generate complex documents from Enterprise Architect with a two-step semi-automated approach

Related

Not sure what i'm looking for (matrix, db-like structure) to organize files by tags

i was messing around organizing my music files when i asked myself why windows nor linux offer a way to organize a folder by custom tags in a database-likle manner rather than hierarchically.
The problem i wanted to solve is the following:
I have music files
A titled "tempest" from Beethoven, classical music in a piano only version.
B titled "whatever" from Mozart, classical music orchestral
D titled "one winged angel" from Uematsu, classical style, game ost, orchestral
C titled "one winged angel" same as before, violin only, cover from Taylor Davis.
And whatever "main" information i use for grouping, makes listing files by any other category immpossible.
Hence i whished to save files in an hidden folder with a simple increasing number.format, and have a program in which i can add files, add categories, search by tags, and end up with a list of the files i want. E.g. today i want to listen to all piano only pieces independently of their composer-time period.
I started making a structure of vectors containing vectors (aka matrix) but indexing lines and column by string started getting complicated when i want to remove a column.
And searching files by tag would require me to have each tag as an object knowing all files that use it, and it starts becomming more similar to a 3d matrix.
I though it would be better to think of this as a database, started with sqllite but ended with the problem of being unable to remove columns (i know i can create a copy etcc, but i wanted to avoid messy workarounds).
Also an sql-like database wouldn't allow me to have an area dedicated to a list of random tags for each file without a definite category.
Is there any existing library that rather then working as an sql database offers me something similar to a search/insert optimized matrix for strings? I don't think i was the first one thinking about that, someone must have done something similar.
This is very similar to what i want to achieve (strictly speaking about functionality), but rather than having only a bunch of random tags, i'd like to have some categories AND a set of random tags.
The problem with random tags only is you can't use the same word when it refers to different things. For example if the title of a piece is A and there's a film named A with a piece titled B, filtering A in the mess of tags would give both, while with categories i could filter pieces titled A. But the random mess of additional tags without category is useful too, for information you don't want to fill in most of the files and that would take pointless space in a standard database.

What's the difference between core data, essential data and sample data in hybris?

In the hybris wiki trails, there is mention of core data vs. essential data vs. sample data. What is the difference between these three types of data?
Ordinarily, I would assume that sample data is illustrative gobbledygook data created to populate the example apparel and electronics storefronts. However, the wiki trails suggest that core data is for non-store specific data and the sample data is for store specific data.
On the same page, the wiki states that core data contains cockpit and catalog definitions, email templates, CMS layout, and site definitions (countries and user groups impex are included in this as well). This seems rather store specific to me. Does anyone have an explanation for this?
Yes, I have an explanation. Actually a lot of this is down to arbitrary decisions I made on separating data between acceleratorcore and acceleratorsampledata extensions as part of the Accelerator in 4.5 (later these had y- prefix added).
Essential and Project Data are two sets of data that are used within hybris' init/update process. These steps are controlled for each extension via particular Annotations on classes and methods.
Core vs Sample data is more about if I thought the impex file, or lines, were specific to the sample store or were more general. You will notice your CoreSystemSetup has both essential and projectdata steps.
Lots of work has happened in various continents since then, so, like much of hybris now, its a bit of a mess.
There are a few fun bugs related to hybris making certain things part of essentialdata. But these are in the platform not something I can fix without complaining to various people etc.
To confuse matters further, there is the yacceleratorinitialdata extension. This extension was a way I hoped to make projects easier, by giving some impex skeletons for new sites and stores. This would be generated for you during modulegen. It has rotted heavily though since release, now very out of date.
For a better explanation, take a look at this answer from answers.sap.com.
Hybris imports two types of data on initialization and update processes; first is essentialdata and other one is projectdata.
Essentialdata is the coredata setup which is mandatory and will import when you run initialization or update.
sampledata is your projectdata and it is not mandatory it will import when you select project while updating the system.

create table in pdf using haru library in c++

I need to create Table structure and fill data using Haru library in C++. Can anyone provide me sample example which create table structure using Haru library.
I while ago I needed to produce some data tables as part of another project using Haru PDF. To simplify the creation of complex tables I wrote a small utility module to be used with the Haru PDF library that greatly simplifies the creation of complex tables. The module allows full customization of the table and supports for example cell spanning (both row and column). It also allows for the separation of layout and look&fell by a theme concept.
A simple usage example (just to give an idea) would be
int num_rows=5;
int num_cols=4;
char *table_title="Example 1: Basic table with default theme";
hpdf_table_t t = hpdf_table_create(num_rows,num_cols,table_title);
hpdf_table_set_content(t,content);
hpdf_table_set_labels(t,labels);
HPDF_REAL xpos=100;
HPDF_REAL ypos=630;
HPDF_REAL width=400;
HPDF_REAL height=0; // Calculate height automatically
hpdf_table_stroke(pdf_doc,pdf_page,t,xpos,ypos,width,height);
It is out of scope for this answer to discuss the code in more details but it should be fairly self documenting.
The module also allows both purely programmatic tables but also the creation of entirely data driven table creation (all layout and look & feel is taken from a structure). This allows a light-way model-view-controller approach to make maintenance easier. To fully use this relies on the client implementing callback functions that the module will call to get the corresponding data.
Since this was never intended to be released as a separate utility I haven't written up (yet) full documentation but I put together a quick standalone example which shows some of the features. The resulting PDF from running the example is included at github. However, all public API are fully Doxygen commented which should give some ideas on how it fits together.
You can find the module at (https://github.com/johan162/hpdf_table)
Update: Due to surprisingly many visits/questions I have taken the time to make a new release (1.4.0) with a completely rewritten documentation and reference which explains all the functionality of the library. The release also fixes all known small bugs as well as several new features.
You can use the draw_graph function in the encoding_list.c demo as an example. It is part of the source tar ball.

I want to use openStreetMap data to render roads in openGL, where should I start?

What I have in mind is that user will select the part of world he/she wants to generate roads and retrieve openStreetMap data and use it to render roads in openGL.
On searching the web and experimenting, I thought of this approach:
get xml file of selected map
parse the xml and generate roads by openGL.
But I think this is very naive approach.
Also to experiment a bit I used OSM2WorldViewer to convert the xml file to obj file and imported that as a model in openGL, but this method is cumbersome and takes time
and I am unfamiliar with OpenStreetMap api and how it can be used in such a project.
Any suggestions, or helpful links how to start this project ?
EDIT: How it ended: Link to the project wiki
Why do you think your approach is naive? Either you have the user to provide a self-downloaded XML file or you have to use an API to retrieve one yourself. The latter approach allows you to implement an automatic update mechanism whenever the user pans the map.
Instead of the main API you can use the Overpass API for downloading data. It's faster and more flexible to use, allowing to specify which element types to download (e.g. only roads and buildings) and much more.
You already mentioned OSM2World, take a look at its freely available code to see an example implementation of a 3D OpenGL renderer. Or take a look at one of the other 3D renderers for OSM.

building objects from xml file at runtime and initializing, in one pass?

I have to parse the XML file and build objects representation based on that, now once I get all these data I create entries in various database for these data objects. I have to do second pass over that for value as in the first pass all I could do is build the assets in various databases. and in second pass I get the values for all the data and put it in the database.
I have a feeling that this can be done in a single pass but I just want to see what are your opinions. As I am just a student who started with professional work, experienced ppl please help.
Can someone who have ideas or done similar work, please provide some light on the topic so that I can think over the possibility of the work and get the prototype going based on your suggestion.
Thanks a lot for your precious time, I honestly appreciate it.
You might be interested in learning several techniques of building XML parsers like DOM or SAX. As it is said in SAX description the only thing which requires second pass could be the XML validation but not the creating the tree.
Beside DOM and SAX parsing, you can use XQuery for querying data from XML files.It is fast, robust and efficient.
here is a link
You can use Qt Xml module for DOM ,SAX and XQuery, btw it is open source.
Another option is xml - C++ data binding, Here is the link.You can create C++ codes from definition directly.It is an elegant solution.
EDIT:
the latter one is at compile time.
You can also use Apache Licensed http://xmlbeansxx.touk.pl/. It works under Windows and Linux.
you could take a look at the somewhat simpler 'pull' api called stax instead of using sax (event based).