You are on page 1of 67

directENC Concept

July 2003

SevenCs AG & Co. KG, Hamburg, Germany


Page i

SevenCs AG & Co. KG


Ruhrstraße 90
22761 Hamburg

Tel. +49 (0)40/851 7240


FAX +49 (0)40/851 5440
http:// www.sevencs.com

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.

directENC Concept July 2003


Page ii

This page intentionally left blank.

directENC Concept July 2003


Preface Page iii

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.

directENC Concept July 2003


Page iv

This page intentionally left blank.

directENC Concept July 2003


Contents Page v

Contents

Preface .............................................................................................................iii

Contents............................................................................................................ v

1 Introduction....................................................................................... 1
1.1 Conventions Used in this Document .................................................... 1

2 directENC Quick Guide ................................................................... 3

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

4 Abstract: directENC Directory Structure.................................... 11


4.1 Files in the directENC Path ................................................................ 11
4.2 Directories in the directENC Path ...................................................... 11
4.3 Recognized File Types ....................................................................... 11
4.3.1 Producer Agency Catalog (PRODCODE.7CA) ................................. 12
4.3.2 SENC Cell (7CB, 7CT) ...................................................................... 12
4.3.3 Cell Catalog (CATALOG.7CC)......................................................... 12
4.3.4 Reference Cell (7CR) ......................................................................... 13
4.3.5 Package Access Keys (PAKs) (7CP) ................................................. 13
4.3.6 PAK Archive (7CK) ........................................................................... 13
4.3.7 Package (7CX).................................................................................... 14
4.3.8 History Files (7CH) ............................................................................ 14
4.3.9 ENC Files (000, 001, ...)..................................................................... 14
4.3.10 Installation Passport (INSTPASS.TXT)............................................. 15
4.3.11 Text/Picture/Multimedia Files (TXT, TIF, ...) ................................... 15
4.4 Initialization........................................................................................ 15
4.5 PAK Handling .................................................................................... 15
4.6 Import of directENC Files .................................................................. 16
4.6.1 Packages (7CX) .................................................................................. 16
4.6.2 SENC Cells......................................................................................... 16

directENC Concept July 2003


Page vi Contents

4.6.3 ENC Files ............................................................................................16


4.6.4 Text, Picture and Multimedia Files .....................................................17
4.7 Removal of directENC Files ...............................................................17
4.7.1 Packages (7CX)...................................................................................17
4.7.2 SENC Files, ENC Files, Text, Picture and Multimedia Files .............17
4.8 Information About Installed directENC Files .....................................17
4.9 Callback Mechanism...........................................................................18

5 directENC Packages in Detail........................................................ 19


5.1 directENC Package Naming Conventions ..........................................19
5.2 directENC Package Content................................................................20
5.3 Generation of directENC Packages.....................................................20

6 Package Access Keys (PAKs) in Detail ......................................... 21


6.1 PAK Types ..........................................................................................21
6.1.1 Time Limited PAKs ............................................................................21
6.1.2 Permanent PAKs .................................................................................21
6.1.3 Update PAKs.......................................................................................21
6.2 Generation of Package Access Keys...................................................22
6.2.1 Installation Passport ............................................................................22

7 directENC Concept in Detail ......................................................... 23


7.1 directENC Naming Conventions.........................................................23
7.2 directENC Directory Structure............................................................24
7.3 directENC File Handling.....................................................................25
7.3.1 Creation of directENC Structure .........................................................25
7.3.2 Import Files into the directENC Structure ..........................................26
7.3.3 Delete Files From the directENC Structure ........................................26
7.3.4 directENC Callback Function .............................................................27
7.4 directENC Package and PAK Archive Handling................................28
7.4.1 Installation of directENC Packages and PAK Archives .....................28
7.4.2 directENC Package Handling .............................................................29
7.4.3 PAK Archive Handling .......................................................................29
7.5 S-57 Base and Update Files ................................................................30
7.5.1 S-57 Import .........................................................................................30
7.5.2 S-57 to SENC Conversion and S-57 Updating ...................................31

8 ENC Shuttle (Windows Only)........................................................ 35

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

directENC Concept July 2003


Contents Page vii

9.2.3 Automatic Cell Loading ..................................................................... 38


9.2.4 Package Handling............................................................................... 38
9.2.5 Producer Codes................................................................................... 38
9.2.6 ENC File Conversion / Updating ....................................................... 39
9.2.7 PAK Handling .................................................................................... 39
9.3 Sample Programs................................................................................ 40
9.3.1 Sample Program 1 .............................................................................. 40
9.3.2 Sample Program 2 .............................................................................. 42
9.3.3 Sample Program 3 .............................................................................. 44
9.3.4 Sample Program 4 .............................................................................. 46
9.3.5 Sample Program 5 .............................................................................. 48
9.3.6 Sample Program 6 .............................................................................. 50
9.3.7 Sample Program 7 .............................................................................. 54

10 Index ................................................................................................. 55

directENC Concept July 2003


Page viii

This page intentionally left blank.

directENC Concept July 2003


1 Introduction Page 1

1 Introduction

1.1 Conventions Used in this Document


Times New Roman font is used for
ƒ plain text in this document

Italic font is used for:


ƒ program and component names

Boldface is used for:


ƒ chapter and section headlines
ƒ important notes
ƒ cross references

Courier New font is used for:


ƒ any text typed by the user
ƒ file content and names

Note:

Displays important information which should not be ignored.

Displays examples of program code.

directENC Concept July 2003


Page 2

This page intentionally left blank.

directENC Concept July 2003


2 directENC Quick Guide Page 3

2 directENC Quick Guide

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.

1. Initialize the directENC functionality with EcDENCCreate(). The function


EcDENCCreate() will create a specific directory structure as well (also
referred to as directENC directory structure).
2. Use EcDENCImportFile() to import 7CK or 7CX archives. The PAKs
will be automatically installed and added to the chart PAK database.
Use EcDENCImportTree() to import the 7CX chart packages and the
respective PAKs (package access keys). The PAKs are contained in 7CK
archives.

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()).

Following is the sequence of the function calls described above:

01 EcDENCCreate() initializes directENC functionality


02a EcDENCImportTree() recursively imports all files (or directENC
packages) from a directory tree into the
directENC structure
02b EcDENCImportFile() imports a single 7CX or 7CK archives

directENC Concept July 2003


Page 4 2 directENC Quick Guide

4. To display the installed directENC charts use the functions of the following
sequence:

03 EcChartViewCreate () creates a new view structure


04 EcDrawSetViewport() defines centre and range of Viewport
05 EcDENCLoadViewByArea() Loads cells needed to cover the given
viewport
06 EcChartSymbolizeView() Symbolization
07 EcDrawNTDrawView() Draws all cells that are currently
assigned to the given view.

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.

directENC Concept July 2003


3 Background Information Page 5

3 Background Information

3.1 What is Behind the directENC Concept?


SevenCs has developed a concept called "directENC" that simplifies and
accelerates the handling of ENCs. The underlying idea is that prior to distribution
ENCs are converted into the SENC format of the EC2007 ECDIS Kernel. As a
consequence, the import of ISO8211 formatted ENCs on board can be replaced by
a simple copy of SENC files from CD-ROM to the hard disk of the ECDIS. The
ECDIS can directly access the SENC file, thus plug & play for digital charts
becomes reality. For easy separation from other files, SENC files that comply
with the directENC concept carry the extension .7CB.
At first glance, directENC is thus a synonym for the native SENC format of the
ECDIS Kernel. From a broader perspective, the directENC concept incorporates
more than the pre-processing of ENCs, it is a chart management concept.
Besides the direct import of data in directENC format the directENC concept also
allows the import of S-57 base files and update files. S-57 data is converted into
SENC format and automatically integrated into the directENC structure. The S-57
updating according to ENC Product Specification is fully supported (please refer
to chapter 7.5 S-57 Base and Update Files).

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

