⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 s57writer.cpp

📁 支持各种栅格图像和矢量图像读取的库
💻 CPP
📖 第 1 页 / 共 3 页
字号:
/****************************************************************************** * $Id: s57writer.cpp 10646 2007-01-18 02:38:10Z warmerdam $ * * Project:  S-57 Translator * Purpose:  Implements S57Writer class. * Author:   Frank Warmerdam, warmerdam@pobox.com * ****************************************************************************** * Copyright (c) 2003, Frank Warmerdam * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. ****************************************************************************/#include "s57.h"#include "ogr_api.h"#include "cpl_conv.h"#include "cpl_string.h"CPL_CVSID("$Id: s57writer.cpp 10646 2007-01-18 02:38:10Z warmerdam $");/************************************************************************//*                             S57Writer()                              *//************************************************************************/S57Writer::S57Writer(){    poModule = NULL;    poRegistrar = NULL;    nCOMF = 10000000;    nSOMF = 10;}/************************************************************************//*                             ~S57Writer()                             *//************************************************************************/S57Writer::~S57Writer(){    Close();}/************************************************************************//*                               Close()                                *//*                                                                      *//*      Close the current S-57 dataset.                                 *//************************************************************************/int S57Writer::Close(){    if( poModule != NULL )    {        poModule->Close();        delete poModule;        poModule = NULL;    }    return TRUE;}/************************************************************************//*                           CreateS57File()                            *//*                                                                      *//*      Create a new output ISO8211 file with all the S-57 data         *//*      definitions.                                                    *//************************************************************************/int S57Writer::CreateS57File( const char *pszFilename ){    DDFModule  oModule;    DDFFieldDefn *poFDefn;    Close();    nNext0001Index = 1;/* -------------------------------------------------------------------- *//*      Create and initialize new module.                               *//* -------------------------------------------------------------------- */    poModule = new DDFModule();    poModule->Initialize();/* -------------------------------------------------------------------- *//*      Create the '0000' definition.                                   *//* -------------------------------------------------------------------- */    poFDefn = new DDFFieldDefn();    poFDefn->Create( "0000", "", "0001DSIDDSIDDSSI0001DSPM0001VRIDVRIDATTVVRIDVRPCVRIDVRPTVRIDSGCCVRIDSG2DVRIDSG3D0001FRIDFRIDFOIDFRIDATTFFRIDNATFFRIDFFPCFRIDFFPTFRIDFSPCFRIDFSPT",                     dsc_elementary,                      dtc_char_string );    poModule->AddField( poFDefn );/* -------------------------------------------------------------------- *//*      Create the '0001' definition.                                   *//* -------------------------------------------------------------------- */    poFDefn = new DDFFieldDefn();    poFDefn->Create( "0001", "ISO 8211 Record Identifier", "",                      dsc_elementary, dtc_bit_string,                     "(b12)" );    poModule->AddField( poFDefn );/* -------------------------------------------------------------------- *//*      Create the DSID field.                                          *//* -------------------------------------------------------------------- */    poFDefn = new DDFFieldDefn();    poFDefn->Create( "DSID", "Data set identification field", "",                     dsc_vector, dtc_mixed_data_type );    poFDefn->AddSubfield( "RCNM", "b11" );    poFDefn->AddSubfield( "RCID", "b14" );    poFDefn->AddSubfield( "EXPP", "b11" );    poFDefn->AddSubfield( "INTU", "b11" );    poFDefn->AddSubfield( "DSNM", "A" );    poFDefn->AddSubfield( "EDTN", "A" );    poFDefn->AddSubfield( "UPDN", "A" );    poFDefn->AddSubfield( "UADT", "A(8)" );    poFDefn->AddSubfield( "ISDT", "A(8)" );    poFDefn->AddSubfield( "STED", "R(4)" );    poFDefn->AddSubfield( "PRSP", "b11" );    poFDefn->AddSubfield( "PSDN", "A" );    poFDefn->AddSubfield( "PRED", "A" );    poFDefn->AddSubfield( "PROF", "b11" );    poFDefn->AddSubfield( "AGEN", "b12" );    poFDefn->AddSubfield( "COMT", "A" );    poModule->AddField( poFDefn );/* -------------------------------------------------------------------- *//*      Create the DSSI field.                                          *//* -------------------------------------------------------------------- */    poFDefn = new DDFFieldDefn();    poFDefn->Create( "DSSI", "Data set structure information field", "",                     dsc_vector, dtc_mixed_data_type );    poFDefn->AddSubfield( "DSTR", "b11" );    poFDefn->AddSubfield( "AALL", "b11" );    poFDefn->AddSubfield( "NALL", "b11" );    poFDefn->AddSubfield( "NOMR", "b14" );    poFDefn->AddSubfield( "NOCR", "b14" );    poFDefn->AddSubfield( "NOGR", "b14" );    poFDefn->AddSubfield( "NOLR", "b14" );    poFDefn->AddSubfield( "NOIN", "b14" );    poFDefn->AddSubfield( "NOCN", "b14" );    poFDefn->AddSubfield( "NOED", "b14" );    poFDefn->AddSubfield( "NOFA", "b14" );    poModule->AddField( poFDefn );/* -------------------------------------------------------------------- *//*      Create the DSPM field.                                          *//* -------------------------------------------------------------------- */    poFDefn = new DDFFieldDefn();    poFDefn->Create( "DSPM", "Data set parameter field", "",                     dsc_vector, dtc_mixed_data_type );    poFDefn->AddSubfield( "RCNM", "b11" );    poFDefn->AddSubfield( "RCID", "b14" );    poFDefn->AddSubfield( "HDAT", "b11" );    poFDefn->AddSubfield( "VDAT", "b11" );    poFDefn->AddSubfield( "SDAT", "b11" );    poFDefn->AddSubfield( "CSCL", "b14" );    poFDefn->AddSubfield( "DUNI", "b11" );    poFDefn->AddSubfield( "HUNI", "b11" );    poFDefn->AddSubfield( "PUNI", "b11" );    poFDefn->AddSubfield( "COUN", "b11" );    poFDefn->AddSubfield( "COMF", "b14" );    poFDefn->AddSubfield( "SOMF", "b14" );    poFDefn->AddSubfield( "COMT", "A" );    poModule->AddField( poFDefn );/* -------------------------------------------------------------------- *//*      Create the VRID field.                                          *//* -------------------------------------------------------------------- */    poFDefn = new DDFFieldDefn();    poFDefn->Create( "VRID", "Vector record identifier field", "",                     dsc_vector, dtc_mixed_data_type );    poFDefn->AddSubfield( "RCNM", "b11" );    poFDefn->AddSubfield( "RCID", "b14" );    poFDefn->AddSubfield( "RVER", "b12" );    poFDefn->AddSubfield( "RUIN", "b11" );    poModule->AddField( poFDefn );/* -------------------------------------------------------------------- *//*      Create the VRPC field.                                          *//* -------------------------------------------------------------------- */    poFDefn = new DDFFieldDefn();    poFDefn->Create( "VRPC", "Vector Record Pointer Control field", "",                     dsc_vector, dtc_mixed_data_type );    poFDefn->AddSubfield( "VPUI", "b11" );    poFDefn->AddSubfield( "VPIX", "b12" );    poFDefn->AddSubfield( "NVPT", "b12" );    poModule->AddField( poFDefn );/* -------------------------------------------------------------------- *//*      Create the VRPT field.                                          *//* -------------------------------------------------------------------- */    poFDefn = new DDFFieldDefn();    poFDefn->Create( "VRPT", "Vector record pointer field", "*",                     dsc_array, dtc_mixed_data_type );    poFDefn->AddSubfield( "NAME", "B(40)" );    poFDefn->AddSubfield( "ORNT", "b11" );    poFDefn->AddSubfield( "USAG", "b11" );    poFDefn->AddSubfield( "TOPI", "b11" );    poFDefn->AddSubfield( "MASK", "b11" );    poModule->AddField( poFDefn );/* -------------------------------------------------------------------- *//*      Create the ATTV field.                                          *//* -------------------------------------------------------------------- */    poFDefn = new DDFFieldDefn();    poFDefn->Create( "ATTV", "Vector record attribute field", "*",                     dsc_array, dtc_mixed_data_type );    poFDefn->AddSubfield( "ATTL", "b12" );    poFDefn->AddSubfield( "ATVL", "A" );    poModule->AddField( poFDefn );/* -------------------------------------------------------------------- *//*      Create the SGCC field.                                          *//* -------------------------------------------------------------------- */    poFDefn = new DDFFieldDefn();    poFDefn->Create( "SGCC", "Coordinate Control Field", "",                     dsc_vector, dtc_mixed_data_type );    poFDefn->AddSubfield( "CCUI", "b11" );    poFDefn->AddSubfield( "CCIX", "b12" );    poFDefn->AddSubfield( "CCNC", "b12" );    poModule->AddField( poFDefn );/* -------------------------------------------------------------------- *//*      Create the SG2D field.                                          *//* -------------------------------------------------------------------- */    poFDefn = new DDFFieldDefn();    poFDefn->Create( "SG2D", "2-D coordinate field", "*",                     dsc_array, dtc_mixed_data_type );    poFDefn->AddSubfield( "YCOO", "b24" );    poFDefn->AddSubfield( "XCOO", "b24" );    poModule->AddField( poFDefn );/* -------------------------------------------------------------------- *//*      Create the SG3D field.                                          *//* -------------------------------------------------------------------- */    poFDefn = new DDFFieldDefn();    poFDefn->Create( "SG3D", "3-D coordinate (sounding array) field", "*",                     dsc_array, dtc_mixed_data_type );    poFDefn->AddSubfield( "YCOO", "b24" );    poFDefn->AddSubfield( "XCOO", "b24" );    poFDefn->AddSubfield( "VE3D", "b24" );    poModule->AddField( poFDefn );/* -------------------------------------------------------------------- *//*      Create the FRID field.                                          *//* -------------------------------------------------------------------- */    poFDefn = new DDFFieldDefn();    poFDefn->Create( "FRID", "Feature record identifier field", "",                     dsc_vector, dtc_mixed_data_type );    poFDefn->AddSubfield( "RCNM", "b11" );    poFDefn->AddSubfield( "RCID", "b14" );    poFDefn->AddSubfield( "PRIM", "b11" );    poFDefn->AddSubfield( "GRUP", "b11" );    poFDefn->AddSubfield( "OBJL", "b12" );    poFDefn->AddSubfield( "RVER", "b12" );    poFDefn->AddSubfield( "RUIN", "b11" );    poModule->AddField( poFDefn );/* -------------------------------------------------------------------- *//*      Create the FOID field.                                          *//* -------------------------------------------------------------------- */    poFDefn = new DDFFieldDefn();    poFDefn->Create( "FOID", "Feature object identifier field", "",                     dsc_vector, dtc_mixed_data_type );    poFDefn->AddSubfield( "AGEN", "b12" );    poFDefn->AddSubfield( "FIDN", "b14" );    poFDefn->AddSubfield( "FIDS", "b12" );    poModule->AddField( poFDefn );/* -------------------------------------------------------------------- *//*      Create the ATTF field.                                          *//* -------------------------------------------------------------------- */    poFDefn = new DDFFieldDefn();    poFDefn->Create( "ATTF", "Feature record attribute field", "*",                     dsc_array, dtc_mixed_data_type );    poFDefn->AddSubfield( "ATTL", "b12" );    poFDefn->AddSubfield( "ATVL", "A" );    poModule->AddField( poFDefn );/* -------------------------------------------------------------------- *//*      Create the NATF field.                                          *//* -------------------------------------------------------------------- */    poFDefn = new DDFFieldDefn();    poFDefn->Create( "NATF", "Feature record national attribute field", "*",                     dsc_array, dtc_mixed_data_type );    poFDefn->AddSubfield( "ATTL", "b12" );    poFDefn->AddSubfield( "ATVL", "A" );

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -