In the last chapter, you saw std::array. In this one, you will be exploring std::vector.
Consider a case where you want to store the marks of the students of a class. But you don't know the number of students in the class and have only an approximate idea about the number. You can declare an array by specifying some array length.
Now, if the length of the array which you have specified during its declaration is smaller than the number of students, then the marks of all the students could not be stored. Also, if we declare its length much larger than the number of students, then unnecessarily extra memory will be allocated to the array which is not required.
In such cases, we don't know about the array length untill compile time (when computer compiles the code). This is where we need std::vector.
What is std::vector?
Unlike std::array whose length is specified at the time of declaration and remains constant till compile time, we can change the length of std::vector dynamically as the program executes according to our requirement.
Vectors are sequence containers which represent arrays which can change in size. Thus, we need not specify its length at the time of declaration and can change it later in the program.
Now let's look at how to use std::vector in place of arrays.
Declaration of std::vector
The declaration syntax of std::vector is the same as that of std::array, with the difference that we don't need to specify the array length along with the data type as shown below.
std::vector<datatype> array_name;
For using std::vector, we need to include the <vector> header in our program.
Let's look at the declaration of a vector named marks of type int to store the marks of students.
std::vector<int> marks;
Now let's see how to initialize a vector.
Initialization of std::vector
The initialization of an std::vector is also the same as that of std::array. We initialize an std::vector by either of the following ways.
std::vector<int> marks = {50, 45, 47, 65, 80};
std::vector<int> marks { {50, 45, 47, 65, 80} };
We can also assign values to the vector after declaration as shown below.
std::vector<int> marks;
marks = {50, 45, 47, 65, 80};
In the above declarations, we stored the marks of 5 students in a vector named marks. Since we did not declare the array length, so the length of 'marks' became equal to the number of values it was initialized with. Now, we may change the number of students i.e. either store the marks of more students or remove the marks of some students.
Length of std::vector
In std::vector also, the size() function returns the length (i.e. number of elements in the vector).
Let's see an example of std::vector.
#include <iostream>
#include <vector>
int main()
{
std::vector<int> marks = {50, 45, 47, 65, 80};
marks = {50, 47, 60};
std::cout << "length of array : " << marks.size() << std::endl;
return 0;
}
In this example, we first initialized the vector marks with 5 elements, thus making its length 5. In the second statement, we reassigned marks with 3 values, thus making its length 3. After reassigning, the values of marks[0], marks[1] and marks[2] are 50, 47 and 60 respectively. Resizing is not possible in case of arrays.
Passing std::vector to function
Let's look at an example of passing a vector to a function.
#include <iostream>
#include <vector>
using namespace std;
void printVector(const std::vector<int> &n)
{
for (int j = 0; j < n.size(); j++ )
{
cout << "n[" << j << "] = " << n[j] << endl;
}
}
int main()
{
vector<int> n = {1,2,3,4,5};
printVector(n);
return 0;
}
n[1] = 2
n[2] = 3
n[3] = 4
n[4] = 5
void printVector(const std::vector<int> &n) - const is used here to prevent the compiler from making a copy of the vector and this enhances the performance.
The passed vector will be n in this function as &n is the parameter of the function 'printArray'.
Member Functions
std::vector also has a number of member functions which makes adding and deleting elements from the vector easier. Let's look at some of these.
at
at function is used to access the element at specified position (index). Let's see an example.
#include <iostream>
#include <vector>
using namespace std;
int main()
{
vector<int> marks = {50, 45, 47, 65, 80};
marks.at(2) = 74;
for(int i = 0; i < marks.size() ; i++)
{
cout << "marks[" << i << "] = " << marks.at(i) << endl;
}
return 0;
}
marks[1] = 45
marks[2] = 74
marks[3] = 65
marks[4] = 80
In this example, marks.at(2) = 74 assigned 74 to the third element (marks[2]) of the vector.
front
The front function returns the first element of a vector.
#include <iostream>
#include <vector>
using namespace std;
int main()
{
vector<int> marks = {50, 45, 47, 65, 80};
cout << marks.front() << endl;
return 0;
}
back
back() function returns the last element of a vector.
#include <iostream>
#include <vector>
using namespace std;
int main()
{
vector<int> marks = {50, 45, 47, 65, 80};
cout << marks.back() << endl;
return 0;
}
empty
It checks whether a vector contains any element or not. It returns 1 if the length of a vector is 0 and 0 if it contains some element.
#include <iostream>
#include <vector>
using namespace std;
int main()
{
vector<int> v1 = {5, 6};
vector<int> v2;
cout << v1.empty() << endl;
cout << v2.empty() << endl;
return 0;
}
1
resize
It resizes a vector so that it contains the specified number of elements. Look at the following example.
#include <iostream>
#include <vector>
using namespace std;
int main()
{
vector<int> v1 = {5, 6};
v1.resize(5);
for(int i = 0; i < v1.size() ; i++)
{
cout << v1[i] << endl;
}
return 0;
}
6
0
0
0
In this example, when we initialized the vector v1, it contained 2 elements. Thus its length was 2 with v1[0] = 5 and v1[1] = 6.
v1.resize(5) resized the vector so that it contains 5 elements. Since we did not assign any value to the rest of the elements of the vector, they got assigned a value 0. So, v1[2] = 0, v1[3] = 0 and v1[4] = 0.
max_size
It returns the maximum number of elements that the vector can hold. This is not the amount of storage space currently allocated to the vector, but the maximum size the vector could reach due to limitations in system implementations.
#include <iostream>
#include <vector>
using namespace std;
int main()
{
vector<int> v1 = {1, 2, 3, 4, 5};
cout << v1.size() << endl;
cout << v1.max_size() << endl;
return 0;
}
1073741823
assign
It assigns new contents to the vector and replaces its current contents. Let's see an example.
#include <iostream>
#include <vector>
using namespace std;
int main()
{
vector<int> v;
v.assign(7, 40); // 7 elements each of value 40
cout << v.size() << endl;
return 0;
}
By writing v.assign(7, 40), the vector v contains 7 elements each having a value of 40.
We can also assign some or all the elements of an array to a vector using this function. Let's see how.
#include <iostream>
#include <vector>
using namespace std;
int main()
{
int arr[] = {1, 2, 3, 4, 7};
vector<int> v1;
vector<int> v2;
v1.assign(arr, arr+5);
v2.assign(arr, arr+2);
//printing values of v1
cout << "elements of v1" << endl;
for(int i = 0; i < v1.size(); i++)
{
cout << v1[i] << endl;
}
//printing values of v2
cout << "elements of v2" << endl;
for(int i = 0; i < v2.size(); i++)
{
cout << v2[i] << endl;
}
return 0;
}
1
2
3
4
7
elements of v2
1
2
In this example, we created an array arr and declared two vectors v1 and v2.
v1.assign(arr, arr+5) - Here, arr is pointing to arr[0] and thus arr+5 is pointing to arr[5]. This statement assigned the values of the elements of the array from arr[0] till arr[5](not including arr[5]) to the vector v1. So, now v1 contains 4 elements of values 1, 2, 3 and 4 respectively.
v2.assign(arr, arr+2) - Similarly, this statement assigned the values of the elements of the array from arr[0] till arr[2](excluding it).
push_back
This function adds a new element at the end of the vector (at the end of the last element of the vector), thus increasing the size of the vector by one.
#include <iostream>
#include <vector>
using namespace std;
int main()
{
vector<int> v = {4, 5, 6, 7, 8};
v.push_back(47);
//printing values of v
cout << "elements of v" << endl;
for(int i = 0; i < v.size(); i++)
{
cout << v[i] << endl;
}
return 0;
}
4
5
6
7
8
47
v.push_back(47) added an element having value 47 at the end of the vector. Thus, the length of the vector became 6 and the value of the new element v[5] became 47.
pop_back
This function removes the last element in the vector, thus reducing the size of the vector by one.
#include <iostream>
#include <vector>
using namespace std;
int main()
{
vector<int> v = {4, 5, 6, 7, 8};
v.pop_back();
//printing values of v
cout << "elements of v" << endl;
for(int i = 0; i < v.size(); i++)
{
cout << v[i] << endl;
}
return 0;
}
4
5
6
7
Here we removed the last element of the vector. thus making the length of the vector 4.
capacity
This function returns the storage space allocated for the vector. In other words, it returns the number of elements which can be stored in the storage space allocated for the vector.
The vector capacity is slightly greater than the vector size because the storage space allocated to a vector is always greater than that occupied by the number of elements in it so that if we add another element in the vector, the extra storage space could adjust it.
#include <iostream>
#include <vector>
using namespace std;
int main()
{
vector<int> v1;
for(int i = 0; i < 50; i++)
{
v1.push_back(1);
}
cout << "size : " << v1.size() << endl;
cout << "max_size : " << v1.max_size() << endl;
cout << "capacity : " << v1.capacity() << endl;
return 0;
}
max_size :<PHONE_NUMBER>
capacity : 64
reserve
This function increases the capacity of the vector if the desired number of elements is greater than the capacity of the vector.
#include <iostream>
#include <vector>
using namespace std;
int main()
{
vector<int> v1;
for(int i = 0; i < 50; i++)
{
v1.push_back(1);
}
v1.reserve(100);
cout << "capacity : " << v1.capacity() << endl;
return 0;
}
Here we want to store 100 elements in the vector and thus increased the capacity of the vector using the reserve() function.
insert
It inserts a new element in a vector before the element at the specified position. Let's see an example to understand this.
#include <iostream>
#include <vector>
#include <iterator>
using namespace std;
void printVector(const std::vector<int> &n)
{
cout << "Vector is :" << endl;
for (auto i: n)
{
std::cout << ' ' << i;
}
std::cout << '\n';
}
int main()
{
vector<int> v = {111,222};
printVector(v);
auto it = v.begin();
v.insert(it,000);
printVector(v);
it = v.begin();
v.insert(it,3,333);
printVector(v);
vector<int> v1 = {555,555};
it = v.begin();
v.insert(it+4, v1.begin(), v1.end());
printVector(v);
return 0;
}
111 222
Vector is :
0 111 222
Vector is :
333 333 333 0 111 222
Vector is :
333 333 333 0 555 555 111 222
v.insert(it,000); - We inserted 0 at the beginning of the vector.
v.insert(it,3,333); - We inserted 333 thrice at the beginning of the vector.
v.insert(it+4, v1.begin(), v1.end()); - We inserted the entire vector v1 (v1.begin(), v1.end()) at the 4th position of the vector v.
erase
erase function removes either a single element or a range of elements from a vector.
To remove a single element, we need to pass the iterator pointing to the element in the vector which is to be removed. To remove a range of elements, we need to pass iterators specifying the range which we want to delete. Let's see an example.
#include <iostream>
#include <vector>
#include <iterator>
using namespace std;
int main()
{
vector<int> v1 = {4, 5, 6, 7, 8};
vector<int> v2 = {1, 2, 3, 4, 5};
v1.erase(v1.begin()+4); // removing a single element at position 4
v2.erase(v2.begin()+1, v2.begin()+3); // removing range of elements from position 1 till 2
//printing the values of v1
cout << "Values of v1" << endl;
for(int i = 0; i < v1.size(); i++)
{
cout << v1[i] << endl;
}
//printing the values of v2
cout << "Values of v2" << endl;
for(int i = 0; i < v2.size(); i++)
{
cout << v2[i] << endl;
}
return 0;
}
4
5
6
7
Values of v2
1
4
5
clear
clear removes all elements of a vector.
#include <iostream>
#include <vector>
using namespace std;
int main()
{
vector<int> v1 = {4, 5, 6, 7, 8};
v1.clear();
for (auto i: v1)
{
std::cout << i << endl;
}
return 0;
}
swap
This function swaps the contents i.e. it exchanges the value of one vector with that of another.
#include <iostream>
#include <vector>
using namespace std;
int main()
{
vector<int> v1 = {1, 2, 3};
vector<int> v2 = {4, 5, 6};
v1.swap(v2);
std::cout << "Vector v1" << endl;
for (auto i: v1)
{
std::cout << i << endl;
}
std::cout << "Vector v2" << endl;
for (auto i: v2)
{
std::cout << i << endl;
}
return 0;
}
4
5
6
Vector v2
1
2
3
Multidimensional std::vector
We can also make multidimensional std::vectors. This is similar to std::array. Let's look at the syntax to make a std::vector.
std::vector<std::vector<int>> v { {{1,2,3}, {4,5,6}} };
This is similar to std::array. The inner vector (std::vector<int>) is a vector of integers and the outer vector is a vector of such inner vectors (std::vector<vector array>).
Let's look at an example to make a multidimensional vector and access all its elements.
#include <iostream>
#include <vector>
using namespace std;
int main()
{
vector<vector<int>> v {{{1,2,3},{4,5,6},{7,8,9}}};
for(int i=0; i<3; i++)
{
for(int j=0; j<3; j++)
{
cout << v[i][j] << "\t";
}
cout << endl;
}
return 0;
}
4 5 6
7 8 9
Passing a multidimensional std::vector to a function
A multidimensional std::vector is also passed to a function in a similar way a 1D vector is passed. Let's look at an example.
#include <iostream>
#include <vector>
using namespace std;
void display(const std::vector<std::vector<int>> &v)
{
for(int i=0; i<v.size(); i++)
{
for(int j = 0; j<v[i].size(); j++)
{
cout << v[i][j] << "\t";
}
cout << endl;
}
}
int main()
{
vector<vector<int>> v {{{1,2,3},{4,5,6},{7,8,9}}};
display(v);
return 0;
}
4 5 6
7 8 9
Never compare your beginning to someone else's middle. Comparison is poison.
-Jon Acuff