CD-ROM 7CK Chart


Automatic permit Definition
Import database of
ENC
Shuttle viewport

Create
view

Import of directENC data into an EC2007 ECDIS Kernel based application

directENC Concept July 2003


Page 6 3 Background Information

3.2 Package Handling


The main interest of the end user is not a single ENC but ENC coverage.
Therefore the directENC concept supports the grouping of ENC files. Chart
packages covering a particular sea area are provided. These packages are read by
the ECDIS application and added to the systems database.
The EC2007 offers dedicated functions that allow package handling like
installation, removing, and query of chart packages.

3.3 Chart Display Handling


To ensure that the directENC data is displayed in a consistent manner, the
directENC concept features a set of functions that handle the loading,
symbolization, and visualization of SENC files in a comfortable way (See the
respective chapter of the EC2007 ECDIS Kernel Programmers Guide) for a
detailed description).

3.3.1 Automatic Cell Loading


To create a chart display by means of the Kernel functions first one (or more)
cells in SENC format must be loaded (or mapped, term derived from the memory
mapping method). The selection of cells depends on the particular application.

3.3.1.1 Data Production Application


In a data production application only that cell is loaded which is currently
modified. It is up to the user to select that cell.
For this selection the application utilizes the Kernel functions EcCellMap()
and EcChartAssignCellToView(). The latter is necessary to allow
assigning a selection of so-called mariner’s settings to the cell. These settings are
required for the correct display of the cell. The selection of mariner’s settings is
stored in the view.

3.3.1.2 ECDIS Application


In an ECDIS application, however, the user should spend as little time as possible
with selecting charts. The cell catalogue enables the system to select which cells
must be loaded for the selected viewport (i.e. geographic chart centre and selected
range, function EcDrawSetViewport()).
The Kernel offers the functions EcDENCLoadViewByArea() and
EcDENCLoadViewByAreaExt2(), respectively. These functions select the
cells, load the selected cells, and assign them to the view.
The cells are selected according to the following procedure:
First the usage (or navigational purpose) is selected according to the range set in
the view. The selection is based on an internal allocation table which, however,

directENC Concept July 2003


3 Background Information Page 7

can be changed by means of the functions EcDrawRangeToScale() and


ECDrawScaleToUsageExt()if required.
Then it is attempted to cover the viewport with cells of the specific usage. For this
purpose the cell catalogue is searched for cells with this usage, and their
geographic coverage is checked. If finally there are still areas in the viewport
which are not covered yet the system starts searching for cells of the second best
(i.e. less detailed) usage.
This procedure is repeated as long as either the viewport is covered completely, or
no more suitable cells can be found. Cells of a “better” (i.e. more detailed) usage
than the one originally selected will not be taken into account. Due to the amount
of details which would then be depicted according to the selected range the
display would probably become too slow and too crammed.
The application can affect the select algorithm by means of an installed Callback
function (EcChartSetCellLoadSortCallback()).
This function is called from the Kernel after all cells overlapping the viewport
have been identified in the cell catalogue. The information about usage, priority
and the producer code of the cells are forwarded to the Callback function as
parameters. Then the application can modify this list, remove single items, or
create an altogether new list, and transfer it back to the Kernel.
The order of the single items in this list determines the ranking of cells in the
further selection procedure. By default the list is pre-sorted according to the
following three criteria:

1. Usage (best first)


the usage of a cell is determined by the producer.
2. Priority (highest first)
the priority of a cell is determined by the distributor.
3. Import Date (newest first)
date when a cell was imported into the SENC structure.

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

3.4 Copy Protection System


The directENC concept supports the copy protection of chart data. Access to a
SENC file can be restricted by means of a package access key (PAK).

directENC Concept July 2003


Page 8 3 Background Information

3.5 Overview: directENC Packages


Electronic charts in directENC format are usually not provided as single files but
as chart packages. The packages are provided by dedicated distributors and can be
downloaded via the internet and/or will be sent on CD.
A chart package is an archive containing the chart data itself (i.e. cells in SevenCs
SENC format) and additional files to administer the package, and can also contain
text and/or image files. A package can be identified by its file extension 7CX.
Each package is named after the sea area that is covered.
directENC packages are generated by the data producer or distributors of
directENC data (local chart dealers). The chart database created by Navionics and
SevenCs is the source of the cells comprising all these packages.
directENC packages are copy-protected. Thus to read these packages, package
access keys (PAKs) are required. The latter will also be provided by the
distributor of the chart packages.
Applications supporting the directENC concept should have a dedicated
directENC installation directory. The application should regularly check the
directENC installation directory. If new charts and PAKs are detected they should
be installed automatically.
The easiest way to import new chart packages and their corresponding package
access keys is to move them to the installation directory. SevenCs provides a
standalone tool called ENCShuttle (free of charge) to automatically move chart
packages and PAKs from any location on your system to the applications
directENC installation directory (see chapter 8 ENC Shuttle (Windows Only)).

directENC Concept July 2003


3 Background Information Page 9

3.6 Overview: Package Access Keys / Installation Passport


Electronic charts in directENC format are copy protected. This means they can be
used for one dedicated installation (i.e. application) only, but not copied from one
system to another. Therefore a unique package access key is required that is valid
for one particular installation only.
The distributor of the chart packages provides the package access keys. These
keys are dependent on two parameters, the product ID of a particular chart
package (which is assigned during package compilation) and the hardware
specifications of the target system (i.e. hardware ID of the system used for
installation of directENC application).
The directENC distributor calculates the package access keys with help of a key
generator. The two input parameters product ID and system’s hardware ID are
used for key generation.
The product ID is stored in the distributor’s database. The System Hardware
specifications, however, must be provided by the end user. To facilitate this
procedure the Installation Passport was introduced. This passport contains all the
relevant information about the end users Hardware specifications.
To generate the Installation passport (automatically or on demand) the directENC
application must call the corresponding Kernel functions. The installation passport
is an ASCII text file (default name INSTPASS.TXT). The directENC application
should allow the mariner to create an Installation passport, assign a name and save
it.
The mariner must send the Installation passport to his or her directENC
distributor. The installation passport is stored in the database of the distributor.
From this moment on the distributor can generate dedicated package access keys
for all available chart packages.

directENC Concept July 2003


Page 10

This page intentionally left blank.

directENC Concept July 2003


4 Abstract: directENC Directory Structure Page 11

4 Abstract: directENC Directory Structure

4.1 Files in the directENC Path


CATALOG.7CC Cell catalogue
INSTPASS.TXT Installation passport
PRODCODE.7CA Producer agency catalogue

4.2 Directories in the directENC Path


CELLS Basic path for SENC cells and history files
(7CB, 7CT, 7CH)
PACKAGES Contains reference cells (7CR)
PERMITS Contains PAK files (7CK)
TEMP Contains tempory files, e.g. during package
installation
TIF Basic path for image files and multimedia
files (TIF, GIF)
TXT Basic path for text files (TXT)
UPDATES Basic path for ENC cells and update files
(000, 001, ...)

4.3 Recognized File Types


7CA Producer agency catalogue
7CB, 7CT SENC cell
7CC Cell catalogue
7CR Reference cell
7CP PAK (Package access key) file
7CK PAK (Package access key) archive
7CX Package
7CH History file

000..999 ENC file

TXT Text file


HTM HTML file
DOC Document

directENC Concept July 2003


Page 12 4 Abstract: directENC Directory Structure

TIF Picture in TIFF format


JPG Picture in JPEG format
GIF Picture in GIF format
PDF Picture in PDF format

MP3 Multimedia file in MP3 format


WAV Multimedia file in WAV format
MPG Multimedia file in MPEG format
AVI Multimedia file in AVI format

4.3.1 Producer Agency Catalog (PRODCODE.7CA)


