Professional Documents
Culture Documents
July 2003
All rights reserved. No part of this document may be reproduced, in any form or
by any means, disclosed or used by any person who has not received prior written
authorization from SevenCs AG & Co. KG.
Preface
This document describes the SevenCs directENC chart management concept and
how to use it. The directENC concept has been developed by SevenCs to simplify
and accelerate the handling of electronic navigational charts (ENCs).
This is achieved by converting ENCs into the SENC format of the SevenCs
EC2007 ECDIS Kernel prior to distribution. Then the ECDIS can directly access
the SENC file, and plug & play for digital charts becomes reality. Moreover, the
directENC concept allows importing S-57 base files and updating files. S-57
updating according to the ENC Product Specification is fully supported.
Contents
Preface .............................................................................................................iii
Contents............................................................................................................ v
1 Introduction....................................................................................... 1
1.1 Conventions Used in this Document .................................................... 1
3 Background Information.................................................................. 5
3.1 What is Behind the directENC Concept? ............................................. 5
3.2 Package Handling................................................................................. 6
3.3 Chart Display Handling........................................................................ 6
3.3.1 Automatic Cell Loading ....................................................................... 6
3.3.1.1 Data Production Application ................................................................ 6
3.3.1.2 ECDIS Application............................................................................... 6
3.4 Copy Protection System ....................................................................... 7
3.5 Overview: directENC Packages ........................................................... 8
3.6 Overview: Package Access Keys / Installation Passport...................... 9
9 Appendices ....................................................................................... 37
9.1 Abbreviations and Terminology .........................................................37
9.2 directENC Functions...........................................................................38
9.2.1 General Functions ...............................................................................38
9.2.2 Chart Import ........................................................................................38
10 Index ................................................................................................. 55
1 Introduction
Note:
The EC2007 ECDIS Kernel software contains a dedicated function set called
EC27_DENC (please also refer to the online help of the EC2007 ECDIS Kernel).
This function set comprises functions that must be utilized to make your
application directENC compatible.
Note:
In order to avoid faulty operation and possible malfunction it is strongly
recommended to read the complete directENC user’s guide.
In the following you will find a brief instruction how to install and visualize
directENC data.
Please also refer to chapter 9.1 Abbreviations and Terminology.
Note:
If they are located in different directories it is recommended to import the 7CK
archives first, and then the 7CX chart packages.
3. The content of each package (e.g. 7CB files, text files, images) is
automatically moved into subdirectories of the directENC directory structure
(which has been created in step 1 with EcDENCCreate()).
4. To display the installed directENC charts use the functions of the following
sequence:
Installation Passport
To create an Installation Passport use the function
EcDENCCreateInstallationPass().
An installation passport contains information about the Kernel installation. The
installation passport is used to identify a hardware system at ChartWorld or other
chart dealers.
Please send the installation passport on request. This will facilitate the procedure
of Package Access Key generation.
3 Background Information
Display
Draw
Directory Symbolize
DENC Import
containing
7CX and 7CK
files Manual DENC
Import
file open Install 7CX Directory Load
dialog 7CX
Structure function
Download incl.
directory catalogue .7CC
or
Create
view
By means of the Callback function the application can e.g. exclude data of a
certain producer from loading (and displaying), or favour these data over others in
the loading order
4.4 Initialization
Functions: EcDENCCreate()
Before the other directENC functions can be utilized a directENC structure must
be created. This structure is then transferred as parameter to most of the other
directENC functions. If required the directENC directory tree is automatically
created (see 9.3.1 Sample Program 1)
4.7.2 SENC Files, ENC Files, Text, Picture and Multimedia Files
When single cells are deleted it is not checked which package they belong to. If a
deleted cell is referenced by a package reference cell this could lead to
inconsistencies. That is why only those cells should be deleted separately which
are not parts of an installed package.
The directENC concept doesn’t necessarily require that chart data is provided as
chart packages (import of single SENC files is possible). However, chart handling
becomes much more convenient if cells are grouped in packages. Package files
can easily be identified by their file name and the extension 7CX. Packages will
be named after the corresponding sea area that is covered.
A chart package is an archive containing S-57 cells in SevenCs SENC format
(extension 7CB) and additional files necessary to administer the chart package.
Usually these cells cover a particular sea area without gaps. The cells can belong
to all standard S-57 usages or directENC usages (customized usages). A unique
product ID (PID) is assigned to each directENC package. This PID is also stored
in every singe cell of the package.
The directENC package serves as container for the single SENC files only.
During the installation process of a directENC package the container is opened
and each SENC file is copied to its final destination in the directENC directory
structure (also refer to chapter 7.2 directENC Directory Structure).
directENC packages can also hold S-57 base and update files, Image files, Text
files. During package installation these are integrated in the directENC directory
structure.
The ECDIS Kernel refers to single SENC files (not to packages) for data access
like cell mapping, chart work, calculations, etc.. Nevertheless the references
between a single cell and its original directENC package are saved in the
directENC structure.
Following is an overview of content and naming conventions of chart package
archives:
Example: 7COST2PST_Baltic_Sea_german_middle_west_part_1_0_2.7CX
SevenCs has introduced a copy protection system for SENC files, which will
prevent illegal copy operations of chart data without any additional device being
needed. This protection system is based on the SevenCs ECDIS Kernel
Registration, and is available on every registered system.
The SENC protection scheme is an important part of SevenCs directENC concept.
The main idea is to distribute electronic charts in the SENC format of the ECDIS
Kernel. Such chart files can be accessed directly by applications using the ECDIS
Kernel functions without any time-consuming S-57 import operation.
The current SENC format allows the protection of each SENC file. A cell file can
be protected by adding a unique mark, which is used to control the access to this
chart. The access to such protected charts is granted by the ECDIS Kernel only if
an appropriate chart package access key (PAK) is installed on the system.
Update PAKs are unlimited, but they are valid only in conjunction with the
specified reference PAK.
All file and directory names may only contain capital letters and digits. For cells
in directENC format the naming conventions of the S-57 standard are used. A cell
name consists of eight capital letters and digits arranged according
to the following scheme:
AAUXXXXX
with
AA representing the producing agency code,
U representing the intended usage (1-6), and
XXXXX representing an unambiguous code for the given AAU combination
For text and picture files in directENC the following scheme is used:
AAXXXXXX
with
AA representing the producing agency code,
XXXXXX representing an unambiguous code for the given AA combination
The subdirectories CELLS, TXT, and TIF all have further subdirectories. The
name of each subdirectory is derived from the name of the corresponding
directENC file, text, or picture file, respectively.
Example:
The SENC file 7C3ABCDE.7CB will be stored in the path
CELLS/7C/3A/BC/DE
The TEXT file 7C123456.TXT will be stored in the path TXT/7C/12/34/56
The cell catalogue CATALOG.7CC can be regarded as table of contents of the
corresponding directENC directory. It holds general information, e.g. cell
coverage. Many directENC functions refer to the catalogue to retrieve information
for further processing (e.g. during cell loading).
This function creates a new directENC structure in memory and reads the
producer agency catalogue if it exists. If a cell catalogue exists in the specified
path it is used, otherwise a new cell catalogue is created. To force the creation of a
new cell catalogue the third parameter can be set to True. The return value of this
function is a pointer to the new EcDENC structure. If the structure is no longer
used it should be deleted by the application using the function
EcDENCDelete(). If the function fails NULL is returned, and the error can be
retrieved with the help of the function EcKernelGetLastError().
To determine the correct location of a file in the directENC directory structure the
function EcDENCGetPath() can be used. The parameters are:
denc pointer to an EcDENC structure
cellname file name to get path for (without path)
cellPath full path including file name
maxPathLen size of cellname buffer
create flag for creating returned path
If the last parameter is set to True the function creates all subdirectories required
to reach the correct location of the specified file. The filename specified by
cellname must follow the directENC naming conventions and must not contain
any path. This function returns True on success and False otherwise. If an
error occurred the function EcKernelGetLastError() can be used to
determine its cause.
To delete all files of a directENC structure and the corresponding directory
structure the function EcDENCDeleteTree() can be used. The parameters are:
denc pointer to EcDENC structure
di pointer to object catalogue context
This function invokes the callback function which can be set with
EcDENCSetCallback() for every file in the directory tree. If the callback
returns True, all files in the corresponding directory will be deleted as well as the
directory itself. If any files remain in the structure, the cell catalogue will be
updated. If all files are deleted, the base directory will also be removed, and the
EcDENC structure denc should be freed using EcDENCDelete().
See the chapter 7.3.4 for more details on setting the callback function.
This function imports a file into the directENC structure. Before the file is added,
the callback function, if any has been set with EcDENCSetCallback(), is
invoked with the parameter reason set to EC_DENC_IMPORT. If the callback
returns True the import procedure will copy the specified file to the correct
location within the directENC structure, and will update the cell catalogue. This
function can be used to import directENC packages, PAK archives, cell files, text
or picture files into a directENC structure.
To import all files contained in a specific directory and all its subdirectories the
function EcDENCImportTree() can be used. The parameters are:
denc pointer to EcDENC structure
di pointer to object dictionary context
path top-level directory of tree
This function steps recursively through the specified tree and calls
EcDENCImportFile() for each file in the directory tree. This implies that for
each file the callback function (if any is set) is invoked with EC_DENC_IMPORT
before it is copied into the directENC structure.
This function removes a file from the directENC structure. Before the file is
This function installs a callback function which is called when importing, deleting
or updating files from the EcDENC structure. To uninstall the function, specify a
NULL pointer for the callBack parameter. If the callback function returns
False the file will not be added, removed, or updated respectively. The
parameters for the callback function are:
denc pointer to EcDENC structure
fileName file name including path
reason reason for calling the function (see below)
These values can be checked to decide if the respective action should be taken for
the particular file or not. Additional values for the parameter reason are:
EC_DENC_IMPORT_ERROR
EC_DENC_UPDATE_APPLIED
EC_DENC_UPDATE_REJECTED
EC_DENC_UPDATE_WRONG_UPDN
EC_DENC_UPDATE_WRONG_EDTN
EC_DENC_UPDATE_NO_CELL
These values can be checked to evaluate the results of the respective action.
The function EcDENCSetCallbackExt() can be used to install a callback
function that takes an additional user parameter. The usage of this function is
similar to EcDENCSetCallback(). A Pointer to (static) user-defined data may
be specified which will then be passed to the installed callback. The user data
buffers should be static in order to keep their contents while the callback function
is executed. In case no user data are needed, a NULL pointer may be specified.
Tip:
It is also possible to install two callback functions by calling first
EcDENCSetCallback(), and then EcDENCSetCallbackExt().
Note:
Do not use the function EcDENCRemoveCallbackExt() to remove
callbacks that have been installed with EcDENSetCallback(). For these
callbacks, use EcDENRemoveCallback() instead.
application and the application specific directENC install directory (Install Path).
In case of a hard disk crash the PAK file PERMITS.7CP might get lost. Therefore
we strongly recommend to generate backups of the chart PAK file. The function
EcCellWriteChartPermits() can be used. To add these backup PAKs to
the PAK database of the system use EcCellReadChartPermits().
The Kernel application should allow the user to generate backups of the PAK
database and save them on a different medium than the local hard disk. Besides it
must be possible to restore lost PAKs (e.g. due to disk crash) by reading the
backup of the chart PAK file.
To import an entire S-57 exchange set which can include text, picture, update, as
well as base cell files the function EcDENCImportS57ExchangeSet() can
be used. The parameters are:
denc pointer to EcDENC structure
di pointer to object dictionary context
path top-level directory of an S-57 exchange set
(usually ENC_ROOT, must contain the
catalogue file CATALOG.03x)
callBack pointer to callback function
This function imports a complete S-57 exchange set into the directENC structure.
Before each file is added the callback function (see chapter 7.3.4), if any has been
set with EcDENCSetCallback(), is invoked with the parameter reason set
to EC_DENC_IMPORT. If the callback function returns True the import
procedure will copy the file to the update directory of the directENC structure.
The function does neither convert the file into the SENC format nor apply any
updates. For more details about S-57 to SENC conversion see chapter 7.5.2.
Because an S-57 exchange set may consist of several volumes (CDs or floppies) it
may be necessary to change the volume during the import process. Therefore, the
fourth parameter of this function specifies a function pointer. This function is
invoked when EcDENCImportS57ExchangeSet() detects that a file is
stored on a different volume than the current one (the one inserted/mounted at
path). The application then has the opportunity to ask the user to insert the
appropriate CD or floppy. If this function returns True
EcDENCImportS57ExchangeSet() will assume that the correct volume has
been inserted/mounted at path. If it returns False the import process will be
terminated. If this callback function has not been specified (i.e. parameter
callBack is NULL), only files from the exchange set that are stored on the
volume inserted/mounted at path will be processed.
The parameters for the passed callback function are:
volId index of required volume (indices start
with 1)
volNum total number of volumes
filename name of the next file to be imported
This function checks the update directory of the directENC structure for new S-57
base or update files. The files are moved into the respective directories of the
directENC structure. All S-57 base, new edition, and reissue files are moved so
that they can be imported by the function EcDENCApplyUpdates(). The
update files are checked with respect to their edition and update number. If an
update is rejected - wrong update or edition number, or corresponding base cell
not found - a corresponding entry will be made in the history file in the update
directory. Base or update files that have already been applied will be deleted, and
a corresponding entry will be made in the history file. This function also invokes
the import callback (see chapter 7.3.4), provided it has been set.
The return value of this function is the number of files which can be applied or -1
if an error occurred.
Note:
The function EcDENCApplyUpdates() should be called before calling the
function EcDENCCheckUpdates() again in order to minimize the chance
of update files from different editions but with same update numbers
overwriting each other.
To convert any S-57 base files or apply any update files the function
EcDENCApplyUpdates() can be used. The parameters are:
denc pointer to EcDENC structure
di pointer to object dictionary context
This function converts the S-57 cell files into the directENC format, and applies
the update files in the respective update directory of the directENC structure. The
files that can be applied are moved into this directory by the function
EcDENCCheckUpdates(). The function also invokes the callback, if any has
been set (see chapter 7.3.4), when an update has been successfully applied with
the parameter reason set to EC_DENC_UPDATE_APPLIED. All changes made
by an applied update are recorded in the cell’s history file. These changes can be
retrieved from the history file by using the function
EcDENCGetUpdateInfo(). The return value of the function
EcDENCApplyUpdates() is the number of successfully converted base cells
and applied updates, or -1 if an error occurred.
To retrieve information about the changed objects of a specific cell the function
EcDENCGetUpdateInfo() is used. The parameters are:
denc pointer to EcDENC structure
cellName name of the base cell (no path required)
updInfo pointer to array containing update
information
infoNum number of entries in array updInfo
This function reads the history file of the specified cell and stores all update
information, if any is available, in an array of EcUpdateInfo structures. Each
entry of this array represents a changed object. The corresponding update number,
issue date, and apply date are also stored in the EcUpdateInfo structure for
each object. The last parameter gives the number of changed objects (elements of
the array updInfo).
Note:
This function allocates memory for the array of update information which, if
the number of elements infoNum is greater than 0, must be freed by the
application using the function EcFree().
If a special update has been applied (announcing that a new edition is available, or
to remove a complete data set) this information will be stored in an entry of the
array updInfo, too. The member info then contains the respective information.
However, all other members are 0 or empty strings.
The dates of the members applyDate and issueDate are stored as a long
values with the following format: YYYYMMDD, making it easy to compare two
dates. The member specialUpd is set in case a base cell has been converted or
a special update has been applied. The values can be EC_UPDATE_BASE_CELL,
EC_UPDATE_EDITION_AVAIL, or
EC_UPDATE_REMOVE_CELL.
TIP:
In all three cases the other members concerning the updated object are 0 or
NULL. So the member specialUpd should be checked before using the
values of the others.
The ENC Shuttle is a software tool to facilitate the installation of both Package
Access Keys (PAKs) as well as directENC chart packages. ENC Shuttle copies
directENC files into a file specific to the application. Further processing is then
conducted within the respective application.
To enable coaction between ENC Shuttle and application the application must be
registered in the Windows Registry. This is done with the function
EcDENCRegisterApplication(). This function takes the name of the
application and a directory path, and writes both of them to the Registry.
ENC Shuttle searches the Windows Registry for all installed programs compatible
with directENC which have been registered with the function
EcDENCRegisterApplication().
In case several programs are registered ENC Shuttle opens a dialogue to select the
specific program the directENC package is intended for.
In that dialogue all applications are listed that have been taken by the function
EcDENCRegisterApplication(). After the selection ENC Shuttle copies
the respective files into the selected directory.
Note:
If there is only one program in the Registry that is compatible with directENC
ENC Shuttle will automatically copy the directENC package into the
appropriate directory.
On Windows systems the Setup of ENC Shuttle will register the tool with the file
extensions 7CX (directENC packages) or 7CK (directENC PAK archives)
respectively. Thus the tool can be started by double-clicking the corresponding
file.
ENC Shuttle can also be started from the Start menu. In this case the command
“Open” will access a Windows dialogue from which the directENC file can be
selected. The default folder for this dialogue is an archive folder in which all
directENC files are being kept. This procedure is especially recommended
whenever ENC Shuttle loads directENC files directly from the Internet, since it
allows to keep backup copies of the respective files.
When the content of the default folder is no longer needed it can be cleared by
using Clear Archive.
9 Appendices
// convert the producer agency code of a cell into human readable form
#define _WINNT_SOURCE
#include <stdio.h>
#ifdef _WINNT_SOURCE
#include <windows.h>
#else
#include <X11/Xlib.h>
#endif
#include "eckernel.h"
// step 3 - get the producer code number from the cell header
if (!EcCellGetHeaderInfo(cid, EC_HDR_AGEN, (caddr_t)&pacInfo.number,
sizeof(pacInfo.number));
{
printf("error: cannot read cell header\n");
EcCellUnmap(cid);
EcDENCDelete(denc);
EcDictionaryFree(dictInfo);
exit(1);
}
// read the information about the installed SENC cells from the cell
catalog
#define _WINNT_SOURCE
#include <stdio.h>
#ifdef _WINNT_SOURCE
#include <windows.h>
#else
#include <X11/Xlib.h>
#endif
#include "eckernel.h"
#define _WINNT_SOURCE
#include <stdio.h>
#ifdef _WINNT_SOURCE
#include <windows.h>
#else
#include <X11/Xlib.h>
#endif
#include "eckernel.h"
/* free cellnames */
for (j=nCells-1; j>=0; j--)
EcFree(cellNames[j]);
EcFree(cellNames);
} // if
/* check coverage of package */
if (nCovPoly > 0)
{
fprintf(stdout, "\tCoverage Polygons: %d\n",
nCovPoly);
for (k=0, j=0; j<nCovPoly; j++)
{
/* check if coverage polygon is closed */
if ((nCovPolyPts[j] > 0) && (covLatLon[k*2] ==
covLatLon[(k+nCovPolyPts[j]-1)*2]) && (covLatLon[(k*2)+1] ==
covLatLon[((k+nCovPolyPts[j]-1)*2)+1]))
hptr="closed";
else
hptr="not closed";
fprintf(stdout, "\t\tPolygon[%d]: %d vertices
(%s)\n", j, nCovPolyPts[j], hptr);
k+=nCovPolyPts[j];
} // for
#define _WINNT_SOURCE
#include <stdio.h>
#ifdef _WINNT_SOURCE
#include <windows.h>
#else
#include <X11/Xlib.h>
#endif
#include "eckernel.h"
#define _WINNT_SOURCE
#include <stdio.h>
#ifdef _WINNT_SOURCE
#include <windows.h>
#else
#include <X11/Xlib.h>
#endif
#include "eckernel.h"
feat=EcFeatureGetFirst(cid);
while (ECOK(feat))
{
ok=EcFeatureGetAttributes(feat, dictInfo, &findInfo, EC_FIRST, attr,
sizeof(attr));
while (ok)
{
if (EcDictionaryTranslateAttributeValue(dictInfo, attr, hstr,
sizeof(hstr)) == EC_DICT_OK)
{
/* check for text refernce ("TXTDSC" or "NTXTDS") */
if (!strncmp(token, "TXTDSC", 6) ||
!strncmp(token, "NTXTDS", 6))
{
if (EcDENCGetPath(chView->denc, hstr, fileName,
sizeof(fileName), False))
{
printf("external reference to text file '%s'\n",
fileName);
}
}
/* check for picture reference ("PICREP") */
if (!strncmp(token, "PICREP", 6))
{
if (EcDENCGetPath(chView->denc, hstr, fileName,
sizeof(fileName), False))
{
printf("external reference to picture file
'%s'\n", fileName);
}
}
} // if
feat=EcFeatureGetNext(feat);
} // while
} // end of getFileReferences()
#define _WINNT_SOURCE
#include <stdio.h>
#ifdef _WINNT_SOURCE
#include <windows.h>
#else
#include <X11/Xlib.h>
#endif
#include "eckernel.h"
#ifdef _WINNT_SOURCE
#define FLOPPY_DRIVE "A:\\"
#else
#define FLOPPY_DRIVE "/floppy"
#endif
if (stat(path, &stBuf) == 0)
{
if (stBuf.st_mode & _S_IFDIR)
ret=True;
}
return ret;
}
switch (reason)
{
// called before a package is imported and another version
// of the package is already installed
case EC_DENC_REPLACE_PACKAGE:
sprintf(hstr, "Replace existing version of package '%s'?",
name);
#ifdef _WINNT_SOURCE
iret=MessageBox(NULL, hstr, "dencTest", MB_YESNO);
if (iret == IDNO) result=False;
#else
printf("%s\n", hstr);
scanf("%c", &hstr);
if (toupper(hstr[0]) == 'N') result=False;
#endif
break;
default:
break;
}
return result;
}
#define _WINNT_SOURCE
#include <stdio.h>
#ifdef _WINNT_SOURCE
#include <windows.h>
#else
#include <X11/Xlib.h>
#endif
#include "eckernel.h"
} // end of showUpdateInfo()
10 Index
installation of ................................................35
G permanent......................................................21
time limited ...................................................21
general functions ........................................................38 types of..........................................................21
generation uddate............................................................21
of directENC packages................................. 20 package handling ......................................................... 6
of package access keys................................. 22 package handling functions........................................ 38
packages
H directENC .......................................................8
PAK ................................................................... 8, 9, 21
handling pak archive................................................................. 13
chart display ................................................... 6 PAK archive
directENC files............................................. 25 handling ..................................................28, 29
directENC package..................................28, 29 PAK archives ............................................................. 22
package handling............................................ 6 installation of ................................................28
PAK archive ............................................28, 29 PAK handliing ........................................................... 15
history files.................................................................14 PAK handling functions............................................. 39
PAKs.......................................................................... 13
generation of .................................................22
I installation of ................................................35
import permanent PAKs ...........................................21
7CK archives.................................................. 3 time limited PAKs.........................................21
7CK chart packages........................................ 3 types of..........................................................21
directENC files............................................. 16 update PAKs .................................................21
files into directENC structure....................... 26 passport
S-57 data....................................................... 30 installation passport ..............................4, 9, 22
iniotialization .............................................................15 permanent PAKs ........................................................ 21
installation picture files .......................................................... 15, 17
of directENC chart packages........................ 35 delete.............................................................17
of directENC packages................................. 28 PID............................................................................. 19
of PAK archives ........................................... 28 producer agency catalog............................................. 12
producer code functions ............................................. 38
of PAKs........................................................ 35 product ID ............................................................ 19, 20
installation passport...................................... 4, 9, 15, 22
protection system
installed directENC files
copy protection................................................7
information about ......................................... 17
K Q
quick guide................................................................... 3
Kernel
EC2007 ECDIS .............................................. 5
R
M recognized file types .................................................. 11
reference cell.............................................................. 13
multimedia files.................................................... 15, 17 remove
delete ............................................................ 17 directENC files..............................................17
N S
naming conventions S-57
directENC..................................................... 23 conversion into SENC format .......................31
S-57 base cells
P import of .......................................................30
S-57 data
package ......................................................................14 import of .......................................................30
delete ............................................................ 17 S-57 update ................................................................ 31
directENC................................................16, 19 SENC cell .................................................................. 12
package access key............................................. 8, 9, 21 SENC cells................................................................. 16
handling...................................................28, 29 SENC files
PAK archives ............................................... 22 delete.............................................................17
package access key archives SENC format.............................................................. 19
installation of................................................ 28 conversion of S-57 into .................................31
package access keys shuttle
generation of................................................. 22 ENC Shuttle ..................................................35
structure U
creation of directENC ................................... 25
directENC directory...................................... 24 update
EcUpdateInfo................................................ 33 S-57 .............................................................. 31
update files
import of....................................................... 30
T update functions......................................................... 39
terminology ................................................................ 37 update PAKs .............................................................. 21
text files ............................................................... 15, 17
delete............................................................. 17 W
time limited PAKs...................................................... 21
Windows
ENC Shuttle.................................................. 35