Update tcllib to 2.0

This commit is contained in:
Joshua Root
2025-01-31 11:02:51 +11:00
parent 1d21d1914a
commit d82c8c930d
6615 changed files with 117002 additions and 52159 deletions
+2 -2
View File
@@ -34,7 +34,7 @@
#set -x
# Script identification:
VERSION=2.7
VERSION=2.10
# Abstraction variables:
PREFIX="@prefix@"
@@ -68,7 +68,7 @@ tcl8/8.6/tdbc/sqlite3-1.1.9.uuid \
libtcl8.5.dylib libtclstub8.5.a"
OLD_VENDOR_DIRS="thread2.7.0 thread2.7.2 thread2.7.3 thread2.8.7 \
thread2.8.8 thread2.8.9 thread2.8.10 \
tcllib1.15 tcllib1.17 tcllib1.18 tclx8.4 tcl8.5 \
tcllib1.15 tcllib1.17 tcllib1.18 tcllib1.21 tclx8.4 tcl8.5 \
itcl4.2.2 itcl4.2.3 itcl4.2.4 itcl4.3.0 \
sqlite3.36.0 sqlite3.40.0 sqlite3.44.2 sqlite3.45.3 \
tdbc1.1.3 tdbcmysql1.1.3 tdbcodbc1.1.3 tdbcpostgres1.1.3 \
Generated Vendored
+3 -5
View File
@@ -31,9 +31,6 @@ all-tclx: all-tcl
@echo ===\> making $(@:%-tcllib=%) in ${DIRPRFX}@VENDOR_TCLLIB_SUBDIR@
@umask 0022; $(MAKE) -C @VENDOR_TCLLIB_SUBDIR@ TCLSH_PROG=@INTREE_TCLSH@ $(@:%-tcllib=%)
# tcllib requires a working tclsh
all-tcllib: all-tcl
%-signify:
@echo ===\> making $(@:%-signify=%) in ${DIRPRFX}${SIGNIFY_SUBDIR}
@umask 0022; $(MAKE) -C ${SIGNIFY_SUBDIR} $(@:%-signify=%)
@@ -65,7 +62,8 @@ destroot-tclx: all-tclx
@echo ===\> staging to destroot in ${DIRPRFX}@VENDOR_TCLX_SUBDIR@
@umask 0022; $(MAKE) -C @VENDOR_TCLX_SUBDIR@ "DESTDIR=${DESTROOT}" @VENDOR_TCLX_INSTALL@
destroot-tcllib: all-tcllib
# tcllib requires a working tclsh
destroot-tcllib: all-tcl
@echo ===\> staging to destroot in ${DIRPRFX}@VENDOR_TCLLIB_SUBDIR@
@umask 0022; $(MAKE) -C @VENDOR_TCLLIB_SUBDIR@ "DESTDIR=${DESTROOT}" TCLSH_PROG=@INTREE_TCLSH@ @VENDOR_TCLLIB_INSTALL@
@chmod -R ugo+rX ${DESTROOT}${PREFIX}/libexec/macports/lib/tcllib*
@@ -124,7 +122,7 @@ install-tclx:
@umask 0022; $(MAKE) -C @VENDOR_TCLX_SUBDIR@ @VENDOR_TCLX_INSTALL@
install-tcllib:
rm -rf $(DESTDIR)$(TCL_PACKAGE_PATH)/tcllib1.1{5,7,8}
rm -rf $(DESTDIR)$(TCL_PACKAGE_PATH)/tcllib1.*
@echo ===\> making $(@:%-tcllib=%) in ${DIRPRFX}@VENDOR_TCLLIB_SUBDIR@
@umask 0022; $(MAKE) -C @VENDOR_TCLLIB_SUBDIR@ TCLSH_PROG=@INTREE_TCLSH@ @VENDOR_TCLLIB_INSTALL@
@chmod -R ugo+rX $(DESTDIR)${PREFIX}/libexec/macports/lib/tcllib*
+4 -4
View File
@@ -2,8 +2,8 @@ Allow tcllib's configure to run without tclsh. Remember to update the
version numbers to match support/installation/version.tcl when updating
tclllib.
--- tcllib-1.21/configure.orig 2022-09-07 22:20:50.000000000 +1000
+++ tcllib-1.21/configure 2022-09-08 01:07:43.000000000 +1000
--- tcllib-2.0/configure.orig 2022-09-07 22:20:50.000000000 +1000
+++ tcllib-2.0/configure 2022-09-08 01:07:43.000000000 +1000
@@ -1301,9 +1301,7 @@
echo "$as_me:$LINENO: result: $TCLSH_PROG" >&5
echo "${ECHO_T}$TCLSH_PROG" >&6
@@ -23,8 +23,8 @@ tclllib.
-MAJOR_VERSION=`$TCLSH_PROG "${SAK}" major`
-MINOR_VERSION=`$TCLSH_PROG "${SAK}" minor`
+PACKAGE=tcllib
+MAJOR_VERSION=1
+MINOR_VERSION=21
+MAJOR_VERSION=2
+MINOR_VERSION=0
PATCHLEVEL=""
VERSION=${MAJOR_VERSION}.${MINOR_VERSION}${PATCHLEVEL}
+1 -1
View File
@@ -1 +1 @@
tcllib-1.21
tcllib-2.0
-25
View File
@@ -1,25 +0,0 @@
Deprecations in Tcllib 1.21
===========================
Four packages are stage 2 deprecated in favor of two replacements.
All internal users of the deprecated packages have been rewritten to
use their replacements.
Module Package Replacement Deprecation stage
------------------ ----------------- ---------------- --------------------------------
doctools doctools::paths fileutil::paths (D2) Attempts to use throw errors
doctools doctools::config struct::map (D2) Attempts to use throw errors
pt paths fileutil::paths (D2) Attempts to use throw errors
pt configuration struct::map (D2) Attempts to use throw errors
------------------ ----------------- ---------------- --------------------------------
Stage 2 (D2) means that:
- The deprecated packages still exist.
- Their implementations have changed and throw errors.
Future progress:
- In the release after 1.21 the stage 2 deprecated packages will be
moved to stage 3 (D3). In that stage the packages will be removed
from Tcllib, causing `package require` to fail.
-24
View File
@@ -1,24 +0,0 @@
Deprecations in Tcllib 1.21
===========================
Four packages are stage 2 deprecated in favor of two replacements.
All internal users of the deprecated packages have been rewritten to
use their replacements.
|Module|Package|Replacement|Deprecation stage|
|---|---|---|---|
|doctools|doctools::paths|fileutil::paths|(D2) Attempts to use throw errors|
|doctools|doctools::config|struct::map|(D2) Attempts to use throw errors|
|pt|paths|fileutil::paths|(D2) Attempts to use throw errors|
|pt|configuration|struct::map|(D2) Attempts to use throw errors|
Stage 1 (__D1__) means that:
- The deprecated packages still exist.
- Their implementations have changed and throw errors.
Future progress:
- In the release after 1.21 the stage 2 deprecated packages will be
moved to stage 3 (__D3__). In that stage the implementations will
be removed from Tcllib, causing `package require` to fail.
-1
View File
@@ -1 +0,0 @@
f diff --to 7444b7b817 --from 62c7dba89c|m
-39
View File
@@ -1,39 +0,0 @@
While the majority of Tcllib consists of packages written in pure Tcl
a number of packages also have [term accelerators] associated with them.
These are [syscmd critcl]-based C packages whose use will boost the
performance of the packages using them.
These accelerators are optional, and they are not built by default.
If they are built according to the instructions below then they will
also be installed as well.
[para] To build the accelerators the normally optional dependency on
[syscmd critcl] becomes required.
[para] To build and install Tcllib with the accelerators in a
Unix-like environment invoke:
[example {
./configure
make critcl # Builds the shared library and package holding
# the accelerators, tcllibc
make install # Installs all packages, including the new tcllibc.
}]
[para] The underlying tool is [file sak.tcl] in the toplevel directory
of Tcllib and the command [cmd {make critcl}] is just a wrapper around
[example {
./sak.tcl critcl
}]
[para] Therefore in a Windows environment instead invoke
[example {
./sak.tcl critcl
./installer.tcl
}]
from within a DOS window, i.e. [syscmd cmd.exe].
-22
View File
@@ -1,22 +0,0 @@
For [term Unix]-like environments Tcllib comes with the standard set
of files to make
[example {
./configure
make install
}]
a suitable way of installing it.
This is a standard non-interactive install automatically figuring out
where to place everything, i.e. packages, applications, and the
manpages.
[para] To get a graphical installer invoke
[example {
./installer.tcl
}]
instead.
-35
View File
@@ -1,35 +0,0 @@
[subsection Critcl]
The [syscmd critcl] tool is an [emph optional] dependency.
[para] It is only required when trying to build the C-based
[term accelerators] for a number of packages, as explained in
[sectref {Critcl & Accelerators}]
[para] Tcllib's build system looks for it in the [variable PATH],
using the name [syscmd critcl]. This is for Unix.
On Windows on the other hand the search is more complex. First we look
for a proper application [syscmd critcl.exe]. When that is not found
we look for a combination of interpreter ([syscmd tclkitsh.exe],
[syscmd tclsh.exe]) and starkit ([syscmd critcl.kit], [syscmd critcl])
instead. [emph Note] that the choice of starkit can be overriden via
the environment variable [variable CRITCL].
[para] Tcllib requires Critcl version 2 or higher.
[para] The github repository providing releases of version 2 and
higher, and the associated sources, can be found at
[uri https://andreas-kupries.github.io/critcl].
[para] Any branch of the repository can be used (if not using the
prebuild starkit or starpack), although the use of the stable branch
[emph master] is recommended.
[para] At the above url is also an explanation on how to build and
install Critcl, including a list of its dependencies.
[para] Its instructions will not be repeated here. If there are
problems with these directions please file a ticket against the
[term Critcl] project, and not Tcllib.
@@ -1,184 +0,0 @@
[//000000001]: # (crc16 \- Cyclic Redundancy Checks)
[//000000002]: # (Generated from file 'crc16\.man' by tcllib/doctools with format 'markdown')
[//000000003]: # (Copyright © 2002, 2017, Pat Thoyts)
[//000000004]: # (crc16\(n\) 1\.1\.4 tcllib "Cyclic Redundancy Checks")
<hr> [ <a href="../../../../toc.md">Main Table Of Contents</a> &#124; <a
href="../../../toc.md">Table Of Contents</a> &#124; <a
href="../../../../index.md">Keyword Index</a> &#124; <a
href="../../../../toc0.md">Categories</a> &#124; <a
href="../../../../toc1.md">Modules</a> &#124; <a
href="../../../../toc2.md">Applications</a> ] <hr>
# NAME
crc16 \- Perform a 16bit Cyclic Redundancy Check
# <a name='toc'></a>Table Of Contents
- [Table Of Contents](#toc)
- [Synopsis](#synopsis)
- [Description](#section1)
- [COMMANDS](#section2)
- [OPTIONS](#section3)
- [EXAMPLES](#section4)
- [AUTHORS](#section5)
- [Bugs, Ideas, Feedback](#section6)
- [See Also](#seealso)
- [Keywords](#keywords)
- [Category](#category)
- [Copyright](#copyright)
# <a name='synopsis'></a>SYNOPSIS
package require Tcl 8\.2
package require crc16 ?1\.1\.4?
[__::crc::crc16__ ?\-format *format*? ?\-seed *value*? ?\-implementation *procname*? __\-\-__ *message*](#1)
[__::crc::crc16__ ?\-format *format*? ?\-seed *value*? ?\-implementation *procname*? \-filename *file*](#2)
[__::crc::crc\-ccitt__ ?\-format *format*? ?\-seed *value*? ?\-implementation *procname*? __\-\-__ *message*](#3)
[__::crc::crc\-ccitt__ ?\-format *format*? ?\-seed *value*? ?\-implementation *procname*? \-filename *file*](#4)
[__::crc::xmodem__ ?\-format *format*? ?\-seed *value*? ?\-implementation *procname*? __\-\-__ *message*](#5)
[__::crc::xmodem__ ?\-format *format*? ?\-seed *value*? ?\-implementation *procname*? \-filename *file*](#6)
# <a name='description'></a>DESCRIPTION
This package provides a Tcl\-only implementation of the CRC algorithms based upon
information provided at http://www\.microconsultants\.com/tips/crc/crc\.txt There
are a number of permutations available for calculating CRC checksums and this
package can handle all of them\. Defaults are set up for the most common cases\.
# <a name='section2'></a>COMMANDS
- <a name='1'></a>__::crc::crc16__ ?\-format *format*? ?\-seed *value*? ?\-implementation *procname*? __\-\-__ *message*
- <a name='2'></a>__::crc::crc16__ ?\-format *format*? ?\-seed *value*? ?\-implementation *procname*? \-filename *file*
- <a name='3'></a>__::crc::crc\-ccitt__ ?\-format *format*? ?\-seed *value*? ?\-implementation *procname*? __\-\-__ *message*
- <a name='4'></a>__::crc::crc\-ccitt__ ?\-format *format*? ?\-seed *value*? ?\-implementation *procname*? \-filename *file*
- <a name='5'></a>__::crc::xmodem__ ?\-format *format*? ?\-seed *value*? ?\-implementation *procname*? __\-\-__ *message*
- <a name='6'></a>__::crc::xmodem__ ?\-format *format*? ?\-seed *value*? ?\-implementation *procname*? \-filename *file*
The command takes either string data or a file name and returns a checksum
value calculated using the CRC algorithm\. The command used sets up the CRC
polynomial, initial value and bit ordering for the desired standard checksum
calculation\. The result is formatted using the *format*\(n\) specifier
provided or as an unsigned integer \(%u\) by default\.
A number of common polynomials are in use with the CRC algorithm and the
most commonly used of these are included in this package\. For convenience
each of these has a command alias in the crc namespace\.
It is possible to implement the CRC\-32 checksum using this crc16 package as
the implementation is sufficiently generic to extend to 32 bit checksums\. As
an example this has been done already \- however this is not the fastest
method to implement this algorithm in Tcl and a separate
__[crc32](crc32\.md)__ package is available\.
# <a name='section3'></a>OPTIONS
- \-filename *name*
Return a checksum for the file contents instead of for parameter data\.
- \-format *string*
Return the checksum using an alternative format template\.
- \-seed *value*
Select an alternative seed value for the CRC calculation\. The default is 0
for the CRC16 calculation and 0xFFFF for the CCITT version\. This can be
useful for calculating the CRC for data structures without first converting
the whole structure into a string\. The CRC of the previous member can be
used as the seed for calculating the CRC of the next member\. It is also used
for accumulating a checksum from fragments of a large message \(or file\)
- \-implementation *procname*
This hook is provided to allow users to provide their own implementation
\(perhaps a C compiled extension\)\. The procedure specfied is called with two
parameters\. The first is the data to be checksummed and the second is the
seed value\. An integer is expected as the result\.
The package provides some implementations of standard CRC polynomials for
the XMODEM, CCITT and the usual CRC\-16 checksum\. For convenience, additional
commands have been provided that make use of these implementations\.
- \-\-
Terminate option processing\. Please note that using the option termination
flag is important when processing data from parameters\. If the binary data
looks like one of the options given above then the data will be read as an
option if this marker is not included\. Always use the *\-\-* option
termination flag before giving the data argument\.
# <a name='section4'></a>EXAMPLES
% crc::crc16 -- "Hello, World!"
64077
% crc::crc-ccitt -- "Hello, World!"
26586
% crc::crc16 -format 0x%X -- "Hello, World!"
0xFA4D
% crc::crc16 -file crc16.tcl
51675
# <a name='section5'></a>AUTHORS
Pat Thoyts
# <a name='section6'></a>Bugs, Ideas, Feedback
This document, and the package it describes, will undoubtedly contain bugs and
other problems\. Please report such in the category *crc* of the [Tcllib
Trackers](http://core\.tcl\.tk/tcllib/reportlist)\. Please also report any ideas
for enhancements you may have for either package and/or documentation\.
When proposing code changes, please provide *unified diffs*, i\.e the output of
__diff \-u__\.
Note further that *attachments* are strongly preferred over inlined patches\.
Attachments can be made by going to the __Edit__ form of the ticket
immediately after its creation, and then using the left\-most button in the
secondary navigation bar\.
# <a name='seealso'></a>SEE ALSO
[cksum\(n\)](cksum\.md), [crc32\(n\)](crc32\.md), [sum\(n\)](sum\.md)
# <a name='keywords'></a>KEYWORDS
[checksum](\.\./\.\./\.\./\.\./index\.md\#checksum),
[cksum](\.\./\.\./\.\./\.\./index\.md\#cksum), [crc](\.\./\.\./\.\./\.\./index\.md\#crc),
[crc16](\.\./\.\./\.\./\.\./index\.md\#crc16),
[crc32](\.\./\.\./\.\./\.\./index\.md\#crc32), [cyclic redundancy
check](\.\./\.\./\.\./\.\./index\.md\#cyclic\_redundancy\_check), [data
integrity](\.\./\.\./\.\./\.\./index\.md\#data\_integrity),
[security](\.\./\.\./\.\./\.\./index\.md\#security)
# <a name='category'></a>CATEGORY
Hashes, checksums, and encryption
# <a name='copyright'></a>COPYRIGHT
Copyright &copy; 2002, 2017, Pat Thoyts
@@ -1,218 +0,0 @@
[//000000001]: # (map::slippy \- Mapping utilities)
[//000000002]: # (Generated from file 'map\_slippy\.man' by tcllib/doctools with format 'markdown')
[//000000003]: # (map::slippy\(n\) 0\.5 tcllib "Mapping utilities")
<hr> [ <a href="../../../../toc.md">Main Table Of Contents</a> &#124; <a
href="../../../toc.md">Table Of Contents</a> &#124; <a
href="../../../../index.md">Keyword Index</a> &#124; <a
href="../../../../toc0.md">Categories</a> &#124; <a
href="../../../../toc1.md">Modules</a> &#124; <a
href="../../../../toc2.md">Applications</a> ] <hr>
# NAME
map::slippy \- Common code for slippy based map packages
# <a name='toc'></a>Table Of Contents
- [Table Of Contents](#toc)
- [Synopsis](#synopsis)
- [Description](#section1)
- [API](#section2)
- [Coordinate systems](#section3)
- [Geographic](#subsection1)
- [Tiles](#subsection2)
- [Pixels/Points](#subsection3)
- [References](#section4)
- [Keywords](#keywords)
# <a name='synopsis'></a>SYNOPSIS
package require Tcl 8\.4
package require Tk 8\.4
package require map::slippy ?0\.5?
[__::map::slippy__ __length__ *level*](#1)
[__::map::slippy__ __tiles__ *level*](#2)
[__::map::slippy__ __tile size__](#3)
[__::map::slippy__ __tile valid__ *tile* *levels* ?*msgvar*?](#4)
[__::map::slippy__ __geo 2tile__ *geo*](#5)
[__::map::slippy__ __geo 2tile\.float__ *geo*](#6)
[__::map::slippy__ __geo 2point__ *geo*](#7)
[__::map::slippy__ __tile 2geo__ *tile*](#8)
[__::map::slippy__ __tile 2point__ *tile*](#9)
[__::map::slippy__ __point 2geo__ *point*](#10)
[__::map::slippy__ __point 2tile__ *point*](#11)
[__::map::slippy__ __fit geobox__ *canvdim* *geobox* *zmin* *zmax*](#12)
# <a name='description'></a>DESCRIPTION
This package provides a number of methods doing things needed by all types of
slippy\-based map packages\.
# <a name='section2'></a>API
- <a name='1'></a>__::map::slippy__ __length__ *level*
This method returns the width/height of a slippy\-based map at the specified
zoom *level*, in pixels\. This is, in essence, the result of
expr { [tiles $level] * [tile size] }
- <a name='2'></a>__::map::slippy__ __tiles__ *level*
This method returns the width/height of a slippy\-based map at the specified
zoom *level*, in *tiles*\.
- <a name='3'></a>__::map::slippy__ __tile size__
This method returns the width/height of a tile in a slippy\-based map, in
pixels\.
- <a name='4'></a>__::map::slippy__ __tile valid__ *tile* *levels* ?*msgvar*?
This method checks whether *tile* described a valid tile in a slippy\-based
map containing that many zoom *levels*\. The result is a boolean value,
__true__ if the tile is valid, and __false__ otherwise\. For the
latter a message is left in the variable named by *msgvar*, should it be
specified\.
A tile identifier as stored in *tile* is a list containing zoom level,
tile row, and tile column, in this order\. The command essentially checks
this, i\.e\. the syntax, that the zoom level is between 0 and "*levels*\-1",
and that the row/col information is within the boundaries for the zoom
level, i\.e\. 0 \.\.\. "\[tiles $zoom\]\-1"\.
- <a name='5'></a>__::map::slippy__ __geo 2tile__ *geo*
Converts a geographical location at a zoom level \(*geo*, a list containing
zoom level, latitude, and longitude, in this order\) to a tile identifier
\(list containing zoom level, row, and column\) at that level\. The tile
identifier uses pure integer numbers for the tile coordinates, for all
geographic coordinates mapping to that tile\.
- <a name='6'></a>__::map::slippy__ __geo 2tile\.float__ *geo*
Converts a geographical location at a zoom level \(*geo*, a list containing
zoom level, latitude, and longitude, in this order\) to a tile identifier
\(list containing zoom level, row, and column\) at that level\. The tile
identifier uses floating point numbers for the tile coordinates,
representing not only the tile the geographic coordinates map to, but also
the fractional location inside of that tile\.
- <a name='7'></a>__::map::slippy__ __geo 2point__ *geo*
Converts a geographical location at a zoom level \(*geo*, a list containing
zoom level, latitude, and longitude, in this order\) to a pixel position
\(list containing zoom level, y, and x\) at that level\.
- <a name='8'></a>__::map::slippy__ __tile 2geo__ *tile*
Converts a tile identifier at a zoom level \(*tile*, list containing zoom
level, row, and column\) to a geographical location \(list containing zoom
level, latitude, and longitude, in this order\) at that level\.
- <a name='9'></a>__::map::slippy__ __tile 2point__ *tile*
Converts a tile identifier at a zoom level \(*tile*, a list containing zoom
level, row, and column, in this order\) to a pixel position \(list containing
zoom level, y, and x\) at that level\.
- <a name='10'></a>__::map::slippy__ __point 2geo__ *point*
Converts a pixel position at a zoom level \(*point*, list containing zoom
level, y, and x\) to a geographical location \(list containing zoom level,
latitude, and longitude, in this order\) at that level\.
- <a name='11'></a>__::map::slippy__ __point 2tile__ *point*
Converts a pixel position at a zoom level \(*point*, a list containing zoom
level, y, and x, in this order\) to a tile identifier \(list containing zoom
level, row, and column\) at that level\.
- <a name='12'></a>__::map::slippy__ __fit geobox__ *canvdim* *geobox* *zmin* *zmax*
Calculates the zoom level \(whithin the bounds *zmin* and *zmax*\) such
that *geobox* \(a 4\-element list containing the latitudes and longitudes
lat0, lat1, lon0 and lon1 of a geo box, in this order\) fits into a viewport
given by *canvdim*, a 2\-element list containing the width and height of
the viewport, in this order\.
# <a name='section3'></a>Coordinate systems
The commands of this package operate on three distinct coordinate systems, which
are explained below\.
## <a name='subsection1'></a>Geographic
*Geographic*al coordinates are represented by *Latitude* and
*[Longitude](\.\./\.\./\.\./\.\./index\.md\#longitude)*, each of which is measured
in degrees, as they are essentially angles\.
__Zero__ longitude is the *Greenwich meridian*, with positive values going
*east*, and negative values going *west*, for a total range of \+/\- 180
degrees\. Note that \+180 and \-180 longitude are the same *meridian*, opposite
to greenwich\.
__zero__ latitude the *Equator*, with positive values going *north* and
negative values going *south*\. While the true range is \+/\- 90 degrees the
projection used by the package requires us to cap the range at \+/\-
85\.05112877983284 degrees\. This means that north and south pole are not
representable and not part of any map\.
## <a name='subsection2'></a>Tiles
While [Geographic](#subsection1)al coordinates of the previous section are
independent of zoom level the *tile coordinates* are not\.
Generally the integer part of tile coordinates represent the row and column
number of the tile in question, wheras the fractional parts signal how far
inside the tile the location in question is, with pure integer coordinates \(no
fractional part\) representing the upper left corner of the tile\.
The zero point of the map is at the upper left corner, regardless of zoom level,
with larger coordinates going right \(east\) and down \(south\), and smaller
coordinates going left \(west\) and up \(north\)\. Again regardless of zxoom level\.
Negative tile coordinates are not allowed\.
At zoom level 0 the whole map is represented by a single, putting the geographic
zero at 1/2, 1/2 of tile coordinates, and the range of tile coordinates as
\[0\.\.\.1\]\.
To go from a zoom level N to the next deeper level N\+1 each tile of level N is
split into its four quadrants, which then are the tiles of level N\+1\.
This means that at zoom level N the map is sliced \(horizontally and vertically\)
into 2^N stripes, for a total of 4^N tiles, with tile coordinates ranging from 0
to 2^N\+1\.
## <a name='subsection3'></a>Pixels/Points
*pixel coordinates*, also called *point coordinates* are in essence [tile
coordinates](#subsection2) scaled by the size of the image representing a
tile\. This tile size currently has a fixed value, __256__\.
# <a name='section4'></a>References
1. [http://wiki\.openstreetmap\.org/wiki/Main\_Page](http://wiki\.openstreetmap\.org/wiki/Main\_Page)
# <a name='keywords'></a>KEYWORDS
[geodesy](\.\./\.\./\.\./\.\./index\.md\#geodesy),
[geography](\.\./\.\./\.\./\.\./index\.md\#geography),
[latitute](\.\./\.\./\.\./\.\./index\.md\#latitute),
[location](\.\./\.\./\.\./\.\./index\.md\#location),
[longitude](\.\./\.\./\.\./\.\./index\.md\#longitude),
[map](\.\./\.\./\.\./\.\./index\.md\#map), [slippy](\.\./\.\./\.\./\.\./index\.md\#slippy),
[zoom](\.\./\.\./\.\./\.\./index\.md\#zoom)
@@ -1,417 +0,0 @@
[//000000001]: # (struct::matrix\_v1 \- Tcl Data Structures)
[//000000002]: # (Generated from file 'matrix1\.man' by tcllib/doctools with format 'markdown')
[//000000003]: # (Copyright &copy; 2002,2019 Andreas Kupries <andreas\_kupries@users\.sourceforge\.net>)
[//000000004]: # (struct::matrix\_v1\(n\) 1\.2\.2 tcllib "Tcl Data Structures")
<hr> [ <a href="../../../../toc.md">Main Table Of Contents</a> &#124; <a
href="../../../toc.md">Table Of Contents</a> &#124; <a
href="../../../../index.md">Keyword Index</a> &#124; <a
href="../../../../toc0.md">Categories</a> &#124; <a
href="../../../../toc1.md">Modules</a> &#124; <a
href="../../../../toc2.md">Applications</a> ] <hr>
# NAME
struct::matrix\_v1 \- Create and manipulate matrix objects
# <a name='toc'></a>Table Of Contents
- [Table Of Contents](#toc)
- [Synopsis](#synopsis)
- [Description](#section1)
- [EXAMPLES](#section2)
- [Bugs, Ideas, Feedback](#section3)
- [Keywords](#keywords)
- [Category](#category)
- [Copyright](#copyright)
# <a name='synopsis'></a>SYNOPSIS
package require Tcl 8\.2
package require struct::matrix ?1\.2\.2?
[__matrixName__ *option* ?*arg arg \.\.\.*?](#1)
[*matrixName* __add column__ ?*values*?](#2)
[*matrixName* __add row__ ?*values*?](#3)
[*matrixName* __add columns__ *n*](#4)
[*matrixName* __add rows__ *n*](#5)
[*matrixName* __cells__](#6)
[*matrixName* __cellsize__ *column row*](#7)
[*matrixName* __columns__](#8)
[*matrixName* __columnwidth__ *column*](#9)
[*matrixName* __delete column__ *column*](#10)
[*matrixName* __delete row__ *row*](#11)
[*matrixName* __destroy__](#12)
[*matrixName* __format 2string__ ?*report*?](#13)
[*matrixName* __format 2chan__ ??*report*? *channel*?](#14)
[*matrixName* __get cell__ *column row*](#15)
[*matrixName* __get column__ *column*](#16)
[*matrixName* __get rect__ *column\_tl row\_tl column\_br row\_br*](#17)
[*matrixName* __get row__ *row*](#18)
[*matrixName* __insert column__ *column* ?*values*?](#19)
[*matrixName* __insert row__ *row* ?*values*?](#20)
[*matrixName* __link__ ?\-transpose? *arrayvar*](#21)
[*matrixName* __links__](#22)
[*matrixName* __rowheight__ *row*](#23)
[*matrixName* __rows__](#24)
[*matrixName* __search__ ?\-nocase? ?\-exact&#124;\-glob&#124;\-regexp? __all__ *pattern*](#25)
[*matrixName* __search__ ?\-nocase? ?\-exact&#124;\-glob&#124;\-regexp? __column__ *column pattern*](#26)
[*matrixName* __search__ ?\-nocase? ?\-exact&#124;\-glob&#124;\-regexp? __row__ *row pattern*](#27)
[*matrixName* __search__ ?\-nocase? ?\-exact&#124;\-glob&#124;\-regexp? __rect__ *column\_tl row\_tl column\_br row\_br pattern*](#28)
[*matrixName* __set cell__ *column row value*](#29)
[*matrixName* __set column__ *column values*](#30)
[*matrixName* __set rect__ *column row values*](#31)
[*matrixName* __set row__ *row values*](#32)
[*matrixName* __sort columns__ ?__\-increasing__&#124;__\-decreasing__? *row*](#33)
[*matrixName* __sort rows__ ?__\-increasing__&#124;__\-decreasing__? *column*](#34)
[*matrixName* __swap columns__ *column\_a column\_b*](#35)
[*matrixName* __swap rows__ *row\_a row\_b*](#36)
[*matrixName* __unlink__ *arrayvar*](#37)
# <a name='description'></a>DESCRIPTION
The __::struct::matrix__ command creates a new matrix object with an
associated global Tcl command whose name is *matrixName*\. This command may be
used to invoke various operations on the matrix\. It has the following general
form:
- <a name='1'></a>__matrixName__ *option* ?*arg arg \.\.\.*?
*Option* and the *arg*s determine the exact behavior of the command\.
A matrix is a rectangular collection of cells, i\.e\. organized in rows and
columns\. Each cell contains exactly one value of arbitrary form\. The cells in
the matrix are addressed by pairs of integer numbers, with the first \(left\)
number in the pair specifying the column and the second \(right\) number
specifying the row the cell is in\. These indices are counted from 0 upward\. The
special non\-numeric index __end__ refers to the last row or column in the
matrix, depending on the context\. Indices of the form __end__\-__number__
are counted from the end of the row or column, like they are for standard Tcl
lists\. Trying to access non\-existing cells causes an error\.
The matrices here are created empty, i\.e\. they have neither rows nor columns\.
The user then has to add rows and columns as needed by his application\. A
specialty of this structure is the ability to export an array\-view onto its
contents\. Such can be used by tkTable, for example, to link the matrix into the
display\.
The following commands are possible for matrix objects:
- <a name='2'></a>*matrixName* __add column__ ?*values*?
Extends the matrix by one column and then acts like __setcolumn__ \(see
below\) on this new column if there were *values* supplied\. Without
*values* the new cells will be set to the empty string\. The new column is
appended immediately behind the last existing column\.
- <a name='3'></a>*matrixName* __add row__ ?*values*?
Extends the matrix by one row and then acts like __setrow__ \(see below\)
on this new row if there were *values* supplied\. Without *values* the
new cells will be set to the empty string\. The new row is appended
immediately behind the last existing row\.
- <a name='4'></a>*matrixName* __add columns__ *n*
Extends the matrix by *n* columns\. The new cells will be set to the empty
string\. The new columns are appended immediately behind the last existing
column\. A value of *n* equal to or smaller than 0 is not allowed\.
- <a name='5'></a>*matrixName* __add rows__ *n*
Extends the matrix by *n* rows\. The new cells will be set to the empty
string\. The new rows are appended immediately behind the last existing row\.
A value of *n* equal to or smaller than 0 is not allowed\.
- <a name='6'></a>*matrixName* __cells__
Returns the number of cells currently managed by the matrix\. This is the
product of __rows__ and __columns__\.
- <a name='7'></a>*matrixName* __cellsize__ *column row*
Returns the length of the string representation of the value currently
contained in the addressed cell\.
- <a name='8'></a>*matrixName* __columns__
Returns the number of columns currently managed by the matrix\.
- <a name='9'></a>*matrixName* __columnwidth__ *column*
Returns the length of the longest string representation of all the values
currently contained in the cells of the addressed column if these are all
spanning only one line\. For cell values spanning multiple lines the length
of their longest line goes into the computation\.
- <a name='10'></a>*matrixName* __delete column__ *column*
Deletes the specified column from the matrix and shifts all columns with
higher indices one index down\.
- <a name='11'></a>*matrixName* __delete row__ *row*
Deletes the specified row from the matrix and shifts all row with higher
indices one index down\.
- <a name='12'></a>*matrixName* __destroy__
Destroys the matrix, including its storage space and associated command\.
- <a name='13'></a>*matrixName* __format 2string__ ?*report*?
Formats the matrix using the specified report object and returns the string
containing the result of this operation\. The report has to support the
__printmatrix__ method\. If no *report* is specified the system will
use an internal report definition to format the matrix\.
- <a name='14'></a>*matrixName* __format 2chan__ ??*report*? *channel*?
Formats the matrix using the specified report object and writes the string
containing the result of this operation into the channel\. The report has to
support the __printmatrix2channel__ method\. If no *report* is
specified the system will use an internal report definition to format the
matrix\. If no *channel* is specified the system will use __stdout__\.
- <a name='15'></a>*matrixName* __get cell__ *column row*
Returns the value currently contained in the cell identified by row and
column index\.
- <a name='16'></a>*matrixName* __get column__ *column*
Returns a list containing the values from all cells in the column identified
by the index\. The contents of the cell in row 0 are stored as the first
element of this list\.
- <a name='17'></a>*matrixName* __get rect__ *column\_tl row\_tl column\_br row\_br*
Returns a list of lists of cell values\. The values stored in the result come
from the sub\-matrix whose top\-left and bottom\-right cells are specified by
*column\_tl, row\_tl* and *column\_br, row\_br* resp\. Note that the
following equations have to be true: "*column\_tl* <= *column\_br*" and
"*row\_tl* <= *row\_br*"\. The result is organized as follows: The outer
list is the list of rows, its elements are lists representing a single row\.
The row with the smallest index is the first element of the outer list\. The
elements of the row lists represent the selected cell values\. The cell with
the smallest index is the first element in each row list\.
- <a name='18'></a>*matrixName* __get row__ *row*
Returns a list containing the values from all cells in the row identified by
the index\. The contents of the cell in column 0 are stored as the first
element of this list\.
- <a name='19'></a>*matrixName* __insert column__ *column* ?*values*?
Extends the matrix by one column and then acts like __setcolumn__ \(see
below\) on this new column if there were *values* supplied\. Without
*values* the new cells will be set to the empty string\. The new column is
inserted just before the column specified by the given index\. This means, if
*column* is less than or equal to zero, then the new column is inserted at
the beginning of the matrix, before the first column\. If *column* has the
value __end__, or if it is greater than or equal to the number of
columns in the matrix, then the new column is appended to the matrix, behind
the last column\. The old column at the chosen index and all columns with
higher indices are shifted one index upward\.
- <a name='20'></a>*matrixName* __insert row__ *row* ?*values*?
Extends the matrix by one row and then acts like __setrow__ \(see below\)
on this new row if there were *values* supplied\. Without *values* the
new cells will be set to the empty string\. The new row is inserted just
before the row specified by the given index\. This means, if *row* is less
than or equal to zero, then the new row is inserted at the beginning of the
matrix, before the first row\. If *row* has the value __end__, or if it
is greater than or equal to the number of rows in the matrix, then the new
row is appended to the matrix, behind the last row\. The old row at that
index and all rows with higher indices are shifted one index upward\.
- <a name='21'></a>*matrixName* __link__ ?\-transpose? *arrayvar*
Links the matrix to the specified array variable\. This means that the
contents of all cells in the matrix is stored in the array too, with all
changes to the matrix propagated there too\. The contents of the cell
*\(column,row\)* is stored in the array using the key *column,row*\. If the
option __\-transpose__ is specified the key *row,column* will be used
instead\. It is possible to link the matrix to more than one array\. Note that
the link is bidirectional, i\.e\. changes to the array are mirrored in the
matrix too\.
- <a name='22'></a>*matrixName* __links__
Returns a list containing the names of all array variables the matrix was
linked to through a call to method __link__\.
- <a name='23'></a>*matrixName* __rowheight__ *row*
Returns the height of the specified row in lines\. This is the highest number
of lines spanned by a cell over all cells in the row\.
- <a name='24'></a>*matrixName* __rows__
Returns the number of rows currently managed by the matrix\.
- <a name='25'></a>*matrixName* __search__ ?\-nocase? ?\-exact&#124;\-glob&#124;\-regexp? __all__ *pattern*
Searches the whole matrix for cells matching the *pattern* and returns a
list with all matches\. Each item in the aforementioned list is a list itself
and contains the column and row index of the matching cell, in this order\.
The results are ordered by column first and row second, both times in
ascending order\. This means that matches to the left and the top of the
matrix come before matches to the right and down\.
The type of the pattern \(string, glob, regular expression\) is determined by
the option after the __search__ keyword\. If no option is given it
defaults to __\-exact__\.
If the option __\-nocase__ is specified the search will be
case\-insensitive\.
- <a name='26'></a>*matrixName* __search__ ?\-nocase? ?\-exact&#124;\-glob&#124;\-regexp? __column__ *column pattern*
Like __search all__, but the search is restricted to the specified
column\.
- <a name='27'></a>*matrixName* __search__ ?\-nocase? ?\-exact&#124;\-glob&#124;\-regexp? __row__ *row pattern*
Like __search all__, but the search is restricted to the specified row\.
- <a name='28'></a>*matrixName* __search__ ?\-nocase? ?\-exact&#124;\-glob&#124;\-regexp? __rect__ *column\_tl row\_tl column\_br row\_br pattern*
Like __search all__, but the search is restricted to the specified
rectangular area of the matrix\.
- <a name='29'></a>*matrixName* __set cell__ *column row value*
Sets the value in the cell identified by row and column index to the data in
the third argument\.
- <a name='30'></a>*matrixName* __set column__ *column values*
Sets the values in the cells identified by the column index to the elements
of the list provided as the third argument\. Each element of the list is
assigned to one cell, with the first element going into the cell in row 0
and then upward\. If there are less values in the list than there are rows
the remaining rows are set to the empty string\. If there are more values in
the list than there are rows the superfluous elements are ignored\. The
matrix is not extended by this operation\.
- <a name='31'></a>*matrixName* __set rect__ *column row values*
Takes a list of lists of cell values and writes them into the submatrix
whose top\-left cell is specified by the two indices\. If the sublists of the
outerlist are not of equal length the shorter sublists will be filled with
empty strings to the length of the longest sublist\. If the submatrix
specified by the top\-left cell and the number of rows and columns in the
*values* extends beyond the matrix we are modifying the over\-extending
parts of the values are ignored, i\.e\. essentially cut off\. This subcommand
expects its input in the format as returned by __getrect__\.
- <a name='32'></a>*matrixName* __set row__ *row values*
Sets the values in the cells identified by the row index to the elements of
the list provided as the third argument\. Each element of the list is
assigned to one cell, with the first element going into the cell in column 0
and then upward\. If there are less values in the list than there are columns
the remaining columns are set to the empty string\. If there are more values
in the list than there are columns the superfluous elements are ignored\. The
matrix is not extended by this operation\.
- <a name='33'></a>*matrixName* __sort columns__ ?__\-increasing__&#124;__\-decreasing__? *row*
Sorts the columns in the matrix using the data in the specified *row* as
the key to sort by\. The options __\-increasing__ and __\-decreasing__
have the same meaning as for __lsort__\. If no option is specified
__\-increasing__ is assumed\.
- <a name='34'></a>*matrixName* __sort rows__ ?__\-increasing__&#124;__\-decreasing__? *column*
Sorts the rows in the matrix using the data in the specified *column* as
the key to sort by\. The options __\-increasing__ and __\-decreasing__
have the same meaning as for __lsort__\. If no option is specified
__\-increasing__ is assumed\.
- <a name='35'></a>*matrixName* __swap columns__ *column\_a column\_b*
Swaps the contents of the two specified columns\.
- <a name='36'></a>*matrixName* __swap rows__ *row\_a row\_b*
Swaps the contents of the two specified rows\.
- <a name='37'></a>*matrixName* __unlink__ *arrayvar*
Removes the link between the matrix and the specified arrayvariable, if
there is one\.
# <a name='section2'></a>EXAMPLES
The examples below assume a 5x5 matrix M with the first row containing the
values 1 to 5, with 1 in the top\-left cell\. Each other row contains the contents
of the row above it, rotated by one cell to the right\.
% M getrect 0 0 4 4
{{1 2 3 4 5} {5 1 2 3 4} {4 5 1 2 3} {3 4 5 1 2} {2 3 4 5 1}}
% M setrect 1 1 {{0 0 0} {0 0 0} {0 0 0}}
% M getrect 0 0 4 4
{{1 2 3 4 5} {5 0 0 0 4} {4 0 0 0 3} {3 0 0 0 2} {2 3 4 5 1}}
Assuming that the style definitions in the example section of the manpage for
the package __[report](\.\./report/report\.md)__ are loaded into the
interpreter now an example which formats a matrix into a tabular report\. The
code filling the matrix with data is not shown\. contains useful data\.
% ::struct::matrix m
% # ... fill m with data, assume 5 columns
% ::report::report r 5 style captionedtable 1
% m format 2string r
+---+-------------------+-------+-------+--------+
|000|VERSIONS: |2:8.4a3|1:8.4a3|1:8.4a3%|
+---+-------------------+-------+-------+--------+
|001|CATCH return ok |7 |13 |53.85 |
|002|CATCH return error |68 |91 |74.73 |
|003|CATCH no catch used|7 |14 |50.00 |
|004|IF if true numeric |12 |33 |36.36 |
|005|IF elseif |15 |47 |31.91 |
| |true numeric | | | |
+---+-------------------+-------+-------+--------+
%
% # alternate way of doing the above
% r printmatrix m
# <a name='section3'></a>Bugs, Ideas, Feedback
This document, and the package it describes, will undoubtedly contain bugs and
other problems\. Please report such in the category *struct :: matrix* of the
[Tcllib Trackers](http://core\.tcl\.tk/tcllib/reportlist)\. Please also report
any ideas for enhancements you may have for either package and/or documentation\.
When proposing code changes, please provide *unified diffs*, i\.e the output of
__diff \-u__\.
Note further that *attachments* are strongly preferred over inlined patches\.
Attachments can be made by going to the __Edit__ form of the ticket
immediately after its creation, and then using the left\-most button in the
secondary navigation bar\.
# <a name='keywords'></a>KEYWORDS
[matrix](\.\./\.\./\.\./\.\./index\.md\#matrix)
# <a name='category'></a>CATEGORY
Data structures
# <a name='copyright'></a>COPYRIGHT
Copyright &copy; 2002,2019 Andreas Kupries <andreas\_kupries@users\.sourceforge\.net>
-3
View File
@@ -1,3 +0,0 @@
# @mdgen EXCLUDE: impersonal.tcl
package ifneeded mutl 1.0 [list source [file join $dir mutl.tcl]]
package ifneeded mbox 1.0 [list source [file join $dir mbox.tcl]]
@@ -1,452 +0,0 @@
'\"
'\" Generated from file 'map_slippy\&.man' by tcllib/doctools with format 'nroff'
'\"
.TH "map::slippy" n 0\&.5 tcllib "Mapping utilities"
.\" The -*- nroff -*- definitions below are for supplemental macros used
.\" in Tcl/Tk manual entries.
.\"
.\" .AP type name in/out ?indent?
.\" Start paragraph describing an argument to a library procedure.
.\" type is type of argument (int, etc.), in/out is either "in", "out",
.\" or "in/out" to describe whether procedure reads or modifies arg,
.\" and indent is equivalent to second arg of .IP (shouldn't ever be
.\" needed; use .AS below instead)
.\"
.\" .AS ?type? ?name?
.\" Give maximum sizes of arguments for setting tab stops. Type and
.\" name are examples of largest possible arguments that will be passed
.\" to .AP later. If args are omitted, default tab stops are used.
.\"
.\" .BS
.\" Start box enclosure. From here until next .BE, everything will be
.\" enclosed in one large box.
.\"
.\" .BE
.\" End of box enclosure.
.\"
.\" .CS
.\" Begin code excerpt.
.\"
.\" .CE
.\" End code excerpt.
.\"
.\" .VS ?version? ?br?
.\" Begin vertical sidebar, for use in marking newly-changed parts
.\" of man pages. The first argument is ignored and used for recording
.\" the version when the .VS was added, so that the sidebars can be
.\" found and removed when they reach a certain age. If another argument
.\" is present, then a line break is forced before starting the sidebar.
.\"
.\" .VE
.\" End of vertical sidebar.
.\"
.\" .DS
.\" Begin an indented unfilled display.
.\"
.\" .DE
.\" End of indented unfilled display.
.\"
.\" .SO ?manpage?
.\" Start of list of standard options for a Tk widget. The manpage
.\" argument defines where to look up the standard options; if
.\" omitted, defaults to "options". The options follow on successive
.\" lines, in three columns separated by tabs.
.\"
.\" .SE
.\" End of list of standard options for a Tk widget.
.\"
.\" .OP cmdName dbName dbClass
.\" Start of description of a specific option. cmdName gives the
.\" option's name as specified in the class command, dbName gives
.\" the option's name in the option database, and dbClass gives
.\" the option's class in the option database.
.\"
.\" .UL arg1 arg2
.\" Print arg1 underlined, then print arg2 normally.
.\"
.\" .QW arg1 ?arg2?
.\" Print arg1 in quotes, then arg2 normally (for trailing punctuation).
.\"
.\" .PQ arg1 ?arg2?
.\" Print an open parenthesis, arg1 in quotes, then arg2 normally
.\" (for trailing punctuation) and then a closing parenthesis.
.\"
.\" # Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
.\" # Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
. ie !"\\$2"" .TP \\n()Cu
. el .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1 \\fI\\$2\\fP (\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1 \\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
.\" # define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
.\" # BS - start boxed text
.\" # ^y = starting y location
.\" # ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
.\" # BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\" Draw four-sided box normally, but don't draw top of
.\" box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
.\" # VS - start vertical sidebar
.\" # ^Y = starting y location
.\" # ^v = 1 (for troff; for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
.\" # VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
.\" # Special macro to handle page bottom: finish off current
.\" # box/sidebar if in box/sidebar mode, then invoked standard
.\" # page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\" Draw three-sided box if this is the box's first page,
.\" draw two sides but no top otherwise.
.ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
.\" # DS - begin display
.de DS
.RS
.nf
.sp
..
.\" # DE - end display
.de DE
.fi
.RE
.sp
..
.\" # SO - start of list of standard options
.de SO
'ie '\\$1'' .ds So \\fBoptions\\fR
'el .ds So \\fB\\$1\\fR
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 5.5c 11c
.ft B
..
.\" # SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\*(So manual entry for details on the standard options.
..
.\" # OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name: \\fB\\$1\\fR
Database Name: \\fB\\$2\\fR
Database Class: \\fB\\$3\\fR
.fi
.IP
..
.\" # CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
.\" # CE - end code excerpt
.de CE
.fi
.RE
..
.\" # UL - underline word
.de UL
\\$1\l'|0\(ul'\\$2
..
.\" # QW - apply quotation marks to word
.de QW
.ie '\\*(lq'"' ``\\$1''\\$2
.\"" fix emacs highlighting
.el \\*(lq\\$1\\*(rq\\$2
..
.\" # PQ - apply parens and quotation marks to word
.de PQ
.ie '\\*(lq'"' (``\\$1''\\$2)\\$3
.\"" fix emacs highlighting
.el (\\*(lq\\$1\\*(rq\\$2)\\$3
..
.\" # QR - quoted range
.de QR
.ie '\\*(lq'"' ``\\$1''\\-``\\$2''\\$3
.\"" fix emacs highlighting
.el \\*(lq\\$1\\*(rq\\-\\*(lq\\$2\\*(rq\\$3
..
.\" # MT - "empty" string
.de MT
.QW ""
..
.BS
.SH NAME
map::slippy \- Common code for slippy based map packages
.SH SYNOPSIS
package require \fBTcl 8\&.4\fR
.sp
package require \fBTk 8\&.4\fR
.sp
package require \fBmap::slippy ?0\&.5?\fR
.sp
\fB::map::slippy\fR \fBlength\fR \fIlevel\fR
.sp
\fB::map::slippy\fR \fBtiles\fR \fIlevel\fR
.sp
\fB::map::slippy\fR \fBtile size\fR
.sp
\fB::map::slippy\fR \fBtile valid\fR \fItile\fR \fIlevels\fR ?\fImsgvar\fR?
.sp
\fB::map::slippy\fR \fBgeo 2tile\fR \fIgeo\fR
.sp
\fB::map::slippy\fR \fBgeo 2tile\&.float\fR \fIgeo\fR
.sp
\fB::map::slippy\fR \fBgeo 2point\fR \fIgeo\fR
.sp
\fB::map::slippy\fR \fBtile 2geo\fR \fItile\fR
.sp
\fB::map::slippy\fR \fBtile 2point\fR \fItile\fR
.sp
\fB::map::slippy\fR \fBpoint 2geo\fR \fIpoint\fR
.sp
\fB::map::slippy\fR \fBpoint 2tile\fR \fIpoint\fR
.sp
\fB::map::slippy\fR \fBfit geobox\fR \fIcanvdim\fR \fIgeobox\fR \fIzmin\fR \fIzmax\fR
.sp
.BE
.SH DESCRIPTION
This package provides a number of methods doing things needed by all
types of slippy-based map packages\&.
.SH API
.TP
\fB::map::slippy\fR \fBlength\fR \fIlevel\fR
This method returns the width/height of a slippy-based map at the
specified zoom \fIlevel\fR, in pixels\&. This is, in essence, the result
of
.CS
expr { [tiles $level] * [tile size] }
.CE
.TP
\fB::map::slippy\fR \fBtiles\fR \fIlevel\fR
This method returns the width/height of a slippy-based map at the
specified zoom \fIlevel\fR, in \fItiles\fR\&.
.TP
\fB::map::slippy\fR \fBtile size\fR
This method returns the width/height of a tile in a slippy-based map,
in pixels\&.
.TP
\fB::map::slippy\fR \fBtile valid\fR \fItile\fR \fIlevels\fR ?\fImsgvar\fR?
This method checks whether \fItile\fR described a valid tile in a
slippy-based map containing that many zoom \fIlevels\fR\&. The result is
a boolean value, \fBtrue\fR if the tile is valid, and \fBfalse\fR
otherwise\&. For the latter a message is left in the variable named by
\fImsgvar\fR, should it be specified\&.
.sp
A tile identifier as stored in \fItile\fR is a list containing zoom
level, tile row, and tile column, in this order\&. The command
essentially checks this, i\&.e\&. the syntax, that the zoom level is
between 0 and "\fIlevels\fR-1", and that the row/col information is
within the boundaries for the zoom level, i\&.e\&. 0 \&.\&.\&.
"[tiles $zoom]-1"\&.
.TP
\fB::map::slippy\fR \fBgeo 2tile\fR \fIgeo\fR
Converts a geographical location at a zoom level (\fIgeo\fR, a list
containing zoom level, latitude, and longitude, in this order) to a
tile identifier (list containing zoom level, row, and column) at that
level\&. The tile identifier uses pure integer numbers for the tile
coordinates, for all geographic coordinates mapping to that tile\&.
.TP
\fB::map::slippy\fR \fBgeo 2tile\&.float\fR \fIgeo\fR
Converts a geographical location at a zoom level (\fIgeo\fR, a list
containing zoom level, latitude, and longitude, in this order) to a
tile identifier (list containing zoom level, row, and column) at that
level\&. The tile identifier uses floating point numbers for the tile
coordinates, representing not only the tile the geographic coordinates
map to, but also the fractional location inside of that tile\&.
.TP
\fB::map::slippy\fR \fBgeo 2point\fR \fIgeo\fR
Converts a geographical location at a zoom level (\fIgeo\fR, a list
containing zoom level, latitude, and longitude, in this order) to a
pixel position (list containing zoom level, y, and x) at that level\&.
.TP
\fB::map::slippy\fR \fBtile 2geo\fR \fItile\fR
Converts a tile identifier at a zoom level (\fItile\fR, list
containing zoom level, row, and column) to a geographical location
(list containing zoom level, latitude, and longitude, in this order)
at that level\&.
.TP
\fB::map::slippy\fR \fBtile 2point\fR \fItile\fR
Converts a tile identifier at a zoom level (\fItile\fR, a list
containing zoom level, row, and column, in this order) to a pixel
position (list containing zoom level, y, and x) at that level\&.
.TP
\fB::map::slippy\fR \fBpoint 2geo\fR \fIpoint\fR
Converts a pixel position at a zoom level (\fIpoint\fR, list
containing zoom level, y, and x) to a geographical location (list
containing zoom level, latitude, and longitude, in this order) at that
level\&.
.TP
\fB::map::slippy\fR \fBpoint 2tile\fR \fIpoint\fR
Converts a pixel position at a zoom level (\fIpoint\fR, a list
containing zoom level, y, and x, in this order) to a tile identifier
(list containing zoom level, row, and column) at that level\&.
.TP
\fB::map::slippy\fR \fBfit geobox\fR \fIcanvdim\fR \fIgeobox\fR \fIzmin\fR \fIzmax\fR
Calculates the zoom level (whithin the bounds \fIzmin\fR and
\fIzmax\fR) such that \fIgeobox\fR (a 4-element list containing the
latitudes and longitudes lat0, lat1, lon0 and lon1 of a geo box,
in this order) fits into a viewport given by \fIcanvdim\fR, a
2-element list containing the width and height of the viewport, in
this order\&.
.PP
.SH "COORDINATE SYSTEMS"
The commands of this package operate on three distinct coordinate
systems, which are explained below\&.
.SS GEOGRAPHIC
\fIGeographic\fRal coordinates are represented by \fILatitude\fR and
\fILongitude\fR, each of which is measured in degrees, as they are
essentially angles\&.
.PP
\fBZero\fR longitude is the \fIGreenwich meridian\fR, with
positive values going \fIeast\fR, and negative values going
\fIwest\fR, for a total range of +/- 180 degrees\&. Note that +180 and
-180 longitude are the same \fImeridian\fR, opposite to greenwich\&.
.PP
\fBzero\fR latitude the \fIEquator\fR, with positive values
going \fInorth\fR and negative values going \fIsouth\fR\&. While the
true range is +/- 90 degrees the projection used by the package
requires us to cap the range at +/- 85\&.05112877983284 degrees\&. This
means that north and south pole are not representable and not part of
any map\&.
.SS TILES
While \fBGeographic\fRal coordinates of the previous section are
independent of zoom level the \fItile coordinates\fR are not\&.
.PP
Generally the integer part of tile coordinates represent the
row and column number of the tile in question, wheras the fractional
parts signal how far inside the tile the location in question is, with
pure integer coordinates (no fractional part) representing the upper
left corner of the tile\&.
.PP
The zero point of the map is at the upper left corner,
regardless of zoom level, with larger coordinates going right (east)
and down (south), and smaller coordinates going left (west) and up
(north)\&. Again regardless of zxoom level\&.
.PP
Negative tile coordinates are not allowed\&.
.PP
At zoom level 0 the whole map is represented by a single,
putting the geographic zero at 1/2, 1/2 of tile coordinates, and the
range of tile coordinates as [0\&.\&.\&.1]\&.
.PP
To go from a zoom level N to the next deeper level N+1 each
tile of level N is split into its four quadrants, which then are the
tiles of level N+1\&.
.PP
This means that at zoom level N the map is sliced (horizontally
and vertically) into 2^N stripes, for a total of 4^N tiles, with tile
coordinates ranging from 0 to 2^N+1\&.
.SS PIXELS/POINTS
\fIpixel coordinates\fR, also called \fIpoint coordinates\fR are
in essence \fBtile coordinates\fR scaled by the size of
the image representing a tile\&. This tile size currently has a fixed
value, \fB256\fR\&.
.SH REFERENCES
.IP [1]
\fIhttp://wiki\&.openstreetmap\&.org/wiki/Main_Page\fR
.PP
.SH KEYWORDS
geodesy, geography, latitute, location, longitude, map, slippy, zoom
File diff suppressed because it is too large Load Diff
@@ -1,263 +0,0 @@
<!DOCTYPE html><html><head>
<title>crc16 - Cyclic Redundancy Checks</title>
<style type="text/css"><!--
HTML {
background: #FFFFFF;
color: black;
}
BODY {
background: #FFFFFF;
color: black;
}
DIV.doctools {
margin-left: 10%;
margin-right: 10%;
}
DIV.doctools H1,DIV.doctools H2 {
margin-left: -5%;
}
H1, H2, H3, H4 {
margin-top: 1em;
font-family: sans-serif;
font-size: large;
color: #005A9C;
background: transparent;
text-align: left;
}
H1.doctools_title {
text-align: center;
}
UL,OL {
margin-right: 0em;
margin-top: 3pt;
margin-bottom: 3pt;
}
UL LI {
list-style: disc;
}
OL LI {
list-style: decimal;
}
DT {
padding-top: 1ex;
}
UL.doctools_toc,UL.doctools_toc UL, UL.doctools_toc UL UL {
font: normal 12pt/14pt sans-serif;
list-style: none;
}
LI.doctools_section, LI.doctools_subsection {
list-style: none;
margin-left: 0em;
text-indent: 0em;
padding: 0em;
}
PRE {
display: block;
font-family: monospace;
white-space: pre;
margin: 0%;
padding-top: 0.5ex;
padding-bottom: 0.5ex;
padding-left: 1ex;
padding-right: 1ex;
width: 100%;
}
PRE.doctools_example {
color: black;
background: #f5dcb3;
border: 1px solid black;
}
UL.doctools_requirements LI, UL.doctools_syntax LI {
list-style: none;
margin-left: 0em;
text-indent: 0em;
padding: 0em;
}
DIV.doctools_synopsis {
color: black;
background: #80ffff;
border: 1px solid black;
font-family: serif;
margin-top: 1em;
margin-bottom: 1em;
}
UL.doctools_syntax {
margin-top: 1em;
border-top: 1px solid black;
}
UL.doctools_requirements {
margin-bottom: 1em;
border-bottom: 1px solid black;
}
--></style>
</head>
<!-- Generated from file 'crc16.man' by tcllib/doctools with format 'html'
-->
<!-- Copyright &amp;copy; 2002, 2017, Pat Thoyts
-->
<!-- crc16.n
-->
<body><hr> [
<a href="../../../../../../../../home">Tcllib Home</a>
&#124; <a href="../../../../toc.html">Main Table Of Contents</a>
&#124; <a href="../../../toc.html">Table Of Contents</a>
&#124; <a href="../../../../index.html">Keyword Index</a>
&#124; <a href="../../../../toc0.html">Categories</a>
&#124; <a href="../../../../toc1.html">Modules</a>
&#124; <a href="../../../../toc2.html">Applications</a>
] <hr>
<div class="doctools">
<h1 class="doctools_title">crc16(n) 1.1.4 tcllib &quot;Cyclic Redundancy Checks&quot;</h1>
<div id="name" class="doctools_section"><h2><a name="name">Name</a></h2>
<p>crc16 - Perform a 16bit Cyclic Redundancy Check</p>
</div>
<div id="toc" class="doctools_section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="doctools_toc">
<li class="doctools_section"><a href="#toc">Table Of Contents</a></li>
<li class="doctools_section"><a href="#synopsis">Synopsis</a></li>
<li class="doctools_section"><a href="#section1">Description</a></li>
<li class="doctools_section"><a href="#section2">COMMANDS</a></li>
<li class="doctools_section"><a href="#section3">OPTIONS</a></li>
<li class="doctools_section"><a href="#section4">EXAMPLES</a></li>
<li class="doctools_section"><a href="#section5">AUTHORS</a></li>
<li class="doctools_section"><a href="#section6">Bugs, Ideas, Feedback</a></li>
<li class="doctools_section"><a href="#see-also">See Also</a></li>
<li class="doctools_section"><a href="#keywords">Keywords</a></li>
<li class="doctools_section"><a href="#category">Category</a></li>
<li class="doctools_section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="doctools_section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="doctools_synopsis">
<ul class="doctools_requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">crc16 <span class="opt">?1.1.4?</span></b></li>
</ul>
<ul class="doctools_syntax">
<li><a href="#1"><b class="cmd">::crc::crc16</b> <span class="opt">?-format <i class="arg">format</i>?</span> <span class="opt">?-seed <i class="arg">value</i>?</span> <span class="opt">?-implementation <i class="arg">procname</i>?</span> <b class="const">--</b> <i class="arg">message</i></a></li>
<li><a href="#2"><b class="cmd">::crc::crc16</b> <span class="opt">?-format <i class="arg">format</i>?</span> <span class="opt">?-seed <i class="arg">value</i>?</span> <span class="opt">?-implementation <i class="arg">procname</i>?</span> -filename <i class="arg">file</i></a></li>
<li><a href="#3"><b class="cmd">::crc::crc-ccitt</b> <span class="opt">?-format <i class="arg">format</i>?</span> <span class="opt">?-seed <i class="arg">value</i>?</span> <span class="opt">?-implementation <i class="arg">procname</i>?</span> <b class="const">--</b> <i class="arg">message</i></a></li>
<li><a href="#4"><b class="cmd">::crc::crc-ccitt</b> <span class="opt">?-format <i class="arg">format</i>?</span> <span class="opt">?-seed <i class="arg">value</i>?</span> <span class="opt">?-implementation <i class="arg">procname</i>?</span> -filename <i class="arg">file</i></a></li>
<li><a href="#5"><b class="cmd">::crc::xmodem</b> <span class="opt">?-format <i class="arg">format</i>?</span> <span class="opt">?-seed <i class="arg">value</i>?</span> <span class="opt">?-implementation <i class="arg">procname</i>?</span> <b class="const">--</b> <i class="arg">message</i></a></li>
<li><a href="#6"><b class="cmd">::crc::xmodem</b> <span class="opt">?-format <i class="arg">format</i>?</span> <span class="opt">?-seed <i class="arg">value</i>?</span> <span class="opt">?-implementation <i class="arg">procname</i>?</span> -filename <i class="arg">file</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="doctools_section"><h2><a name="section1">Description</a></h2>
<p>This package provides a Tcl-only implementation of the CRC
algorithms based upon information provided at
http://www.microconsultants.com/tips/crc/crc.txt
There are a number of permutations available for calculating CRC
checksums and this package can handle all of them. Defaults are set up
for the most common cases.</p>
</div>
<div id="section2" class="doctools_section"><h2><a name="section2">COMMANDS</a></h2>
<dl class="doctools_definitions">
<dt><a name="1"><b class="cmd">::crc::crc16</b> <span class="opt">?-format <i class="arg">format</i>?</span> <span class="opt">?-seed <i class="arg">value</i>?</span> <span class="opt">?-implementation <i class="arg">procname</i>?</span> <b class="const">--</b> <i class="arg">message</i></a></dt>
<dd></dd>
<dt><a name="2"><b class="cmd">::crc::crc16</b> <span class="opt">?-format <i class="arg">format</i>?</span> <span class="opt">?-seed <i class="arg">value</i>?</span> <span class="opt">?-implementation <i class="arg">procname</i>?</span> -filename <i class="arg">file</i></a></dt>
<dd></dd>
<dt><a name="3"><b class="cmd">::crc::crc-ccitt</b> <span class="opt">?-format <i class="arg">format</i>?</span> <span class="opt">?-seed <i class="arg">value</i>?</span> <span class="opt">?-implementation <i class="arg">procname</i>?</span> <b class="const">--</b> <i class="arg">message</i></a></dt>
<dd></dd>
<dt><a name="4"><b class="cmd">::crc::crc-ccitt</b> <span class="opt">?-format <i class="arg">format</i>?</span> <span class="opt">?-seed <i class="arg">value</i>?</span> <span class="opt">?-implementation <i class="arg">procname</i>?</span> -filename <i class="arg">file</i></a></dt>
<dd></dd>
<dt><a name="5"><b class="cmd">::crc::xmodem</b> <span class="opt">?-format <i class="arg">format</i>?</span> <span class="opt">?-seed <i class="arg">value</i>?</span> <span class="opt">?-implementation <i class="arg">procname</i>?</span> <b class="const">--</b> <i class="arg">message</i></a></dt>
<dd></dd>
<dt><a name="6"><b class="cmd">::crc::xmodem</b> <span class="opt">?-format <i class="arg">format</i>?</span> <span class="opt">?-seed <i class="arg">value</i>?</span> <span class="opt">?-implementation <i class="arg">procname</i>?</span> -filename <i class="arg">file</i></a></dt>
<dd><p>The command takes either string data or a file name and returns a checksum
value calculated using the CRC algorithm. The command used sets up the
CRC polynomial, initial value and bit ordering for the desired
standard checksum calculation. The result is formatted
using the <i class="arg">format</i>(n) specifier provided or as an unsigned integer
(%u) by default.</p>
<p>A number of common polynomials are in use with the CRC algorithm and
the most commonly used of these are included in this package. For
convenience each of these has a command alias in the crc namespace.</p>
<p>It is possible to implement the CRC-32 checksum using this crc16
package as the implementation is sufficiently generic to extend to 32
bit checksums. As an example this has been done already - however this
is not the fastest method to implement this algorithm in Tcl and a
separate <b class="package"><a href="crc32.html">crc32</a></b> package is available.</p></dd>
</dl>
</div>
<div id="section3" class="doctools_section"><h2><a name="section3">OPTIONS</a></h2>
<dl class="doctools_definitions">
<dt>-filename <i class="arg">name</i></dt>
<dd><p>Return a checksum for the file contents instead of for parameter data.</p></dd>
<dt>-format <i class="arg">string</i></dt>
<dd><p>Return the checksum using an alternative format template.</p></dd>
<dt>-seed <i class="arg">value</i></dt>
<dd><p>Select an alternative seed value for the CRC calculation. The default
is 0 for the CRC16 calculation and 0xFFFF for the CCITT version.
This can be useful for calculating the CRC for data
structures without first converting the whole structure into a
string. The CRC of the previous member can be used as the seed for
calculating the CRC of the next member. It is also used for
accumulating a checksum from fragments of a large message (or file)</p></dd>
<dt>-implementation <i class="arg">procname</i></dt>
<dd><p>This hook is provided to allow users to provide their own
implementation (perhaps a C compiled extension). The
procedure specfied is called with two parameters. The first is the
data to be checksummed and the second is the seed value. An
integer is expected as the result.</p>
<p>The package provides some implementations of standard CRC polynomials
for the XMODEM, CCITT and the usual CRC-16 checksum. For convenience,
additional commands have been provided that make use of these
implementations.</p></dd>
<dt>--</dt>
<dd><p>Terminate option processing. Please note that using the option
termination flag is important when processing data from parameters. If
the binary data looks like one of the options given above then the
data will be read as an option if this marker is not included.
Always use the <i class="arg">--</i> option termination flag before giving the data
argument.</p></dd>
</dl>
</div>
<div id="section4" class="doctools_section"><h2><a name="section4">EXAMPLES</a></h2>
<pre class="doctools_example">
% crc::crc16 -- &quot;Hello, World!&quot;
64077
</pre>
<pre class="doctools_example">
% crc::crc-ccitt -- &quot;Hello, World!&quot;
26586
</pre>
<pre class="doctools_example">
% crc::crc16 -format 0x%X -- &quot;Hello, World!&quot;
0xFA4D
</pre>
<pre class="doctools_example">
% crc::crc16 -file crc16.tcl
51675
</pre>
</div>
<div id="section5" class="doctools_section"><h2><a name="section5">AUTHORS</a></h2>
<p>Pat Thoyts</p>
</div>
<div id="section6" class="doctools_section"><h2><a name="section6">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>crc</em> of the
<a href="http://core.tcl.tk/tcllib/reportlist">Tcllib Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
<p>When proposing code changes, please provide <em>unified diffs</em>,
i.e the output of <b class="const">diff -u</b>.</p>
<p>Note further that <em>attachments</em> are strongly preferred over
inlined patches. Attachments can be made by going to the <b class="const">Edit</b>
form of the ticket immediately after its creation, and then using the
left-most button in the secondary navigation bar.</p>
</div>
<div id="see-also" class="doctools_section"><h2><a name="see-also">See Also</a></h2>
<p><a href="cksum.html">cksum(n)</a>, <a href="crc32.html">crc32(n)</a>, <a href="sum.html">sum(n)</a></p>
</div>
<div id="keywords" class="doctools_section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#checksum">checksum</a>, <a href="../../../../index.html#cksum">cksum</a>, <a href="../../../../index.html#crc">crc</a>, <a href="../../../../index.html#crc16">crc16</a>, <a href="../../../../index.html#crc32">crc32</a>, <a href="../../../../index.html#cyclic_redundancy_check">cyclic redundancy check</a>, <a href="../../../../index.html#data_integrity">data integrity</a>, <a href="../../../../index.html#security">security</a></p>
</div>
<div id="category" class="doctools_section"><h2><a name="category">Category</a></h2>
<p>Hashes, checksums, and encryption</p>
</div>
<div id="copyright" class="doctools_section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2002, 2017, Pat Thoyts</p>
</div>
</div></body></html>
@@ -1,284 +0,0 @@
<!DOCTYPE html><html><head>
<title>map::slippy - Mapping utilities</title>
<style type="text/css"><!--
HTML {
background: #FFFFFF;
color: black;
}
BODY {
background: #FFFFFF;
color: black;
}
DIV.doctools {
margin-left: 10%;
margin-right: 10%;
}
DIV.doctools H1,DIV.doctools H2 {
margin-left: -5%;
}
H1, H2, H3, H4 {
margin-top: 1em;
font-family: sans-serif;
font-size: large;
color: #005A9C;
background: transparent;
text-align: left;
}
H1.doctools_title {
text-align: center;
}
UL,OL {
margin-right: 0em;
margin-top: 3pt;
margin-bottom: 3pt;
}
UL LI {
list-style: disc;
}
OL LI {
list-style: decimal;
}
DT {
padding-top: 1ex;
}
UL.doctools_toc,UL.doctools_toc UL, UL.doctools_toc UL UL {
font: normal 12pt/14pt sans-serif;
list-style: none;
}
LI.doctools_section, LI.doctools_subsection {
list-style: none;
margin-left: 0em;
text-indent: 0em;
padding: 0em;
}
PRE {
display: block;
font-family: monospace;
white-space: pre;
margin: 0%;
padding-top: 0.5ex;
padding-bottom: 0.5ex;
padding-left: 1ex;
padding-right: 1ex;
width: 100%;
}
PRE.doctools_example {
color: black;
background: #f5dcb3;
border: 1px solid black;
}
UL.doctools_requirements LI, UL.doctools_syntax LI {
list-style: none;
margin-left: 0em;
text-indent: 0em;
padding: 0em;
}
DIV.doctools_synopsis {
color: black;
background: #80ffff;
border: 1px solid black;
font-family: serif;
margin-top: 1em;
margin-bottom: 1em;
}
UL.doctools_syntax {
margin-top: 1em;
border-top: 1px solid black;
}
UL.doctools_requirements {
margin-bottom: 1em;
border-bottom: 1px solid black;
}
--></style>
</head>
<!-- Generated from file 'map_slippy.man' by tcllib/doctools with format 'html'
-->
<!-- map::slippy.n
-->
<body><hr> [
<a href="../../../../../../../../home">Tcllib Home</a>
&#124; <a href="../../../../toc.html">Main Table Of Contents</a>
&#124; <a href="../../../toc.html">Table Of Contents</a>
&#124; <a href="../../../../index.html">Keyword Index</a>
&#124; <a href="../../../../toc0.html">Categories</a>
&#124; <a href="../../../../toc1.html">Modules</a>
&#124; <a href="../../../../toc2.html">Applications</a>
] <hr>
<div class="doctools">
<h1 class="doctools_title">map::slippy(n) 0.5 tcllib &quot;Mapping utilities&quot;</h1>
<div id="name" class="doctools_section"><h2><a name="name">Name</a></h2>
<p>map::slippy - Common code for slippy based map packages</p>
</div>
<div id="toc" class="doctools_section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="doctools_toc">
<li class="doctools_section"><a href="#toc">Table Of Contents</a></li>
<li class="doctools_section"><a href="#synopsis">Synopsis</a></li>
<li class="doctools_section"><a href="#section1">Description</a></li>
<li class="doctools_section"><a href="#section2">API</a></li>
<li class="doctools_section"><a href="#section3">Coordinate systems</a>
<ul>
<li class="doctools_subsection"><a href="#subsection1">Geographic</a></li>
<li class="doctools_subsection"><a href="#subsection2">Tiles</a></li>
<li class="doctools_subsection"><a href="#subsection3">Pixels/Points</a></li>
</ul>
</li>
<li class="doctools_section"><a href="#section4">References</a></li>
<li class="doctools_section"><a href="#keywords">Keywords</a></li>
</ul>
</div>
<div id="synopsis" class="doctools_section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="doctools_synopsis">
<ul class="doctools_requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">Tk 8.4</b></li>
<li>package require <b class="pkgname">map::slippy <span class="opt">?0.5?</span></b></li>
</ul>
<ul class="doctools_syntax">
<li><a href="#1"><b class="cmd">::map::slippy</b> <b class="method">length</b> <i class="arg">level</i></a></li>
<li><a href="#2"><b class="cmd">::map::slippy</b> <b class="method">tiles</b> <i class="arg">level</i></a></li>
<li><a href="#3"><b class="cmd">::map::slippy</b> <b class="method">tile size</b></a></li>
<li><a href="#4"><b class="cmd">::map::slippy</b> <b class="method">tile valid</b> <i class="arg">tile</i> <i class="arg">levels</i> <span class="opt">?<i class="arg">msgvar</i>?</span></a></li>
<li><a href="#5"><b class="cmd">::map::slippy</b> <b class="method">geo 2tile</b> <i class="arg">geo</i></a></li>
<li><a href="#6"><b class="cmd">::map::slippy</b> <b class="method">geo 2tile.float</b> <i class="arg">geo</i></a></li>
<li><a href="#7"><b class="cmd">::map::slippy</b> <b class="method">geo 2point</b> <i class="arg">geo</i></a></li>
<li><a href="#8"><b class="cmd">::map::slippy</b> <b class="method">tile 2geo</b> <i class="arg">tile</i></a></li>
<li><a href="#9"><b class="cmd">::map::slippy</b> <b class="method">tile 2point</b> <i class="arg">tile</i></a></li>
<li><a href="#10"><b class="cmd">::map::slippy</b> <b class="method">point 2geo</b> <i class="arg">point</i></a></li>
<li><a href="#11"><b class="cmd">::map::slippy</b> <b class="method">point 2tile</b> <i class="arg">point</i></a></li>
<li><a href="#12"><b class="cmd">::map::slippy</b> <b class="method">fit geobox</b> <i class="arg">canvdim</i> <i class="arg">geobox</i> <i class="arg">zmin</i> <i class="arg">zmax</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="doctools_section"><h2><a name="section1">Description</a></h2>
<p>This package provides a number of methods doing things needed by all
types of slippy-based map packages.</p>
</div>
<div id="section2" class="doctools_section"><h2><a name="section2">API</a></h2>
<dl class="doctools_definitions">
<dt><a name="1"><b class="cmd">::map::slippy</b> <b class="method">length</b> <i class="arg">level</i></a></dt>
<dd><p>This method returns the width/height of a slippy-based map at the
specified zoom <i class="arg">level</i>, in pixels. This is, in essence, the result
of</p>
<pre class="doctools_example">
expr { [tiles $level] * [tile size] }
</pre>
</dd>
<dt><a name="2"><b class="cmd">::map::slippy</b> <b class="method">tiles</b> <i class="arg">level</i></a></dt>
<dd><p>This method returns the width/height of a slippy-based map at the
specified zoom <i class="arg">level</i>, in <i class="term">tiles</i>.</p></dd>
<dt><a name="3"><b class="cmd">::map::slippy</b> <b class="method">tile size</b></a></dt>
<dd><p>This method returns the width/height of a tile in a slippy-based map,
in pixels.</p></dd>
<dt><a name="4"><b class="cmd">::map::slippy</b> <b class="method">tile valid</b> <i class="arg">tile</i> <i class="arg">levels</i> <span class="opt">?<i class="arg">msgvar</i>?</span></a></dt>
<dd><p>This method checks whether <i class="arg">tile</i> described a valid tile in a
slippy-based map containing that many zoom <i class="arg">levels</i>. The result is
a boolean value, <b class="const">true</b> if the tile is valid, and <b class="const">false</b>
otherwise. For the latter a message is left in the variable named by
<i class="arg">msgvar</i>, should it be specified.</p>
<p>A tile identifier as stored in <i class="arg">tile</i> is a list containing zoom
level, tile row, and tile column, in this order. The command
essentially checks this, i.e. the syntax, that the zoom level is
between 0 and &quot;<i class="arg">levels</i>-1&quot;, and that the row/col information is
within the boundaries for the zoom level, i.e. 0 ...
&quot;[tiles $zoom]-1&quot;.</p></dd>
<dt><a name="5"><b class="cmd">::map::slippy</b> <b class="method">geo 2tile</b> <i class="arg">geo</i></a></dt>
<dd><p>Converts a geographical location at a zoom level (<i class="arg">geo</i>, a list
containing zoom level, latitude, and longitude, in this order) to a
tile identifier (list containing zoom level, row, and column) at that
level. The tile identifier uses pure integer numbers for the tile
coordinates, for all geographic coordinates mapping to that tile.</p></dd>
<dt><a name="6"><b class="cmd">::map::slippy</b> <b class="method">geo 2tile.float</b> <i class="arg">geo</i></a></dt>
<dd><p>Converts a geographical location at a zoom level (<i class="arg">geo</i>, a list
containing zoom level, latitude, and longitude, in this order) to a
tile identifier (list containing zoom level, row, and column) at that
level. The tile identifier uses floating point numbers for the tile
coordinates, representing not only the tile the geographic coordinates
map to, but also the fractional location inside of that tile.</p></dd>
<dt><a name="7"><b class="cmd">::map::slippy</b> <b class="method">geo 2point</b> <i class="arg">geo</i></a></dt>
<dd><p>Converts a geographical location at a zoom level (<i class="arg">geo</i>, a list
containing zoom level, latitude, and longitude, in this order) to a
pixel position (list containing zoom level, y, and x) at that level.</p></dd>
<dt><a name="8"><b class="cmd">::map::slippy</b> <b class="method">tile 2geo</b> <i class="arg">tile</i></a></dt>
<dd><p>Converts a tile identifier at a zoom level (<i class="arg">tile</i>, list
containing zoom level, row, and column) to a geographical location
(list containing zoom level, latitude, and longitude, in this order)
at that level.</p></dd>
<dt><a name="9"><b class="cmd">::map::slippy</b> <b class="method">tile 2point</b> <i class="arg">tile</i></a></dt>
<dd><p>Converts a tile identifier at a zoom level (<i class="arg">tile</i>, a list
containing zoom level, row, and column, in this order) to a pixel
position (list containing zoom level, y, and x) at that level.</p></dd>
<dt><a name="10"><b class="cmd">::map::slippy</b> <b class="method">point 2geo</b> <i class="arg">point</i></a></dt>
<dd><p>Converts a pixel position at a zoom level (<i class="arg">point</i>, list
containing zoom level, y, and x) to a geographical location (list
containing zoom level, latitude, and longitude, in this order) at that
level.</p></dd>
<dt><a name="11"><b class="cmd">::map::slippy</b> <b class="method">point 2tile</b> <i class="arg">point</i></a></dt>
<dd><p>Converts a pixel position at a zoom level (<i class="arg">point</i>, a list
containing zoom level, y, and x, in this order) to a tile identifier
(list containing zoom level, row, and column) at that level.</p></dd>
<dt><a name="12"><b class="cmd">::map::slippy</b> <b class="method">fit geobox</b> <i class="arg">canvdim</i> <i class="arg">geobox</i> <i class="arg">zmin</i> <i class="arg">zmax</i></a></dt>
<dd><p>Calculates the zoom level (whithin the bounds <i class="arg">zmin</i> and
<i class="arg">zmax</i>) such that <i class="arg">geobox</i> (a 4-element list containing the
latitudes and longitudes lat0, lat1, lon0 and lon1 of a geo box,
in this order) fits into a viewport given by <i class="arg">canvdim</i>, a
2-element list containing the width and height of the viewport, in
this order.</p></dd>
</dl>
</div>
<div id="section3" class="doctools_section"><h2><a name="section3">Coordinate systems</a></h2>
<p>The commands of this package operate on three distinct coordinate
systems, which are explained below.</p>
<div id="subsection1" class="doctools_subsection"><h3><a name="subsection1">Geographic</a></h3>
<p><i class="term">Geographic</i>al coordinates are represented by <i class="term">Latitude</i> and
<i class="term"><a href="../../../../index.html#longitude">Longitude</a></i>, each of which is measured in degrees, as they are
essentially angles.</p>
<p><b class="const">Zero</b> longitude is the <i class="term">Greenwich meridian</i>, with
positive values going <i class="term">east</i>, and negative values going
<i class="term">west</i>, for a total range of +/- 180 degrees. Note that +180 and
-180 longitude are the same <i class="term">meridian</i>, opposite to greenwich.</p>
<p><b class="const">zero</b> latitude the <i class="term">Equator</i>, with positive values
going <i class="term">north</i> and negative values going <i class="term">south</i>. While the
true range is +/- 90 degrees the projection used by the package
requires us to cap the range at +/- 85.05112877983284 degrees. This
means that north and south pole are not representable and not part of
any map.</p>
</div>
<div id="subsection2" class="doctools_subsection"><h3><a name="subsection2">Tiles</a></h3>
<p>While <span class="sectref"><a href="#subsection1">Geographic</a></span>al coordinates of the previous section are
independent of zoom level the <i class="term">tile coordinates</i> are not.</p>
<p>Generally the integer part of tile coordinates represent the
row and column number of the tile in question, wheras the fractional
parts signal how far inside the tile the location in question is, with
pure integer coordinates (no fractional part) representing the upper
left corner of the tile.</p>
<p>The zero point of the map is at the upper left corner,
regardless of zoom level, with larger coordinates going right (east)
and down (south), and smaller coordinates going left (west) and up
(north). Again regardless of zxoom level.</p>
<p>Negative tile coordinates are not allowed.</p>
<p>At zoom level 0 the whole map is represented by a single,
putting the geographic zero at 1/2, 1/2 of tile coordinates, and the
range of tile coordinates as [0...1].</p>
<p>To go from a zoom level N to the next deeper level N+1 each
tile of level N is split into its four quadrants, which then are the
tiles of level N+1.</p>
<p>This means that at zoom level N the map is sliced (horizontally
and vertically) into 2^N stripes, for a total of 4^N tiles, with tile
coordinates ranging from 0 to 2^N+1.</p>
</div>
<div id="subsection3" class="doctools_subsection"><h3><a name="subsection3">Pixels/Points</a></h3>
<p><i class="term">pixel coordinates</i>, also called <i class="term">point coordinates</i> are
in essence <span class="sectref"><a href="#subsection2">tile coordinates</a></span> scaled by the size of
the image representing a tile. This tile size currently has a fixed
value, <b class="const">256</b>.</p>
</div>
</div>
<div id="section4" class="doctools_section"><h2><a name="section4">References</a></h2>
<ol class="doctools_enumerated">
<li><p><a href="http://wiki.openstreetmap.org/wiki/Main_Page">http://wiki.openstreetmap.org/wiki/Main_Page</a></p></li>
</ol>
</div>
<div id="keywords" class="doctools_section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#geodesy">geodesy</a>, <a href="../../../../index.html#geography">geography</a>, <a href="../../../../index.html#latitute">latitute</a>, <a href="../../../../index.html#location">location</a>, <a href="../../../../index.html#longitude">longitude</a>, <a href="../../../../index.html#map">map</a>, <a href="../../../../index.html#slippy">slippy</a>, <a href="../../../../index.html#zoom">zoom</a></p>
</div>
</div></body></html>
@@ -1,455 +0,0 @@
<!DOCTYPE html><html><head>
<title>struct::matrix_v1 - Tcl Data Structures</title>
<style type="text/css"><!--
HTML {
background: #FFFFFF;
color: black;
}
BODY {
background: #FFFFFF;
color: black;
}
DIV.doctools {
margin-left: 10%;
margin-right: 10%;
}
DIV.doctools H1,DIV.doctools H2 {
margin-left: -5%;
}
H1, H2, H3, H4 {
margin-top: 1em;
font-family: sans-serif;
font-size: large;
color: #005A9C;
background: transparent;
text-align: left;
}
H1.doctools_title {
text-align: center;
}
UL,OL {
margin-right: 0em;
margin-top: 3pt;
margin-bottom: 3pt;
}
UL LI {
list-style: disc;
}
OL LI {
list-style: decimal;
}
DT {
padding-top: 1ex;
}
UL.doctools_toc,UL.doctools_toc UL, UL.doctools_toc UL UL {
font: normal 12pt/14pt sans-serif;
list-style: none;
}
LI.doctools_section, LI.doctools_subsection {
list-style: none;
margin-left: 0em;
text-indent: 0em;
padding: 0em;
}
PRE {
display: block;
font-family: monospace;
white-space: pre;
margin: 0%;
padding-top: 0.5ex;
padding-bottom: 0.5ex;
padding-left: 1ex;
padding-right: 1ex;
width: 100%;
}
PRE.doctools_example {
color: black;
background: #f5dcb3;
border: 1px solid black;
}
UL.doctools_requirements LI, UL.doctools_syntax LI {
list-style: none;
margin-left: 0em;
text-indent: 0em;
padding: 0em;
}
DIV.doctools_synopsis {
color: black;
background: #80ffff;
border: 1px solid black;
font-family: serif;
margin-top: 1em;
margin-bottom: 1em;
}
UL.doctools_syntax {
margin-top: 1em;
border-top: 1px solid black;
}
UL.doctools_requirements {
margin-bottom: 1em;
border-bottom: 1px solid black;
}
--></style>
</head>
<!-- Generated from file 'matrix1.man' by tcllib/doctools with format 'html'
-->
<!-- Copyright &amp;copy; 2002,2019 Andreas Kupries &amp;lt;andreas_kupries@users.sourceforge.net&amp;gt;
-->
<!-- struct::matrix_v1.n
-->
<body><hr> [
<a href="../../../../../../../../home">Tcllib Home</a>
&#124; <a href="../../../../toc.html">Main Table Of Contents</a>
&#124; <a href="../../../toc.html">Table Of Contents</a>
&#124; <a href="../../../../index.html">Keyword Index</a>
&#124; <a href="../../../../toc0.html">Categories</a>
&#124; <a href="../../../../toc1.html">Modules</a>
&#124; <a href="../../../../toc2.html">Applications</a>
] <hr>
<div class="doctools">
<h1 class="doctools_title">struct::matrix_v1(n) 1.2.2 tcllib &quot;Tcl Data Structures&quot;</h1>
<div id="name" class="doctools_section"><h2><a name="name">Name</a></h2>
<p>struct::matrix_v1 - Create and manipulate matrix objects</p>
</div>
<div id="toc" class="doctools_section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="doctools_toc">
<li class="doctools_section"><a href="#toc">Table Of Contents</a></li>
<li class="doctools_section"><a href="#synopsis">Synopsis</a></li>
<li class="doctools_section"><a href="#section1">Description</a></li>
<li class="doctools_section"><a href="#section2">EXAMPLES</a></li>
<li class="doctools_section"><a href="#section3">Bugs, Ideas, Feedback</a></li>
<li class="doctools_section"><a href="#keywords">Keywords</a></li>
<li class="doctools_section"><a href="#category">Category</a></li>
<li class="doctools_section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="doctools_section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="doctools_synopsis">
<ul class="doctools_requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">struct::matrix <span class="opt">?1.2.2?</span></b></li>
</ul>
<ul class="doctools_syntax">
<li><a href="#1"><b class="cmd">matrixName</b> <i class="arg">option</i> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></li>
<li><a href="#2"><i class="arg">matrixName</i> <b class="method">add column</b> <span class="opt">?<i class="arg">values</i>?</span></a></li>
<li><a href="#3"><i class="arg">matrixName</i> <b class="method">add row</b> <span class="opt">?<i class="arg">values</i>?</span></a></li>
<li><a href="#4"><i class="arg">matrixName</i> <b class="method">add columns</b> <i class="arg">n</i></a></li>
<li><a href="#5"><i class="arg">matrixName</i> <b class="method">add rows</b> <i class="arg">n</i></a></li>
<li><a href="#6"><i class="arg">matrixName</i> <b class="method">cells</b></a></li>
<li><a href="#7"><i class="arg">matrixName</i> <b class="method">cellsize</b> <i class="arg">column row</i></a></li>
<li><a href="#8"><i class="arg">matrixName</i> <b class="method">columns</b></a></li>
<li><a href="#9"><i class="arg">matrixName</i> <b class="method">columnwidth</b> <i class="arg">column</i></a></li>
<li><a href="#10"><i class="arg">matrixName</i> <b class="method">delete column</b> <i class="arg">column</i></a></li>
<li><a href="#11"><i class="arg">matrixName</i> <b class="method">delete row</b> <i class="arg">row</i></a></li>
<li><a href="#12"><i class="arg">matrixName</i> <b class="method">destroy</b></a></li>
<li><a href="#13"><i class="arg">matrixName</i> <b class="method">format 2string</b> <span class="opt">?<i class="arg">report</i>?</span></a></li>
<li><a href="#14"><i class="arg">matrixName</i> <b class="method">format 2chan</b> <span class="opt">?<span class="opt">?<i class="arg">report</i>?</span> <i class="arg">channel</i>?</span></a></li>
<li><a href="#15"><i class="arg">matrixName</i> <b class="method">get cell</b> <i class="arg">column row</i></a></li>
<li><a href="#16"><i class="arg">matrixName</i> <b class="method">get column</b> <i class="arg">column</i></a></li>
<li><a href="#17"><i class="arg">matrixName</i> <b class="method">get rect</b> <i class="arg">column_tl row_tl column_br row_br</i></a></li>
<li><a href="#18"><i class="arg">matrixName</i> <b class="method">get row</b> <i class="arg">row</i></a></li>
<li><a href="#19"><i class="arg">matrixName</i> <b class="method">insert column</b> <i class="arg">column</i> <span class="opt">?<i class="arg">values</i>?</span></a></li>
<li><a href="#20"><i class="arg">matrixName</i> <b class="method">insert row</b> <i class="arg">row</i> <span class="opt">?<i class="arg">values</i>?</span></a></li>
<li><a href="#21"><i class="arg">matrixName</i> <b class="method">link</b> <span class="opt">?-transpose?</span> <i class="arg">arrayvar</i></a></li>
<li><a href="#22"><i class="arg">matrixName</i> <b class="method">links</b></a></li>
<li><a href="#23"><i class="arg">matrixName</i> <b class="method">rowheight</b> <i class="arg">row</i></a></li>
<li><a href="#24"><i class="arg">matrixName</i> <b class="method">rows</b></a></li>
<li><a href="#25"><i class="arg">matrixName</i> <b class="method">search</b> <span class="opt">?-nocase?</span> <span class="opt">?-exact|-glob|-regexp?</span> <b class="method">all</b> <i class="arg">pattern</i></a></li>
<li><a href="#26"><i class="arg">matrixName</i> <b class="method">search</b> <span class="opt">?-nocase?</span> <span class="opt">?-exact|-glob|-regexp?</span> <b class="method">column</b> <i class="arg">column pattern</i></a></li>
<li><a href="#27"><i class="arg">matrixName</i> <b class="method">search</b> <span class="opt">?-nocase?</span> <span class="opt">?-exact|-glob|-regexp?</span> <b class="method">row</b> <i class="arg">row pattern</i></a></li>
<li><a href="#28"><i class="arg">matrixName</i> <b class="method">search</b> <span class="opt">?-nocase?</span> <span class="opt">?-exact|-glob|-regexp?</span> <b class="method">rect</b> <i class="arg">column_tl row_tl column_br row_br pattern</i></a></li>
<li><a href="#29"><i class="arg">matrixName</i> <b class="method">set cell</b> <i class="arg">column row value</i></a></li>
<li><a href="#30"><i class="arg">matrixName</i> <b class="method">set column</b> <i class="arg">column values</i></a></li>
<li><a href="#31"><i class="arg">matrixName</i> <b class="method">set rect</b> <i class="arg">column row values</i></a></li>
<li><a href="#32"><i class="arg">matrixName</i> <b class="method">set row</b> <i class="arg">row values</i></a></li>
<li><a href="#33"><i class="arg">matrixName</i> <b class="method">sort columns</b> <span class="opt">?<b class="option">-increasing</b>|<b class="option">-decreasing</b>?</span> <i class="arg">row</i></a></li>
<li><a href="#34"><i class="arg">matrixName</i> <b class="method">sort rows</b> <span class="opt">?<b class="option">-increasing</b>|<b class="option">-decreasing</b>?</span> <i class="arg">column</i></a></li>
<li><a href="#35"><i class="arg">matrixName</i> <b class="method">swap columns</b> <i class="arg">column_a column_b</i></a></li>
<li><a href="#36"><i class="arg">matrixName</i> <b class="method">swap rows</b> <i class="arg">row_a row_b</i></a></li>
<li><a href="#37"><i class="arg">matrixName</i> <b class="method">unlink</b> <i class="arg">arrayvar</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="doctools_section"><h2><a name="section1">Description</a></h2>
<p>The <b class="cmd">::struct::matrix</b> command creates a new matrix object with an
associated global Tcl command whose name is <i class="arg">matrixName</i>. This
command may be used to invoke various operations on the matrix. It has
the following general form:</p>
<dl class="doctools_definitions">
<dt><a name="1"><b class="cmd">matrixName</b> <i class="arg">option</i> <span class="opt">?<i class="arg">arg arg ...</i>?</span></a></dt>
<dd><p><i class="arg">Option</i> and the <i class="arg">arg</i>s determine the exact behavior of the
command.</p></dd>
</dl>
<p>A matrix is a rectangular collection of cells, i.e. organized in rows
and columns. Each cell contains exactly one value of arbitrary
form. The cells in the matrix are addressed by pairs of integer
numbers, with the first (left) number in the pair specifying the
column and the second (right) number specifying the row the cell is
in. These indices are counted from 0 upward. The special non-numeric
index <b class="const">end</b> refers to the last row or column in the matrix,
depending on the context. Indices of the form
<b class="const">end</b>-<b class="variable">number</b> are counted from the end of the row or
column, like they are for standard Tcl lists. Trying to access
non-existing cells causes an error.</p>
<p>The matrices here are created empty, i.e. they have neither rows nor
columns. The user then has to add rows and columns as needed by his
application. A specialty of this structure is the ability to export an
array-view onto its contents. Such can be used by tkTable, for
example, to link the matrix into the display.</p>
<p>The following commands are possible for matrix objects:</p>
<dl class="doctools_definitions">
<dt><a name="2"><i class="arg">matrixName</i> <b class="method">add column</b> <span class="opt">?<i class="arg">values</i>?</span></a></dt>
<dd><p>Extends the matrix by one column and then acts like <b class="method">setcolumn</b>
(see below) on this new column if there were <i class="arg">values</i>
supplied. Without <i class="arg">values</i> the new cells will be set to the empty
string. The new column is appended immediately behind the last
existing column.</p></dd>
<dt><a name="3"><i class="arg">matrixName</i> <b class="method">add row</b> <span class="opt">?<i class="arg">values</i>?</span></a></dt>
<dd><p>Extends the matrix by one row and then acts like <b class="method">setrow</b> (see
below) on this new row if there were <i class="arg">values</i> supplied. Without
<i class="arg">values</i> the new cells will be set to the empty string. The new
row is appended immediately behind the last existing row.</p></dd>
<dt><a name="4"><i class="arg">matrixName</i> <b class="method">add columns</b> <i class="arg">n</i></a></dt>
<dd><p>Extends the matrix by <i class="arg">n</i> columns. The new cells will be set to
the empty string. The new columns are appended immediately behind the
last existing column. A value of <i class="arg">n</i> equal to or smaller than 0 is
not allowed.</p></dd>
<dt><a name="5"><i class="arg">matrixName</i> <b class="method">add rows</b> <i class="arg">n</i></a></dt>
<dd><p>Extends the matrix by <i class="arg">n</i> rows. The new cells will be set to the
empty string. The new rows are appended immediately behind the last
existing row. A value of <i class="arg">n</i> equal to or smaller than 0 is not
allowed.</p></dd>
<dt><a name="6"><i class="arg">matrixName</i> <b class="method">cells</b></a></dt>
<dd><p>Returns the number of cells currently managed by the matrix. This is
the product of <b class="method">rows</b> and <b class="method">columns</b>.</p></dd>
<dt><a name="7"><i class="arg">matrixName</i> <b class="method">cellsize</b> <i class="arg">column row</i></a></dt>
<dd><p>Returns the length of the string representation of the value currently
contained in the addressed cell.</p></dd>
<dt><a name="8"><i class="arg">matrixName</i> <b class="method">columns</b></a></dt>
<dd><p>Returns the number of columns currently managed by the matrix.</p></dd>
<dt><a name="9"><i class="arg">matrixName</i> <b class="method">columnwidth</b> <i class="arg">column</i></a></dt>
<dd><p>Returns the length of the longest string representation of all the
values currently contained in the cells of the addressed column if
these are all spanning only one line. For cell values spanning
multiple lines the length of their longest line goes into the
computation.</p></dd>
<dt><a name="10"><i class="arg">matrixName</i> <b class="method">delete column</b> <i class="arg">column</i></a></dt>
<dd><p>Deletes the specified column from the matrix and shifts all columns
with higher indices one index down.</p></dd>
<dt><a name="11"><i class="arg">matrixName</i> <b class="method">delete row</b> <i class="arg">row</i></a></dt>
<dd><p>Deletes the specified row from the matrix and shifts all row with
higher indices one index down.</p></dd>
<dt><a name="12"><i class="arg">matrixName</i> <b class="method">destroy</b></a></dt>
<dd><p>Destroys the matrix, including its storage space and associated
command.</p></dd>
<dt><a name="13"><i class="arg">matrixName</i> <b class="method">format 2string</b> <span class="opt">?<i class="arg">report</i>?</span></a></dt>
<dd><p>Formats the matrix using the specified report object and returns the
string containing the result of this operation. The report has to
support the <b class="method">printmatrix</b> method. If no <i class="arg">report</i> is
specified the system will use an internal report definition to format
the matrix.</p></dd>
<dt><a name="14"><i class="arg">matrixName</i> <b class="method">format 2chan</b> <span class="opt">?<span class="opt">?<i class="arg">report</i>?</span> <i class="arg">channel</i>?</span></a></dt>
<dd><p>Formats the matrix using the specified report object and writes the
string containing the result of this operation into the channel. The
report has to support the <b class="method">printmatrix2channel</b> method. If no
<i class="arg">report</i> is specified the system will use an internal report
definition to format the matrix. If no <i class="arg">channel</i> is specified the
system will use <b class="const">stdout</b>.</p></dd>
<dt><a name="15"><i class="arg">matrixName</i> <b class="method">get cell</b> <i class="arg">column row</i></a></dt>
<dd><p>Returns the value currently contained in the cell identified by row
and column index.</p></dd>
<dt><a name="16"><i class="arg">matrixName</i> <b class="method">get column</b> <i class="arg">column</i></a></dt>
<dd><p>Returns a list containing the values from all cells in the column
identified by the index. The contents of the cell in row 0 are stored
as the first element of this list.</p></dd>
<dt><a name="17"><i class="arg">matrixName</i> <b class="method">get rect</b> <i class="arg">column_tl row_tl column_br row_br</i></a></dt>
<dd><p>Returns a list of lists of cell values. The values stored in the
result come from the sub-matrix whose top-left and bottom-right cells
are specified by <i class="arg">column_tl, row_tl</i> and
<i class="arg">column_br, row_br</i> resp. Note that the following equations have
to be true: &quot;<i class="arg">column_tl</i> &lt;= <i class="arg">column_br</i>&quot; and &quot;<i class="arg">row_tl</i> &lt;=
<i class="arg">row_br</i>&quot;. The result is organized as follows: The outer list is
the list of rows, its elements are lists representing a single
row. The row with the smallest index is the first element of the outer
list. The elements of the row lists represent the selected cell
values. The cell with the smallest index is the first element in each
row list.</p></dd>
<dt><a name="18"><i class="arg">matrixName</i> <b class="method">get row</b> <i class="arg">row</i></a></dt>
<dd><p>Returns a list containing the values from all cells in the row
identified by the index. The contents of the cell in column 0 are
stored as the first element of this list.</p></dd>
<dt><a name="19"><i class="arg">matrixName</i> <b class="method">insert column</b> <i class="arg">column</i> <span class="opt">?<i class="arg">values</i>?</span></a></dt>
<dd><p>Extends the matrix by one column and then acts like <b class="method">setcolumn</b>
(see below) on this new column if there were <i class="arg">values</i>
supplied. Without <i class="arg">values</i> the new cells will be set to the empty
string. The new column is inserted just before the column specified by
the given index. This means, if <i class="arg">column</i> is less than or equal to
zero, then the new column is inserted at the beginning of the matrix,
before the first column. If <i class="arg">column</i> has the value <b class="const">end</b>,
or if it is greater than or equal to the number of columns in the
matrix, then the new column is appended to the matrix, behind the last
column. The old column at the chosen index and all columns with higher
indices are shifted one index upward.</p></dd>
<dt><a name="20"><i class="arg">matrixName</i> <b class="method">insert row</b> <i class="arg">row</i> <span class="opt">?<i class="arg">values</i>?</span></a></dt>
<dd><p>Extends the matrix by one row and then acts like <b class="method">setrow</b> (see
below) on this new row if there were <i class="arg">values</i> supplied. Without
<i class="arg">values</i> the new cells will be set to the empty string. The new
row is inserted just before the row specified by the given index. This
means, if <i class="arg">row</i> is less than or equal to zero, then the new row is
inserted at the beginning of the matrix, before the first row. If
<i class="arg">row</i> has the value <b class="const">end</b>, or if it is greater than or
equal to the number of rows in the matrix, then the new row is
appended to the matrix, behind the last row. The old row at that index
and all rows with higher indices are shifted one index upward.</p></dd>
<dt><a name="21"><i class="arg">matrixName</i> <b class="method">link</b> <span class="opt">?-transpose?</span> <i class="arg">arrayvar</i></a></dt>
<dd><p>Links the matrix to the specified array variable. This means that the
contents of all cells in the matrix is stored in the array too, with
all changes to the matrix propagated there too. The contents of the
cell <i class="arg">(column,row)</i> is stored in the array using the key
<i class="arg">column,row</i>. If the option <b class="option">-transpose</b> is specified the
key <i class="arg">row,column</i> will be used instead. It is possible to link the
matrix to more than one array. Note that the link is bidirectional,
i.e. changes to the array are mirrored in the matrix too.</p></dd>
<dt><a name="22"><i class="arg">matrixName</i> <b class="method">links</b></a></dt>
<dd><p>Returns a list containing the names of all array variables the matrix
was linked to through a call to method <b class="method">link</b>.</p></dd>
<dt><a name="23"><i class="arg">matrixName</i> <b class="method">rowheight</b> <i class="arg">row</i></a></dt>
<dd><p>Returns the height of the specified row in lines. This is the highest
number of lines spanned by a cell over all cells in the row.</p></dd>
<dt><a name="24"><i class="arg">matrixName</i> <b class="method">rows</b></a></dt>
<dd><p>Returns the number of rows currently managed by the matrix.</p></dd>
<dt><a name="25"><i class="arg">matrixName</i> <b class="method">search</b> <span class="opt">?-nocase?</span> <span class="opt">?-exact|-glob|-regexp?</span> <b class="method">all</b> <i class="arg">pattern</i></a></dt>
<dd><p>Searches the whole matrix for cells matching the <i class="arg">pattern</i> and
returns a list with all matches. Each item in the aforementioned list
is a list itself and contains the column and row index of the matching
cell, in this order. The results are ordered by column first and row
second, both times in ascending order. This means that matches to the
left and the top of the matrix come before matches to the right and
down.</p>
<p>The type of the pattern (string, glob, regular expression) is
determined by the option after the <b class="method">search</b> keyword. If no
option is given it defaults to <b class="option">-exact</b>.</p>
<p>If the option <b class="option">-nocase</b> is specified the search will be
case-insensitive.</p></dd>
<dt><a name="26"><i class="arg">matrixName</i> <b class="method">search</b> <span class="opt">?-nocase?</span> <span class="opt">?-exact|-glob|-regexp?</span> <b class="method">column</b> <i class="arg">column pattern</i></a></dt>
<dd><p>Like <b class="method">search all</b>, but the search is restricted to the
specified column.</p></dd>
<dt><a name="27"><i class="arg">matrixName</i> <b class="method">search</b> <span class="opt">?-nocase?</span> <span class="opt">?-exact|-glob|-regexp?</span> <b class="method">row</b> <i class="arg">row pattern</i></a></dt>
<dd><p>Like <b class="method">search all</b>, but the search is restricted to the
specified row.</p></dd>
<dt><a name="28"><i class="arg">matrixName</i> <b class="method">search</b> <span class="opt">?-nocase?</span> <span class="opt">?-exact|-glob|-regexp?</span> <b class="method">rect</b> <i class="arg">column_tl row_tl column_br row_br pattern</i></a></dt>
<dd><p>Like <b class="method">search all</b>, but the search is restricted to the
specified rectangular area of the matrix.</p></dd>
<dt><a name="29"><i class="arg">matrixName</i> <b class="method">set cell</b> <i class="arg">column row value</i></a></dt>
<dd><p>Sets the value in the cell identified by row and column index to the
data in the third argument.</p></dd>
<dt><a name="30"><i class="arg">matrixName</i> <b class="method">set column</b> <i class="arg">column values</i></a></dt>
<dd><p>Sets the values in the cells identified by the column index to the
elements of the list provided as the third argument. Each element of
the list is assigned to one cell, with the first element going into
the cell in row 0 and then upward. If there are less values in the
list than there are rows the remaining rows are set to the empty
string. If there are more values in the list than there are rows the
superfluous elements are ignored. The matrix is not extended by this
operation.</p></dd>
<dt><a name="31"><i class="arg">matrixName</i> <b class="method">set rect</b> <i class="arg">column row values</i></a></dt>
<dd><p>Takes a list of lists of cell values and writes them into the
submatrix whose top-left cell is specified by the two indices. If the
sublists of the outerlist are not of equal length the shorter sublists
will be filled with empty strings to the length of the longest
sublist. If the submatrix specified by the top-left cell and the
number of rows and columns in the <i class="arg">values</i> extends beyond the
matrix we are modifying the over-extending parts of the values are
ignored, i.e. essentially cut off. This subcommand expects its input
in the format as returned by <b class="method">getrect</b>.</p></dd>
<dt><a name="32"><i class="arg">matrixName</i> <b class="method">set row</b> <i class="arg">row values</i></a></dt>
<dd><p>Sets the values in the cells identified by the row index to the
elements of the list provided as the third argument. Each element of
the list is assigned to one cell, with the first element going into
the cell in column 0 and then upward. If there are less values in the
list than there are columns the remaining columns are set to the empty
string. If there are more values in the list than there are columns
the superfluous elements are ignored. The matrix is not extended by
this operation.</p></dd>
<dt><a name="33"><i class="arg">matrixName</i> <b class="method">sort columns</b> <span class="opt">?<b class="option">-increasing</b>|<b class="option">-decreasing</b>?</span> <i class="arg">row</i></a></dt>
<dd><p>Sorts the columns in the matrix using the data in the specified
<i class="arg">row</i> as the key to sort by. The options <b class="option">-increasing</b>
and <b class="option">-decreasing</b> have the same meaning as for <b class="cmd">lsort</b>.
If no option is specified <b class="option">-increasing</b> is assumed.</p></dd>
<dt><a name="34"><i class="arg">matrixName</i> <b class="method">sort rows</b> <span class="opt">?<b class="option">-increasing</b>|<b class="option">-decreasing</b>?</span> <i class="arg">column</i></a></dt>
<dd><p>Sorts the rows in the matrix using the data in the specified
<i class="arg">column</i> as the key to sort by. The options <b class="option">-increasing</b>
and <b class="option">-decreasing</b> have the same meaning as for <b class="cmd">lsort</b>.
If no option is specified <b class="option">-increasing</b> is assumed.</p></dd>
<dt><a name="35"><i class="arg">matrixName</i> <b class="method">swap columns</b> <i class="arg">column_a column_b</i></a></dt>
<dd><p>Swaps the contents of the two specified columns.</p></dd>
<dt><a name="36"><i class="arg">matrixName</i> <b class="method">swap rows</b> <i class="arg">row_a row_b</i></a></dt>
<dd><p>Swaps the contents of the two specified rows.</p></dd>
<dt><a name="37"><i class="arg">matrixName</i> <b class="method">unlink</b> <i class="arg">arrayvar</i></a></dt>
<dd><p>Removes the link between the matrix and the specified arrayvariable,
if there is one.</p></dd>
</dl>
</div>
<div id="section2" class="doctools_section"><h2><a name="section2">EXAMPLES</a></h2>
<p>The examples below assume a 5x5 matrix M with the first row containing
the values 1 to 5, with 1 in the top-left cell. Each other row
contains the contents of the row above it, rotated by one cell to the
right.</p>
<pre class="doctools_example">
% M getrect 0 0 4 4
{{1 2 3 4 5} {5 1 2 3 4} {4 5 1 2 3} {3 4 5 1 2} {2 3 4 5 1}}
</pre>
<pre class="doctools_example">
% M setrect 1 1 {{0 0 0} {0 0 0} {0 0 0}}
% M getrect 0 0 4 4
{{1 2 3 4 5} {5 0 0 0 4} {4 0 0 0 3} {3 0 0 0 2} {2 3 4 5 1}}
</pre>
<p>Assuming that the style definitions in the example section of the
manpage for the package <b class="package"><a href="../report/report.html">report</a></b> are loaded into the
interpreter now an example which formats a matrix into a tabular
report. The code filling the matrix with data is not shown. contains
useful data.</p>
<pre class="doctools_example">
% ::struct::matrix m
% # ... fill m with data, assume 5 columns
% ::report::report r 5 style captionedtable 1
% m format 2string r
+---+-------------------+-------+-------+--------+
|000|VERSIONS: |2:8.4a3|1:8.4a3|1:8.4a3%|
+---+-------------------+-------+-------+--------+
|001|CATCH return ok |7 |13 |53.85 |
|002|CATCH return error |68 |91 |74.73 |
|003|CATCH no catch used|7 |14 |50.00 |
|004|IF if true numeric |12 |33 |36.36 |
|005|IF elseif |15 |47 |31.91 |
| |true numeric | | | |
+---+-------------------+-------+-------+--------+
%
% # alternate way of doing the above
% r printmatrix m
</pre>
</div>
<div id="section3" class="doctools_section"><h2><a name="section3">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>struct :: matrix</em> of the
<a href="http://core.tcl.tk/tcllib/reportlist">Tcllib Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
<p>When proposing code changes, please provide <em>unified diffs</em>,
i.e the output of <b class="const">diff -u</b>.</p>
<p>Note further that <em>attachments</em> are strongly preferred over
inlined patches. Attachments can be made by going to the <b class="const">Edit</b>
form of the ticket immediately after its creation, and then using the
left-most button in the secondary navigation bar.</p>
</div>
<div id="keywords" class="doctools_section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#matrix">matrix</a></p>
</div>
<div id="category" class="doctools_section"><h2><a name="category">Category</a></h2>
<p>Data structures</p>
</div>
<div id="copyright" class="doctools_section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2002,2019 Andreas Kupries &lt;andreas_kupries@users.sourceforge.net&gt;</p>
</div>
</div></body></html>
File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More