Functions: EcDENCImportFile()
EcDENCGetPACEntryByNumber()
EcDENCGetPACEntryByCode()
EcDENCGetAllPACEntries()
This file contains a list of all Producer Agency (i.e. data manufacturer) Codes
hitherto known.
The list is managed by the Open ECDIS Forum (www.openecdis.org). It can be
used to transform the numeric code included in the cells into text (see 9.3.1
Sample Program 1).

4.3.2 SENC Cell (7CB, 7CT)


Functions: EcDENCImportFile()
EcDENCGetPath()
EcDENCDeleteFile()
SENC is a data format that has been optimized to provide quick access. A SENC
cell contains geographic and descriptive data for a defined area. ENC cells (000)
must be converted into SENC cells before utilizing them. To utilize a SENC cell a
corresponding PAK (package access key) must be installed. This PAK determines
access rights (read/write) and possibly a time limitation of access rights.

4.3.3 Cell Catalog (CATALOG.7CC)


Functions: EcDENCCreate()
EcDENCGetCatalogueList()
EcCellGetCatalogueInfoExt()
The cell catalogue contains information about all installed SENC cells. It is
generated automatically, and is updated whenever cells are imported or deleted.
Applications should never try to manipulate the cell catalogue since this may
result in inconsistencies (see 9.3.2 Sample Program 2).

directENC Concept July 2003


4 Abstract: directENC Directory Structure Page 13

4.3.4 Reference Cell (7CR)


Functions: EcDENCGetInstalledPackages()
EcDENCGetPackageInfo()
EcDENCGetPackageBestView()
Each package contains a reference cell carrying the extension 7CR. This reference
cell contains all relevant information about the package, e.g. names of included
cells, geographic coverage and an (optional) representative coordinate which may
be used in a preview.

4.3.5 Package Access Keys (PAKs) (7CP)


Functions: EcDENCImportFile()
EcCellAddChartPermit()
EcCellRemoveChartPermit()
EcCellReadChartPermits()
PAKs are needed to grant read or write access to cells in SENC format (7CB).
The PAK determines the kind of access (read only, or write as well).
A PAK is valid for one dedicated protID. This protID can be unique for each cell,
or can be assigned to a group of cells (e.g. a package). In the latter case the PAK
is valid for all cells of this group. Apart from the kind of access the PAK may also
include a runtime limit.
There can always be just one PAK per protID, i.e. when a PAK is newly installed
a possibly existing PAK for the same protID will be overwritten. Thus it is always
the PAK that was last installed which is used for a protID.
PAKs are sequences of hexadecimal characters which normally are delivered as
PAK archive (7CK), or as file (7CP) containing one or more PAKs. In exceptional
cases PAKs can also be delivered by fax or phone.
Generally PAKs are hardware-dependent, i.e. they can only be used on the
computer system for which they were created. All necessary information will be
provided by the installation passport.

4.3.6 PAK Archive (7CK)


Functions: EcDENCImportFile()
EcDENCSetPAKSearchPath()
EcDENCGetInstalledPAKs()
A PAK archive contains one or more PAKs (package access keys; 7CP) as a
packed archive. Normally, it is delivered with a package. (See Sample Program
3) It may also contain a file with the extension HID. In this case the hardware ID
of the computer is compared with the file name. Only if they match the PAKs of
the package will be installed.

directENC Concept July 2003


Page 14 4 Abstract: directENC Directory Structure

4.3.7 Package (7CX)


Functions: EcDENCImportFile()
EcDENCGetInstalledPackages()
EcDENCGetPackageInfo()
EcDENCGetPackageBestView()
EcDENCDeletePackage()
A package contains SENC cells plus (optional) text and multimedia files which
are grouped according to either geography or topic. Packages may overlap, and
may contain data from several manufacturers. The files belonging to one package
are delivered as packed archive.
To install a package a valid PAK (package access key) must be available, or must
have been installed already. Normally, the PAK is delivered as PAK archive along
with the package, and is installed automatically (see 9.3.3 Sample Program 3 and
9.3.6 Sample Program 6).

4.3.8 History Files (7CH)


Functions: EcDENCGetUpdateInfo()
For each installed file automatically a history file is created in the same directory.
This file carries the same name, but its extension is 7CH.
The history file contains information about when the file was installed or deleted
respectively, and about updates which were applied. For SENC cells additional
information about protID, PAK, etc. are stored. History files will not be deleted
when the corresponding cell is deleted (see 9.3.7 Sample Program 7).

4.3.9 ENC Files (000, 001, ...)


Functions: EcDENCImportFile()
EcDENCImportS57ExchangeSet()
EcDENCCheckUpdates()
EcDENCApplyUpdates()
ENC files must be converted into SENC format before they can be used. Basic
cells (000) are converted into SENC cells of the same name (7CB). Update files
(001, 002, ...) are applied to the SENC cell. The conversion is not automatically
initialized by merely importing an ENC file. After importing the application must
check whether there are any ENC files, and then explicitly start the conversion
(see 9.3.6 Sample Program 6 and 9.3.7 Sample Program 7).

directENC Concept July 2003


4 Abstract: directENC Directory Structure Page 15

4.3.10 Installation Passport (INSTPASS.TXT)


Functions: EcDENCCreateInstallationPass()
The application should create an installation passport to ensure that all necessary
information is at hand when packages, cells and/or PAKs shall be ordered. The
installation passport can then be transferred via e-mail, web-browser or fax.
Likewise it is necessary when support is needed in case any problems should
occur (see 9.3.4 Sample Program 4).

4.3.11 Text/Picture/Multimedia Files (TXT, TIF, ...)


Functions: EcDENCImportFile()
EcDENCGetPath()
EcDENCDeleteFile()
Data in SENC cells may reference text files or image files, e.g. the description of
extraordinary dangers or a picture of a port entrance. The referenced files are
delivered in one package together with the cell, and are automatically installed. If
necessary the application can then display the contents of these files in
combination with the information contained in the cell (see 9.3.5 Sample
Program 5).

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.5 PAK Handling


ƒ Temporary/permanent PAKs
ƒ Expired PAKs
ƒ Search path
During the import of packages the respective package access keys (PAKs) are
looked for unless they have been already installed.
The search is carried out as follows:
First the directory containing the package to be installed is searched, then the
PAK search path. If the search path is not explicitly set by means of the function
EcDENCSetPAKSearchPath() by default the root directory of floppy drive
A is searched (applies to Windows systems only; see 9.3.6 Sample Program 6).

directENC Concept July 2003


Page 16 4 Abstract: directENC Directory Structure

4.6 Import of directENC Files


Functions: EcDENCImportFile(), EcDENCImportTree(),
EcDENCImportS57ExchangeSet()

4.6.1 Packages (7CX)


When a package is identified (by means of the extension 7CX) it is first checked
whether it contains a file carrying the extension PID. If so, the name of the
respective file is interpreted as protID, and an already installed PAK for this
protID is looked for. If such PAK cannot be found the directory containing the
package (7CX) and the set PAK search path are searched for all PAK archives
(7CK), and these archives are installed. Then a PAK matching the protID
mentioned above is searched.
If still no matching PAK can be found the package is rejected.
If, however, a matching PAK is found it is checked whether another version of the
respective package has been installed yet. This is done by means of the reference
cell (7CR).
If the directory PACKAGES already contains a file of the same name it is
assumed that the package (or another version of the package) has been previously
installed. In this case the user is given the opportunity (by means of the Callback
mechanism) to decide whether the package shall be installed nevertheless, or shall
be rejected.
In case the package contains PAKs (7CP) these will be unpacked first (in the
TEMPPERM directory), and then installed. The other files of the package are
unpacked in the TEMP directory, and afterwards installed separately. During the
installation the tests described below are carried out.
If the package contains a reference cell (7CR) this is installed in the PACKAGES
directory (see 9.3.6 Sample Program 6).

4.6.2 SENC Cells