|
UTPP
|
Following is how I have been using UTTP in my own projects. It may not be the best solution but it has worked for me.
\development
\development\cool_proj
\development\cool_proj\include
\development\cool_proj\lib
\development\utpp
utpp
in \development\cool_proj\include
pointing to \development\utpp\include\utpp
: lib
in \development\utpp
pointing to \development\cool_proj\lib
\development\utpp\lib
folder. Because of the second symlink, uttp.lib will show up in \development\cool_proj\lib
.\development\cool_proj\include
contains a folder named utpp
and the compiler can find the include file.utpp.h
file contains a #pragma directive that specifies the utpp.lib
and the linker will be able locate utpp.lib
file in \development\cool_proj\lib
UTPP libarary can be built in debug or release configurations for 32 or 64 bits. To accommodate that, the output library is produced in lib\win32\debug
or lib\x64\debug
or lib\win32\release
or lib\x64\release
. If you follow the same convention for COOL_PROJ everything should work automatically.
Does this work with git?
Yes it does. Git tries not to touch folders and files that are not under source control. The way the symlinks are setup should take care of that.
What if I have more than one project that uses UTPP? How can I setup my symlinks?
I find it easiest to have a single include folder with subfolders for each project (something like \development, \develompent, etc.) and one common lib folder. Follow the steps above and all should work smoothly.


