// ***** AUTOGENERATED CODE, DO NOT EDIT *****
            // ***** This class is not copyable.
        
        #include "REcmaSpatialIndex.h"
        #include "RMetaTypes.h"
        #include "../REcmaHelper.h"

        // forwards declarations mapped to includes
        
            
        // includes for base ecma wrapper classes
        
                  #include "REcmaRequireHeap.h"
                 void REcmaSpatialIndex::initEcma(QScriptEngine& engine, QScriptValue* proto 
    
    ) 
    
    {

    bool protoCreated = false;
    if(proto == NULL){
        proto = new QScriptValue(engine.newVariant(qVariantFromValue(
                (RSpatialIndex*) 0)));
        protoCreated = true;
    }

    
        // primary base class RRequireHeap:
        
            QScriptValue dpt = engine.defaultPrototype(
                qMetaTypeId<RRequireHeap*>());

            if (dpt.isValid()) {
                proto->setPrototype(dpt);
            }
          
        /*
        
        */
    

    QScriptValue fun;

    // toString:
    REcmaHelper::registerFunction(&engine, proto, toString, "toString");
    

    // destroy:
    REcmaHelper::registerFunction(&engine, proto, destroy, "destroy");
    
        // conversion for base class RRequireHeap
        REcmaHelper::registerFunction(&engine, proto, getRRequireHeap, "getRRequireHeap");
        

    // get class name
    REcmaHelper::registerFunction(&engine, proto, getClassName, "getClassName");
    

    // conversion to all base classes (multiple inheritance):
    REcmaHelper::registerFunction(&engine, proto, getBaseClasses, "getBaseClasses");
    

    // properties:
    

    // methods:
    
            REcmaHelper::registerFunction(&engine, proto, create, "create");
            
            REcmaHelper::registerFunction(&engine, proto, clear, "clear");
            
            REcmaHelper::registerFunction(&engine, proto, bulkLoad, "bulkLoad");
            
            REcmaHelper::registerFunction(&engine, proto, bulkLoadSimple, "bulkLoadSimple");
            
            REcmaHelper::registerFunction(&engine, proto, addToIndex, "addToIndex");
            
            REcmaHelper::registerFunction(&engine, proto, removeFromIndex, "removeFromIndex");
            
            REcmaHelper::registerFunction(&engine, proto, queryIntersected, "queryIntersected");
            
            REcmaHelper::registerFunction(&engine, proto, queryContained, "queryContained");
            
            REcmaHelper::registerFunction(&engine, proto, queryNearestNeighbor, "queryNearestNeighbor");
            
        engine.setDefaultPrototype(
            qMetaTypeId<RSpatialIndex*>(), *proto);

        
    

    QScriptValue ctor = engine.newFunction(createEcma, *proto, 2);
    
    // static methods:
    
            REcmaHelper::registerFunction(&engine, &ctor, getSIId, "getSIId");
            
            REcmaHelper::registerFunction(&engine, &ctor, getId, "getId");
            
            REcmaHelper::registerFunction(&engine, &ctor, getPos, "getPos");
            

    // static properties:
    

    // enum values:
    

    // enum conversions:
    
        
    // init class:
    engine.globalObject().setProperty("RSpatialIndex",
    ctor, QScriptValue::SkipInEnumeration);
    
    if( protoCreated ){
       delete proto;
    }
    
    }
     QScriptValue REcmaSpatialIndex::createEcma(QScriptContext* context, QScriptEngine* engine) 
    
    {
           return REcmaHelper::throwError("Abstract class RSpatialIndex: Cannot be constructed.",
               context); 
    }
    

    // conversion functions for base classes:
     QScriptValue REcmaSpatialIndex::getRRequireHeap(QScriptContext *context,
            QScriptEngine *engine)
        
            {
                RRequireHeap* cppResult =
                    qscriptvalue_cast<RSpatialIndex*> (context->thisObject());
                QScriptValue result = qScriptValueFromValue(engine, cppResult);
                return result;
            }
            

    // returns class name:
     QScriptValue REcmaSpatialIndex::getClassName(QScriptContext *context, QScriptEngine *engine) 
        
    {
        return qScriptValueFromValue(engine, QString("RSpatialIndex"));
    }
    

    // returns all base classes (in case of multiple inheritance):
     QScriptValue REcmaSpatialIndex::getBaseClasses(QScriptContext *context, QScriptEngine *engine) 
        
    {
        QStringList list;
        
        list.append("RRequireHeap");
    

        return qScriptValueFromSequence(engine, list);
    }
    

    // properties:
    

    // public methods:
     QScriptValue
        REcmaSpatialIndex::getSIId
        (QScriptContext* context, QScriptEngine* engine) 
        
        {
            //REcmaHelper::functionStart("REcmaSpatialIndex::getSIId", context, engine);
            //qDebug() << "ECMAScript WRAPPER: REcmaSpatialIndex::getSIId";
            //QCoreApplication::processEvents();

            QScriptValue result = engine->undefinedValue();
            
    
    if( context->argumentCount() ==
    2 && (
            context->argument(0).isNumber()
        ) /* type: int */
     && (
            context->argument(1).isNumber()
        ) /* type: int */
    
    ){
    // prepare arguments:
    
                    // argument isStandardType
                    int
                    a0 =
                    (int)
                    
                    context->argument( 0 ).
                    toNumber();
                
                    // argument isStandardType
                    int
                    a1 =
                    (int)
                    
                    context->argument( 1 ).
                    toNumber();
                
    // end of arguments

    // call C++ function:
    // return type 'qint64'
    qint64 cppResult =
        RSpatialIndex::
       getSIId(a0
        ,
    a1);
        // return type: qint64
                // not standard type nor reference
                result = qScriptValueFromValue(engine, cppResult);
            
    } else


        
            {
               return REcmaHelper::throwError("Wrong number/types of arguments for RSpatialIndex.getSIId().",
                   context);
            }
            //REcmaHelper::functionEnd("REcmaSpatialIndex::getSIId", context, engine);
            return result;
        }
         QScriptValue
        REcmaSpatialIndex::getId
        (QScriptContext* context, QScriptEngine* engine) 
        
        {
            //REcmaHelper::functionStart("REcmaSpatialIndex::getId", context, engine);
            //qDebug() << "ECMAScript WRAPPER: REcmaSpatialIndex::getId";
            //QCoreApplication::processEvents();

            QScriptValue result = engine->undefinedValue();
            
    
    if( context->argumentCount() ==
    1 && (
            context->argument(0).isVariant() || 
            context->argument(0).isQObject() || 
            context->argument(0).isNull()
        ) /* type: qint64 */
    
    ){
    // prepare arguments:
    
                    // argument is reference
                    qint64*
                    ap0 =
                    qscriptvalue_cast<
                    qint64*
                        >(
                        context->argument(
                        0
                        )
                    );
                    if( ap0 == NULL ){
                           return REcmaHelper::throwError("RSpatialIndex: Argument 0 is not of type qint64*.",
                               context);                    
                    }
                    qint64& a0 = *ap0;
                
    // end of arguments

    // call C++ function:
    // return type 'int'
    int cppResult =
        RSpatialIndex::
       getId(a0);
        // return type: int
                // standard Type
                result = QScriptValue(cppResult);
            
    } else


        
            {
               return REcmaHelper::throwError("Wrong number/types of arguments for RSpatialIndex.getId().",
                   context);
            }
            //REcmaHelper::functionEnd("REcmaSpatialIndex::getId", context, engine);
            return result;
        }
         QScriptValue
        REcmaSpatialIndex::getPos
        (QScriptContext* context, QScriptEngine* engine) 
        
        {
            //REcmaHelper::functionStart("REcmaSpatialIndex::getPos", context, engine);
            //qDebug() << "ECMAScript WRAPPER: REcmaSpatialIndex::getPos";
            //QCoreApplication::processEvents();

            QScriptValue result = engine->undefinedValue();
            
    
    if( context->argumentCount() ==
    1 && (
            context->argument(0).isVariant() || 
            context->argument(0).isQObject() || 
            context->argument(0).isNull()
        ) /* type: qint64 */
    
    ){
    // prepare arguments:
    
                    // argument is reference
                    qint64*
                    ap0 =
                    qscriptvalue_cast<
                    qint64*
                        >(
                        context->argument(
                        0
                        )
                    );
                    if( ap0 == NULL ){
                           return REcmaHelper::throwError("RSpatialIndex: Argument 0 is not of type qint64*.",
                               context);                    
                    }
                    qint64& a0 = *ap0;
                
    // end of arguments

    // call C++ function:
    // return type 'int'
    int cppResult =
        RSpatialIndex::
       getPos(a0);
        // return type: int
                // standard Type
                result = QScriptValue(cppResult);
            
    } else


        
            {
               return REcmaHelper::throwError("Wrong number/types of arguments for RSpatialIndex.getPos().",
                   context);
            }
            //REcmaHelper::functionEnd("REcmaSpatialIndex::getPos", context, engine);
            return result;
        }
         QScriptValue
        REcmaSpatialIndex::create
        (QScriptContext* context, QScriptEngine* engine) 
        
        {
            //REcmaHelper::functionStart("REcmaSpatialIndex::create", context, engine);
            //qDebug() << "ECMAScript WRAPPER: REcmaSpatialIndex::create";
            //QCoreApplication::processEvents();

            QScriptValue result = engine->undefinedValue();
            
                    // public function: can be called from ECMA wrapper of ECMA shell:
                    RSpatialIndex* self = 
                        getSelf("create", context);
                  

                //Q_ASSERT(self!=NULL);
                if (self==NULL) {
                    return REcmaHelper::throwError("self is NULL", context);
                }
                
    
    if( context->argumentCount() ==
    0
    ){
    // prepare arguments:
    
    // end of arguments

    // call C++ function:
    // return type 'RSpatialIndex *'
    RSpatialIndex * cppResult =
        
               self->create();
        // return type: RSpatialIndex *
                // not standard type nor reference
                result = qScriptValueFromValue(engine, cppResult);
            
    } else


        
            {
               return REcmaHelper::throwError("Wrong number/types of arguments for RSpatialIndex.create().",
                   context);
            }
            //REcmaHelper::functionEnd("REcmaSpatialIndex::create", context, engine);
            return result;
        }
         QScriptValue
        REcmaSpatialIndex::clear
        (QScriptContext* context, QScriptEngine* engine) 
        
        {
            //REcmaHelper::functionStart("REcmaSpatialIndex::clear", context, engine);
            //qDebug() << "ECMAScript WRAPPER: REcmaSpatialIndex::clear";
            //QCoreApplication::processEvents();

            QScriptValue result = engine->undefinedValue();
            
                    // public function: can be called from ECMA wrapper of ECMA shell:
                    RSpatialIndex* self = 
                        getSelf("clear", context);
                  

                //Q_ASSERT(self!=NULL);
                if (self==NULL) {
                    return REcmaHelper::throwError("self is NULL", context);
                }
                
    
    if( context->argumentCount() ==
    0
    ){
    // prepare arguments:
    
    // end of arguments

    // call C++ function:
    // return type 'void'
    
               self->clear();
    } else


        
            {
               return REcmaHelper::throwError("Wrong number/types of arguments for RSpatialIndex.clear().",
                   context);
            }
            //REcmaHelper::functionEnd("REcmaSpatialIndex::clear", context, engine);
            return result;
        }
         QScriptValue
        REcmaSpatialIndex::bulkLoad
        (QScriptContext* context, QScriptEngine* engine) 
        
        {
            //REcmaHelper::functionStart("REcmaSpatialIndex::bulkLoad", context, engine);
            //qDebug() << "ECMAScript WRAPPER: REcmaSpatialIndex::bulkLoad";
            //QCoreApplication::processEvents();

            QScriptValue result = engine->undefinedValue();
            
                    // public function: can be called from ECMA wrapper of ECMA shell:
                    RSpatialIndex* self = 
                        getSelf("bulkLoad", context);
                  

                //Q_ASSERT(self!=NULL);
                if (self==NULL) {
                    return REcmaHelper::throwError("self is NULL", context);
                }
                
    
    if( context->argumentCount() ==
    2 && (
            context->argument(0).isArray()
        ) /* type: QList < int > */
     && (
            context->argument(1).isArray()
        ) /* type: QList < QList < RBox > > */
    
    ){
    // prepare arguments:
    
                    // argument isArray
                    QList < int >
                    a0;
                    REcmaHelper::fromScriptValue(
                        engine,
                        context->argument(0),
                        a0
                    );
                
                    // argument isArray
                    QList < QList < RBox > >
                    a1;
                    REcmaHelper::fromScriptValue(
                        engine,
                        context->argument(1),
                        a1
                    );
                
    // end of arguments

    // call C++ function:
    // return type 'void'
    
               self->bulkLoad(a0
        ,
    a1);
    } else


        
            {
               return REcmaHelper::throwError("Wrong number/types of arguments for RSpatialIndex.bulkLoad().",
                   context);
            }
            //REcmaHelper::functionEnd("REcmaSpatialIndex::bulkLoad", context, engine);
            return result;
        }
         QScriptValue
        REcmaSpatialIndex::bulkLoadSimple
        (QScriptContext* context, QScriptEngine* engine) 
        
        {
            //REcmaHelper::functionStart("REcmaSpatialIndex::bulkLoadSimple", context, engine);
            //qDebug() << "ECMAScript WRAPPER: REcmaSpatialIndex::bulkLoadSimple";
            //QCoreApplication::processEvents();

            QScriptValue result = engine->undefinedValue();
            
                    // public function: can be called from ECMA wrapper of ECMA shell:
                    RSpatialIndex* self = 
                        getSelf("bulkLoadSimple", context);
                  

                //Q_ASSERT(self!=NULL);
                if (self==NULL) {
                    return REcmaHelper::throwError("self is NULL", context);
                }
                
    
    if( context->argumentCount() ==
    2 && (
            context->argument(0).isArray()
        ) /* type: QList < int > */
     && (
            context->argument(1).isArray()
        ) /* type: QList < RBox > */
    
    ){
    // prepare arguments:
    
                    // argument isArray
                    QList < int >
                    a0;
                    REcmaHelper::fromScriptValue(
                        engine,
                        context->argument(0),
                        a0
                    );
                
                    // argument isArray
                    QList < RBox >
                    a1;
                    REcmaHelper::fromScriptValue(
                        engine,
                        context->argument(1),
                        a1
                    );
                
    // end of arguments

    // call C++ function:
    // return type 'void'
    
               self->bulkLoadSimple(a0
        ,
    a1);
    } else


        
            {
               return REcmaHelper::throwError("Wrong number/types of arguments for RSpatialIndex.bulkLoadSimple().",
                   context);
            }
            //REcmaHelper::functionEnd("REcmaSpatialIndex::bulkLoadSimple", context, engine);
            return result;
        }
         QScriptValue
        REcmaSpatialIndex::addToIndex
        (QScriptContext* context, QScriptEngine* engine) 
        
        {
            //REcmaHelper::functionStart("REcmaSpatialIndex::addToIndex", context, engine);
            //qDebug() << "ECMAScript WRAPPER: REcmaSpatialIndex::addToIndex";
            //QCoreApplication::processEvents();

            QScriptValue result = engine->undefinedValue();
            
                    // public function: can be called from ECMA wrapper of ECMA shell:
                    RSpatialIndex* self = 
                        getSelf("addToIndex", context);
                  

                //Q_ASSERT(self!=NULL);
                if (self==NULL) {
                    return REcmaHelper::throwError("self is NULL", context);
                }
                
    
    if( context->argumentCount() ==
    8 && (
            context->argument(0).isNumber()
        ) /* type: int */
     && (
            context->argument(1).isNumber()
        ) /* type: int */
     && (
            context->argument(2).isNumber()
        ) /* type: double */
     && (
            context->argument(3).isNumber()
        ) /* type: double */
     && (
            context->argument(4).isNumber()
        ) /* type: double */
     && (
            context->argument(5).isNumber()
        ) /* type: double */
     && (
            context->argument(6).isNumber()
        ) /* type: double */
     && (
            context->argument(7).isNumber()
        ) /* type: double */
    
    ){
    // prepare arguments:
    
                    // argument isStandardType
                    int
                    a0 =
                    (int)
                    
                    context->argument( 0 ).
                    toNumber();
                
                    // argument isStandardType
                    int
                    a1 =
                    (int)
                    
                    context->argument( 1 ).
                    toNumber();
                
                    // argument isStandardType
                    double
                    a2 =
                    (double)
                    
                    context->argument( 2 ).
                    toNumber();
                
                    // argument isStandardType
                    double
                    a3 =
                    (double)
                    
                    context->argument( 3 ).
                    toNumber();
                
                    // argument isStandardType
                    double
                    a4 =
                    (double)
                    
                    context->argument( 4 ).
                    toNumber();
                
                    // argument isStandardType
                    double
                    a5 =
                    (double)
                    
                    context->argument( 5 ).
                    toNumber();
                
                    // argument isStandardType
                    double
                    a6 =
                    (double)
                    
                    context->argument( 6 ).
                    toNumber();
                
                    // argument isStandardType
                    double
                    a7 =
                    (double)
                    
                    context->argument( 7 ).
                    toNumber();
                
    // end of arguments

    // call C++ function:
    // return type 'void'
    
               self->addToIndex(a0
        ,
    a1
        ,
    a2
        ,
    a3
        ,
    a4
        ,
    a5
        ,
    a6
        ,
    a7);
    } else


        
    
    if( context->argumentCount() ==
    3 && (
            context->argument(0).isNumber()
        ) /* type: int */
     && (
            context->argument(1).isNumber()
        ) /* type: int */
     && (
            context->argument(2).isVariant() || 
            context->argument(2).isQObject() || 
            context->argument(2).isNull()
        ) /* type: RBox */
    
    ){
    // prepare arguments:
    
                    // argument isStandardType
                    int
                    a0 =
                    (int)
                    
                    context->argument( 0 ).
                    toNumber();
                
                    // argument isStandardType
                    int
                    a1 =
                    (int)
                    
                    context->argument( 1 ).
                    toNumber();
                
                    // argument isCopyable and has default constructor and isSimpleClass 
                    RBox*
                    ap2 =
                    qscriptvalue_cast<
                    RBox*
                        >(
                        context->argument(
                        2
                        )
                    );
                    if (ap2 == NULL) {
                           return REcmaHelper::throwError("RSpatialIndex: Argument 2 is not of type RBox.",
                               context);                    
                    }
                    RBox 
                    a2 = 
                    *ap2;
                
    // end of arguments

    // call C++ function:
    // return type 'void'
    
               self->addToIndex(a0
        ,
    a1
        ,
    a2);
    } else


        
    
    if( context->argumentCount() ==
    2 && (
            context->argument(0).isNumber()
        ) /* type: int */
     && (
            context->argument(1).isArray()
        ) /* type: QList < RBox > */
    
    ){
    // prepare arguments:
    
                    // argument isStandardType
                    int
                    a0 =
                    (int)
                    
                    context->argument( 0 ).
                    toNumber();
                
                    // argument isArray
                    QList < RBox >
                    a1;
                    REcmaHelper::fromScriptValue(
                        engine,
                        context->argument(1),
                        a1
                    );
                
    // end of arguments

    // call C++ function:
    // return type 'void'
    
               self->addToIndex(a0
        ,
    a1);
    } else


        
            {
               return REcmaHelper::throwError("Wrong number/types of arguments for RSpatialIndex.addToIndex().",
                   context);
            }
            //REcmaHelper::functionEnd("REcmaSpatialIndex::addToIndex", context, engine);
            return result;
        }
         QScriptValue
        REcmaSpatialIndex::removeFromIndex
        (QScriptContext* context, QScriptEngine* engine) 
        
        {
            //REcmaHelper::functionStart("REcmaSpatialIndex::removeFromIndex", context, engine);
            //qDebug() << "ECMAScript WRAPPER: REcmaSpatialIndex::removeFromIndex";
            //QCoreApplication::processEvents();

            QScriptValue result = engine->undefinedValue();
            
                    // public function: can be called from ECMA wrapper of ECMA shell:
                    RSpatialIndex* self = 
                        getSelf("removeFromIndex", context);
                  

                //Q_ASSERT(self!=NULL);
                if (self==NULL) {
                    return REcmaHelper::throwError("self is NULL", context);
                }
                
    
    if( context->argumentCount() ==
    8 && (
            context->argument(0).isNumber()
        ) /* type: int */
     && (
            context->argument(1).isNumber()
        ) /* type: int */
     && (
            context->argument(2).isNumber()
        ) /* type: double */
     && (
            context->argument(3).isNumber()
        ) /* type: double */
     && (
            context->argument(4).isNumber()
        ) /* type: double */
     && (
            context->argument(5).isNumber()
        ) /* type: double */
     && (
            context->argument(6).isNumber()
        ) /* type: double */
     && (
            context->argument(7).isNumber()
        ) /* type: double */
    
    ){
    // prepare arguments:
    
                    // argument isStandardType
                    int
                    a0 =
                    (int)
                    
                    context->argument( 0 ).
                    toNumber();
                
                    // argument isStandardType
                    int
                    a1 =
                    (int)
                    
                    context->argument( 1 ).
                    toNumber();
                
                    // argument isStandardType
                    double
                    a2 =
                    (double)
                    
                    context->argument( 2 ).
                    toNumber();
                
                    // argument isStandardType
                    double
                    a3 =
                    (double)
                    
                    context->argument( 3 ).
                    toNumber();
                
                    // argument isStandardType
                    double
                    a4 =
                    (double)
                    
                    context->argument( 4 ).
                    toNumber();
                
                    // argument isStandardType
                    double
                    a5 =
                    (double)
                    
                    context->argument( 5 ).
                    toNumber();
                
                    // argument isStandardType
                    double
                    a6 =
                    (double)
                    
                    context->argument( 6 ).
                    toNumber();
                
                    // argument isStandardType
                    double
                    a7 =
                    (double)
                    
                    context->argument( 7 ).
                    toNumber();
                
    // end of arguments

    // call C++ function:
    // return type 'bool'
    bool cppResult =
        
               self->removeFromIndex(a0
        ,
    a1
        ,
    a2
        ,
    a3
        ,
    a4
        ,
    a5
        ,
    a6
        ,
    a7);
        // return type: bool
                // standard Type
                result = QScriptValue(cppResult);
            
    } else


        
    
    if( context->argumentCount() ==
    3 && (
            context->argument(0).isNumber()
        ) /* type: int */
     && (
            context->argument(1).isNumber()
        ) /* type: int */
     && (
            context->argument(2).isVariant() || 
            context->argument(2).isQObject() || 
            context->argument(2).isNull()
        ) /* type: RBox */
    
    ){
    // prepare arguments:
    
                    // argument isStandardType
                    int
                    a0 =
                    (int)
                    
                    context->argument( 0 ).
                    toNumber();
                
                    // argument isStandardType
                    int
                    a1 =
                    (int)
                    
                    context->argument( 1 ).
                    toNumber();
                
                    // argument isCopyable and has default constructor and isSimpleClass 
                    RBox*
                    ap2 =
                    qscriptvalue_cast<
                    RBox*
                        >(
                        context->argument(
                        2
                        )
                    );
                    if (ap2 == NULL) {
                           return REcmaHelper::throwError("RSpatialIndex: Argument 2 is not of type RBox.",
                               context);                    
                    }
                    RBox 
                    a2 = 
                    *ap2;
                
    // end of arguments

    // call C++ function:
    // return type 'bool'
    bool cppResult =
        
               self->removeFromIndex(a0
        ,
    a1
        ,
    a2);
        // return type: bool
                // standard Type
                result = QScriptValue(cppResult);
            
    } else


        
    
    if( context->argumentCount() ==
    2 && (
            context->argument(0).isNumber()
        ) /* type: int */
     && (
            context->argument(1).isArray()
        ) /* type: QList < RBox > */
    
    ){
    // prepare arguments:
    
                    // argument isStandardType
                    int
                    a0 =
                    (int)
                    
                    context->argument( 0 ).
                    toNumber();
                
                    // argument isArray
                    QList < RBox >
                    a1;
                    REcmaHelper::fromScriptValue(
                        engine,
                        context->argument(1),
                        a1
                    );
                
    // end of arguments

    // call C++ function:
    // return type 'bool'
    bool cppResult =
        
               self->removeFromIndex(a0
        ,
    a1);
        // return type: bool
                // standard Type
                result = QScriptValue(cppResult);
            
    } else


        
            {
               return REcmaHelper::throwError("Wrong number/types of arguments for RSpatialIndex.removeFromIndex().",
                   context);
            }
            //REcmaHelper::functionEnd("REcmaSpatialIndex::removeFromIndex", context, engine);
            return result;
        }
         QScriptValue
        REcmaSpatialIndex::queryIntersected
        (QScriptContext* context, QScriptEngine* engine) 
        
        {
            //REcmaHelper::functionStart("REcmaSpatialIndex::queryIntersected", context, engine);
            //qDebug() << "ECMAScript WRAPPER: REcmaSpatialIndex::queryIntersected";
            //QCoreApplication::processEvents();

            QScriptValue result = engine->undefinedValue();
            
                    // public function: can be called from ECMA wrapper of ECMA shell:
                    RSpatialIndex* self = 
                        getSelf("queryIntersected", context);
                  

                //Q_ASSERT(self!=NULL);
                if (self==NULL) {
                    return REcmaHelper::throwError("self is NULL", context);
                }
                
    
    if( context->argumentCount() ==
    6 && (
            context->argument(0).isNumber()
        ) /* type: double */
     && (
            context->argument(1).isNumber()
        ) /* type: double */
     && (
            context->argument(2).isNumber()
        ) /* type: double */
     && (
            context->argument(3).isNumber()
        ) /* type: double */
     && (
            context->argument(4).isNumber()
        ) /* type: double */
     && (
            context->argument(5).isNumber()
        ) /* type: double */
    
    ){
    // prepare arguments:
    
                    // argument isStandardType
                    double
                    a0 =
                    (double)
                    
                    context->argument( 0 ).
                    toNumber();
                
                    // argument isStandardType
                    double
                    a1 =
                    (double)
                    
                    context->argument( 1 ).
                    toNumber();
                
                    // argument isStandardType
                    double
                    a2 =
                    (double)
                    
                    context->argument( 2 ).
                    toNumber();
                
                    // argument isStandardType
                    double
                    a3 =
                    (double)
                    
                    context->argument( 3 ).
                    toNumber();
                
                    // argument isStandardType
                    double
                    a4 =
                    (double)
                    
                    context->argument( 4 ).
                    toNumber();
                
                    // argument isStandardType
                    double
                    a5 =
                    (double)
                    
                    context->argument( 5 ).
                    toNumber();
                
    // end of arguments

    // call C++ function:
    // return type 'QMap < int , QSet < int > >'
    QMap < int , QSet < int > > cppResult =
        
               self->queryIntersected(a0
        ,
    a1
        ,
    a2
        ,
    a3
        ,
    a4
        ,
    a5);
        // return type: QMap < int , QSet < int > >
                // not standard type nor reference
                result = qScriptValueFromValue(engine, cppResult);
            
    } else


        
    
    if( context->argumentCount() ==
    7 && (
            context->argument(0).isNumber()
        ) /* type: double */
     && (
            context->argument(1).isNumber()
        ) /* type: double */
     && (
            context->argument(2).isNumber()
        ) /* type: double */
     && (
            context->argument(3).isNumber()
        ) /* type: double */
     && (
            context->argument(4).isNumber()
        ) /* type: double */
     && (
            context->argument(5).isNumber()
        ) /* type: double */
     && (
            context->argument(6).isVariant() || 
            context->argument(6).isQObject() || 
            context->argument(6).isNull()
        ) /* type: RSpatialIndexVisitor * */
    
    ){
    // prepare arguments:
    
                    // argument isStandardType
                    double
                    a0 =
                    (double)
                    
                    context->argument( 0 ).
                    toNumber();
                
                    // argument isStandardType
                    double
                    a1 =
                    (double)
                    
                    context->argument( 1 ).
                    toNumber();
                
                    // argument isStandardType
                    double
                    a2 =
                    (double)
                    
                    context->argument( 2 ).
                    toNumber();
                
                    // argument isStandardType
                    double
                    a3 =
                    (double)
                    
                    context->argument( 3 ).
                    toNumber();
                
                    // argument isStandardType
                    double
                    a4 =
                    (double)
                    
                    context->argument( 4 ).
                    toNumber();
                
                    // argument isStandardType
                    double
                    a5 =
                    (double)
                    
                    context->argument( 5 ).
                    toNumber();
                
                    // argument is pointer
                    RSpatialIndexVisitor * a6 = NULL;

                    a6 = 
                        REcmaHelper::scriptValueTo<RSpatialIndexVisitor >(
                            context->argument(6)
                        );
                    
                    if (a6==NULL && 
                        !context->argument(6).isNull()) {
                        return REcmaHelper::throwError("RSpatialIndex: Argument 6 is not of type RSpatialIndexVisitor *RSpatialIndexVisitor *.", context);                    
                    }
                
    // end of arguments

    // call C++ function:
    // return type 'QMap < int , QSet < int > >'
    QMap < int , QSet < int > > cppResult =
        
               self->queryIntersected(a0
        ,
    a1
        ,
    a2
        ,
    a3
        ,
    a4
        ,
    a5
        ,
    a6);
        // return type: QMap < int , QSet < int > >
                // not standard type nor reference
                result = qScriptValueFromValue(engine, cppResult);
            
    } else


        
    
    if( context->argumentCount() ==
    1 && (
            context->argument(0).isVariant() || 
            context->argument(0).isQObject() || 
            context->argument(0).isNull()
        ) /* type: RBox */
    
    ){
    // prepare arguments:
    
                    // argument isCopyable and has default constructor and isSimpleClass 
                    RBox*
                    ap0 =
                    qscriptvalue_cast<
                    RBox*
                        >(
                        context->argument(
                        0
                        )
                    );
                    if (ap0 == NULL) {
                           return REcmaHelper::throwError("RSpatialIndex: Argument 0 is not of type RBox.",
                               context);                    
                    }
                    RBox 
                    a0 = 
                    *ap0;
                
    // end of arguments

    // call C++ function:
    // return type 'QMap < int , QSet < int > >'
    QMap < int , QSet < int > > cppResult =
        
               self->queryIntersected(a0);
        // return type: QMap < int , QSet < int > >
                // not standard type nor reference
                result = qScriptValueFromValue(engine, cppResult);
            
    } else


        
    
    if( context->argumentCount() ==
    2 && (
            context->argument(0).isVariant() || 
            context->argument(0).isQObject() || 
            context->argument(0).isNull()
        ) /* type: RBox */
     && (
            context->argument(1).isVariant() || 
            context->argument(1).isQObject() || 
            context->argument(1).isNull()
        ) /* type: RSpatialIndexVisitor * */
    
    ){
    // prepare arguments:
    
                    // argument isCopyable and has default constructor and isSimpleClass 
                    RBox*
                    ap0 =
                    qscriptvalue_cast<
                    RBox*
                        >(
                        context->argument(
                        0
                        )
                    );
                    if (ap0 == NULL) {
                           return REcmaHelper::throwError("RSpatialIndex: Argument 0 is not of type RBox.",
                               context);                    
                    }
                    RBox 
                    a0 = 
                    *ap0;
                
                    // argument is pointer
                    RSpatialIndexVisitor * a1 = NULL;

                    a1 = 
                        REcmaHelper::scriptValueTo<RSpatialIndexVisitor >(
                            context->argument(1)
                        );
                    
                    if (a1==NULL && 
                        !context->argument(1).isNull()) {
                        return REcmaHelper::throwError("RSpatialIndex: Argument 1 is not of type RSpatialIndexVisitor *RSpatialIndexVisitor *.", context);                    
                    }
                
    // end of arguments

    // call C++ function:
    // return type 'QMap < int , QSet < int > >'
    QMap < int , QSet < int > > cppResult =
        
               self->queryIntersected(a0
        ,
    a1);
        // return type: QMap < int , QSet < int > >
                // not standard type nor reference
                result = qScriptValueFromValue(engine, cppResult);
            
    } else


        
            {
               return REcmaHelper::throwError("Wrong number/types of arguments for RSpatialIndex.queryIntersected().",
                   context);
            }
            //REcmaHelper::functionEnd("REcmaSpatialIndex::queryIntersected", context, engine);
            return result;
        }
         QScriptValue
        REcmaSpatialIndex::queryContained
        (QScriptContext* context, QScriptEngine* engine) 
        
        {
            //REcmaHelper::functionStart("REcmaSpatialIndex::queryContained", context, engine);
            //qDebug() << "ECMAScript WRAPPER: REcmaSpatialIndex::queryContained";
            //QCoreApplication::processEvents();

            QScriptValue result = engine->undefinedValue();
            
                    // public function: can be called from ECMA wrapper of ECMA shell:
                    RSpatialIndex* self = 
                        getSelf("queryContained", context);
                  

                //Q_ASSERT(self!=NULL);
                if (self==NULL) {
                    return REcmaHelper::throwError("self is NULL", context);
                }
                
    
    if( context->argumentCount() ==
    6 && (
            context->argument(0).isNumber()
        ) /* type: double */
     && (
            context->argument(1).isNumber()
        ) /* type: double */
     && (
            context->argument(2).isNumber()
        ) /* type: double */
     && (
            context->argument(3).isNumber()
        ) /* type: double */
     && (
            context->argument(4).isNumber()
        ) /* type: double */
     && (
            context->argument(5).isNumber()
        ) /* type: double */
    
    ){
    // prepare arguments:
    
                    // argument isStandardType
                    double
                    a0 =
                    (double)
                    
                    context->argument( 0 ).
                    toNumber();
                
                    // argument isStandardType
                    double
                    a1 =
                    (double)
                    
                    context->argument( 1 ).
                    toNumber();
                
                    // argument isStandardType
                    double
                    a2 =
                    (double)
                    
                    context->argument( 2 ).
                    toNumber();
                
                    // argument isStandardType
                    double
                    a3 =
                    (double)
                    
                    context->argument( 3 ).
                    toNumber();
                
                    // argument isStandardType
                    double
                    a4 =
                    (double)
                    
                    context->argument( 4 ).
                    toNumber();
                
                    // argument isStandardType
                    double
                    a5 =
                    (double)
                    
                    context->argument( 5 ).
                    toNumber();
                
    // end of arguments

    // call C++ function:
    // return type 'QMap < int , QSet < int > >'
    QMap < int , QSet < int > > cppResult =
        
               self->queryContained(a0
        ,
    a1
        ,
    a2
        ,
    a3
        ,
    a4
        ,
    a5);
        // return type: QMap < int , QSet < int > >
                // not standard type nor reference
                result = qScriptValueFromValue(engine, cppResult);
            
    } else


        
    
    if( context->argumentCount() ==
    7 && (
            context->argument(0).isNumber()
        ) /* type: double */
     && (
            context->argument(1).isNumber()
        ) /* type: double */
     && (
            context->argument(2).isNumber()
        ) /* type: double */
     && (
            context->argument(3).isNumber()
        ) /* type: double */
     && (
            context->argument(4).isNumber()
        ) /* type: double */
     && (
            context->argument(5).isNumber()
        ) /* type: double */
     && (
            context->argument(6).isVariant() || 
            context->argument(6).isQObject() || 
            context->argument(6).isNull()
        ) /* type: RSpatialIndexVisitor * */
    
    ){
    // prepare arguments:
    
                    // argument isStandardType
                    double
                    a0 =
                    (double)
                    
                    context->argument( 0 ).
                    toNumber();
                
                    // argument isStandardType
                    double
                    a1 =
                    (double)
                    
                    context->argument( 1 ).
                    toNumber();
                
                    // argument isStandardType
                    double
                    a2 =
                    (double)
                    
                    context->argument( 2 ).
                    toNumber();
                
                    // argument isStandardType
                    double
                    a3 =
                    (double)
                    
                    context->argument( 3 ).
                    toNumber();
                
                    // argument isStandardType
                    double
                    a4 =
                    (double)
                    
                    context->argument( 4 ).
                    toNumber();
                
                    // argument isStandardType
                    double
                    a5 =
                    (double)
                    
                    context->argument( 5 ).
                    toNumber();
                
                    // argument is pointer
                    RSpatialIndexVisitor * a6 = NULL;

                    a6 = 
                        REcmaHelper::scriptValueTo<RSpatialIndexVisitor >(
                            context->argument(6)
                        );
                    
                    if (a6==NULL && 
                        !context->argument(6).isNull()) {
                        return REcmaHelper::throwError("RSpatialIndex: Argument 6 is not of type RSpatialIndexVisitor *RSpatialIndexVisitor *.", context);                    
                    }
                
    // end of arguments

    // call C++ function:
    // return type 'QMap < int , QSet < int > >'
    QMap < int , QSet < int > > cppResult =
        
               self->queryContained(a0
        ,
    a1
        ,
    a2
        ,
    a3
        ,
    a4
        ,
    a5
        ,
    a6);
        // return type: QMap < int , QSet < int > >
                // not standard type nor reference
                result = qScriptValueFromValue(engine, cppResult);
            
    } else


        
    
    if( context->argumentCount() ==
    1 && (
            context->argument(0).isVariant() || 
            context->argument(0).isQObject() || 
            context->argument(0).isNull()
        ) /* type: RBox */
    
    ){
    // prepare arguments:
    
                    // argument isCopyable and has default constructor and isSimpleClass 
                    RBox*
                    ap0 =
                    qscriptvalue_cast<
                    RBox*
                        >(
                        context->argument(
                        0
                        )
                    );
                    if (ap0 == NULL) {
                           return REcmaHelper::throwError("RSpatialIndex: Argument 0 is not of type RBox.",
                               context);                    
                    }
                    RBox 
                    a0 = 
                    *ap0;
                
    // end of arguments

    // call C++ function:
    // return type 'QMap < int , QSet < int > >'
    QMap < int , QSet < int > > cppResult =
        
               self->queryContained(a0);
        // return type: QMap < int , QSet < int > >
                // not standard type nor reference
                result = qScriptValueFromValue(engine, cppResult);
            
    } else


        
    
    if( context->argumentCount() ==
    2 && (
            context->argument(0).isVariant() || 
            context->argument(0).isQObject() || 
            context->argument(0).isNull()
        ) /* type: RBox */
     && (
            context->argument(1).isVariant() || 
            context->argument(1).isQObject() || 
            context->argument(1).isNull()
        ) /* type: RSpatialIndexVisitor * */
    
    ){
    // prepare arguments:
    
                    // argument isCopyable and has default constructor and isSimpleClass 
                    RBox*
                    ap0 =
                    qscriptvalue_cast<
                    RBox*
                        >(
                        context->argument(
                        0
                        )
                    );
                    if (ap0 == NULL) {
                           return REcmaHelper::throwError("RSpatialIndex: Argument 0 is not of type RBox.",
                               context);                    
                    }
                    RBox 
                    a0 = 
                    *ap0;
                
                    // argument is pointer
                    RSpatialIndexVisitor * a1 = NULL;

                    a1 = 
                        REcmaHelper::scriptValueTo<RSpatialIndexVisitor >(
                            context->argument(1)
                        );
                    
                    if (a1==NULL && 
                        !context->argument(1).isNull()) {
                        return REcmaHelper::throwError("RSpatialIndex: Argument 1 is not of type RSpatialIndexVisitor *RSpatialIndexVisitor *.", context);                    
                    }
                
    // end of arguments

    // call C++ function:
    // return type 'QMap < int , QSet < int > >'
    QMap < int , QSet < int > > cppResult =
        
               self->queryContained(a0
        ,
    a1);
        // return type: QMap < int , QSet < int > >
                // not standard type nor reference
                result = qScriptValueFromValue(engine, cppResult);
            
    } else


        
            {
               return REcmaHelper::throwError("Wrong number/types of arguments for RSpatialIndex.queryContained().",
                   context);
            }
            //REcmaHelper::functionEnd("REcmaSpatialIndex::queryContained", context, engine);
            return result;
        }
         QScriptValue
        REcmaSpatialIndex::queryNearestNeighbor
        (QScriptContext* context, QScriptEngine* engine) 
        
        {
            //REcmaHelper::functionStart("REcmaSpatialIndex::queryNearestNeighbor", context, engine);
            //qDebug() << "ECMAScript WRAPPER: REcmaSpatialIndex::queryNearestNeighbor";
            //QCoreApplication::processEvents();

            QScriptValue result = engine->undefinedValue();
            
                    // public function: can be called from ECMA wrapper of ECMA shell:
                    RSpatialIndex* self = 
                        getSelf("queryNearestNeighbor", context);
                  

                //Q_ASSERT(self!=NULL);
                if (self==NULL) {
                    return REcmaHelper::throwError("self is NULL", context);
                }
                
    
    if( context->argumentCount() ==
    4 && (
            context->argument(0).isNumber()
        ) /* type: int */
     && (
            context->argument(1).isNumber()
        ) /* type: double */
     && (
            context->argument(2).isNumber()
        ) /* type: double */
     && (
            context->argument(3).isNumber()
        ) /* type: double */
    
    ){
    // prepare arguments:
    
                    // argument isStandardType
                    int
                    a0 =
                    (int)
                    
                    context->argument( 0 ).
                    toNumber();
                
                    // argument isStandardType
                    double
                    a1 =
                    (double)
                    
                    context->argument( 1 ).
                    toNumber();
                
                    // argument isStandardType
                    double
                    a2 =
                    (double)
                    
                    context->argument( 2 ).
                    toNumber();
                
                    // argument isStandardType
                    double
                    a3 =
                    (double)
                    
                    context->argument( 3 ).
                    toNumber();
                
    // end of arguments

    // call C++ function:
    // return type 'QMap < int , QSet < int > >'
    QMap < int , QSet < int > > cppResult =
        
               self->queryNearestNeighbor(a0
        ,
    a1
        ,
    a2
        ,
    a3);
        // return type: QMap < int , QSet < int > >
                // not standard type nor reference
                result = qScriptValueFromValue(engine, cppResult);
            
    } else


        
    
    if( context->argumentCount() ==
    5 && (
            context->argument(0).isNumber()
        ) /* type: int */
     && (
            context->argument(1).isNumber()
        ) /* type: double */
     && (
            context->argument(2).isNumber()
        ) /* type: double */
     && (
            context->argument(3).isNumber()
        ) /* type: double */
     && (
            context->argument(4).isVariant() || 
            context->argument(4).isQObject() || 
            context->argument(4).isNull()
        ) /* type: RSpatialIndexVisitor * */
    
    ){
    // prepare arguments:
    
                    // argument isStandardType
                    int
                    a0 =
                    (int)
                    
                    context->argument( 0 ).
                    toNumber();
                
                    // argument isStandardType
                    double
                    a1 =
                    (double)
                    
                    context->argument( 1 ).
                    toNumber();
                
                    // argument isStandardType
                    double
                    a2 =
                    (double)
                    
                    context->argument( 2 ).
                    toNumber();
                
                    // argument isStandardType
                    double
                    a3 =
                    (double)
                    
                    context->argument( 3 ).
                    toNumber();
                
                    // argument is pointer
                    RSpatialIndexVisitor * a4 = NULL;

                    a4 = 
                        REcmaHelper::scriptValueTo<RSpatialIndexVisitor >(
                            context->argument(4)
                        );
                    
                    if (a4==NULL && 
                        !context->argument(4).isNull()) {
                        return REcmaHelper::throwError("RSpatialIndex: Argument 4 is not of type RSpatialIndexVisitor *RSpatialIndexVisitor *.", context);                    
                    }
                
    // end of arguments

    // call C++ function:
    // return type 'QMap < int , QSet < int > >'
    QMap < int , QSet < int > > cppResult =
        
               self->queryNearestNeighbor(a0
        ,
    a1
        ,
    a2
        ,
    a3
        ,
    a4);
        // return type: QMap < int , QSet < int > >
                // not standard type nor reference
                result = qScriptValueFromValue(engine, cppResult);
            
    } else


        
    
    if( context->argumentCount() ==
    3 && (
            context->argument(0).isNumber()
        ) /* type: double */
     && (
            context->argument(1).isNumber()
        ) /* type: double */
     && (
            context->argument(2).isNumber()
        ) /* type: double */
    
    ){
    // prepare arguments:
    
                    // argument isStandardType
                    double
                    a0 =
                    (double)
                    
                    context->argument( 0 ).
                    toNumber();
                
                    // argument isStandardType
                    double
                    a1 =
                    (double)
                    
                    context->argument( 1 ).
                    toNumber();
                
                    // argument isStandardType
                    double
                    a2 =
                    (double)
                    
                    context->argument( 2 ).
                    toNumber();
                
    // end of arguments

    // call C++ function:
    // return type 'QPair < int , int >'
    QPair < int , int > cppResult =
        
               self->queryNearestNeighbor(a0
        ,
    a1
        ,
    a2);
        // return type: QPair < int , int >
                // Pair of ...:
                //result = REcmaHelper::pairToScriptValue(engine, cppResult);
                QVariantList vl;
                QVariant v;
                
                     v.setValue(cppResult.first);
                  

                vl.append(v);
                v.setValue(cppResult.second);
                vl.append(v);
                result = qScriptValueFromValue(engine, vl);
            
    } else


        
            {
               return REcmaHelper::throwError("Wrong number/types of arguments for RSpatialIndex.queryNearestNeighbor().",
                   context);
            }
            //REcmaHelper::functionEnd("REcmaSpatialIndex::queryNearestNeighbor", context, engine);
            return result;
        }
         QScriptValue REcmaSpatialIndex::toString
    (QScriptContext *context, QScriptEngine *engine)
    
    {

    RSpatialIndex* self = getSelf("toString", context);
    
    QString result;
    
            QDebug d(&result);
            if (self!=NULL) {
                d << *self;
            }
            else {
                d << "NULL";
            }
        
    return QScriptValue(result);
    }
     QScriptValue REcmaSpatialIndex::destroy(QScriptContext *context, QScriptEngine *engine)
    
    {

        RSpatialIndex* self = getSelf("RSpatialIndex", context);
        //Q_ASSERT(self!=NULL);
        if (self==NULL) {
            return REcmaHelper::throwError("self is NULL", context);
        }
        
    
        delete self;
        context->thisObject().setData(engine->nullValue());
        context->thisObject().prototype().setData(engine->nullValue());
        context->thisObject().setPrototype(engine->nullValue());
        context->thisObject().setScriptClass(NULL);
        return engine->undefinedValue();
    }
    RSpatialIndex* REcmaSpatialIndex::getSelf(const QString& fName, QScriptContext* context)
    
        {
            RSpatialIndex* self = NULL;

            
                // self could be a normal object (e.g. from an UI file) or
                // an ECMA shell object (made from an ECMA script):
                //self = getSelfShell(fName, context);
                

            //if (self==NULL) {
                self = REcmaHelper::scriptValueTo<RSpatialIndex >(context->thisObject())
                
                ;
            //}

            if (self == NULL){
                // avoid recursion (toString is used by the backtrace):
                if (fName!="toString") {
                    REcmaHelper::throwError(QString("RSpatialIndex.%1(): "
                        "This object is not a RSpatialIndex").arg(fName),
                        context);
                }
                return NULL;
            }

            return self;
        }
        RSpatialIndex* REcmaSpatialIndex::getSelfShell(const QString& fName, QScriptContext* context)
    
        {
          RSpatialIndex* selfBase = getSelf(fName, context);
                RSpatialIndex* self = dynamic_cast<RSpatialIndex*>(selfBase);
                //return REcmaHelper::scriptValueTo<RSpatialIndex >(context->thisObject());
            if(self == NULL){
                REcmaHelper::throwError(QString("RSpatialIndex.%1(): "
                    "This object is not a RSpatialIndex").arg(fName),
                    context);
            }

            return self;
            


        }
        