Before a cell is installed the validity period of the associated PAK, edition and
update number of the cell are determined. If no valid PAK is installed the cell is
rejected. Then it is checked whether another version of that cell has already been
installed.
If so, PAK validity period, edition and update number of the installed cell are
determined. In case edition and update number match the cell with the shorter
PAK validity period is installed or kept respectively, otherwise the cell with the
higher edition or update number (in case the edition numbers match). After this
the history file and the cell catalogue are updated.

4.6.3 ENC Files


ENC files are copied to a special directory (UPDATES) where they are kept for
future conversions into SENC format (see 9.3.6 Sample Program 6).

directENC Concept July 2003


4 Abstract: directENC Directory Structure Page 17

4.6.4 Text, Picture and Multimedia Files


These files are installed without any further testing.

4.7 Removal of directENC Files


Functions: EcDENCDeleteFile(), EcDENCDeleteTree()

4.7.1 Packages (7CX)


When a package shall be deleted the PACKAGES directory is searched for the
associated reference cell. Out of this reference cell information about all SENC
cells in the package is read. For each of these cells it is then checked whether it is
contained in another package as well. If this is not the case the cell is deleted, and
a corresponding entry is stored to the respective history file.

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.

4.8 Information About Installed directENC Files


Functions: EcDENCGetCatalogueList()
EcCellGetCatalogueInfoExt()
EcDENCGetInstalledPackages()
EcDENCGetPackageInfo()
If necessary a list of all installed cells can be created by means of reading out the
cell catalogue with the appropriate function.
It is also possible to generate a list of all installed packages. This information is
retrieved by searching the PACKAGES directory for reference cells.
On the other hand, for each installed package a list of all cells it comprises can be
generated (see 9.3.2 Sample Program 2 and 9.3.3 Sample Program 3).

directENC Concept July 2003


Page 18 4 Abstract: directENC Directory Structure

4.9 Callback Mechanism


Functions: EcDENCSetDisclaimerCallback()
EcDENCSetCallbackExt()
EcDENCRemoveCallbackExt()
Depending on the number of cells included the import or the deletion of packages
can be quite time-consuming.
In order to display the progress of the action a callback function can be defined.
This function then is called anew for every affected cell.
Moreover a function can be defined which is called instead of the standard
function whenever a so-called disclaimer file is detected while importing a
package. These files contain advice on how to use the cells included in a package.
Normally the content of these disclaimer files is displayed before the cells of a
package are installed, and the user is requested to accept the advice by confirming
a dialogue (see 9.3.6 Sample Program 6).

directENC Concept July 2003


5 directENC Packages in Detail Page 19

5 directENC Packages in Detail

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:

5.1 directENC Package Naming Conventions


Format: “PPNNNNLGT_xxx_V_M_S.7CX”
P: packer of ENC package
N: number
L: licence, professional (P, for rent), leisure (L, for sale)
G: area, sea (S, open sea), inland (I, inland waterways)
T: type, sale (S), demo (D), test (T)
xxx: format: text, max. 100 characters, e.g. The_Elbe_Schulau_to_Hamburg
V: major version
M: minor version
S: sub minor version
7CX: extension of directENC package

Example: 7COST2PST_Baltic_Sea_german_middle_west_part_1_0_2.7CX

directENC Concept July 2003


Page 20 5 directENC Packages in Detail

5.2 directENC Package Content

Amount File Type File Description


Extension
unlimited SENC 7CB Chart files in SevenCs SENC format
1 reference 7CR Cell with package information used
file for package handling
1 name file NAM Used for package handling
1 product pid File indicating product ID of
ID file directENC package (used for
protected packages only)
1 (at least) text file txt Disclaimer of data producer, package
producer
optional others text files, images, html, …

5.3 Generation of directENC Packages


For directENC chart producers and retailers SevenCs provides the ENC
Dispatcher. With help of the ENC Dispatcher a particular sea area can be defined.
Automatically the required cells are imported from a database and added to the
directENC package. The product ID is assigned and the administrative files (i.e.
reference file, name file, product ID file disclaimer(s)) are generated and also
added to the package. The ENC Dispatcher automatically takes care of the naming
conventions.

directENC Concept July 2003


6 Package Access Keys (PAKs) in Detail Page 21

6 Package Access Keys (PAKs) in Detail

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.

6.1 PAK Types


Depending on the licence type the direct ENC concept supports different types of
PAKs.

6.1.1 Time Limited PAKs


The PAKs of corresponding chart packages are valid for a limited period of time.
The length of this period depends on the licensing scheme of the individual
directENC distributor (directENC dealer).
Usually mariners who want to update their directENC data regularly should buy
temporary licenses.
When the time limited PAKs have expired the application can’t display the
directENC data properly any more. Artificial distortions and a visual warning
“licence expired” are indicating that the corresponding chart packages must not be
used any longer. Three months after the expiration date the corresponding cells
cannot be used any longer. New package access keys are required.

6.1.2 Permanent PAKs


Permanent directENC licenses should be used for sea areas where regular updates
are not required. The corresponding PAKs won’t expire.

6.1.3 Update PAKs


The use of update PAKs allows maximum flexibility concerning the licensing
scheme. The idea behind update PAKs is that they can be used only in
conjunction with a reference PAK. The reference PAK can be any permanent
PAK that has been installed in a previous session.
The use of update PAKs for example allows the distributor to grant discounts for
new chart packages if a particular package was acquired before.

directENC Concept July 2003


Page 22 6 Package Access Keys (PAKs) in Detail

Update PAKs are unlimited, but they are valid only in conjunction with the
specified reference PAK.

6.2 Generation of Package Access Keys


For directENC dealers SevenCs provides special tools to generate package access
keys. A package access key (PAK) is a coded ( multiple character ) string that is
written to a package access key file. PAK file names carry the extension 7CP.
Analogue to directENC chart files PAK files are also grouped in archives which
are called PAK archives.
A PAK archive can be identified by its file extension 7CK. Besides the extension
there are no naming conventions for PAK archives. PAK archives contain
package access key files plus an optional file. This file is named after the system
hardware ID that was used to create the package access keys, its extension is HID.
This file allows to identify the associated system the PAKs were generated for.
To prevent the installation of a non-matching PAK archive this file is checked by
the directENC application. The application then will refuse the installation in case
the hardware IDs do not match.
The amount of PAK files per archive is unlimited.
Every single PAK is unique and can be used on one dedicated system to install
one dedicated directENC package only. The system is identified by its unique
hardware ID. This hardware ID is the same as the one to register the ECDIS
Kernel software. The directENC package is identified by its product ID.
To generate a PAK the two parameters productID (PID) and hardwareID (HID)
must be known. The PID is provided by the producer of the directENC package
(e.g. same body as distributor or separate producer who cooperates with the
distributor). The HID must be provided by the end user (e.g. mariner, ship owner,
OEM).

6.2.1 Installation Passport


As described before to generate individual PAKs the end user must provide the
system’s hardware ID. Depending on the application this identification number is
not necessarily accessible or visible to the end user. The system’s hardware ID is
also used when the EC2007 Kernel is registered. The most convenient way to
retrieve the Hardware specifications of the system and write them into a file is by
means of the Installation Passport.
To write the Installation Passport EcDENCCreateInstallationPass()
must be called. The default name of this ASCII file is INSTPASS.TXT. Besides
information about the Operating System, OS Version, EC2007 Kernel Version,
environment settings, etc. the file holds the required hardware ID.
The Installation Passport must be sent to the directENC Chart dealer, where the
information is stored. From this moment on individual PAKs for all directENC
packages of the distributors stock can be generated. Usually the PAKs should be
provided together with the respective directENC packages the end user acquires.

directENC Concept July 2003


7 directENC Concept in Detail Page 23

7 directENC Concept in Detail

The directENC concept requires specific naming conventions and a specific


directory structure. The EC2007 ECDIS Kernel provides a dedicated function set
EC27_DENC() to install, handle and visualize directENC data.

7.1 directENC Naming Conventions


The following file extensions are used in the directENC directory structure:

7CB cells in directENC format


7CR directENC package reference cell
7CP package access key file
7CT temporary data
7CH history files
7CC cell catalogue file
7CA catalogue containing producing agency codes
TXT text files in ASCII format
TIF picture files in TIF-format

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

directENC Concept July 2003


Page 24 7 directENC Concept in Detail

7.2 directENC Directory Structure


To achieve the plug & play effect while copying directENC packages and package
access keys to the ECDIS hard disk the ECDIS software relies on a standardized
directory structure.
The <DENC_ROOT> directory is specified by the application programmer while
the subdirectories are standardized, and are created by means of EC2007 ECDIS
Kernel functions. The directENC directory structure is as follows:

Files in the <DENC_ROOT> directory


CATALOG.7CC Cell catalogue
INSTPASS.TXT Installation passport
PRODCODE.7CA Producer agency catalogue

Directories in the <DENC_ROOT> directory


CELLS Basic path for SENC cells and history files
(7CB, 7CT, 7CH)
PACKAGES Contains reference cells (7CR)
PERMITS Contains PAK files (7CK)
TEMP Contains tempory files, e.g. during package
installation
TIF Basic path for image files and multimedia
files (TIF, GIF)
TXT Basic path for text files (TXT)
UPDATES Basic path for ENC cells and update files
(000, 001, ...)

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).

directENC Concept July 2003


7 directENC Concept in Detail Page 25

7.3 directENC File Handling


The directENC structure must be initialized before the functions of the EC2007
Function Set EC27_DENC can be used. During initialization the directory
structure described above is automatically created.

7.3.1 Creation of directENC Structure


The function to create a directENC structure and the standardized directory
structure is called EcDENCCreate(). The parameters are:
di pointer to a dictionary context
path location of <DENC_ROOT> directory (will
be created if it does not already exist)
forceFlag catalogue overwrite flag

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

directENC Concept July 2003


Page 26 7 directENC Concept in Detail

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.

7.3.2 Import Files into the directENC Structure


To import files into the directENC directory structure the functions
EcDENCImportFile() or EcDENCImportTree() can be used. The
function EcDENCImportFile() is used to import a single file. The parameters
are:
denc pointer to EcDENC structure
di pointer to object dictionary context
fullName file name including path

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.

7.3.3 Delete Files From the directENC Structure


It is not only possible to add files to a directENC structure but also to remove
them from such a structure. The function EcDENCDeleteFile() is used to
remove a single file from a directENC structure. The parameters are:
denc pointer to EcDENC structure
di pointer to object dictionary context
fileName file name (no path required)

This function removes a file from the directENC structure. Before the file is

directENC Concept July 2003


7 directENC Concept in Detail Page 27

deleted, the callback function, if any has been set with


EcDENCSetCallback(), is invoked with the parameter reason set to
EC_DENC_DELETE. If the callback returns True, the delete procedure will
remove the specified file from the directENC structure and updates the cell
catalogue. The parameter filename must specify a valid directENC file.

7.3.4 directENC Callback Function


The callback function which is invoked by the import, delete, and update
functions can be set using the ECDIS Kernel function
EcDENCSetCallback(). The parameters are:
denc pointer to EcDENC structure
callBack pointer to callback function

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)

Possible values for the parameter reason are:


EC_DENC_IMPORT
EC_DENC_DELETE
EC_DENC_UPDATE

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

directENC Concept July 2003


Page 28 7 directENC Concept in Detail

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().

To remove a previously installed callback you can use the function


EcDENCRemoveCallbackExt(). However, you should use this function only
to remove callbacks that have been installed with
EcDENCSetCallbackExt().

Note:
Do not use the function EcDENCRemoveCallbackExt() to remove
callbacks that have been installed with EcDENSetCallback(). For these
callbacks, use EcDENRemoveCallback() instead.

7.4 directENC Package and PAK Archive Handling

7.4.1 Installation of directENC Packages and PAK Archives


The import of directENC packages and PAK archives works the same as the
import of any other file into the directENC structure (please refer to chapter 7.3.2
Import Files into the directENC Structure). The function
EcDENCImportTree() can be used to install all directENC packages and
PAK archives from a specified path (Install Path). This Install Path should be
passed to the parameter path of the function EcDENCImportTree().
directENC packages will be installed only if a corresponding PAK is available
either in the PAK database of the system (i.e. PAK file was installed in previous
session), or in the Install Path or in dedicated PAK archive search path. The
PAK archive search path can be specified with the function
EcDENCSetPAKSearchPath(). By default, the search path is set to "A:" (the
first floppy drive) on Windows systems. On Unix systems, the default search path
is empty.
When the corresponding PAK of a directENC package is detected in the Install
Path or in dedicated PAK archive search path both PAKs and directENC packages
are installed.
For Windows users SevenCs provides a special tool called ENC Shuttle (see
chapter 8 ENC Shuttle (Windows Only)) to automatically move directENC
packages and PAK-Archives from any location (local, LAN, internet) into the
Install Path of the directENC application.
To ensure that the directENC application integrates with the ENC Shuttle special
entries in the Windows registry are necessary. The function
EcDENCRegisterApplication() must be used to enter the name of the

directENC Concept July 2003


7 directENC Concept in Detail Page 29

application and the application specific directENC install directory (Install Path).

7.4.2 directENC Package Handling


As described above the function EcDENCImportTree() is used to install
directENC packages located in the applications Install Path. During installation
the content of the packages is copied into the TEMP directory of the directENC
directory structure. Then every single file is automatically moved to its final
destination within the directENC directory structure.
SENC, Text and Image files are moved to a file specific path of the subdirectories
CELLS, TXT, or TIF respectively. For every single file that is moved to its final
destination a history file is created. The history file contains information like
import date and time, SENC version, protection status, PID, edition number,
update number, issue date, update date, and others.
The package reference files (i.e. files with extension 7CR) are used for package
handling (e.g. to list all packages that have been installed or to delete the cells of a
particular package). During package installation they are copied into the directory
PACKAGES. Besides, a history file for each package is created. These history files
are used to log the installation and deletion of directENC packages.

7.4.3 PAK Archive Handling


PAK archives that are located in the Install Path or the PAK archive search path
will be automatically installed when EcDENCImportTree() is called to install
directENC packages (located in the install directory). First the PAKs will be
installed, then the corresponding directENC packages.
To install PAK archives located anywhere else an additional call of
EcDENCImportTree() is required. The path containing such PAK archives
must be passed to the function.
During the installation process of PAK archives it is not checked whether
corresponding directENC packages are available or not.
During the installation it is only checked whether the PAKs are valid for the
current system or not if the PAK archive contains an additional file named after
the system hardware ID. If there is no such additional file the PAK will be
installed anyway, and marked “accepted” or “not accepted” in the PAK database
of the system.
During the installation of the PAKs they are automatically added to the PAK
database of the system (i.e. one single PAK file called PERMITS.7CP). This file
is automatically updated when new PAKs are imported. The file is located in the
/config directory of the Kernel installation. The Kernel will always parse this file
whenever a protected cell shall be mapped. Protected cells can only be mapped
and displayed if a corresponding PAK entry is found in the PAK database of the
system.
During installation of the PAK archives the PAKs are copied to the TEMP
directory of the directENC directory structure. Then the PAKs are added to the
systems chart PAK database. The PAK files of each PAK archive are moved the
directENC directory PERMITS.

directENC Concept July 2003


Page 30 7 directENC Concept in Detail

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.

7.5 S-57 Base and Update Files


