AMDAPlugin.cc 6.77 KB
/* -*- Base: 10 ; Mode: C++ -*- */
/*------------------------------------------------------------------------
 **	
                                FOST project
 **
--------------------------------------------------------------------------
--------------------------------------------------------------------------
                                FILE LOG
                $Revision: 1.3 $    $Date: 2012-06-15 13:04:42 $
--------------------------------------------------------------------------
CREATION
        V.SAC

SUMMARY

DESCRIPTION

        The main function performs the following actions :
        <ul>
        <li>
        </ul>

------------------------------------------------------------------------*/

/**

 */
//=============================================================================
// Include section
//=============================================================================

// Standard libraries include files
//-----------------------------------------------------------------------------
#include <iostream>

// Include oriented definitions 
//-----------------------------------------------------------------------------

// Module Kernel include files
//-----------------------------------------------------------------------------

#include "DicError.hh"
#include "AMDA_exception.hh"
#include "ServicesServer.hh"
#include "PluginManager.hh"
#include "CurveFunctionWriter.hh"
#include "Boundaries.hh"

#include <math.h>

using namespace AMDA::Parameters;
using namespace plot;

// Other modules include files
//-----------------------------------------------------------------------------

/**
 * @details This procedure return the curve definition of a circle.
 */
void circle(double precision, CurveFunctionWriter::AttributeList& pAttributeList, CurveFunctionWriter::CurvePointList& curvePointList) {
    //radius
    double radius = 1.;
    CurveFunctionWriter::AttributeList::iterator lradiusIt = pAttributeList.find("radius");
    if (lradiusIt != pAttributeList.end())
        radius = lradiusIt->second;

    for (int i = 0; i < precision; ++i) {
        CurveFunctionWriter::CurvePoint point;

        double theta = (2. * M_PI) * (double) (((double) i) / precision);
        point.x = radius * cos(theta);
        point.y = radius * sin(theta);
        point.z = radius * cos(theta);
        // std::cout << "BRE - " << point.x << " - " << point.y << " - " << point.z << std::endl;
        curvePointList.push_back(point);
    }
}
//=============================================================================
// Methods of Class AMDAPlugin
//=============================================================================

/**
   Retrieve the Plugin version we're going to expect
 */
extern "C" const char* getPluginVersion() {
    return "(Version)";
}

/**
   Tells us to register our functionality to an engine kernel
 */
extern "C" void registerPlugin(AMDA::Plugins::PluginManager & pm) {
    std::string pluginPath = pm.getCurrentPluginPath();
    ServicesServer::getInstance()->addServiceImpl<CurveFunctionWriter::CurveFunctionProcess>("bowshock", &bowshock);
    ServicesServer::getInstance()->linkProcessWithPlugin("bowshock", pluginPath);

    ServicesServer::getInstance()->addServiceImpl<CurveFunctionWriter::CurveFunctionProcess>("bowshock_farris", &bowshock_farris);
    ServicesServer::getInstance()->linkProcessWithPlugin("bowshock_farris", pluginPath);
    // Elena TBD : id in plotCurves.xml acts as function name - to change Request generation procedure
    ServicesServer::getInstance()->addServiceImpl<CurveFunctionWriter::CurveFunctionProcess>("mars_bowshock", &bowshock);
    ServicesServer::getInstance()->linkProcessWithPlugin("mars_bowshock", pluginPath);
    
    ServicesServer::getInstance()->addServiceImpl<CurveFunctionWriter::CurveFunctionProcess>("mars_bowshock_hall", &bowshock);
    ServicesServer::getInstance()->linkProcessWithPlugin("mars_bowshock_hall", pluginPath);
    
    ServicesServer::getInstance()->addServiceImpl<CurveFunctionWriter::CurveFunctionProcess>("venus_bowshock", &bowshock);
    ServicesServer::getInstance()->linkProcessWithPlugin("venus_bowshock", pluginPath);
    
    ServicesServer::getInstance()->addServiceImpl<CurveFunctionWriter::CurveFunctionProcess>("mercury_bowshock", &bowshock);
    ServicesServer::getInstance()->linkProcessWithPlugin("mercury_bowshock", pluginPath);
    
    ServicesServer::getInstance()->addServiceImpl<CurveFunctionWriter::CurveFunctionProcess>("saturn_bowshock_went", &saturn_bowshock_went);
    ServicesServer::getInstance()->linkProcessWithPlugin("saturn_bowshock_went", pluginPath);
    
    ServicesServer::getInstance()->addServiceImpl<CurveFunctionWriter::CurveFunctionProcess>("jupiter_bowshock_high", &bowshock1);
    ServicesServer::getInstance()->linkProcessWithPlugin("jupiter_bowshock_high", pluginPath);
    
    ServicesServer::getInstance()->addServiceImpl<CurveFunctionWriter::CurveFunctionProcess>("jupiter_bowshock_low", &bowshock1);
    ServicesServer::getInstance()->linkProcessWithPlugin("jupiter_bowshock_low", pluginPath);
    
    ServicesServer::getInstance()->addServiceImpl<CurveFunctionWriter::CurveFunctionProcess>("jupiter_magnetopause_high", &bowshock1);
    ServicesServer::getInstance()->linkProcessWithPlugin("jupiter_magnetopause_high", pluginPath);
    
    ServicesServer::getInstance()->addServiceImpl<CurveFunctionWriter::CurveFunctionProcess>("jupiter_magnetopause_low", &bowshock1);
    ServicesServer::getInstance()->linkProcessWithPlugin("jupiter_magnetopause_low", pluginPath);
    
    ServicesServer::getInstance()->addServiceImpl<CurveFunctionWriter::CurveFunctionProcess>("venus_magnetopause", &venus_magnetopause);
    ServicesServer::getInstance()->linkProcessWithPlugin("venus_magnetopause", pluginPath);
    
    ServicesServer::getInstance()->addServiceImpl<CurveFunctionWriter::CurveFunctionProcess>("mars_magnetopause", &mars_magnetopause);
    ServicesServer::getInstance()->linkProcessWithPlugin("mars_magnetopause", pluginPath);
    
    ServicesServer::getInstance()->addServiceImpl<CurveFunctionWriter::CurveFunctionProcess>("mercury_magnetopause", &mercury_magnetopause);
    ServicesServer::getInstance()->linkProcessWithPlugin("mercury_magnetopause", pluginPath);
    
    ServicesServer::getInstance()->addServiceImpl<CurveFunctionWriter::CurveFunctionProcess>("saturn_magnetopause", &saturn_magnetopause);
    ServicesServer::getInstance()->linkProcessWithPlugin("saturn_magnetopause", pluginPath);
    
    ServicesServer::getInstance()->addServiceImpl<CurveFunctionWriter::CurveFunctionProcess>("magnetopause_shue", &magnetopause_shue);
    ServicesServer::getInstance()->linkProcessWithPlugin("magnetopause_shue", pluginPath);
    
    ServicesServer::getInstance()->addServiceImpl<CurveFunctionWriter::CurveFunctionProcess>("circle", &circle);
    ServicesServer::getInstance()->linkProcessWithPlugin("circle", pluginPath);
}