WITNESS LIST Pensions & Investments Committee (Subcommittee on Defined Contribution / Defined Benefits) April 11, 2000-10:00A Defined Benefits/Contribution On: Anderson, Gary W. (Texas Municipal Retirement System) Deiters, Kevin (State Pension Review Board) Dunlap, Charles (Teacher Retirement System) Gregg, Brock (Association of Texas Professional Educators) Horton, Terry (Texas County and District Retirement System) Kelly, Jack (Texas State Teachers Association) Lathrop, Matt (The American Legislative Exchange Council) Lehr, Mike (Texas Retired Teacher Association) Snell, Ronald K. (National Conference of State Legislatures) Alexander, Toni (Texas Higher Education Coordinating Board) Beckett, Sheila (Employees Retirement System) Hartman, Eric (Texas Federation of Teachers)


Principal Components Analysis (PCA) is a multivariate procedure which rotates the data such that maximum variabilities are projected onto the axes. Essentially, a set of correlated variables are transformed into a set of uncorrelated variables which are ordered by reducing variability. The uncorrelated variables are linear cmbinations of the original variables, and the last of these variables can be removed with minimum loss of real data.
The main use of PCA is to reduce the dimensionality of a data set while retaining as much information as is possible. It computes a compact and optimal description of the data set.
The first principal component is the combination of variables that explains the greatest amount of variation. The second principal component defines the next largest amount of variation and is independent to the first principal component. There can be as many possible principal components as there are variables.
It can be viewed as a rotation of the existing axes to new positions in the space defined by the original variables. In this new rotation, there will be no correlation between the new variables defined by the rotation. The first new variable contains the maximum amount of variation, the second new variable contains the maximum amount of variation unexplained by the first and orthogonal to the first, etc...
There are several algorithms for calculating the Principal Components. Given the same starting data they will produce the same results with the one exception (are you surprised?). This exception is that, if at some point, there are two or more possible rotations that contain the same "maximum" variation, then which one is used is indeterminate. In two dimensions the data cloud would look like a circle, instead of an ellipse. In a circle, any rotation would be equivalent. In an elliptical data cloud, the first component would be parallel to the major axis of the ellipse.
It can be viewed as finding a projection of the observations onto orthogonal axes contained in the space defined by the original variables. The criteria being that the first axis "contains" the maximum amount of variation, or "accounts" for the maximum amount of variation. The second axis contains the maximum amount of variation orthogonal to the first. The third axis contains the maximum amount of variation orthogonal to the first and second axis and so on until one has the last new axis which is the last amount of variation left. As you can see these are really two slightly different ways of saying the same thing!
In this example, we take a simple set of 2-D data and apply PCA to determine the principal axes. Although the technique is used with many dimensions, 2 dimensional data will make it simpler to visualise.
First of all we generate a set of data for analysis:
x = -3.0139 -2.6748 0.1810 -2.1227 -6.5559 -4.2424 1.5960 1.9161 2.7825 -1.2017 2.0292 2.1421 -2.5200 -1.7787 0.2340 -0.8122 0.8263 -0.9407 -4.6227 -2.5955 -4.3052 -3.2307 -2.6013 0.5435 3.5409 1.9755 5.1704 3.8629 . . . . . .The Principal Component Analysis is then performed. First the covariance matrix is calculated:
covx = 7.5649 3.8464 3.8464 3.2451
From this the PC's are calculated:
pc = 0.8630 -0.5052 0.5052 0.8630
The red line represents the direction of the first principal component and the green is the second. Note how the first principal component lies along the lineo of greatest variation, and the second lies perpendicular to it. Where there are more than two dimensions, the second component will be both perpendicular to the first, and along the line of next greatest variation.
By multiplying the original data-set by the principal components, the data is rotated so that the PC's lie along the axes:
The most common use for PCA is to reduce the dimensionality of the data while retaining the most information.
The following MATLAB code generates the above images:
% Clear all variables and figures. clear all; close all; % Generate elliptical cloud of data-poitns. x(1,:) = randn(1,100); x(2,:) = randn(1,100)*3; % Rotate the cloud for demonstration. [p(1,:),p(2,:)] = cart2pol(x(1,:),x(2,:)); p(1,:) = p(1,:)-pi/3; [x(1,:),x(2,:)] = pol2cart(p(1,:),p(2,:)); % Plot data. scatter(x(1,:),x(2,:)); axis equal; drawnow; pause; % Calculate PC's. [pc, latent, explained] = pcacov(cov(x')); % Draw PC's on top of data. hold on; plot([-4 4]*pc(1,1),[-4 4]*pc(2,1),'r-'); plot([-2 2]*pc(1,2),[-2 2]*pc(2,2),'g-'); pause; % Rotate the data to the PC's y = (x'*pc)'; % Plot data. figure; scatter(y(1,:),y(2,:)); axis equal; drawnow; pause; % Calculate PC's, to demonstrate they now lie on the axes. [pc2, latent, explained] = pcacov(cov(y')); % Draw PC's on top of data. hold on; plot([-4 4]*pc2(1,1),[-4 4]*pc2(2,1),'r-'); plot([-2 2]*pc2(1,2),[-2 2]*pc2(2,2),'g-'); pause; % Set the second component of y to zero, reducing the dimensionality to one. y(2,:) = 0; % Transform back to the original data. x = (y'*inv(pc))'; % Plot data. figure; scatter(x(1,:),x(2,:)); axis equal; drawnow; pause; % Tidy up. close all;