In addition to the direct installation of SENC data in directENC format the
directENC concept supports the import of S-57 data. Both the import of S-57 base
cells as well as automatic updating of ENC data according to the ENC Product
Specification is supported.
Files in S-57 format, i.e. S-57 base cells or update files, first must be converted
into the directENC format or applied to the corresponding cell, respectively. This
is not done automatically by the directENC import functions. The S-57 files are
collected in the update directory of the directENC structure. From here they can
be checked and moved into the correct subdirectories.

7.5.1 S-57 Import


Files in S-57 format can be imported with the functions
EcDENCImportFile() or EcDENCImportTree() but must be processed
further in order to be added to the directENC structure (see chapter 7.5.2. S-57 to
SENC Conversion and S-57 Updating).

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

directENC Concept July 2003


7 directENC Concept in Detail Page 31

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

7.5.2 S-57 to SENC Conversion and S-57 Updating


After importing S-57 files or an S-57 exchange set the updating functions
EcDENCCheckUpdates() and EcDENCApplyUpdates()should be called
to convert the S-57 files into the SENC format, apply any updates, and copy the
cells into the respective directories of the directENC structure.
To check if any new S-57 base cells are available or if any updates can be applied
the function EcDENCCheckUpdates() is used. The parameters are:
denc pointer to EcDENC structure
di pointer to object dictionary context

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.

directENC Concept July 2003


Page 32 7 directENC Concept in Detail

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().

directENC Concept July 2003


7 directENC Concept in Detail Page 33

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 structure EcUpdateInfo has the following members:

Data Type Parameter Parameter Description


Name
char *featName (out of use)
char *action type of change (can be inserted, deleted
or modified)
char *objClass feature object class (6 char acronym)
char *info additional information
EcCoordinate lat, lon latitude and longitude of position
int recId record ID of feature object
int updNum update number
long applyDate date when update was applied
long issueDate issue date of update
int specialUpd flag for special update messages

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.

directENC Concept July 2003


Page 34 7 directENC Concept in Detail

This page intentionally left blank.

directENC Concept July 2003


8 ENC Shuttle (Windows Only) Page 35

8 ENC Shuttle (Windows Only)

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.

Choose dialogue of ENC Shuttle

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.

directENC Concept July 2003


Page 36 8 ENC Shuttle (Windows Only)

When the content of the default folder is no longer needed it can be cleared by
using Clear Archive.

directENC Concept July 2003


9 Appendices Page 37

9 Appendices

9.1 Abbreviations and Terminology

ENC Electronic navigational chart (S57/ISO8211 format)


SENC System ENC (SevenCs proprietary format)
PAK Package access key (SevenCs proprietary format)
ProtID Protection ID (SevenCs proprietary format)
DENC directENC (SevenCs proprietary format)

Cell File containing ENC or SENC chart data


Package Archive containing a collection of charts

directENC Concept July 2003


Page 38 9 Appendices

9.2 directENC Functions

9.2.1 General Functions


EcDENCCreate()
EcDENCCreateInstallationPass()
EcDENCRegisterApplication()
EcDENCDelete()
EcDENCGetPath()
EcDENCCheckFilename()
EcDENCCreateArchive
EcDENCExtractArchive()

9.2.2 Chart Import


EcDENCSetDisclaimerCallback()
EcDENCSetCallback()
EcDENCSetCallbackExt()
EcDENCRemoveCallbackExt()
EcDENCImportFile()
EcDENCDeleteFile()
EcDENCDeleteTree()
EcDENCImportTree()
EcDENCImportS57ExchangeSet()

9.2.3 Automatic Cell Loading


EcDENCGetCatalogueList()
EcCellGetCatalogueInfoExt()
EcDENCLoadViewByAreaExt()
EcDENCLoadViewByAreaExt2()
EcDENCLoadViewByArea()

9.2.4 Package Handling


EcDENCSetPAKSearchPath()
EcDENCGetInstalledPAKs()
EcDENCGetInstalledPackages()
EcDENCGetPackageInfo()
EcDENCGetPackageBestView()
EcDENCDeletePackage()

9.2.5 Producer Codes


EcDENCGetPACEntryByNumber()
EcDENCGetPACEntryByCode()
EcDENCGetAllPACEntries()

directENC Concept July 2003


9 Appendices Page 39

9.2.6 ENC File Conversion / Updating


EcDENCCheckUpdates()
EcDENCApplyUpdates()
EcDENCApplyUpdatesExt()
EcDENCCompleteUpdates()
EcDENCGetUpdateInfo()

9.2.7 PAK Handling


EcCellAddChartPermit()
EcCellRemoveChartPermit()
EcCellReadChartPermits()

directENC Concept July 2003


Page 40 9 Appendices

9.3 Sample Programs

9.3.1 Sample Program 1

// 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"

#define SAMPLE_CELL_NAME "/home/cells/7C1W0000.7CB"


#define SAMPLE_DENC_PATH "/home/directENC/DENC"

int main(int argc, char **argv)


{
EcDENC *denc; // handle of DENC structure
EcCellId cid; // cell ID
EcPACInfo pacInfo; // producer agency code structure
EcDictInfo *dictInfo; // handle of dictionary info structure

// step 1 - create a DENC structure, need to read dictionaries before


dictInfo=EcDictionaryReadExt("OBJCATV3.DIC", "ATRCATV3.DIC", stderr);
if (dictInfo == NULL)
{
printf("error: cannot read dictionaries\n");
exit(1);
}

denc=EcDENCCreate(dictInfo, SAMPLE_DENC_PATH, False);


if (denc == NULL)
{
printf("error: cannot create DENC structure\n");
EcDictionaryFree(dictInfo);
exit(1);
}

Continued on next page

directENC Concept July 2003


9 Appendices Page 41

Sample Program 1 (continued)


// step 2 - map the cell
cid=EcCellMap(SAMPLE_CELL_NAME, EC_ACCESSREAD, 0);
if (cid == EC_NOCELLID)
{
printf("error: cannot map cell\n");
EcDENCDelete(denc);
EcDictionaryFree(dictInfo);
exit(1);
}

// 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);
}

// step 4 - convert the number into a string


if (!EcDENCGetPACEntryByNumber(denc, &pacInfo))
printf("error: cannot convert code into string\n");
else
printf("producer of cell is: '%s'\n", pacInfo.name);

// step 5 - unmap the cell


EcCellUnmap(cid);

// step 6 - destroy DENC structure


EcDENCDelete(denc);

// step 7 - free dictionaries


EcDictionaryFree(dictInfo);
} // end of main()

directENC Concept July 2003


Page 42 9 Appendices

9.3.2 Sample Program 2

// 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 SAMPLE_DENC_PATH "/home/directENC/DENC"

int main(int argc, char **argv)


{
int usage; // usage of the cell
Bool ok; // check return code
char name[256], title[256], pos1[256], pos2[256]; // name of
cell, title and position
EcCoordinate lat_ll, lon_ll, lat_ur, lon_ur; // corner
coordinates
EcDENC *denc; // handle of DENC structure
EcCatList *catList; // handle of cell catalog list
EcDictInfo *dictInfo; // handle of dictionary info structure

// step 1 - create a DENC structure, need to read dictionaries before


dictInfo=EcDictionaryReadExt("OBJCATV3.DIC", "ATRCATV3.DIC", stderr);
if (dictInfo == NULL)
{
printf("error: cannot read dictionaries\n");
exit(1);
}

denc=EcDENCCreate(dictInfo, SAMPLE_DENC_PATH, False);


if (denc == NULL)
{
printf("error: cannot create DENC structure\n");
EcDictionaryFree(dictInfo);
exit(1);
}

Continued on next page

directENC Concept July 2003


9 Appendices Page 43

Sample Program 2 (continued)

// step 2 - get handle of catatlog list (does not need to be freed)


catList=EcDENCGetCatalogueList(denc);
if (catList == NULL)
{
printf("error: cannot get catalog list\n");
EcDENCDelete(denc);
EcDictionaryFree(dictInfo);
exit(1);
}

// step 3 - read contents of catalog list


title[0]=(char)0;
ok=EcCellGetCatalogueInfoExt(catList, EC_FIRST, &lat_ll, &lon_ll,
&lat_ur, &lon_ur, &usage, name, sizeof(name), title, sizeof(title));
while (ok)
{
EcOutPositionToString(pos1, lat_ll, lon_ll, 3);
EcOutPositionToString(pos2, lat_ur, lon_ur, 3);
printf("'%s', '%s', %X, %s, %s\n", name, title, usage, pos1, pos2);
title[0]=(char)0;
ok=EcCellGetCatalogueInfoExt(catList, EC_NEXT, &lat_ll, &lon_ll,
&lat_ur, &lon_ur, &usage, name, sizeof(name), title, sizeof(title));
}

// step 4 - destroy DENC structure


EcDENCDelete(denc);

// step 5 - free dictionaries


EcDictionaryFree(dictInfo);
} // end of main()

