/usr/share/ncarg/hluex/mapplot/mp07c.c is in libncarg-data 6.4.0-9.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | /*
* $Id: mp07c.c,v 1.4 2010-03-15 22:49:24 haley Exp $
*/
/***********************************************************************
* *
* Copyright (C) 2002 *
* University Corporation for Atmospheric Research *
* All Rights Reserved *
* *
***********************************************************************/
/*
* File: mp07c.c
*
* Author: Mary Haley
* National Center for Atmospheric Research
* PO 3000, Boulder, Colorado
*
* Date: Mon Mar 4 14:34:48 MST 2002
*
* Description: Shows how to draw high-resolution coastlines using the
* RANGS (Regionally Accessible Nested Global Shorelines), developed
* by Rainer Feistel from Wessel and Smith's GSHHS (Global
* Self-consistent Hierarchical High-resolution Shoreline) database.
* To access the RANGS/GSHHS database, you must first download it from
* Rainer Feistel's web site at
* http://www.io-warnemuende.de/homepages/rfeistel/index.html. Right
* before the section entitled "Some WWW Links", you should see a
* little table with ten *.zip files to download:
*
* rangs(0).zip gshhs(0).zip
* rangs(1).zip gshhs(1).zip
* rangs(2).zip gshhs(2).zip
* rangs(3).zip gshhs(3).zip
* rangs(4).zip gshhs(4).zip
*
* You must download all ten of these files, unzip them, and either
* put them in the default directory
* "$NCARG_ROOT/lib/ncarg/database/rangs", or put them somewhere else
* and set the environment variable NCARG_RANGS to this directory. The
* files take up about 140 megabytes, unzipped. Once you have the
* files in the appropriate location, then set the mpDataBaseVersion
* resource to "RANGS_GSHHS" to create maps using this database. You
* should not use this database to plot maximal area plots, because 1)
* you will get horizontal lines through your plot, and 2) it takes a
* long time.
*
*/
#include <stdio.h>
#include <math.h>
#include <ncarg/gks.h>
#include <ncarg/ncargC.h>
#include <ncarg/hlu/hlu.h>
#include <ncarg/hlu/App.h>
#include <ncarg/hlu/NcgmWorkstation.h>
#include <ncarg/hlu/PSWorkstation.h>
#include <ncarg/hlu/PDFWorkstation.h>
#include <ncarg/hlu/CairoWorkstation.h>
#include <ncarg/hlu/MapPlot.h>
int main(int argc, char *argv[])
{
int wks,appid,mapid;
int rlist;
char const *wks_type = "x11";
/*
* Initialize the high level utility library
*/
NhlInitialize();
rlist = NhlRLCreate(NhlSETRL);
/*
* Create an application object.
*/
NhlRLClear(rlist);
NhlCreate(&appid,"mp07",NhlappClass,NhlDEFAULT_APP,rlist);
if (!strcmp(wks_type,"ncgm") || !strcmp(wks_type,"NCGM")) {
/*
* Create a meta file workstation
*/
NhlRLClear(rlist);
NhlRLSetString(rlist,NhlNwkMetaName,"./mp07c.ncgm");
NhlCreate(&wks,"mp07Work",
NhlncgmWorkstationClass,NhlDEFAULT_APP,rlist);
}
else if (!strcmp(wks_type,"x11") || !strcmp(wks_type,"X11")) {
/*
* Create an X workstation
*/
NhlRLClear(rlist);
NhlCreate(&wks,"mp07Work",NhlcairoWindowWorkstationClass,appid,rlist);
}
else if (!strcmp(wks_type,"oldps") || !strcmp(wks_type,"OLDPS")) {
/*
* Create an older-style PostScript workstation.
*/
NhlRLClear(rlist);
NhlRLSetString(rlist,NhlNwkPSFileName,"./mp07c.ps");
NhlCreate(&wks,"mp07Work",
NhlpsWorkstationClass,NhlDEFAULT_APP,rlist);
}
else if (!strcmp(wks_type,"oldpdf") || !strcmp(wks_type,"OLDPDF")) {
/*
* Create an older-style PDF workstation.
*/
NhlRLClear(rlist);
NhlRLSetString(rlist,NhlNwkPDFFileName,"./mp07c.pdf");
NhlCreate(&wks,"mp07Work",
NhlpdfWorkstationClass,NhlDEFAULT_APP,rlist);
}
else if (!strcmp(wks_type,"pdf") || !strcmp(wks_type,"PDF") ||
!strcmp(wks_type,"ps") || !strcmp(wks_type,"PS")) {
/*
* Create a cairo PS/PDF workstation.
*/
NhlRLClear(rlist);
NhlRLSetString(rlist,NhlNwkFileName,"./mp07c");
NhlRLSetString(rlist,NhlNwkFormat,(char*)wks_type);
NhlCreate(&wks,"mp07Work",
NhlcairoDocumentWorkstationClass,NhlDEFAULT_APP,rlist);
}
else if (!strcmp(wks_type,"png") || !strcmp(wks_type,"PNG")) {
/*
* Create a cairo PNG workstation.
*/
NhlRLClear(rlist);
NhlRLSetString(rlist,NhlNwkFileName,"./mp07c");
NhlRLSetString(rlist,NhlNwkFormat,(char*)wks_type);
NhlCreate(&wks,"mp07Work",
NhlcairoImageWorkstationClass,NhlDEFAULT_APP,rlist);
}
/*
* Create and draw a map with all mainland US counties outlined.
*/
NhlRLClear(rlist);
NhlRLSetFloat(rlist,NhlNvpWidthF, 0.80);
NhlRLSetFloat(rlist,NhlNvpHeightF, 0.80);
NhlRLSetFloat(rlist,NhlNvpXF, 0.15);
NhlRLSetFloat(rlist,NhlNvpYF, 0.90);
NhlRLSetString(rlist,NhlNmpProjection,"CylindricalEquidistant");
/*
* "LowRes" is the default database, also sometimes known
* as "Ncarg4_0".
*
*/
NhlRLSetString(rlist,NhlNmpDataBaseVersion, "LowRes");
/*
* Zoom in on part of the map.
*/
NhlRLSetString(rlist,NhlNmpLimitMode,"LatLon");
NhlRLSetFloat(rlist,NhlNmpMinLatF, 30.);
NhlRLSetFloat(rlist,NhlNmpMaxLatF, 60.);
NhlRLSetFloat(rlist,NhlNmpMinLonF, -15.);
NhlRLSetFloat(rlist,NhlNmpMaxLonF, 15. );
/*
* Turn on the labeling of lat/lon lines.
*/
NhlRLSetString(rlist,NhlNpmTickMarkDisplayMode,"Always");
NhlCreate(&mapid,"mp07",NhlmapPlotClass,wks,rlist);
/*
* Draw map and advance the frame.
*/
NhlDraw(mapid);
NhlFrame(wks);
/*
* Set the resource indicating you want to use the high-resolution
* RANGS/GSHHS database.
*/
NhlRLClear(rlist);
NhlRLSetString(rlist,NhlNmpDataBaseVersion,"RANGS_GSHHS");
NhlSetValues(mapid,rlist);
NhlDraw(mapid);
NhlFrame(wks);
/*
* Destroy the objects created, close the HLU library and exit.
*/
NhlDestroy(wks);
NhlClose();
exit(0);
}
|