Maps > Map Projections > Creating a New Projection > Defining the Projection
 
Defining the Projection
The projection is defined in the file proj_step1.cpp
To define the class, you use the IlvMapsDefineBasicProjectionIO macro. This macro defines the function and static members that are necessary to support input and output operations. It also generates code to initialize the IlvProjectionClassInfo.
#include "proj_step1.h"
IlvMapsDefineBasicProjectionIO(Mercator,
IlvProjection,
"My Mercator Implementation",
new Mercator(),
IlvMapsEmptyStatement());
*The first argument of the macro is the name of the projection class.
*The second argument is the name of the superclass of the projection.
*The third argument is the projection name. This name is used, for example, by the IlvProjectionDictionary class.
*The fourth argument is the statement used to create a new instance of this class.
*The last argument is a statement that will be called during the initialization of the projection class. Since nothing specific is done in this example, the IlvMapsEmptyStatement macro is used. This last parameter will be used in steps 2 and 3.
Now the projection constructor must be defined. This constructor calls the constructor of its superclass IlvProjection, which takes three arguments.
*The first argument is an IlBoolean value specifying whether the projection supports nonspherical ellipsoids. In our example, this argument is set to IlTrue since the projection supports the equations for nonspherical ellipsoids.
*The second argument is an IlvBoolean value indicating whether the projection supports an inverse function. In our example, this argument is set to IlTrue since the projection supports an inverse function.
*The third argument is an enum value that indicates the geometric properties of the projection. In our example this argument is IlvConformalProjectionGeometricProperty since the Mercator projection is conformal.
You must also define a copy constructor that is declared by the IlvMapsDeclareProjectionIO macro.
Mercator::Mercator()
:IlvProjection(IlTrue,
IlTrue,
IlvConformalProjectionGeometricProperty)
{
}
Mercator::Mercator(const Mercator& source)
:IlvProjection(source)
{
}

Version 6.3
Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.