directENC Concept July 2003


Page 44 9 Appendices

9.3.3 Sample Program 3

// read the information about the installed PAKs and packages

#define _WINNT_SOURCE

#include <stdio.h>

#ifdef _WINNT_SOURCE
#include <windows.h>
#else
#include <X11/Xlib.h>
#endif

#include "eckernel.h"

void listFunc(EcDENC *denc, const EcDictInfo *dictInfo)


{
int i, j, k, nInstPAKs, nInstPackages, nCells;
int *nCovPolyPts, nCovPoly;
char *hptr;
char **packageNames, **cellNames;
double bvRange;
EcProtId *protIds, pId;
EcCoordinate *covLatLon, bvLat, bvLon;

/* get installed PAK files */


nInstPAKs=EcDENCGetInstalledPAKs(&protIds);
if (nInstPAKs > 0)
{
fprintf(stdout, "Installed PAKs: %d\n", nInstPAKs);
for (i=0; i<nInstPAKs; i++)
fprintf(stdout, "\tProtId [%d]: %s\n", i, protIds[i].cPid);

/* free prot ids*/


EcFree(protIds);
} // if

/* get installed packages */


nInstPackages=EcDENCGetInstalledPackages(denc, &packageNames,
&protIds);
if (nInstPackages > 0)
{
fprintf(stdout, "\nInstalled Packages: %d\n", nInstPackages);
for (i=0; i<nInstPackages; i++)
{
fprintf(stdout, "\tPackage[%d]: %s\n", i, packageNames[i]);
fprintf(stdout, "\tProtId [%d]: %s\n", i, protIds[i].cPid);

/* get cells of package */


nCells=EcDENCGetPackageInfo(denc, dictInfo,

Continued on next page

directENC Concept July 2003


9 Appendices Page 45

Sample Program 3 (continued)

packageNames[i], &pId, &cellNames, &covLatLon, &nCovPolyPts,


&nCovPoly);
if (nCells > 0)
{
fprintf(stdout, "\tContained Cells: %d\n", nCells);
for (j=0; j<nCells; j++)
fprintf(stdout, "\t\tCell[%d]: %s\n", j,
cellNames[j]);

/* 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

/* free vertex counts */


EcFree(nCovPolyPts);

/* free coordinate array */


EcFree(covLatLon);
} // if
/* get location of "best view" of package */
if (EcDENCGetPackageBestView(denc, dictInfo,
packageNames[i], &bvLat, &bvLon, &bvRange))
{
char posStr[64];
EcOutPositionToString(posStr, bvLat, bvLon, 2);
fprintf(stdout, "\tBest View: %s (%3.1lf nm)\n",
posStr, bvRange);
} // if
} // for

/* free package names */


for (i=nInstPackages-1; i>=0; i--)
EcFree(packageNames[i]);
EcFree(packageNames);

/* free prot ids */


EcFree(protIds);
} // if
} // end of listFunc()

directENC Concept July 2003


Page 46 9 Appendices

9.3.4 Sample Program 4

// create an installation passport

#define _WINNT_SOURCE

#include <stdio.h>

#ifdef _WINNT_SOURCE
#include <windows.h>
#else
#include <X11/Xlib.h>
#endif

#include "eckernel.h"

#define SAMPLE_DENC_PATH "/home/directENC/DENC"


#define APP_NAME "directENC-Sample"

int main(int argc, char **argv)


{
const char *ptr; // pointer to environment variable
EcDENC *denc; // handle of DENC structure
EcDictInfo *dictInfo; // handle of dictionary info structure

// step 1 - create a DENC structure, need to read dictionaries before


dictInfo=EcDictionaryReadExt("OBJCATV3.DIC", "ATRCATV3.DIC", stderr);
if (dictInfo == NULL)
{
printf("error: cannot read dictionaries\n");
exit(1);
}

denc=EcDENCCreate(dictInfo, SAMPLE_DENC_PATH, False);


if (denc == NULL)
{
printf("error: cannot create DENC structure\n");
EcDictionaryFree(dictInfo);
exit(1);
}

// step 2 - create installation passport

// get host name


#ifdef _WINNT_SOURCE
ptr=getenv("USERDOMAIN");
#else
ptr=getenv("HOST");
#endif

EcDENCRegisterApplication(denc, APP_NAME, NULL);

Continued on next page

directENC Concept July 2003


9 Appendices Page 47

Sample Program 4 (continued)

if (!EcDENCCreateInstallationPass(denc, NULL, APP_NAME, ptr, "PC",


NULL, NULL, "For test purpose only"))
printf("error: cannot create installation pass\n");
// step 3 - destroy DENC structure
EcDENCDelete(denc);

// step 4 - free dictionaries


EcDictionaryFree(dictInfo);
} // end of main()

directENC Concept July 2003


Page 48 9 Appendices

9.3.5 Sample Program 5

// get external file references from feature objects in a cell

#define _WINNT_SOURCE

#include <stdio.h>

#ifdef _WINNT_SOURCE
#include <windows.h>
#else
#include <X11/Xlib.h>
#endif

#include "eckernel.h"

void getFileReferences(EcCellId cid, const EcDictInfo *dictInfo)


{
char attr[256], hstr[256], fileName[256];
Bool ok;
EcFeature feat;
EcFindInfo findInfo;

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);
}
}

Continued on next page

directENC Concept July 2003


9 Appendices Page 49

Sample Program 5 (continued)

} // if

ok=EcFeatureGetAttributes(feat, dictInfo, &findInfo, EC_NEXT,


attr, sizeof(attr));
} // while

feat=EcFeatureGetNext(feat);
} // while

} // end of getFileReferences()

directENC Concept July 2003


Page 50 9 Appendices

9.3.6 Sample Program 6

// use the callback mechanism to control the import of files

#define _WINNT_SOURCE

#include <stdio.h>

#ifdef _WINNT_SOURCE
#include <windows.h>
#else
#include <X11/Xlib.h>
#endif

#include "eckernel.h"

#define SAMPLE_IMPORT_NAME "/home/directENC/importDir"


#define SAMPLE_DENC_PATH "/home/directENC/DENC"

#ifdef _WINNT_SOURCE
#define FLOPPY_DRIVE "A:\\"
#else
#define FLOPPY_DRIVE "/floppy"
#endif

// check if specified name is a directory


Bool IsDir(const char *path)
{
Bool ret=False;
struct stat stBuf;

if (stat(path, &stBuf) == 0)
{
if (stBuf.st_mode & _S_IFDIR)
ret=True;
}
return ret;
}

// callback for import of directENC files