§275-7 Definitions. "Emergency" as used in sections 275-5 and 275-6 means a situation in which property or human life is in jeopardy and the prompt summoning of aid is essential.
"Party line" as used in sections 275-5 and 275-6 means a subscriber's line telephone circuit, consisting of two or more main telephone stations connected therewith, each station with a distinctive ring or telephone number. [L 1957, c 190, pt of §1; Supp, §309A-3; HRS §275-7]
Note
Section 275-5 referred to in text is repealed.
Revision Note
Definitions rearranged.


UNCLASSIFIED
Error Conditions
This section describes each of the
error messages that can be generated by the GEOTRANS application. Errors are
grouped into four types.
Initialization Error Messages
Coordinate Conversion
Error Messages
User-Defined Ellipsoid & Datum Error
Messages
File Processing Error
Messages
Initialization Error
Messages
Initialization error messages are
returned by the MSP Coordinate Conversion Service when it is unable to
initialize properly.
The Initialization error messages
are:
- Error initializing
MSP Coordinate Conversion Service: Unable to locate ellipsoid data file: ellips.dat!
- Error initializing
MSP Coordinate Conversion Service: Ellipsoid table is full!
- Error initializing
MSP Coordinate Conversion Service: Invalid ellipsoid code!
- Error initializing
MSP Coordinate Conversion Service: Unable to locate datum data files:
3_param.dat, 7_param.dat!
- Error initializing
MSP Coordinate Conversion Service: Datum table is full!
- Error initializing
MSP Coordinate Conversion Service: Unable to read datum file!
- Error initializing
MSP Coordinate Conversion Service: Unable to locate geoid
data
files:
egm84.grd, egm96.grd!
- Error initializing
MSP Coordinate Conversion Service: Unable to read geoid
file!
Typically, multiple initialization
error messages are generated. After each
of these messages have been acknowledged, a Failed to create empty document
dialog box will appear.
Initialization failure most often
occurs as a result of the application software being unable to open or read one
or more of five key data files:
1) ellips.dat containing ellipsoid parameter values,
2) 3_param.dat
containing datum parameter values for datums that
are specified only by their displacement relative to WGS84,
3) 7_param.dat
containing datum parameter values for datums that
are specified in terms of displacement, rotation, and scale differences
relative to WGS84,
4) egm96.grd
containing geoid separation values for Earth
Gravity Model 1996,
5) egm84.grd
containing geoid separation values for Earth
Gravity Model 1984.
These data files are normally located
in the /data subdirectory, and the GEOTRANS software looks for them there by
default. As an alternative, you can define the environment variable CCS_DATA,
and place the files in the directory identified by this variable.
Coordinate Conversion
Error Messages
Coordinate conversion error messages
are displayed by the GEOTRANS software when a parameter or coordinate value is
invalid relative to a particular coordinate system or map projection. In some
cases, all of the individual parameter or coordinate values may be valid, but
the combination is not. It may also be possible for the input coordinates to be
invalid relative to the output coordinate system or map projection after being
converted. When any of these errors are detected during interactive operations,
a message box is displayed, identifying either the input or the output
coordinate system or map projection, and the parameter or coordinate value, or
values, which are invalid. When any of these errors are detected during file
processing, the same message is written to the output coordinate file in the
form of a comment.
Each message includes a prefix that
indicates whether the problem is in the input or output portion of the
conversion process, and the coordinate reference frame involved. For example,
if the error occurred in a conversion from UTM to geodetic coordinates, the
prefix might read "Input UTM Coordinates:"
The Coordinate Conversion warning
messages are:
- Latitude is too far from Central
Meridian, distortion may be significant This warning
indicates that the input coordinates are located too far from the central
meridian of either the input or output projection, as indicated in the
message prefix. The conversion is performed, but you should recheck the
input coordinates and the Central Meridian
parameter value.
- Location is not within valid domain for current datum
This warning indicates that the input coordinates are not located in the
part of the world addressed by the current input or output datum, as
indicated in the message prefix. The conversion is performed, but you
should recheck the input coordinates and the input and output datum
selections.
The Coordinate Conversion error
messages are:
- 1st and 2nd Standard Parallels
cannot both be zero the 1st and 2nd Standard
Parallel parameter values are both zero (i.e., the equator), and so do not
define a valid projection cone.
- Central Meridian out of range the Central
Meridian parameter value for the input or output projection,
as indicated in the message prefix, is outside the valid range for
longitude values, which is from -180° to +360°.
- Easting/X out of range the Easting/X coordinate
value is not valid for the input or output projection, as indicated by the
message prefix. The value is too far from the False Easting parameter
value for the projection.
- Easting/Northing too far from center of projection-
the combination of the Easting/X and Northing/Y coordinate values denote a
point that is located too far from the center of the current input or
output projection, as indicated by the message prefix.
- Invalid Standard Parallel the Standard Parallel
parameter value is not valid for the Equidistant Cylindrical projection.
- Invalid 1st Standard Parallel the 1st Standard
Parallel parameter value is not valid for the currently specified Albers
Equal Area Conic or Lambert Conformal Conic projection. The valid range is
from -90° to +90°, but does not include the poles themselves.
- Invalid 2nd Standard Parallel the 2nd Standard
Parallel parameter value is not valid for the currently specified Albers
Equal Area Conic or Lambert Conformal Conic projection. The valid range is
from -90° to +90°, but does not include the poles themselves.
- Invalid British National Grid Coordinate String the
input British National Grid coordinate string does not contain a valid
British National Grid coordinate value. The British National Grid coordinate
string may contain invalid characters or may not be formatted correctly
- Invalid GEOREF Coordinate String the input GEOREF
coordinate string does not contain a valid GEOREF coordinate value.
- Invalid GARS Coordinate String the input GARS
coordinate string does not contain a valid GARS coordinate value.
- Invalid MGRS Coordinate String the input MGRS
coordinate string does not contain a valid MGRS coordinate value. The MGRS
string may not be formatted correctly, or the zone letter, zone number,
100,000m square designation, and easting/northing values specified by the
string may not be consistent with one another.
- Invalid USNG Coordinate String the input USNG
coordinate string does not contain a valid USNG coordinate value. The USNG
string may not be formatted correctly, or the zone letter, zone number,
100,000m square designation, and easting/northing values specified by the
string may not be consistent with one another.
- Invalid Zone the UTM zone number specified does not
have a valid value. The valid range for UTM zone numbers is from 1 to 60.
- Invalid Zone Override the UTM zone number specified
in the Set Zone field is too far from the 'natural' UTM zone of the input
coordinates. The specified zone must be adjacent to the 'natural' zone of
the input coordinates.
- Latitude out of range the Latitude coordinate value
is not valid for the input or output projection, as indicated by the
message prefix. Depending on the projection, this may mean that the
latitude value is too close to a pole or the equator, or is outside the
valid range for latitude values, which is from -90° to +90°.
- Latitude 1 out of range the Latitude 1 parameter
value for the input or output Oblique Mercator projection is not valid.
Latitude 1 is outside the valid range for the first latitude values, which
is from -90° to +90°, not including the poles.
- Latitude 1 and Latitude 2 cannot be equal Latitude
1 and Latitude 2 parameter values are the same.
- The latitude part of the GEOREF string is greater
than 60 the latitude portion of a GEOREF string must have a value in the
range from 0000 to 5999.
- Latitude 2 out of range the Latitude 2 parameter
value for the input or output Oblique Mercator projection is not valid.
Latitude 2 is outside the valid range for the second latitude values,
which is from -90° to +90°, not including the poles.
- Longitude out of range the Longitude coordinate
value is not valid for the input or output projection, as indicated by the
message prefix. This means that the longitude value is outside the valid
range for longitude values, which is from -180° to +360°.
- Longitude 1 out of range the Longitude 1 parameter
value for the input or output Oblique Mercator projection is not valid.
Longitude 1 is outside the valid range for latitude values, which is from
-180° to +360°.
- Longitude 2 out of range the Longitude 2 parameter
value for the input or output Oblique Mercator projection is not valid.
Longitude 2 is outside the valid range for latitude values, which is from
-180° to +360°.
- The longitude part of the GEOREF string is greater
than 60 the longitude portion of a GEOREF string must have a value in
the range from 0000 to 5999.
- Northing/Y out of range the Northing/Y coordinate
value is not valid for the input or output projection, as indicated by the
message prefix. The value is too far from the False Northing parameter
value for the projection.
- Origin Latitude (or Latitude of True Scale) out of
range the Origin Latitude (or Latitude of True Scale) parameter value
for the input or output projection, or Local
Cartesian coordinate system, as indicated in the message prefix, is not
valid. Depending on the projection, this may mean that the Origin Latitude
is too close to a pole or the equator, or is outside the valid range for
latitude values, which is from -90° to +90°.
- Origin Longitude (or Longitude Down from Pole) out of
range the Origin Longitude (or Longitude Down from Pole) parameter value
for the input or output projection, or Local Cartesian coordinate system,
as indicated in the message prefix, is not valid. This means that the
Origin Longitude value is outside the valid range for longitude values,
which is from -180° to +360°.
- Point 1 and Point 2 cannot be in different
hemispheres Latitude 1 and Latitude 2 parameter values are in opposite
hemispheres.
- Scale Factor out of range the Scale Factor
parameter value is not valid (i.e., either too large or too small) for the
input or output projection, as indicated by the message prefix.
- Standard Parallels cannot be equal and opposite
latitudes the 1st and 2nd Standard Parallel
parameter values denote the same latitude, but in opposite hemispheres.
This would cause the projection cone to become a cylinder, and is not
allowed.
- Coordinates are outside valid area the specified
British National Grid coordinate string is outside the valid conversion
area.
- Ellipsoid must be Airy the specified ellipsoid for
a British National Grid coordinate string must be Airy.
- Ellipsoid must be International the specified
ellipsoid for New Zealand Map Grid coordinates must be International.
See the description of the indicated
coordinate reference frame, and/or the description(s) of the indicated
parameter or coordinate field(s) for more information on the valid ranges and
valid combinations of map projection parameter and coordinate values.
It is possible for the MSP Coordinate
Conversion Application to output error messages other than those listed above.
However, these error messages should never appear under normal circumstances, and
indicate that the software is in an invalid internal state.
User-Defined Ellipsoid & Datum
Error Messages
User-defined datum error messages may
be generated when you use the Create... or Delete... commands in the Datum
menu. When creating a new user-defined datum, if the code specified for the new
datum is already in use, or if any of the parameters for the new datum are not
value, an error message box will be displayed after the OK button is clicked.
Once the error message is acknowledged, the message box disappears and you are
returned to the Create Datum dialog box, where you may either correct the
invalid inputs, or cancel the operation.
When deleting a user-defined datum,
if the code specified for the datum to be deleted is not user-defined, an error
message box will be displayed after the OK button is clicked. Once the error
message is acknowledged, the message box disappears and you are returned to the
Delete Datum dialog box, where you may either select another datum, or cancel
the operation.
The user-defined datum error messages
are:
- 3-parameter datum table is full the 3-parameter
datum table has run out of available space. No more new datums can be created until the Datum module is
modified to allocate additional space.
- 7-parameter datum table is full the 7-parameter
datum table has run out of available space. No more new datums can be
created until the Datum module is modified to allocate additional space.
- Error returned by Ellipsoid module the most likely
cause for this message is that the ellipsoid specified for the new
user-defined datum is invalid. Select another ellipsoid.
- Invalid local datum domain of validity the
specified latitude and longitude values do not form a valid bounding
geodetic rectangle. The southernmost latitude is greater than the
northernmost latitude, and/or the westernmost longitude is greater than
the easternmost longitude. The bounding rectangle cannot cross the ±180°
line.
- Latitude out of range one or both of the latitude
values specified for the domain of validity of the new datum is not valid.
- Longitude out of range one or both of the longitude
values specified for the domain of validity of the new datum is not valid.
- Specified code not user defined the specified datum
is not a user-defined datum.
- Specified code already in use- the code specified for
the new user-defined datum is already in use for an existing datum. Choose
a different code for the new datum.
- Standard error values must be positive,
or -1 if unknown one or more of the datum shift standard error
values is negative, but is not -1. Correct the standard error value(s).
User-defined ellipsoid error messages
may be generated when you use the Create... command in the Ellipsoid menu. When
creating a user-defined ellipsoid, if the code specified for the new
user-defined ellipsoid is already in use, or if the ellipsoid axis values are
not valid, an error message box will be displayed after the OK button is
clicked. Once the error message is acknowledged, the message box disappears and
you are returned to the Create Ellipsoid dialog box, where you may either
correct the invalid inputs, or cancel the operation.
When deleting a user-defined
ellipsoid, if the code specified for the ellipsoid to be deleted is not
user-defined, an error message box will be displayed after the OK button is
clicked. Once the error message is acknowledged, the message box disappears and
you are returned to the Delete Ellipsoid dialog box, where you may either
select another ellipsoid, or cancel the operation.
The user-defined ellipsoid error
messages are:
- Ellipsoid flattening must be between 250 and 350
self-explanatory. Correct the flattening value.
- Ellipsoid is in use by a datum the user-defined
ellipsoid is in use by a user-defined datum and can not be deleted. You
must delete all user-defined datums that use the
ellipsoid before it can be deleted.
- Ellipsoid semi-major axis must be greater than zero
self-explanatory. Correct the semi-major axis value.
- Ellipsoid table is full the ellipsoid table has run
out of available space. No more user-defined ellipsoids can be created
until the Ellipsoid module is modified to allocate additional space.
- Specified code already in use the code specified
for the new ellipsoid is already in use for an existing ellipsoid. Choose
a different code for the new ellipsoid.
- Specified code not user defined the specified
ellipsoid is not a user-defined ellipsoid.
File
Processing Error Messages
File processing error messages are
generated when the header of an input coordinate file does not have the proper
format, or when a particular set of coordinates in the body of an input
coordinate file cannot be read successfully, or contains an illegal value. When
an error is detected in the header of an input coordinate file, a message box
is displayed, and file processing is aborted. When an error is detected in the
body of an input coordinate file, a message is written to the output coordinate
file in the form of a comment.
The File Processing input coordinate
file header error messages are:
- Input file error opening file the file designated
by the specified path and file name could not be opened, probably because
it does not exist. Recheck the file and directory/folder names, and try
again.
- Input file error in keyword a line in the input
coordinate file header does not start with a recognizable keyword.
- Input file error in coordinate type a line in the
input coordinate file header starting with the keyword 'COORDINATES' or
'PROJECTION' did not contain a valid value.
- Input file error in datum a line in the input
coordinate file header starting with the keyword 'DATUM' did not contain a
valid datum code.
- Input file error in Central Meridian a line in the
input coordinate file header starting with the keyword 'CENTRAL MERIDIAN'
did not contain a legal value, or contained a value outside the valid
range for a longitude (-180° to +360°).
- Input file error in Origin Latitude a line in the
input coordinate file header starting with the keyword 'ORIGIN LATITUDE'
did not contain a legal value, or contained a value outside the valid
range for a latitude (-90° to +90°).
- Input file error in Origin Longitude a line in the
input coordinate file header starting with the keyword 'ORIGIN LONGITUDE'
did not contain a legal value, or contained a value outside the valid
range for a longitude (-180° to +360°).
- Input file error in Origin Height a line in the
input coordinate file header starting with the keyword 'ORIGIN HEIGHT' did
not contain a legal value.
- Input file error in Standard Parallel a line in the
input coordinate file header starting with the keyword 'STANDARD PARALLEL'
did not contain a legal value, or contained a value outside the valid
range for a latitude (-90° to +90°).
- Input file error in Standard Parallel 1 a line in
the input coordinate file header starting with the keyword 'STANDARD
PARALLEL 1' did not contain a legal value, or contained a value outside
the valid range for a latitude (-90° to +90°).
- Input file error in Standard Parallel 2 a line in
the input coordinate file header starting with the keyword 'STANDARD
PARALLEL 2' did not contain a legal value, or contained a value outside
the valid range for a latitude (-90° to +90°).
- Input file error in Latitude 1 a line in the input coordinate
file header starting with the keyword 'LATITUDE ONE' did not contain a
legal value, or contained a value outside the valid range for the first
latitude (-89° to +89°, excluding the equator).
- Input file error in Longitude 1 a line in the input
coordinate file header starting with the keyword 'LONGITUDE ONE' did not
contain a legal value, or contained a value outside the valid range for a
longitude (-180° to +360°).
- Input file error in Latitude 2 a line in the input
coordinate file header starting with the keyword 'LATITUDE TWO' did not
contain a legal value, or contained a value outside the valid range for
the second latitude (-89° to +89°).
- Input file error in Longitude 2 a line in the input
coordinate file header starting with the keyword 'LONGITUDE TWO' did not
contain a legal value, or contained a value outside the valid range for a
longitude (-180° to +360°).
- Input file error in False Easting a line in the
input coordinate file header starting with the keyword 'FALSE EASTING' did
not contain a legal value.
- Input file error in False Northing a line in the
input coordinate file header starting with the keyword 'FALSE NORTHING'
did not contain a legal value.
- Input file error in Scale Factor a line in the
input coordinate file header starting with the keyword 'SCALE FACTOR' did
not contain a legal value.
- Input file unknown error the input coordinate file
header could not be parsed successfully. Check to make sure that the
specified file was actually a valid coordinate file.
Unless otherwise indicated above, you
should examine the header of the input coordinate file, and use a text editor
to correct the error. See the description of the indicated field for
information on the valid ranges of map projection parameter and coordinate
values.
The File Processing input coordinate
file body error messages are:
- Error reading coordinates from input file the line
containing a set of coordinates was not formatted properly, or contained
one or more illegal coordinate values.
In addition, any of the coordinate
conversion error messages contained in the previous section can occur during
file processing. These messages are written to the output coordinate file in
the form of comments. The File Processing dialog box displays the number of
such errors in the file when file processing is complete. Examine the line in
the input coordinate file which corresponds to the line containing the error
message in the output coordinate file (there is a one-to-one correspondence),
and correct the contents of the input coordinate file using a text editor. See
the descriptions of the coordinate systems, and the coordinate field
descriptions, for information on the valid formats and ranges of coordinate
values.
UNCLASSIFIED


