Maps > 地図投影図法 > 新しい投影図法の作成 > 手順 3:新しい投影図法の定義
 
手順 3:新しい投影図法の定義
この手順では、投影図法の特定パラメーターに対応するアクセサーの追加方法を説明します。
この投影図法のコード一式は、proj_step3.h ファイルと proj_step3.cpp ファイルに入っています。
アクセサー・サポートの追加
アクセサーは、投影図法のパラメーターに関するランタイム情報を提供します。それらは通常、地図アプリケーションの汎用投影図法エディターの構築に使用されます。
アクセサーを投影図法に追加するためには、このパラメーターのゲッタ関数とセッタ関数を書き、静的初期化の段階で、アクセサーを IlvProjectionClassInfo に追加する必要があります。
// The getter for the latitudeOfTrueScale accessor.
static void _getter(const IlvProjection* p, IlvValue& v)
{
Mercator* mercator = (Mercator*) p;
char buffer[12];
v = IlvMaps::RadianToDMS(buffer,
mercator->getLatitudeOfTrueScale(),
IlTrue);
}
 
// The setter for the latitudeOfTrueScale accessor.
static IlvBoolean _setter(IlvProjection* p, const IlvValue& v)
{
Mercator* mercator = (Mercator*) p;
IlvDouble value;
IlvMapsError error = IlvMaps::DMSToRadian(v, value);
if (error != IlvMaps::NoError())
return IlFalse;
mercator->setLatitudeOfTrueScale(value);
return IlTrue;
}
 
void
Mercator::InitClass()
{
_polarZoneError =
IlvMaps::CreateError("&MercatorPolarZoneError");
 
ClassInfo()->addAccessor(IlvGetSymbol("latitudeOfTrueScale"),
IlvValueStringType,
_getter,
_setter);
}

Version 6.0
Copyright © 2015, Rogue Wave Software, Inc. All Rights Reserved.