Bool dencCallBack(EcDENC *denc, const char *name, int reason)
{
int iret;
char hstr[256];
Bool result=True;

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;

Continued on next page

directENC Concept July 2003


9 Appendices Page 51

Sample Program 6 (continued)

#else
printf("%s\n", hstr);
scanf("%c", &hstr);
if (toupper(hstr[0]) == 'N') result=False;
#endif
break;

case EC_DENC_IMPORT: break; // called before a file is imported


case EC_DENC_DELETE: break; // called before a file is deleted
case EC_DENC_UPDATE: break; // called before a file is updated
case EC_DENC_ARCHIV: break; // called before an archive is
imported

case EC_DENC_UPDATE_APPLIED: break; // called after an update


has been successfully applied
case EC_DENC_UPDATE_DELETED: break; // called after an update
has been deleted
case EC_DENC_UPDATE_WRONG_UPDN: break; // called after an update
number did not match
case EC_DENC_UPDATE_WRONG_EDTN: break; // called after an edition
number did not match
case EC_DENC_UPDATE_NO_CELL: break; // called after no base
cell was found for an update
case EC_DENC_UPDATE_ERROR: break; // called after update
could not be applied

case EC_DENC_IMPORT_ERROR: break; // called after file


could not be imported
case EC_DENC_IMPORT_ERROR_NO_PERMIT: break; // called after no
permit found for a cell
case EC_DENC_IMPORT_ERROR_BAD_CRC: break; // called after a
checksum error in a package
case EC_DENC_IMPORT_CANCELLED: break; // called after
import has been cancelled

default:
break;
}

return result;
}

// callback for import of S57 exchange sets


Bool s57CallBack(int volId, int volNum, const char *fileName)
{
char ch;
printf("insert Disk %d of %d and enter any character to
continue\n", volId, volNum);
scanf("%c", &ch);
return True;
}

Continued on next page

directENC Concept July 2003


Page 52 9 Appendices

Sample Program 6 (continued)

// callback for disclaimer files


Bool disclaimerCallBack(EcDENC *denc, const char *name, int nFiles)
{
printf("disclaimer file '%s', %d files follow\n", name, nFiles);
return True;
}

int main(int argc, char **argv)


{
int nFiles;
EcDENC *denc; // handle of DENC structure
EcDictInfo *dictInfo; // handle of dictionary info structure

// step 1 - create a DENC structure, need to read dictionaries before


dictInfo=EcDictionaryReadExt("OBJCATV3.DIC", "ATRCATV3.DIC", stderr);
if (dictInfo == NULL)
{
printf("error: cannot read dictionaries\n");
exit(1);
}

denc=EcDENCCreate(dictInfo, SAMPLE_DENC_PATH, False);


if (denc == NULL)
{
printf("error: cannot create DENC structure\n");
EcDictionaryFree(dictInfo);
exit(1);
}

// step 2 - install an import and a disclaimer callback function


EcDENCSetCallback(denc, dencCallBack);
EcDENCSetDisclaimerCallback(denc, disclaimerCallBack);

// step 3 - set search path for PAK files


EcDENCSetPAKSearchPath(denc, FLOPPY_DRIVE);

// step 4 - import files


if (IsDir(SAMPLE_IMPORT_NAME))
{
// import name specifies a directory
nFiles=EcDENCImportTree(denc, dictInfo, SAMPLE_IMPORT_NAME);
}
else
{
// import name specifies a file, check for S57 exchange set
("CATLOG.030" or "CATLOG.031")
if (strstr(SAMPLE_IMPORT_NAME, "CATLOG.03"))
nFiles=EcDENCImportS57ExchangeSet(denc, dictInfo,
SAMPLE_IMPORT_NAME, s57CallBack, True);
else
nFiles=EcDENCImportFile(denc, dictInfo, SAMPLE_IMPORT_NAME);
}

Continued on next page

directENC Concept July 2003


9 Appendices Page 53

Sample Program 6 (continued)

// step 5 - check for imported ENC files (base cells or updates)


if (nFiles > 0)
{
nFiles=EcDENCCheckUpdates(denc, dictInfo);
if (nFiles > 0)
nFiles=EcDENCApplyUpdates(denc, dictInfo);
}

// step 6 - destroy DENC structure


EcDENCDelete(denc);

// step 7 - free dictionaries


EcDictionaryFree(dictInfo);
} // end of main()

directENC Concept July 2003


Page 54 9 Appendices

9.3.7 Sample Program 7

// show information on applied updates for the specified cell

#define _WINNT_SOURCE

#include <stdio.h>

#ifdef _WINNT_SOURCE
#include <windows.h>
#else
#include <X11/Xlib.h>
#endif

#include "eckernel.h"

void showUpdateInfo(EcDENC *denc, const char *cellName)


{
int i, nInfos=0;
char hstr[256], posStr[64];
EcUpdateInfo *updInfo;

EcDENCGetUpdateInfo(denc, cellName, &updInfo, &nInfos);


if (nInfos > 0)
{
for (i=0; i<nInfos; i++)
{
// print update information
switch (updInfo[i].specialUpd)
{
case EC_UPDATE_BASE_CELL:
sprintf(hstr, "New dataset");
break;
case EC_UPDATE_EDITION_AVAIL:
sprintf(hstr, "A new edition will be available
soon");
break;
case EC_UPDATE_REMOVE_CELL:
sprintf(hstr, "Dataset has been deleted");
break;
default:
EcOutPositionToString(posStr, updInfo[i].lat,
updInfo[i].lon, 3);
sprintf(hstr, "%s %s at %s", updInfo[i].objClass,
updInfo[i].action, posStr);
break;
} // switch
} // for

// free info array


EcFree(updInfo);
} // if

} // end of showUpdateInfo()

directENC Concept July 2003


9 Appendices Page 55

10 Index

directENC package .................................................... 19


7 content .......................................................... 20
generation ..................................................... 20
7CK archives directENC packages............................................... 8, 16
import ............................................................. 3 installation of................................................ 28
7CK chart packages directENC path
import ............................................................. 3 directories in................................................. 11
files in........................................................... 11
A directENC structure
delete files from............................................ 26
abbreviations.............................................................. 37 import files ................................................... 26
automatic cell loading functions ................................ 38 directENCstructure
creation of..................................................... 25
C directories
in directENC path......................................... 11
callback function........................................................ 27 directory structure
callback mechanism ................................................... 18 directENC..................................................... 24
cell catalog ................................................................. 12 display
chart display handling .................................................. 6
directENC charts ............................................ 4
chart import functions ................................................ 38
document ..................................................................... 1
chart packages.............................................................. 6
import ............................................................. 3
concept E
dierectENC ..................................................... 5 EC2007 ECDIS Kernel ................................................ 5
content EcUpdateInfo
directENC package ....................................... 20 structure of.................................................... 33
conventions ENC Dispatcher ......................................................... 20
in document .................................................... 1 ENC file conversion functions................................... 39
conversion ENC files ............................................................. 14, 16
S-57 to SENC format.................................... 31 delete ............................................................ 17
copy protection....................................................... 7, 21 ENC Shuttle ............................................................... 35
creation
of directENC structure.................................. 25
F
D file handling
directENC..................................................... 25
delete file types
ENC files ...................................................... 17 recognized .................................................... 11
files from directENC structure...................... 26 files
multimedia files ............................................ 17 delete from ENC structure............................ 26
package ......................................................... 17 import into directENC structure ................... 26
picture files ................................................... 17 in directENC path......................................... 11
SENC files .................................................... 17 fonts
text files ........................................................ 17 in document .................................................... 1
directENC functions
callback function........................................... 27 automatic cell loading .................................. 38
directory structure......................................... 24 chart import .................................................. 38
file handling.................................................. 25 ENC file conversion ..................................... 39
naming conventions...................................... 23 general functions .......................................... 38
package handling .................................... 28, 29 package handling.......................................... 38
directENC chart packages PAK handling............................................... 39
installation of ................................................ 35 producer codes.............................................. 38
directENC charts updating........................................................ 39
display............................................................. 4
directENC concept ................................................. 5, 23
directENC files
import ........................................................... 16
information about installed ........................... 17
remove .......................................................... 17

directENC Concept July 2003


Page 56 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

directENC Concept July 2003


9 Appendices Page 57

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

directENC Concept July 2003

You might also like