Class TextFormatterConfig
This class is used as the argument of the CreateFormatter
method of the SECSFormatterFactory
which creates a
SECSFormatter
object that is implemented to produce logging output
as either SML or XML formatted text.
Inheritance
Namespace: com.CIMthetics.CSharpSECSTools.TextFormatter
Assembly: TextFormatter.dll
Syntax
public class TextFormatterConfig
Properties
AddDirection
Indicates whether or not message direction information should be added to the output.
Declaration
public bool AddDirection { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean | If |
Remarks
The default value is true
.
AddTimestamp
Indicates whether or not a timestamp should be added to the generated output.
Declaration
public bool AddTimestamp { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean | If |
Remarks
The default value is true
.
BodyOutputConfig
This property returns the current output configuration
(for SECSItem
s) that this formatter is currently
working with.
Declaration
public BodyOutputConfig BodyOutputConfig { get; }
Property Value
| Type | Description |
|---|---|
| BodyOutputConfig | If the |
HeaderOutputConfig
This property returns the current output configuration
(for SECSHeader
s) that this formatter is currently
working with.
Declaration
public HeaderOutputConfig HeaderOutputConfig { get; }
Property Value
| Type | Description |
|---|---|
| HeaderOutputConfig | If the |
IndentAmount
The number of spaces to be used when indentation is required in the generated output.
Declaration
public int IndentAmount { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 | The number of spaces to be used when indentation is required in the generated output. |
Remarks
The default value is 2.
LoggingOutputFormat
This property specifies the kind of output that a formatter it to produce.
Declaration
public string LoggingOutputFormat { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
Remarks
The acceptable values are "SML" or "XML"
MaxIndentionSpaces
This sets the maximum number of spaces available to be used to provide indentation for output text generation.
Declaration
public int MaxIndentionSpaces { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 | The maximum number of spaces available for indentation. |
Remarks
This may sound stupid, but, how can you run out of spaces?
Working with string
s tends to
produce a lot of garbage that the garbage collector will need to
deal with. Since many of the programs that use this API may be
executing for a long time and generating a lot of output
the spaces required for indentation
have been preallocated in a string[]
.
Unlike most other properties this property is only used during the construction of a formatter. Once created this property is not used again. Thus, changing its value will not have any effect.
The default value is 48. Specifying an overly large value for
this property does nothing but use more memory. If the value
is too small a System.IndexOutOfRangeException
will be thrown at the point the CurrentIndentLevel
exceeds
the value of this property. See
SECSFormatter
for more information.
SMLOutputConfig
This property specifies the output format information for a formatter when it is producing output in the SML format.
Declaration
public SMLOutputConfig SMLOutputConfig { get; set; }
Property Value
| Type | Description |
|---|---|
| SMLOutputConfig |
TimestampFormat
If the AddTimestamp
property is set to true
this is the output
formatting string that is applied to the timestamp as it is
converted to textual form.
Declaration
public string TimestampFormat { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String | A format string to be applied to the timestamp. |
Remarks
The default value is "yyyy-MM-ddTHH:mm:ss.fff".
XMLOutputConfig
This property specifies the output format information for a formatter when it is producing output in the XML format.
Declaration
public XMLOutputConfig XMLOutputConfig { get; set; }
Property Value
| Type | Description |
|---|---|
| XMLOutputConfig |
Methods
ToString()
Creates a string
displaying the current "state" of this instance.
This is mostly only useful for debugging.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| System.String |