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.
Related
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
so I posted a question on OpenData and after advancing me a bit further in my quest to create maps from real cartographic information, I was advised to post my follow up questions on this website.
So after this intro, here is the original question:
I'm creating a 2D realistic RTS (Real time strategy game) and I wanted to be able to use real locations as the scenarios for the games.
The game will be developed via unreal engine which uses c++. The idea is for the engine to read an file and convert into a grid (coordinate point) where each square has type of terrain associated, like in this image of a scenario editor.
The file resulting from the other website is a GML (Geographic Markup Language) of a given location in the globe. GML is a XML extension.
The problem I'm facing is converting that GML for a given location into data that can be used by my game, like an location array or something like that.
Any sugestions?
There are many possibilities into doing this but the general guidelines or concepts should be as follows:
Know the data structure used by your engine
Open the incoming file and being able to parse and extract the needed data
Populate your structures or classes
Use your custom structures or classes to create game content (map data).
The first suggestion that I can give would be to read up on any and all documentation on the GML file format to know how the tags of the marked up language works then from there look to see if you can find any libraries that make it easy to read in a GML or XML file type and to generate C++ classes or structures, otherwise you will have to write both the file loader and gml(xml)parser with schema manually. Then from those structures being able to extract the data that you need and to pass them or store them into your engine's custom data structures. Then finally you should be able to use the stored data in your engine to generate the content that you want.
References
www.opengeospatial.org
www.w3.org
www.ogcnetwork.net
www.gdal.org
www.svgopen.org
Books
Geo-Informatics... 200+ page preview of almost 1,000 pages
Whitepapers
ResearchGate
Tools - Some Free Some Not
Google Search - GML File Converter
GoLoader by Snowflake Software
Various Sources by OGCNetwork
Open Source software from opengeospatial
GML Reader by tsusiatsoftware
Libraries
Question found on Stack Exchange
Various Libraries & Frameworks for Different Formats and Languages
gmXML Parser by YOYO games - *This Might be for the GameMaker Language
Java Code Examples for org.geotools.xml.Parser from programcreek
GML API for C/C++ Documentation
GML - The Geometric Modelling Library - API & GUI
Open Source - CityGML
The information needed is out there; it just takes time and effort; good research and the ability to apply what you have read into an actual code base.
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.
I am looking for a good java library to manipulate box, arrows and labels in order to dynamically create and fill diagrams like the following and render them to a png :
Another example
I can create a static template to be filled later, but I will need to dynamically create labels for every box and edges in the diagrams.
For now I have tried using batik to manipulate an svg template but creating multiline labels for the edges is proving quite complicated. The SVG way with batik seems to force me to create 1 text object for each label line with absolute positioning for each which is a real pain.
I would like to be able to define the label specifying only the text and the link they relate to, eventually some hints as to how it should be placed and let the library place them.
Any suggestions ?
If this is in a commercial scenario, the Java graph drawing library yFiles can be a good match for your requirements:
You can use a convenient API to create and style your diagram and automatically layout the diagram with lots and lots options to constrain the resulting layout to suit your needs.
Multi-line and (simple) HTML labels are supported out-of-the-box.
Also you can export to PNG (as well as other pixel based image formats) and vector graphics formats like SVG, PDF, EPS.
This can be done both in a regular Java (Swing) application as well as in a headless environment (e.g. to create images on a server and to send them to a web-based thin client dynamically).
To get a feel what can be done using that library, I suggest you take a look at the freely available graph editor application "yEd" that is based on yFiles and lets you try out the above steps in an interactive manner.
(Disclosure: I work for yWorks, but on Stackoverflow I do not represent my employer.)
from a c++ program i need to print a simple label. the label contains a text, an image and a barcode.(in my project the label is more complex, this is just for example)
my customer need a way to customize che label layout.
in the past in java I solve this problem using a report created with jasperreport. my customer customize the report with ireport and then i fill the data with an hashtable datasource (i never connect to an sql database)
anybody know a way to obtain something like this in java
really sorry for my scholastic english
Offhand, it's a bit hard to say -- most report generators assume some sort of database (SQL or at least accessible via ODBC) as the data source. I'd probably look into some that are free and include source code so you can change the data source (though I've no idea how difficult a modification that will be).
The other problem is that printing anything but plain text is somewhat non-portable; you'll need different code for Linux, Mac/OS or Windows. For Windows, one possibility would be Report Generator from CodeProject.com. If you want something more portable, you could use something like Xport to create XHTML output to be viewed in/printed from a browser (or any number of other programs that understand [X]HTML (there's also a commercial version). Of course, you could generate output in any number of other formats that support graphics, such as Postscript/PDF, LaTex, etc. This lets you use portable code to generate the report, but usually requires some non-portable code to invoke a viewer.